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,93 +0,0 @@
|
|
|
1
|
-
import type { StreamChat } from './client';
|
|
2
|
-
import type { APIResponse, BatchChannelDataUpdate, NewMemberPayload, UpdateChannelsBatchFilters, UpdateChannelsBatchResponse } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* ChannelBatchUpdater - A class that provides convenience methods for batch channel operations
|
|
5
|
-
*/
|
|
6
|
-
export declare class ChannelBatchUpdater {
|
|
7
|
-
client: StreamChat;
|
|
8
|
-
constructor(client: StreamChat);
|
|
9
|
-
/**
|
|
10
|
-
* addMembers - Add members to channels matching the filter
|
|
11
|
-
*
|
|
12
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
13
|
-
* @param {string[] | NewMemberPayload[]} members Members to add
|
|
14
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
15
|
-
*/
|
|
16
|
-
addMembers(filter: UpdateChannelsBatchFilters, members: string[] | NewMemberPayload[]): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
17
|
-
/**
|
|
18
|
-
* removeMembers - Remove members from channels matching the filter
|
|
19
|
-
*
|
|
20
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
21
|
-
* @param {string[]} members Member IDs to remove
|
|
22
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
23
|
-
*/
|
|
24
|
-
removeMembers(filter: UpdateChannelsBatchFilters, members: string[]): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
25
|
-
/**
|
|
26
|
-
* inviteMembers - Invite members to channels matching the filter
|
|
27
|
-
*
|
|
28
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
29
|
-
* @param {string[] | NewMemberPayload[]} members Members to invite
|
|
30
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
31
|
-
*/
|
|
32
|
-
inviteMembers(filter: UpdateChannelsBatchFilters, members: string[] | NewMemberPayload[]): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
33
|
-
/**
|
|
34
|
-
* addModerators - Add moderators to channels matching the filter
|
|
35
|
-
*
|
|
36
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
37
|
-
* @param {string[]} members Member IDs to promote to moderator
|
|
38
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
39
|
-
*/
|
|
40
|
-
addModerators(filter: UpdateChannelsBatchFilters, members: string[]): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
41
|
-
/**
|
|
42
|
-
* demoteModerators - Remove moderator role from members in channels matching the filter
|
|
43
|
-
*
|
|
44
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
45
|
-
* @param {string[]} members Member IDs to demote
|
|
46
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
47
|
-
*/
|
|
48
|
-
demoteModerators(filter: UpdateChannelsBatchFilters, members: string[]): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
49
|
-
/**
|
|
50
|
-
* assignRoles - Assign roles to members in channels matching the filter
|
|
51
|
-
*
|
|
52
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
53
|
-
* @param {NewMemberPayload[]} members Members with role assignments
|
|
54
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
55
|
-
*/
|
|
56
|
-
assignRoles(filter: UpdateChannelsBatchFilters, members: NewMemberPayload[]): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
57
|
-
/**
|
|
58
|
-
* hide - Hide channels matching the filter
|
|
59
|
-
*
|
|
60
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
61
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
62
|
-
*/
|
|
63
|
-
hide(filter: UpdateChannelsBatchFilters): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
64
|
-
/**
|
|
65
|
-
* show - Show channels matching the filter
|
|
66
|
-
*
|
|
67
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
68
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
69
|
-
*/
|
|
70
|
-
show(filter: UpdateChannelsBatchFilters): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
71
|
-
/**
|
|
72
|
-
* archive - Archive channels matching the filter
|
|
73
|
-
*
|
|
74
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
75
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
76
|
-
*/
|
|
77
|
-
archive(filter: UpdateChannelsBatchFilters): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
78
|
-
/**
|
|
79
|
-
* unarchive - Unarchive channels matching the filter
|
|
80
|
-
*
|
|
81
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
82
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
83
|
-
*/
|
|
84
|
-
unarchive(filter: UpdateChannelsBatchFilters): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
85
|
-
/**
|
|
86
|
-
* updateData - Update data on channels matching the filter
|
|
87
|
-
*
|
|
88
|
-
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
89
|
-
* @param {BatchChannelDataUpdate} data Data to update
|
|
90
|
-
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
91
|
-
*/
|
|
92
|
-
updateData(filter: UpdateChannelsBatchFilters, data: BatchChannelDataUpdate): Promise<APIResponse & UpdateChannelsBatchResponse>;
|
|
93
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Channel } from './channel';
|
|
2
|
-
import type { ChannelMemberResponse, Event, LocalMessage, MessageResponse,
|
|
2
|
+
import type { ChannelMemberResponse, Event, LocalMessage, MessageResponse, PendingMessageResponse, UserResponse } from './types';
|
|
3
|
+
import { StateStore } from './store';
|
|
3
4
|
type ChannelReadStatus = Record<string, {
|
|
4
5
|
last_read: Date;
|
|
5
6
|
unread_messages: number;
|
|
@@ -9,218 +10,69 @@ type ChannelReadStatus = Record<string, {
|
|
|
9
10
|
last_delivered_at?: Date;
|
|
10
11
|
last_delivered_message_id?: string;
|
|
11
12
|
}>;
|
|
13
|
+
export type WatcherState = {
|
|
14
|
+
watcherCount: number;
|
|
15
|
+
watchers: Record<string, UserResponse>;
|
|
16
|
+
};
|
|
17
|
+
export type TypingUsersState = {
|
|
18
|
+
typing: Record<string, Event>;
|
|
19
|
+
};
|
|
20
|
+
export type ReadState = {
|
|
21
|
+
read: ChannelReadStatus;
|
|
22
|
+
};
|
|
23
|
+
export type MutedUsersState = {
|
|
24
|
+
mutedUsers: Array<UserResponse>;
|
|
25
|
+
};
|
|
26
|
+
export type MembersState = {
|
|
27
|
+
members: Record<string, ChannelMemberResponse>;
|
|
28
|
+
memberCount: number;
|
|
29
|
+
};
|
|
30
|
+
export type OwnCapabilitiesState = {
|
|
31
|
+
ownCapabilities: string[];
|
|
32
|
+
};
|
|
12
33
|
/**
|
|
13
34
|
* ChannelState - A container class for the channel state.
|
|
14
35
|
*/
|
|
15
36
|
export declare class ChannelState {
|
|
16
37
|
_channel: Channel;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
38
|
+
readonly watcherStore: StateStore<WatcherState>;
|
|
39
|
+
readonly typingStore: StateStore<TypingUsersState>;
|
|
40
|
+
readonly readStore: StateStore<ReadState>;
|
|
41
|
+
readonly membersStore: StateStore<MembersState>;
|
|
42
|
+
readonly ownCapabilitiesStore: StateStore<OwnCapabilitiesState>;
|
|
43
|
+
readonly mutedUsersStore: StateStore<MutedUsersState>;
|
|
21
44
|
pending_messages: Array<PendingMessageResponse>;
|
|
22
|
-
threads: Record<string, Array<ReturnType<ChannelState['formatMessage']>>>;
|
|
23
|
-
mutedUsers: Array<UserResponse>;
|
|
24
|
-
watchers: Record<string, UserResponse>;
|
|
25
|
-
members: Record<string, ChannelMemberResponse>;
|
|
26
45
|
unreadCount: number;
|
|
27
46
|
membership: ChannelMemberResponse;
|
|
28
|
-
last_message_at: Date | null;
|
|
29
|
-
/**
|
|
30
|
-
* Flag which indicates if channel state contain latest/recent messages or no.
|
|
31
|
-
* This flag should be managed by UI sdks using a setter - setIsUpToDate.
|
|
32
|
-
* When false, any new message (received by websocket event - message.new) will not
|
|
33
|
-
* be pushed on to message list.
|
|
34
|
-
*/
|
|
35
|
-
isUpToDate: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Disjoint lists of messages
|
|
38
|
-
* Users can jump in the message list (with searching) and this can result in disjoint lists of messages
|
|
39
|
-
* The state manages these lists and merges them when lists overlap
|
|
40
|
-
* The messages array contains the currently active set
|
|
41
|
-
*/
|
|
42
|
-
messageSets: MessageSet[];
|
|
43
47
|
constructor(channel: Channel);
|
|
44
|
-
get
|
|
45
|
-
set
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
get
|
|
51
|
-
set
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @param
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
messageSet: MessageSet;
|
|
70
|
-
filteredMessageIds: string[];
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Takes the message object, parses the dates, sets `__html`
|
|
74
|
-
* and sets the status to `received` if missing; returns a new message object.
|
|
75
|
-
*
|
|
76
|
-
* @param {MessageResponse} message `MessageResponse` object
|
|
77
|
-
*/
|
|
78
|
-
formatMessage: (message: MessageResponse | MessageResponseBase | LocalMessage) => LocalMessage;
|
|
79
|
-
/**
|
|
80
|
-
* addMessagesSorted - Add the list of messages to state and resorts the messages
|
|
81
|
-
*
|
|
82
|
-
* @param {Array<MessageResponse>} newMessages A list of messages
|
|
83
|
-
* @param {boolean} timestampChanged Whether updating messages with changed created_at value.
|
|
84
|
-
* @param {boolean} initializing Whether channel is being initialized.
|
|
85
|
-
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
86
|
-
* @param {MessageSetType} messageSetToAddToIfDoesNotExist Which message set to add to if messages are not in the list (only used if addIfDoesNotExist is true)
|
|
87
|
-
*
|
|
88
|
-
*/
|
|
89
|
-
addMessagesSorted(newMessages: (MessageResponse | LocalMessage)[], timestampChanged?: boolean, initializing?: boolean, addIfDoesNotExist?: boolean, messageSetToAddToIfDoesNotExist?: MessageSetType): {
|
|
90
|
-
messageSet: MessageSet;
|
|
91
|
-
filteredMessageIds: string[];
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* addPinnedMessages - adds messages in pinnedMessages property
|
|
95
|
-
*
|
|
96
|
-
* @param {Array<MessageResponse>} pinnedMessages A list of pinned messages
|
|
97
|
-
*
|
|
98
|
-
*/
|
|
99
|
-
addPinnedMessages(pinnedMessages: MessageResponse[]): void;
|
|
100
|
-
/**
|
|
101
|
-
* addPinnedMessage - adds message in pinnedMessages
|
|
102
|
-
*
|
|
103
|
-
* @param {MessageResponse} pinnedMessage message to update
|
|
104
|
-
*
|
|
105
|
-
*/
|
|
106
|
-
addPinnedMessage(pinnedMessage: MessageResponse): void;
|
|
107
|
-
/**
|
|
108
|
-
* removePinnedMessage - removes pinned message from pinnedMessages
|
|
109
|
-
*
|
|
110
|
-
* @param {MessageResponse} message message to remove
|
|
111
|
-
*
|
|
112
|
-
*/
|
|
113
|
-
removePinnedMessage(message: MessageResponse): void;
|
|
114
|
-
addReaction(reaction: ReactionResponse, message?: MessageResponse, enforce_unique?: boolean): MessageResponse | LocalMessage | undefined;
|
|
115
|
-
_addReactionToState(messageFromState: LocalMessage, reaction: ReactionResponse, enforce_unique?: boolean): LocalMessage;
|
|
116
|
-
_addOwnReactionToMessage(ownReactions: ReactionResponse[] | null | undefined, reaction: ReactionResponse, enforce_unique?: boolean): ReactionResponse[];
|
|
117
|
-
_removeOwnReactionFromMessage(ownReactions: ReactionResponse[] | null | undefined, reaction: ReactionResponse): ReactionResponse[] | null | undefined;
|
|
118
|
-
removeReaction(reaction: ReactionResponse, message?: MessageResponse): MessageResponse | undefined;
|
|
119
|
-
_removeReactionFromState(messageFromState: LocalMessage, reaction: ReactionResponse): LocalMessage;
|
|
120
|
-
_updateQuotedMessageReferences({ message, remove, }: {
|
|
121
|
-
message: MessageResponse;
|
|
122
|
-
remove?: boolean;
|
|
123
|
-
}): void;
|
|
124
|
-
removeQuotedMessageReferences(message: MessageResponse): void;
|
|
125
|
-
/**
|
|
126
|
-
* Updates all instances of given message in channel state
|
|
127
|
-
* @param message
|
|
128
|
-
* @param updateFunc
|
|
129
|
-
*/
|
|
130
|
-
_updateMessage(message: {
|
|
131
|
-
id?: string;
|
|
132
|
-
parent_id?: string;
|
|
133
|
-
pinned?: boolean;
|
|
134
|
-
show_in_channel?: boolean;
|
|
135
|
-
}, updateFunc: (msg: ReturnType<ChannelState['formatMessage']>) => ReturnType<ChannelState['formatMessage']>): void;
|
|
136
|
-
/**
|
|
137
|
-
* Setter for isUpToDate.
|
|
138
|
-
*
|
|
139
|
-
* @param isUpToDate Flag which indicates if channel state contain latest/recent messages or no.
|
|
140
|
-
* This flag should be managed by UI sdks using a setter - setIsUpToDate.
|
|
141
|
-
* When false, any new message (received by websocket event - message.new) will not
|
|
142
|
-
* be pushed on to message list.
|
|
143
|
-
*/
|
|
144
|
-
setIsUpToDate: (isUpToDate: boolean) => void;
|
|
145
|
-
/**
|
|
146
|
-
* _addToMessageList - Adds a message to a list of messages, tries to update first, appends if message isn't found
|
|
147
|
-
*
|
|
148
|
-
* @param {Array<ReturnType<ChannelState['formatMessage']>>} messages A list of messages
|
|
149
|
-
* @param message
|
|
150
|
-
* @param {boolean} timestampChanged Whether updating a message with changed created_at value.
|
|
151
|
-
* @param {string} sortBy field name to use to sort the messages by
|
|
152
|
-
* @param {boolean} addIfDoesNotExist Add message if it is not in the list, used to prevent out of order updated messages from being added.
|
|
153
|
-
*/
|
|
154
|
-
_addToMessageList(messages: Array<ReturnType<ChannelState['formatMessage']>>, message: ReturnType<ChannelState['formatMessage']>, timestampChanged?: boolean, sortBy?: 'pinned_at' | 'created_at', addIfDoesNotExist?: boolean): LocalMessage[];
|
|
155
|
-
/**
|
|
156
|
-
* removeMessage - Description
|
|
157
|
-
*
|
|
158
|
-
* @param {{ id: string; parent_id?: string }} messageToRemove Object of the message to remove. Needs to have at id specified.
|
|
159
|
-
*
|
|
160
|
-
* @return {boolean} Returns if the message was removed
|
|
161
|
-
*/
|
|
162
|
-
removeMessage(messageToRemove: {
|
|
163
|
-
id: string;
|
|
164
|
-
messageSetIndex?: number;
|
|
165
|
-
parent_id?: string;
|
|
166
|
-
}): boolean;
|
|
167
|
-
removeMessageFromArray: (msgArray: Array<ReturnType<ChannelState["formatMessage"]>>, msg: {
|
|
168
|
-
id: string;
|
|
169
|
-
parent_id?: string;
|
|
170
|
-
}) => {
|
|
171
|
-
removed: boolean;
|
|
172
|
-
result: LocalMessage[];
|
|
173
|
-
};
|
|
174
|
-
/**
|
|
175
|
-
* Updates the message.user property with updated user object, for messages.
|
|
176
|
-
*
|
|
177
|
-
* @param {UserResponse} user
|
|
178
|
-
*/
|
|
179
|
-
updateUserMessages: (user: UserResponse) => void;
|
|
180
|
-
/**
|
|
181
|
-
* Marks the messages as deleted, from deleted user.
|
|
182
|
-
*
|
|
183
|
-
* @param {UserResponse} user
|
|
184
|
-
* @param {boolean} hardDelete
|
|
185
|
-
*/
|
|
186
|
-
deleteUserMessages: (user: UserResponse, hardDelete?: boolean, deletedAt?: LocalMessage["deleted_at"]) => void;
|
|
187
|
-
/**
|
|
188
|
-
* filterErrorMessages - Removes error messages from the channel state.
|
|
189
|
-
*
|
|
190
|
-
*/
|
|
191
|
-
filterErrorMessages(): void;
|
|
48
|
+
get members(): Record<string, ChannelMemberResponse>;
|
|
49
|
+
set members(members: Record<string, ChannelMemberResponse>);
|
|
50
|
+
get member_count(): number;
|
|
51
|
+
set member_count(memberCount: number);
|
|
52
|
+
get read(): ChannelReadStatus;
|
|
53
|
+
set read(read: ChannelReadStatus);
|
|
54
|
+
get typing(): Record<string, Event>;
|
|
55
|
+
set typing(typing: Record<string, Event>);
|
|
56
|
+
syncMemberCountFromChannelData(data: Channel['data'], fallbackData?: Channel['data']): void;
|
|
57
|
+
syncOwnCapabilitiesFromChannelData(data: Channel['data'], fallbackData?: Channel['data']): void;
|
|
58
|
+
setTypingEvent(userID: string, event: Event): void;
|
|
59
|
+
removeTypingEvent(userID: string): void;
|
|
60
|
+
get mutedUsers(): Array<UserResponse>;
|
|
61
|
+
set mutedUsers(mutedUsers: Array<UserResponse>);
|
|
62
|
+
get watchers(): Record<string, UserResponse>;
|
|
63
|
+
set watchers(watchers: Record<string, UserResponse>);
|
|
64
|
+
get watcher_count(): number;
|
|
65
|
+
set watcher_count(watcherCount: number);
|
|
66
|
+
/**
|
|
67
|
+
* Takes the message object, adds SDK-specific fields (status, error),
|
|
68
|
+
* and returns a new message object.
|
|
69
|
+
*
|
|
70
|
+
* @param message - `MessageResponse` object
|
|
71
|
+
*/
|
|
72
|
+
formatMessage: (message: MessageResponse | LocalMessage) => LocalMessage;
|
|
192
73
|
/**
|
|
193
74
|
* clean - Remove stale data such as users that stayed in typing state for more than 5 seconds
|
|
194
75
|
*/
|
|
195
76
|
clean(): void;
|
|
196
|
-
clearMessages(): void;
|
|
197
|
-
initMessages(): void;
|
|
198
|
-
/**
|
|
199
|
-
* loadMessageIntoState - Loads a given message (and messages around it) into the state
|
|
200
|
-
*
|
|
201
|
-
* @param {string} messageId The id of the message, or 'latest' to indicate switching to the latest messages
|
|
202
|
-
* @param {string} parentMessageId The id of the parent message, if we want load a thread reply
|
|
203
|
-
* @param {number} limit The page size if the message has to be queried from the server
|
|
204
|
-
*/
|
|
205
|
-
loadMessageIntoState(messageId: string | 'latest', parentMessageId?: string, limit?: number): Promise<void>;
|
|
206
|
-
/**
|
|
207
|
-
* findMessage - Finds a message inside the state
|
|
208
|
-
*
|
|
209
|
-
* @param {string} messageId The id of the message
|
|
210
|
-
* @param {string} parentMessageId The id of the parent message, if we want load a thread reply
|
|
211
|
-
*
|
|
212
|
-
* @return {ReturnType<ChannelState['formatMessage']>} Returns the message, or undefined if the message wasn't found
|
|
213
|
-
*/
|
|
214
|
-
findMessage(messageId: string, parentMessageId?: string): LocalMessage | undefined;
|
|
215
|
-
findMessageByTimestamp(timestampMs: number, parentMessageId?: string, exactTsMatch?: boolean): LocalMessage | null;
|
|
216
|
-
private switchToMessageSet;
|
|
217
|
-
private areMessageSetsOverlap;
|
|
218
|
-
private findMessageSetIndex;
|
|
219
|
-
/**
|
|
220
|
-
* Identifies the set index into which a message set would pertain if its first item's creation date corresponded to oldestTimestampMs.
|
|
221
|
-
* @param oldestTimestampMs
|
|
222
|
-
*/
|
|
223
|
-
private findMessageSetByOldestTimestamp;
|
|
224
|
-
private findTargetMessageSet;
|
|
225
77
|
}
|
|
226
78
|
export {};
|