stream-chat 9.50.3 → 9.52.0
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 +601 -275
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +610 -276
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +599 -273
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/channel.d.ts +4 -3
- package/dist/types/client.d.ts +23 -9
- package/dist/types/index.d.ts +7 -0
- package/dist/types/messageComposer/attachmentIdentity.d.ts +4 -0
- package/dist/types/messageComposer/attachmentManager.d.ts +8 -0
- package/dist/types/messageComposer/messageComposer.d.ts +13 -0
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +20 -1
- package/dist/types/messageComposer/middleware/messageComposer/MessageComposerMiddlewareExecutor.d.ts +6 -1
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +24 -0
- package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +22 -1
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +15 -9
- package/dist/types/messageComposer/types.d.ts +5 -0
- package/dist/types/middleware.d.ts +8 -0
- package/dist/types/offline-support/offline_support_api.d.ts +7 -1
- package/dist/types/offline-support/offline_sync_manager.d.ts +12 -1
- package/dist/types/search/BaseSearchSource.d.ts +42 -24
- package/dist/types/search/ChannelMemberSearchSource.d.ts +9 -4
- package/dist/types/search/ChannelSearchSource.d.ts +9 -3
- package/dist/types/search/MessageSearchSource.d.ts +14 -3
- package/dist/types/search/UserSearchSource.d.ts +9 -3
- package/dist/types/search/types.d.ts +14 -1
- package/dist/types/types.d.ts +12 -1
- package/dist/types/uploadManager.d.ts +30 -0
- package/dist/types/utils.d.ts +21 -2
- package/package.json +7 -7
- package/src/channel.ts +20 -8
- package/src/client.ts +71 -13
- package/src/index.ts +12 -0
- package/src/messageComposer/attachmentIdentity.ts +27 -0
- package/src/messageComposer/attachmentManager.ts +61 -12
- package/src/messageComposer/messageComposer.ts +43 -8
- 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 +4 -0
- package/src/messageComposer/middleware/messageComposer/MessageComposerMiddlewareExecutor.ts +9 -0
- package/src/messageComposer/middleware/messageComposer/attachments.ts +109 -0
- package/src/messageComposer/middleware/messageComposer/types.ts +22 -1
- package/src/messageComposer/middleware/textComposer/mentions.ts +75 -23
- package/src/messageComposer/types.ts +5 -0
- package/src/middleware.ts +11 -0
- package/src/offline-support/offline_support_api.ts +21 -2
- package/src/offline-support/offline_sync_manager.ts +36 -8
- package/src/search/BaseSearchSource.ts +123 -39
- package/src/search/ChannelMemberSearchSource.ts +22 -11
- package/src/search/ChannelSearchSource.ts +16 -5
- package/src/search/MessageSearchSource.ts +36 -4
- package/src/search/UserSearchSource.ts +16 -5
- package/src/search/types.ts +14 -1
- package/src/types.ts +13 -1
- package/src/uploadManager.ts +45 -0
- package/src/utils.ts +78 -3
package/dist/types/channel.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { CooldownTimer } from './CooldownTimer';
|
|
|
4
4
|
import { MessageComposer } from './messageComposer';
|
|
5
5
|
import { MessageReceiptsTracker } from './messageDelivery';
|
|
6
6
|
import type { StreamChat } from './client';
|
|
7
|
-
import type { AIState, APIResponse, AscDesc, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelMemberResponse, ChannelPushPreference, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateDraftResponse, DeleteChannelAPIResponse, DraftMessagePayload, Event, EventAPIResponse, EventHandler, EventTypes, GetDraftResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, LiveLocationPayload, LocalMessage, MarkReadOptions, MarkUnreadOptions, MemberFilters, MemberSort, Message, MessageFilters, MessageOptions, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, NewMemberPayload, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PartialUpdateMember, PartialUpdateMemberAPIResponse, PinnedMessagePaginationOptions, PinnedMessagesSort, PollVoteData, QueryChannelAPIResponse, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchAPIResponse, SearchOptions, SendMessageAPIResponse, SendMessageOptions, SendReactionOptions, StaticLocationPayload, TruncateChannelAPIResponse, TruncateOptions, UnBanUserOptions, UpdateChannelAPIResponse, UpdateChannelOptions, UpdateLocationPayload, UserResponse } from './types';
|
|
7
|
+
import type { AIState, APIResponse, AscDesc, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelMemberResponse, ChannelPushPreference, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateDraftResponse, DeleteChannelAPIResponse, DraftMessagePayload, Event, EventAPIResponse, EventHandler, EventTypes, GetDraftResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, LiveLocationPayload, LocalMessage, MarkReadOptions, MarkUnreadOptions, MemberFilters, MemberSort, Message, MessageFilters, MessageOptions, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, NewMemberPayload, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PartialUpdateMember, PartialUpdateMemberAPIResponse, PinnedMessagePaginationOptions, PinnedMessagesSort, PollVoteData, QueryChannelAPIResponse, QueryMembersOptions, Reaction, ReactionAPIResponse, RequestOptions, SearchAPIResponse, SearchOptions, SendMessageAPIResponse, SendMessageOptions, SendReactionOptions, StaticLocationPayload, TruncateChannelAPIResponse, TruncateOptions, UnBanUserOptions, UpdateChannelAPIResponse, UpdateChannelOptions, UpdateLocationPayload, UserResponse } from './types';
|
|
8
8
|
import type { Role } from './permissions';
|
|
9
9
|
/**
|
|
10
10
|
* Channel - The Channel class manages it's own state.
|
|
@@ -80,7 +80,7 @@ export declare class Channel {
|
|
|
80
80
|
*
|
|
81
81
|
* @return {Promise<SendMessageAPIResponse>} The Server Response
|
|
82
82
|
*/
|
|
83
|
-
_sendMessage(
|
|
83
|
+
_sendMessage(rawMessage: Message, options?: SendMessageOptions): Promise<SendMessageAPIResponse>;
|
|
84
84
|
sendMessage(message: Message, options?: SendMessageOptions): Promise<SendMessageAPIResponse>;
|
|
85
85
|
/**
|
|
86
86
|
* Upload a file to this channel’s file endpoint (multipart). Forwards to the client’s `sendFile` implementation.
|
|
@@ -136,10 +136,11 @@ export declare class Channel {
|
|
|
136
136
|
* @param {MemberSort} [sort] Sort options, for instance [{created_at: -1}].
|
|
137
137
|
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
|
|
138
138
|
* @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
|
|
139
|
+
* @param {RequestOptions} [requestOptions] Carries an abort signal. Not sent in the request.
|
|
139
140
|
*
|
|
140
141
|
* @return {Promise<ChannelMemberAPIResponse>} Query Members response
|
|
141
142
|
*/
|
|
142
|
-
queryMembers(filterConditions: MemberFilters, sort?: MemberSort, options?: QueryMembersOptions): Promise<ChannelMemberAPIResponse>;
|
|
143
|
+
queryMembers(filterConditions: MemberFilters, sort?: MemberSort, options?: QueryMembersOptions, requestOptions?: RequestOptions): Promise<ChannelMemberAPIResponse>;
|
|
143
144
|
/**
|
|
144
145
|
* updateMemberPartial - Partial update a member
|
|
145
146
|
*
|
package/dist/types/client.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { WSConnectionFallback } from './connection_fallback';
|
|
|
8
8
|
import { Campaign } from './campaign';
|
|
9
9
|
import { ChannelBatchUpdater } from './channel_batch_updater';
|
|
10
10
|
import { Segment } from './segment';
|
|
11
|
-
import type { ActiveLiveLocationsAPIResponse, AddUserGroupMembersOptions, AddUserGroupMembersResponse, APIErrorResponse, APIResponse, AppIdentifier, AppSettings, AppSettingsAPIResponse, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BaseDeviceFields, BlockList, BlockListResponse, BlockUserAPIResponse, CampaignData, CampaignFilters, CampaignQueryOptions, CampaignResponse, CampaignSort, CastVoteAPIResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelResponse, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSNSResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CreateImportOptions, CreateImportResponse, CreateImportURLResponse, CreatePollAPIResponse, CreatePollData, CreatePollOptionAPIResponse, CreatePredefinedFilterOptions, CreateReminderOptions, CreateRoleAPIResponse, CreateUserGroupOptions, CreateUserGroupResponse, CustomPermissionOptions, DeactivateUsersOptions, DeleteCommandResponse, DeleteMessageOptions, DeleteUserGroupOptions, DeleteUserOptions, Device, DeviceIdentifier, DraftFilters, DraftSort, EndpointName, Event, EventAPIResponse, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, ExportUsersRequest, ExportUsersResponse, FlagMessageResponse, FlagReportsFilters, FlagReportsPaginationOptions, FlagReportsResponse, FlagsFilters, FlagsPaginationOptions, FlagsResponse, FlagUserResponse, FutureChannelBansResponse, GetBlockedUsersAPIResponse, GetCampaignOptions, GetChannelTypeResponse, GetCommandResponse, GetHookEventsResponse, GetImportResponse, GetMessageOptions, GetPollAPIResponse, GetRateLimitsResponse, GetRetentionPolicyResponse, GetRetentionPolicyRunsOptions, GetRetentionPolicyRunsResponse, GetThreadAPIResponse, GetThreadOptions, GetUnreadCountAPIResponse, GetUnreadCountBatchAPIResponse, GetUserGroupOptions, GetUserGroupResponse, ListChannelResponse, ListCommandsResponse, ListImportsPaginationOptions, ListImportsResponse, ListPredefinedFiltersOptions, ListPredefinedFiltersResponse, ListRolesAPIResponse, LocalMessage, Logger, MarkChannelsReadOptions, MarkDeliveredOptions, MessageFilters, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OGAttachment, OwnUserResponse, Pager, PartialMessageUpdate, PartialPollUpdate, PartialThreadUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PollAnswersAPIResponse, PollData, PollOptionData, PollSort, PollVote, PollVoteData, PollVotesAPIResponse, PredefinedFilterResponse, Product, PushPreference, PushProvider, PushProviderConfig, PushProviderID, PushProviderListResponse, PushProviderUpsertResponse, QueryChannelsAPIResponse, QueryDraftsResponse, QueryFutureChannelBansOptions, QueryMessageHistoryFilters, QueryMessageHistoryOptions, QueryMessageHistoryResponse, QueryMessageHistorySort, QueryPollsFilters, QueryPollsOptions, QueryPollsResponse, QueryReactionsAPIResponse, QueryReactionsOptions, QueryRemindersOptions, QueryRemindersResponse, QuerySegmentsOptions, QuerySegmentTargetsFilter, QueryTeamUsageStatsOptions, QueryTeamUsageStatsResponse, QueryThreadsOptions, QueryUserGroupsOptions, QueryUserGroupsResponse, QueryVotesFilters, QueryVotesOptions, ReactionFilters, ReactionResponse, ReactionSort, ReactivateUserOptions, ReactivateUsersOptions, ReminderAPIResponse, RemoveUserGroupMembersOptions, RemoveUserGroupMembersResponse, ReviewFlagReportOptions, ReviewFlagReportResponse, SdkIdentifier, SearchAPIResponse, SearchOptions, SearchRolesAPIResponse, SearchRolesOptions, SearchUserGroupsOptions, SearchUserGroupsResponse, SegmentData, SegmentResponse, SegmentTargetsResponse, SegmentType, SendFileAPIResponse, SetRetentionPolicyResponse, SharedLocationResponse, SortParam, StreamChatOptions, SyncOptions, SyncResponse, TaskResponse, TaskStatus, TestPushDataInput, TestSNSDataInput, TestSQSDataInput, TokenOrProvider, TranslateResponse, UnBanUserOptions, UpdateChannelsBatchOptions, UpdateChannelTypeRequest, UpdateChannelTypeResponse, UpdateCommandOptions, UpdateCommandResponse, UpdateLocationPayload, UpdateMessageAPIResponse, UpdateMessageOptions, UpdatePollAPIResponse, UpdatePredefinedFilterOptions, UpdateReminderOptions, UpdateSegmentData, UpdateUserGroupOptions, UpdateUserGroupResponse, UpdateUsersAPIResponse, UpsertPushPreferencesResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, VoteSort } from './types';
|
|
11
|
+
import type { ActiveLiveLocationsAPIResponse, AddUserGroupMembersOptions, AddUserGroupMembersResponse, APIErrorResponse, APIResponse, AppIdentifier, AppSettings, AppSettingsAPIResponse, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BaseDeviceFields, BlockList, BlockListResponse, BlockUserAPIResponse, CampaignData, CampaignFilters, CampaignQueryOptions, CampaignResponse, CampaignSort, CastVoteAPIResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelResponse, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSNSResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CreateImportOptions, CreateImportResponse, CreateImportURLResponse, CreatePollAPIResponse, CreatePollData, CreatePollOptionAPIResponse, CreatePredefinedFilterOptions, CreateReminderOptions, CreateRoleAPIResponse, CreateUserGroupOptions, CreateUserGroupResponse, CustomPermissionOptions, DeactivateUsersOptions, DeleteCommandResponse, DeleteMessageOptions, DeleteUserGroupOptions, DeleteUserOptions, Device, DeviceIdentifier, DraftFilters, DraftSort, EndpointName, Event, EventAPIResponse, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, ExportUsersRequest, ExportUsersResponse, FlagMessageResponse, FlagReportsFilters, FlagReportsPaginationOptions, FlagReportsResponse, FlagsFilters, FlagsPaginationOptions, FlagsResponse, FlagUserResponse, FutureChannelBansResponse, GetBlockedUsersAPIResponse, GetCampaignOptions, GetChannelTypeResponse, GetCommandResponse, GetHookEventsResponse, GetImportResponse, GetMessageOptions, GetPollAPIResponse, GetRateLimitsResponse, GetRetentionPolicyResponse, GetRetentionPolicyRunsOptions, GetRetentionPolicyRunsResponse, GetThreadAPIResponse, GetThreadOptions, GetUnreadCountAPIResponse, GetUnreadCountBatchAPIResponse, GetUserGroupOptions, GetUserGroupResponse, ListChannelResponse, ListCommandsResponse, ListImportsPaginationOptions, ListImportsResponse, ListPredefinedFiltersOptions, ListPredefinedFiltersResponse, ListRolesAPIResponse, LocalMessage, Logger, MarkChannelsReadOptions, MarkDeliveredOptions, MessageFilters, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OGAttachment, OwnUserResponse, Pager, PartialMessageUpdate, PartialPollUpdate, PartialThreadUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PollAnswersAPIResponse, PollData, PollOptionData, PollSort, PollVote, PollVoteData, PollVotesAPIResponse, PredefinedFilterResponse, Product, PushPreference, PushProvider, PushProviderConfig, PushProviderID, PushProviderListResponse, PushProviderUpsertResponse, QueryChannelsAPIResponse, QueryDraftsResponse, QueryFutureChannelBansOptions, QueryMessageHistoryFilters, QueryMessageHistoryOptions, QueryMessageHistoryResponse, QueryMessageHistorySort, QueryPollsFilters, QueryPollsOptions, QueryPollsResponse, QueryReactionsAPIResponse, QueryReactionsOptions, QueryRemindersOptions, QueryRemindersResponse, QuerySegmentsOptions, QuerySegmentTargetsFilter, QueryTeamUsageStatsOptions, QueryTeamUsageStatsResponse, QueryThreadsOptions, QueryUserGroupsOptions, QueryUserGroupsResponse, QueryVotesFilters, QueryVotesOptions, ReactionFilters, ReactionResponse, ReactionSort, ReactivateUserOptions, ReactivateUsersOptions, ReminderAPIResponse, RemoveUserGroupMembersOptions, RemoveUserGroupMembersResponse, RequestOptions, ReviewFlagReportOptions, ReviewFlagReportResponse, SdkIdentifier, SearchAPIResponse, SearchOptions, SearchRolesAPIResponse, SearchRolesOptions, SearchUserGroupsOptions, SearchUserGroupsResponse, SegmentData, SegmentResponse, SegmentTargetsResponse, SegmentType, SendFileAPIResponse, SetRetentionPolicyResponse, SharedLocationResponse, SortParam, StreamChatOptions, SyncOptions, SyncResponse, TaskResponse, TaskStatus, TestPushDataInput, TestSNSDataInput, TestSQSDataInput, TokenOrProvider, TranslateResponse, UnBanUserOptions, UpdateChannelsBatchOptions, UpdateChannelTypeRequest, UpdateChannelTypeResponse, UpdateCommandOptions, UpdateCommandResponse, UpdateLocationPayload, UpdateMessageAPIResponse, UpdateMessageOptions, UpdatePollAPIResponse, UpdatePredefinedFilterOptions, UpdateReminderOptions, UpdateSegmentData, UpdateUserGroupOptions, UpdateUserGroupResponse, UpdateUsersAPIResponse, UpsertPushPreferencesResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, VoteSort } from './types';
|
|
12
12
|
import { ErrorFromResponse } from './types';
|
|
13
13
|
import { InsightMetrics } from './insights';
|
|
14
14
|
import { Thread } from './thread';
|
|
@@ -406,9 +406,9 @@ export declare class StreamChat {
|
|
|
406
406
|
maxBodyLength?: number;
|
|
407
407
|
};
|
|
408
408
|
}) => Promise<T>;
|
|
409
|
-
get<T>(url: string, params?: AxiosRequestConfig['params']): Promise<T>;
|
|
409
|
+
get<T>(url: string, params?: AxiosRequestConfig['params'], config?: Omit<AxiosRequestConfig, 'params'>): Promise<T>;
|
|
410
410
|
put<T>(url: string, data?: unknown): Promise<T>;
|
|
411
|
-
post<T>(url: string, data?: unknown): Promise<T>;
|
|
411
|
+
post<T>(url: string, data?: unknown, config?: Omit<AxiosRequestConfig, 'params'>): Promise<T>;
|
|
412
412
|
patch<T>(url: string, data?: unknown): Promise<T>;
|
|
413
413
|
delete<T>(url: string, params?: AxiosRequestConfig['params']): Promise<T>;
|
|
414
414
|
sendFile(url: string, uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse, axiosRequestConfig?: AxiosRequestConfig): Promise<SendFileAPIResponse>;
|
|
@@ -487,10 +487,11 @@ export declare class StreamChat {
|
|
|
487
487
|
* @param {UserSort} sort Sort options, for instance [{last_active: -1}].
|
|
488
488
|
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
|
|
489
489
|
* @param {UserOptions} options Option object, {presence: true}
|
|
490
|
+
* @param {RequestOptions} [requestOptions] Carries an abort signal. Not sent in the request.
|
|
490
491
|
*
|
|
491
492
|
* @return {Promise<{ users: Array<UserResponse> }>} User Query Response
|
|
492
493
|
*/
|
|
493
|
-
queryUsers(filterConditions: UserFilters, sort?: UserSort, options?: UserOptions): Promise<APIResponse & {
|
|
494
|
+
queryUsers(filterConditions: UserFilters, sort?: UserSort, options?: UserOptions, requestOptions?: RequestOptions): Promise<APIResponse & {
|
|
494
495
|
users: Array<UserResponse>;
|
|
495
496
|
}>;
|
|
496
497
|
/**
|
|
@@ -522,10 +523,10 @@ export declare class StreamChat {
|
|
|
522
523
|
* searchUserGroups - Search user groups by prefix for autocomplete
|
|
523
524
|
*
|
|
524
525
|
* @param {SearchUserGroupsOptions} options The search options
|
|
525
|
-
*
|
|
526
|
+
* @param {RequestOptions} [requestOptions] Carries an abort signal. Not sent in the request.
|
|
526
527
|
* @return {Promise<SearchUserGroupsResponse>} User Group Search Response
|
|
527
528
|
*/
|
|
528
|
-
searchUserGroups(options: SearchUserGroupsOptions): Promise<SearchUserGroupsResponse>;
|
|
529
|
+
searchUserGroups(options: SearchUserGroupsOptions, requestOptions?: RequestOptions): Promise<SearchUserGroupsResponse>;
|
|
529
530
|
/**
|
|
530
531
|
* updateUserGroup - Update a user group by ID
|
|
531
532
|
*
|
|
@@ -601,10 +602,11 @@ export declare class StreamChat {
|
|
|
601
602
|
* @param {ChannelSort} [sort] Sort options, for instance {created_at: -1}.
|
|
602
603
|
* When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_updated: -1}, {created_at: 1}]
|
|
603
604
|
* @param {ChannelOptions} [options] Options object. Can include predefined_filter, filter_values, and sort_values for using predefined filters.
|
|
605
|
+
* @param {RequestOptions} [requestOptions] Carries an abort signal. Not sent in the request.
|
|
604
606
|
*
|
|
605
607
|
* @return {Promise<QueryChannelsAPIResponse>} full search channels response
|
|
606
608
|
*/
|
|
607
|
-
queryChannelsRequestWithResponse(filterConditions: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions): Promise<QueryChannelsAPIResponse>;
|
|
609
|
+
queryChannelsRequestWithResponse(filterConditions: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions, requestOptions?: RequestOptions): Promise<QueryChannelsAPIResponse>;
|
|
608
610
|
/**
|
|
609
611
|
* queryChannelsRequest - Queries channels and returns the raw channel response list.
|
|
610
612
|
*
|
|
@@ -632,6 +634,7 @@ export declare class StreamChat {
|
|
|
632
634
|
* - stateOptions.skipInitialization - Skips the initialization of the state for the channels matching the ids in the list.
|
|
633
635
|
* - stateOptions.skipHydration - Skips returning the channels as instances of the Channel class and rather returns the raw query response.
|
|
634
636
|
* - stateOptions.withResponse - Returns the full query response with hydrated channels. This is a compatibility bridge for internal callers that need response-level metadata while the default return value remains `Channel[]`.
|
|
637
|
+
* - stateOptions.signal - Aborts the request. See AbortController.
|
|
635
638
|
*
|
|
636
639
|
* @return {Promise<Array<Channel>>} search channels response
|
|
637
640
|
*/
|
|
@@ -656,10 +659,11 @@ export declare class StreamChat {
|
|
|
656
659
|
* @param {ChannelFilters} filterConditions MongoDB style filter conditions
|
|
657
660
|
* @param {MessageFilters | string} query search query or object MongoDB style filters
|
|
658
661
|
* @param {SearchOptions} [options] Option object, {user_id: 'tommaso'}
|
|
662
|
+
* @param {RequestOptions} [requestOptions] Carries an abort signal. Not sent in the request.
|
|
659
663
|
*
|
|
660
664
|
* @return {Promise<SearchAPIResponse>} search messages response
|
|
661
665
|
*/
|
|
662
|
-
search(filterConditions: ChannelFilters, query: string | MessageFilters, options?: SearchOptions): Promise<SearchAPIResponse>;
|
|
666
|
+
search(filterConditions: ChannelFilters, query: string | MessageFilters, options?: SearchOptions, requestOptions?: RequestOptions): Promise<SearchAPIResponse>;
|
|
663
667
|
/**
|
|
664
668
|
* setLocalDevice - Set the device info for the current client(device) that will be sent via WS connection automatically
|
|
665
669
|
*
|
|
@@ -986,6 +990,11 @@ export declare class StreamChat {
|
|
|
986
990
|
}): Promise<FlagUserResponse>;
|
|
987
991
|
/**
|
|
988
992
|
* unflagMessage - unflag a message
|
|
993
|
+
*
|
|
994
|
+
* @deprecated The `/moderation/unflag` endpoint is deprecated and is a no-op on
|
|
995
|
+
* the backend - calling this resolves successfully but does not remove the flag.
|
|
996
|
+
* Use `client.moderation.submitAction()` against the review queue item instead.
|
|
997
|
+
*
|
|
989
998
|
* @param {string} targetMessageID
|
|
990
999
|
* @param {string} [options.user_id] currentUserID, only used with serverside auth
|
|
991
1000
|
* @returns {Promise<APIResponse>}
|
|
@@ -995,6 +1004,11 @@ export declare class StreamChat {
|
|
|
995
1004
|
}): Promise<FlagMessageResponse>;
|
|
996
1005
|
/**
|
|
997
1006
|
* unflagUser - unflag a user
|
|
1007
|
+
*
|
|
1008
|
+
* @deprecated The `/moderation/unflag` endpoint is deprecated and is a no-op on
|
|
1009
|
+
* the backend - calling this resolves successfully but does not remove the flag.
|
|
1010
|
+
* Use `client.moderation.submitAction()` against the review queue item instead.
|
|
1011
|
+
*
|
|
998
1012
|
* @param {string} targetID
|
|
999
1013
|
* @param {string} [options.user_id] currentUserID, only used with serverside auth
|
|
1000
1014
|
* @returns {Promise<APIResponse>}
|
|
@@ -1427,7 +1441,7 @@ export declare class StreamChat {
|
|
|
1427
1441
|
*
|
|
1428
1442
|
* @returns {Promise<APIResponse>}
|
|
1429
1443
|
*/
|
|
1430
|
-
searchRoles(options: SearchRolesOptions): Promise<SearchRolesAPIResponse>;
|
|
1444
|
+
searchRoles(options: SearchRolesOptions, requestOptions?: RequestOptions): Promise<SearchRolesAPIResponse>;
|
|
1431
1445
|
/** deleteRole - deletes a custom role
|
|
1432
1446
|
*
|
|
1433
1447
|
* @param {string} name the role name
|
package/dist/types/index.d.ts
CHANGED
|
@@ -35,3 +35,10 @@ export * from './LiveLocationManager';
|
|
|
35
35
|
export type { CustomAttachmentData, CustomChannelData, CustomCommandData, CustomEventData, CustomEventTypes, CustomMemberData, CustomMessageComposerData, CustomMessageData, CustomPollOptionData, CustomPollData, CustomReactionData, CustomUserData, CustomThreadData, } from './custom_types';
|
|
36
36
|
export { isOwnUser, chatCodes, logChatPromiseExecution, localMessageToNewMessagePayload, formatMessage, promoteChannel, } from './utils';
|
|
37
37
|
export { FixedSizeQueueCache } from './utils/FixedSizeQueueCache';
|
|
38
|
+
/**
|
|
39
|
+
* Tag-keyed async runners. Exported so the UI SDKs (and integrators) serialize their own
|
|
40
|
+
* actions with the same primitive the SDK uses internally instead of hand-rolling promise
|
|
41
|
+
* chains. Tags share one process-wide map, so namespace yours (`my-app/thing/${id}`) to avoid
|
|
42
|
+
* colliding with another caller's.
|
|
43
|
+
*/
|
|
44
|
+
export { hasPending, settled, withCancellation, withoutConcurrency, } from './utils/concurrency';
|
|
@@ -3,6 +3,10 @@ import type { AudioAttachment, FileAttachment, GiphyAttachment, ImageAttachment,
|
|
|
3
3
|
export declare const isScrapedContent: (attachment: Attachment) => boolean;
|
|
4
4
|
export declare const isLocalAttachment: (attachment: unknown) => attachment is LocalAttachment;
|
|
5
5
|
export declare const isLocalUploadAttachment: (attachment: unknown) => attachment is LocalUploadAttachment;
|
|
6
|
+
/** Whether an upload for this attachment is still expected to resolve. */
|
|
7
|
+
export declare const isPendingUpload: (attachment: unknown) => attachment is LocalUploadAttachment;
|
|
8
|
+
/** Whether this attachment's upload already resolved to a URL. */
|
|
9
|
+
export declare const isFinishedUpload: (attachment: unknown) => attachment is LocalUploadAttachment;
|
|
6
10
|
export declare const isFileAttachment: (attachment: Attachment | LocalAttachment, supportedVideoFormat?: string[]) => attachment is FileAttachment;
|
|
7
11
|
export declare const isLocalFileAttachment: (attachment: Attachment | LocalAttachment) => attachment is LocalFileAttachment;
|
|
8
12
|
export declare const isImageAttachment: (attachment: Attachment) => attachment is ImageAttachment;
|
|
@@ -57,6 +57,14 @@ export declare class AttachmentManager {
|
|
|
57
57
|
private prepareAttachmentUpdate;
|
|
58
58
|
updateAttachment: (attachmentToUpdate: LocalAttachment) => void;
|
|
59
59
|
upsertAttachments: (attachmentsToUpsert: LocalAttachment[]) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Releases a local preview URL the SDK minted, if it minted one.
|
|
62
|
+
*
|
|
63
|
+
* Only `blob:` URLs are ours to revoke: `toLocalUploadAttachment` puts a
|
|
64
|
+
* `URL.createObjectURL` result in `previewUri` for a `File`, but for a React Native
|
|
65
|
+
* `FileReference` it stores the caller's own native file URI, which must be left alone.
|
|
66
|
+
*/
|
|
67
|
+
private revokePreviewUri;
|
|
60
68
|
removeAttachments: (localAttachmentIds: string[]) => void;
|
|
61
69
|
getUploadConfigCheck: (fileLike: FileReference | FileLike) => Promise<UploadPermissionCheckResult>;
|
|
62
70
|
static toLocalUploadAttachment: (fileLike: FileReference | FileLike) => LocalUploadAttachment;
|
|
@@ -107,6 +107,19 @@ export declare class MessageComposer extends WithSubscriptions {
|
|
|
107
107
|
isCommandDisabled: (command: CommandResponse) => boolean;
|
|
108
108
|
validateCommandSendability: (command: CommandResponse, text?: string) => CommandSendability;
|
|
109
109
|
get isCommandSendable(): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Whether the installed composition middleware composes messages whose uploads are still in
|
|
112
|
+
* flight — see `MessageCompositionMiddleware.allowsPendingUploads`.
|
|
113
|
+
*
|
|
114
|
+
* Derived from the chain rather than from config, so there is exactly one switch: the UI SDK
|
|
115
|
+
* that implements the rest of the flow installs the middleware, and everything that has to
|
|
116
|
+
* follow from that (starting with {@link hasSendableData}) follows on its own.
|
|
117
|
+
*
|
|
118
|
+
* **Temporary API.** In v10 sending with pending uploads becomes part of the composer
|
|
119
|
+
* configuration (`MessageComposerConfig`, set through `updateConfig`), and this getter,
|
|
120
|
+
* together with the middleware declaration it reads, is replaced by that config field.
|
|
121
|
+
*/
|
|
122
|
+
get allowsPendingUploads(): boolean;
|
|
110
123
|
get hasSendableData(): boolean;
|
|
111
124
|
get compositionIsEmpty(): boolean;
|
|
112
125
|
get contentIsEmpty(): boolean;
|
package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
1
1
|
import type { AttachmentPostUploadMiddleware } from '../types';
|
|
2
|
-
|
|
2
|
+
import type { MessageComposer } from '../../../messageComposer';
|
|
3
|
+
/**
|
|
4
|
+
* Writes the uploaded URL onto the attachment and releases its local preview.
|
|
5
|
+
*
|
|
6
|
+
* The preview is a blob URL the composer created for the file. Releasing it once the CDN URL is
|
|
7
|
+
* in is what keeps the browser from holding the file in memory.
|
|
8
|
+
*
|
|
9
|
+
* Pass `composer` and the preview is released only while the attachment is still one of the
|
|
10
|
+
* composer's own — still listed in `attachmentManager.attachments`, i.e. still shown above the
|
|
11
|
+
* input, waiting to be sent.
|
|
12
|
+
*
|
|
13
|
+
* This runs when an upload finishes, which can be after the composer was cleared: `uploadFile`
|
|
14
|
+
* executes this chain before the (by then no-op) `updateAttachment`. If the attachment is gone
|
|
15
|
+
* from the composer, a message is rendering from the preview instead, and releasing it would
|
|
16
|
+
* blank that message out. A message can be sent with uploads still running — see
|
|
17
|
+
* `createSendWithPendingUploadsAttachmentsMiddleware`.
|
|
18
|
+
*
|
|
19
|
+
* Omit `composer` and the preview is always released.
|
|
20
|
+
*/
|
|
21
|
+
export declare const createPostUploadAttachmentEnrichmentMiddleware: (composer?: MessageComposer) => AttachmentPostUploadMiddleware;
|
package/dist/types/messageComposer/middleware/messageComposer/MessageComposerMiddlewareExecutor.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { MiddlewareExecutor } from '../../../middleware';
|
|
2
|
-
import type { MessageComposerMiddlewareExecutorOptions, MessageComposerMiddlewareState, MessageDraftComposerMiddlewareExecutorOptions, MessageDraftComposerMiddlewareValueState } from './types';
|
|
2
|
+
import type { MessageComposerMiddlewareExecutorOptions, MessageComposerMiddlewareState, MessageCompositionMiddleware, MessageDraftComposerMiddlewareExecutorOptions, MessageDraftComposerMiddlewareValueState } from './types';
|
|
3
3
|
export declare class MessageComposerMiddlewareExecutor extends MiddlewareExecutor<MessageComposerMiddlewareState, 'compose'> {
|
|
4
4
|
constructor({ composer }: MessageComposerMiddlewareExecutorOptions);
|
|
5
|
+
/**
|
|
6
|
+
* Narrows the base accessor to the composition middleware type, so callers can read the
|
|
7
|
+
* declarations it carries (`allowsPendingUploads`) without casting.
|
|
8
|
+
*/
|
|
9
|
+
get installedMiddleware(): ReadonlyArray<MessageCompositionMiddleware>;
|
|
5
10
|
}
|
|
6
11
|
export declare class MessageDraftComposerMiddlewareExecutor extends MiddlewareExecutor<MessageDraftComposerMiddlewareValueState, 'compose'> {
|
|
7
12
|
constructor({ composer }: MessageDraftComposerMiddlewareExecutorOptions);
|
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
import type { MessageComposer } from '../../messageComposer';
|
|
2
2
|
import type { MessageCompositionMiddleware, MessageDraftCompositionMiddleware } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Drop-in replacement for {@link createAttachmentsCompositionMiddleware} that lets a message be
|
|
5
|
+
* composed while its attachments are still uploading.
|
|
6
|
+
*
|
|
7
|
+
* Reuses the same middleware id, so installing it with
|
|
8
|
+
* `compositionMiddlewareExecutor.replace([...])` keeps its position in the chain. The default
|
|
9
|
+
* refuses instead: it warns "Wait until all attachments have uploaded" and discards the
|
|
10
|
+
* composition.
|
|
11
|
+
*
|
|
12
|
+
* **Installing this is only half of the flow.** The composition it produces is not ready for the
|
|
13
|
+
* wire — `message.attachments` omits everything that has no URL yet. Whoever performs the send
|
|
14
|
+
* has to await those uploads (`UploadManager.upload` is idempotent by `localMetadata.id`, so
|
|
15
|
+
* calling it again returns the in-flight promise), write the resolved URLs in, and send after
|
|
16
|
+
* that.
|
|
17
|
+
*
|
|
18
|
+
* Sendability follows on its own: the `allowsPendingUploads` declaration below is what
|
|
19
|
+
* {@link MessageComposer.hasSendableData} reads to stop treating an upload in flight as a
|
|
20
|
+
* blocker, so installing this middleware is the only switch there is.
|
|
21
|
+
*
|
|
22
|
+
* This is why there is no config option turning it on: the switch belongs to the UI SDK that
|
|
23
|
+
* implements the other half. stream-chat-react exposes it as a `Chat` prop;
|
|
24
|
+
* stream-chat-react-native as `allowSendBeforeAttachmentsUpload` on the message input.
|
|
25
|
+
*/
|
|
26
|
+
export declare const createSendWithPendingUploadsAttachmentsMiddleware: (composer: MessageComposer) => MessageCompositionMiddleware;
|
|
3
27
|
export declare const createAttachmentsCompositionMiddleware: (composer: MessageComposer) => MessageCompositionMiddleware;
|
|
4
28
|
export declare const createDraftAttachmentsCompositionMiddleware: (composer: MessageComposer) => MessageDraftCompositionMiddleware;
|
|
@@ -16,5 +16,26 @@ export type MessageDraftComposerMiddlewareValueState = {
|
|
|
16
16
|
export type MessageDraftComposerMiddlewareExecutorOptions = {
|
|
17
17
|
composer: MessageComposer;
|
|
18
18
|
};
|
|
19
|
-
export type MessageCompositionMiddleware = Middleware<MessageComposerMiddlewareState, 'compose'
|
|
19
|
+
export type MessageCompositionMiddleware = Middleware<MessageComposerMiddlewareState, 'compose'> & {
|
|
20
|
+
/**
|
|
21
|
+
* Declares that this middleware composes messages whose attachment uploads are still in
|
|
22
|
+
* flight, instead of refusing to compose until they finish.
|
|
23
|
+
*
|
|
24
|
+
* {@link MessageComposer.hasSendableData} reads this: an upload in flight must not block the
|
|
25
|
+
* send while such a middleware is installed, or the send could never be triggered. Any
|
|
26
|
+
* middleware implementing that contract may set it - the composer keys off the declaration,
|
|
27
|
+
* not off a middleware id, so a custom implementation is treated the same as the one shipped
|
|
28
|
+
* here.
|
|
29
|
+
*
|
|
30
|
+
* Composing this way is only half of the flow: whoever performs the send has to await those
|
|
31
|
+
* uploads and write the resolved URLs into the payload. See
|
|
32
|
+
* {@link createSendWithPendingUploadsAttachmentsMiddleware}.
|
|
33
|
+
*
|
|
34
|
+
* **Temporary API.** In v10 sending with pending uploads becomes part of the composer
|
|
35
|
+
* configuration (`MessageComposerConfig`, set through `updateConfig`), and this declaration,
|
|
36
|
+
* together with {@link MessageComposer.allowsPendingUploads}, is replaced by that config
|
|
37
|
+
* field.
|
|
38
|
+
*/
|
|
39
|
+
allowsPendingUploads?: boolean;
|
|
40
|
+
};
|
|
20
41
|
export type MessageDraftCompositionMiddleware = Middleware<MessageDraftComposerMiddlewareValueState, 'compose'>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseSearchSource, type SearchSourceOptions } from '../../../search';
|
|
1
|
+
import { BaseSearchSource, type SearchQueryOptions, type SearchSourceOptions } from '../../../search';
|
|
2
2
|
import type { ChannelMentionSuggestion, HereMentionSuggestion, MentionSuggestion, RoleMentionSuggestion, TextComposerMiddlewareOptions, UserGroupMentionSuggestion, UserSuggestion } from './types';
|
|
3
3
|
import type { StreamChat } from '../../../client';
|
|
4
4
|
import type { MemberFilters, MemberSort, UserFilters, UserGroupResponse, UserOptions, UserResponse, UserSort } from '../../../types';
|
|
@@ -11,6 +11,13 @@ export declare const accentsMap: {
|
|
|
11
11
|
export declare const removeDiacritics: (text?: string) => string;
|
|
12
12
|
export declare const calculateLevenshtein: (query: string, name: string) => number;
|
|
13
13
|
export type MentionsSearchSourceOptions = SearchSourceOptions & {
|
|
14
|
+
/** Static base filters for the app-wide user query (mentionAllAppUsers). */
|
|
15
|
+
userFilters?: UserFilters;
|
|
16
|
+
userSort?: UserSort;
|
|
17
|
+
/** Static base filters for the channel member query. */
|
|
18
|
+
memberFilters?: MemberFilters;
|
|
19
|
+
memberSort?: MemberSort;
|
|
20
|
+
searchOptions?: Omit<UserOptions, 'limit' | 'offset'>;
|
|
14
21
|
mentionAllAppUsers?: boolean;
|
|
15
22
|
suggestionFactoryMappers?: MentionSuggestionFactoryMapperOverrides;
|
|
16
23
|
textComposerText?: string;
|
|
@@ -56,7 +63,7 @@ export declare class MentionsSearchSource extends BaseSearchSource<MentionSugges
|
|
|
56
63
|
userSort: UserSort | undefined;
|
|
57
64
|
memberSort: MemberSort | undefined;
|
|
58
65
|
searchOptions: Omit<UserOptions, 'limit' | 'offset'> | undefined;
|
|
59
|
-
config: MentionsSearchSourceOptions
|
|
66
|
+
config: Pick<MentionsSearchSourceOptions, 'mentionAllAppUsers' | 'suggestionFactoryMappers' | 'textComposerText' | 'trigger'>;
|
|
60
67
|
constructor(channel: Channel, options?: MentionsSearchSourceOptions);
|
|
61
68
|
get allMembersLoadedWithInitialChannelQuery(): boolean;
|
|
62
69
|
normalizeSearchValue: (value?: string) => string;
|
|
@@ -81,7 +88,6 @@ export declare class MentionsSearchSource extends BaseSearchSource<MentionSugges
|
|
|
81
88
|
next?: string | null;
|
|
82
89
|
offset?: number;
|
|
83
90
|
};
|
|
84
|
-
canExecuteQuery: (newSearchString?: string) => boolean;
|
|
85
91
|
protected updatePaginationStateFromQuery(): {
|
|
86
92
|
hasNext: boolean;
|
|
87
93
|
next: undefined;
|
|
@@ -90,7 +96,7 @@ export declare class MentionsSearchSource extends BaseSearchSource<MentionSugges
|
|
|
90
96
|
transliterate: (text: string) => string;
|
|
91
97
|
getMembersAndWatchers: () => UserResponse[];
|
|
92
98
|
getBuiltinMentionSuggestions: (searchQuery: string) => MentionSuggestion[];
|
|
93
|
-
getRoleMentionSuggestions: (query: string) => Promise<RoleMentionSuggestion[]>;
|
|
99
|
+
getRoleMentionSuggestions: (query: string, queryOptions?: SearchQueryOptions) => Promise<RoleMentionSuggestion[]>;
|
|
94
100
|
searchMembersLocally: (searchQuery: string) => UserResponse[];
|
|
95
101
|
prepareQueryUsersParams: (searchQuery: string, offset?: number) => {
|
|
96
102
|
filters: UserFilters;
|
|
@@ -112,18 +118,18 @@ export declare class MentionsSearchSource extends BaseSearchSource<MentionSugges
|
|
|
112
118
|
presence?: boolean;
|
|
113
119
|
};
|
|
114
120
|
};
|
|
115
|
-
queryUsers: (searchQuery: string, offset?: number) => Promise<UserResponse[]>;
|
|
116
|
-
queryMembers: (searchQuery: string, offset?: number) => Promise<UserResponse[]>;
|
|
117
|
-
getUserSuggestionsPage: (searchQuery: string, userOffset?: number) => Promise<{
|
|
121
|
+
queryUsers: (searchQuery: string, offset?: number, queryOptions?: SearchQueryOptions) => Promise<UserResponse[]>;
|
|
122
|
+
queryMembers: (searchQuery: string, offset?: number, queryOptions?: SearchQueryOptions) => Promise<UserResponse[]>;
|
|
123
|
+
getUserSuggestionsPage: (searchQuery: string, userOffset?: number, queryOptions?: SearchQueryOptions) => Promise<{
|
|
118
124
|
items: UserSuggestion[];
|
|
119
125
|
nextOffset: number | undefined;
|
|
120
126
|
}>;
|
|
121
127
|
buildUserGroupSearchCursor: (items: UserGroupResponse[]) => string | undefined;
|
|
122
|
-
getUserGroupSuggestionsPage: (searchQuery: string, cursor?: string) => Promise<{
|
|
128
|
+
getUserGroupSuggestionsPage: (searchQuery: string, cursor?: string, queryOptions?: SearchQueryOptions) => Promise<{
|
|
123
129
|
items: UserGroupMentionSuggestion[];
|
|
124
130
|
next: string | undefined;
|
|
125
131
|
}>;
|
|
126
|
-
query(searchQuery: string): Promise<{
|
|
132
|
+
query(searchQuery: string, queryOptions?: SearchQueryOptions): Promise<{
|
|
127
133
|
items: MentionSuggestion[];
|
|
128
134
|
}>;
|
|
129
135
|
filterMutes(data: UserSuggestion[]): UserSuggestion[];
|
|
@@ -68,6 +68,11 @@ export type LocalAttachmentUploadMetadata = {
|
|
|
68
68
|
*/
|
|
69
69
|
previewUri?: string;
|
|
70
70
|
uploadState: AttachmentLoadingState;
|
|
71
|
+
/**
|
|
72
|
+
* Mirrors {@link UploadRecord.uploadConfirmationPending}: every byte has been sent, but the server has
|
|
73
|
+
* not confirmed yet - not returned response to the upload request. Render an indeterminate indicator rather than a full bar.
|
|
74
|
+
*/
|
|
75
|
+
uploadConfirmationPending?: boolean;
|
|
71
76
|
uploadPermissionCheck?: UploadPermissionCheckResult;
|
|
72
77
|
/** 0–100 while uploading when progress tracking is enabled; undefined otherwise or when indeterminate */
|
|
73
78
|
uploadProgress?: number;
|
|
@@ -34,6 +34,14 @@ export declare class MiddlewareExecutor<TValue, THandlers extends string> {
|
|
|
34
34
|
readonly id: string;
|
|
35
35
|
private middleware;
|
|
36
36
|
constructor();
|
|
37
|
+
/**
|
|
38
|
+
* The middleware currently installed, in execution order.
|
|
39
|
+
*
|
|
40
|
+
* Read-only: use `use` / `insert` / `replace` / `setOrder` / `remove` to change the chain. It
|
|
41
|
+
* exists so components can ask what the chain is capable of - a middleware may declare
|
|
42
|
+
* behaviour its host has to account for, and the host has no other way to find out.
|
|
43
|
+
*/
|
|
44
|
+
get installedMiddleware(): ReadonlyArray<Middleware<TValue, THandlers>>;
|
|
37
45
|
use(middleware: Middleware<TValue, THandlers> | Middleware<TValue, THandlers>[]): this;
|
|
38
46
|
replace(middleware: Middleware<TValue, THandlers>[]): this;
|
|
39
47
|
insert({ middleware, position, unique, }: {
|
|
@@ -16,8 +16,14 @@ export declare abstract class AbstractOfflineDB implements OfflineDBApi {
|
|
|
16
16
|
private client;
|
|
17
17
|
syncManager: OfflineDBSyncManager;
|
|
18
18
|
state: StateStore<OfflineDBState>;
|
|
19
|
-
constructor({ client }: {
|
|
19
|
+
constructor({ client, syncMaxEventCount, }: {
|
|
20
20
|
client: StreamChat;
|
|
21
|
+
/**
|
|
22
|
+
* Optional positive cap forwarded to the {@link OfflineDBSyncManager}, which
|
|
23
|
+
* owns sync. `undefined` or any non-positive value means "no limit". See
|
|
24
|
+
* {@link OfflineDBSyncManager.syncMaxEventCount}.
|
|
25
|
+
*/
|
|
26
|
+
syncMaxEventCount?: number;
|
|
21
27
|
});
|
|
22
28
|
/**
|
|
23
29
|
* @abstract
|
|
@@ -16,9 +16,20 @@ export declare class OfflineDBSyncManager {
|
|
|
16
16
|
private scheduledSyncStatusCallbacks;
|
|
17
17
|
private client;
|
|
18
18
|
private offlineDb;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Optional positive cap on the number of events a single `/sync` response may
|
|
21
|
+
* contain before this manager skips event replay into local storage and relies
|
|
22
|
+
* on the reconnect-time channel refresh (queryChannels + `channel.watch()`) to
|
|
23
|
+
* bring visible surfaces up to date.
|
|
24
|
+
*
|
|
25
|
+
* `undefined` or any non-positive value means "no limit" and event replay always
|
|
26
|
+
* runs with whatever maximum the server decides to return.
|
|
27
|
+
*/
|
|
28
|
+
readonly syncMaxEventCount?: number;
|
|
29
|
+
constructor({ client, offlineDb, syncMaxEventCount, }: {
|
|
20
30
|
client: StreamChat;
|
|
21
31
|
offlineDb: AbstractOfflineDB;
|
|
32
|
+
syncMaxEventCount?: number;
|
|
22
33
|
});
|
|
23
34
|
/**
|
|
24
35
|
* Initializes the sync manager. Should only be called once per session.
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { StateStore } from '../store';
|
|
2
2
|
import { type DebouncedFunc } from '../utils';
|
|
3
3
|
import type { QueryReturnValue, SearchSourceOptions, SearchSourceState, SearchSourceType } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Passed to a search source's `query()`. Carries a cancellation handle and makes no
|
|
6
|
+
* claim that the query performs a request: a source may resolve from local data and
|
|
7
|
+
* ignore the signal. Where a source does issue requests, forward this straight through
|
|
8
|
+
* as the request options.
|
|
9
|
+
*/
|
|
10
|
+
export type SearchQueryOptions = {
|
|
11
|
+
/** Aborted once a newer query supersedes this one. */
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
};
|
|
4
14
|
export type DebounceOptions = {
|
|
5
|
-
|
|
15
|
+
/** Applies to both short and long queries unless overridden by the options below. */
|
|
16
|
+
debounceMs?: number;
|
|
17
|
+
shortQueryDebounceMs?: number;
|
|
18
|
+
longQueryDebounceMs?: number;
|
|
19
|
+
shortQueryMaxLength?: number;
|
|
6
20
|
};
|
|
7
|
-
type DebouncedExecQueryFunction = DebouncedFunc<(searchString?: string) => Promise<void>>;
|
|
8
21
|
interface ISearchSource<T = any> {
|
|
9
22
|
activate(): void;
|
|
10
23
|
canExecuteQuery(newSearchString?: string): boolean;
|
|
@@ -33,28 +46,36 @@ export interface SearchSourceSync<T = any> extends ISearchSource<T> {
|
|
|
33
46
|
setDebounceOptions(options: DebounceOptions): void;
|
|
34
47
|
search(text?: string): void;
|
|
35
48
|
}
|
|
36
|
-
declare abstract class BaseSearchSourceBase<T
|
|
49
|
+
declare abstract class BaseSearchSourceBase<T, R extends void | Promise<void>> implements ISearchSource<T> {
|
|
37
50
|
state: StateStore<SearchSourceState<T>>;
|
|
38
51
|
pageSize: number;
|
|
39
52
|
protected allowEmptySearchString: boolean;
|
|
40
53
|
protected resetOnNewSearchQuery: boolean;
|
|
54
|
+
protected shortQueryDebounceMs: number;
|
|
55
|
+
protected longQueryDebounceMs: number;
|
|
56
|
+
protected shortQueryMaxLength: number;
|
|
57
|
+
protected searchDebounced: DebouncedFunc<(searchString?: string) => R>;
|
|
41
58
|
abstract readonly type: SearchSourceType;
|
|
42
59
|
protected constructor(options?: SearchSourceOptions);
|
|
60
|
+
abstract executeQuery(newSearchString?: string): R;
|
|
61
|
+
setDebounceOptions: (options?: DebounceOptions) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Short queries match too much and are slow server-side, so they get a longer debounce.
|
|
64
|
+
* Resolved per call, which is what lets the interval switch as the user keeps typing.
|
|
65
|
+
*/
|
|
66
|
+
protected getDebounceMs: (searchString?: string) => number;
|
|
67
|
+
/**
|
|
68
|
+
* A new search query preempts an in-flight one; pagination waits for it to finish
|
|
69
|
+
* and needs a next page to fetch.
|
|
70
|
+
*/
|
|
71
|
+
protected canDispatchQuery(hasNewSearchQuery: boolean): boolean;
|
|
72
|
+
search: (searchQuery?: string) => R | undefined;
|
|
43
73
|
get lastQueryError(): Error | undefined;
|
|
44
74
|
get hasNext(): boolean;
|
|
45
75
|
get hasResults(): boolean;
|
|
46
76
|
get isActive(): boolean;
|
|
47
77
|
get isLoading(): boolean;
|
|
48
|
-
get initialState():
|
|
49
|
-
hasNext: boolean;
|
|
50
|
-
isActive: boolean;
|
|
51
|
-
isLoading: boolean;
|
|
52
|
-
items: undefined;
|
|
53
|
-
lastQueryError: undefined;
|
|
54
|
-
next: undefined;
|
|
55
|
-
offset: number;
|
|
56
|
-
searchQuery: string;
|
|
57
|
-
};
|
|
78
|
+
get initialState(): SearchSourceState<T>;
|
|
58
79
|
get items(): T[] | undefined;
|
|
59
80
|
get next(): string | null | undefined;
|
|
60
81
|
get offset(): number | undefined;
|
|
@@ -72,24 +93,21 @@ declare abstract class BaseSearchSourceBase<T> implements ISearchSource<T> {
|
|
|
72
93
|
resetState(): void;
|
|
73
94
|
resetStateAndActivate(): void;
|
|
74
95
|
}
|
|
75
|
-
export declare abstract class BaseSearchSource<T> extends BaseSearchSourceBase<T
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
protected abstract query(searchQuery: string): Promise<QueryReturnValue<T>>;
|
|
96
|
+
export declare abstract class BaseSearchSource<T> extends BaseSearchSourceBase<T, Promise<void>> implements SearchSource<T> {
|
|
97
|
+
/** Aborts the in-flight request, if any, once a newer query is dispatched. */
|
|
98
|
+
protected queryAbortController: AbortController | null;
|
|
99
|
+
protected abstract query(searchQuery: string, options?: SearchQueryOptions): Promise<QueryReturnValue<T>>;
|
|
79
100
|
protected abstract filterQueryResults(items: T[]): T[] | Promise<T[]>;
|
|
80
|
-
|
|
101
|
+
/** Aborts the in-flight request, if any. Returns true when one was aborted. */
|
|
102
|
+
protected abortInFlightQuery(): boolean;
|
|
103
|
+
resetState(): void;
|
|
81
104
|
executeQuery(newSearchString?: string): Promise<void>;
|
|
82
|
-
search: (searchQuery?: string) => Promise<void> | undefined;
|
|
83
105
|
cancelScheduledQuery(): void;
|
|
84
106
|
}
|
|
85
|
-
export declare abstract class BaseSearchSourceSync<T> extends BaseSearchSourceBase<T> implements SearchSourceSync<T> {
|
|
86
|
-
protected searchDebounced: DebouncedExecQueryFunction;
|
|
87
|
-
constructor(options?: SearchSourceOptions);
|
|
107
|
+
export declare abstract class BaseSearchSourceSync<T> extends BaseSearchSourceBase<T, void> implements SearchSourceSync<T> {
|
|
88
108
|
protected abstract query(searchQuery: string): QueryReturnValue<T>;
|
|
89
109
|
protected abstract filterQueryResults(items: T[]): T[];
|
|
90
|
-
setDebounceOptions: ({ debounceMs }: DebounceOptions) => void;
|
|
91
110
|
executeQuery(newSearchString?: string): void;
|
|
92
|
-
search: (searchQuery?: string) => Promise<void> | undefined;
|
|
93
111
|
cancelScheduledQuery(): void;
|
|
94
112
|
}
|
|
95
113
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseSearchSource } from './BaseSearchSource';
|
|
1
|
+
import { BaseSearchSource, type SearchQueryOptions } from './BaseSearchSource';
|
|
2
2
|
import { FilterBuilder, type FilterBuilderOptions } from '../pagination';
|
|
3
3
|
import type { Channel } from '../channel';
|
|
4
4
|
import type { ChannelMemberResponse, MemberFilters, MemberSort, QueryMembersOptions } from '../types';
|
|
@@ -7,6 +7,12 @@ type CustomContext = Record<string, unknown>;
|
|
|
7
7
|
export type ChannelMemberSearchSourceFilterBuilderContext<C extends CustomContext = CustomContext> = {
|
|
8
8
|
searchQuery?: string;
|
|
9
9
|
} & C;
|
|
10
|
+
export type ChannelMemberSearchSourceOptions = SearchSourceOptions & {
|
|
11
|
+
/** Static base filters merged under the dynamically generated ones. */
|
|
12
|
+
filters?: MemberFilters;
|
|
13
|
+
sort?: MemberSort;
|
|
14
|
+
searchOptions?: Omit<QueryMembersOptions, 'limit' | 'offset'>;
|
|
15
|
+
};
|
|
10
16
|
export declare class ChannelMemberSearchSource<TFilterContext extends CustomContext = CustomContext> extends BaseSearchSource<ChannelMemberResponse> {
|
|
11
17
|
readonly type = "members";
|
|
12
18
|
channel: Channel;
|
|
@@ -14,9 +20,8 @@ export declare class ChannelMemberSearchSource<TFilterContext extends CustomCont
|
|
|
14
20
|
sort: MemberSort | undefined;
|
|
15
21
|
searchOptions: Omit<QueryMembersOptions, 'limit' | 'offset'> | undefined;
|
|
16
22
|
filterBuilder: FilterBuilder<MemberFilters, ChannelMemberSearchSourceFilterBuilderContext<TFilterContext>>;
|
|
17
|
-
constructor(channel: Channel, options?:
|
|
18
|
-
|
|
19
|
-
protected query(searchQuery: string): Promise<{
|
|
23
|
+
constructor(channel: Channel, options?: ChannelMemberSearchSourceOptions, filterBuilderOptions?: FilterBuilderOptions<MemberFilters, ChannelMemberSearchSourceFilterBuilderContext<TFilterContext>>);
|
|
24
|
+
protected query(searchQuery: string, queryOptions?: SearchQueryOptions): Promise<{
|
|
20
25
|
items: ChannelMemberResponse[];
|
|
21
26
|
}>;
|
|
22
27
|
protected filterQueryResults(items: ChannelMemberResponse[]): ChannelMemberResponse[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseSearchSource } from './BaseSearchSource';
|
|
1
|
+
import { BaseSearchSource, type SearchQueryOptions } from './BaseSearchSource';
|
|
2
2
|
import type { FilterBuilderOptions } from '../pagination';
|
|
3
3
|
import { FilterBuilder } from '../pagination';
|
|
4
4
|
import type { Channel } from '../channel';
|
|
@@ -9,6 +9,12 @@ type CustomContext = Record<string, unknown>;
|
|
|
9
9
|
export type ChannelSearchSourceFilterBuilderContext<C extends CustomContext = CustomContext> = {
|
|
10
10
|
searchQuery?: string;
|
|
11
11
|
} & C;
|
|
12
|
+
export type ChannelSearchSourceOptions = SearchSourceOptions & {
|
|
13
|
+
/** Static base filters merged under the dynamically generated ones. */
|
|
14
|
+
filters?: ChannelFilters;
|
|
15
|
+
sort?: ChannelSort;
|
|
16
|
+
searchOptions?: Omit<ChannelOptions, 'limit' | 'offset'>;
|
|
17
|
+
};
|
|
12
18
|
export declare class ChannelSearchSource<TFilterContext extends CustomContext = CustomContext> extends BaseSearchSource<Channel> {
|
|
13
19
|
readonly type = "channels";
|
|
14
20
|
client: StreamChat;
|
|
@@ -16,8 +22,8 @@ export declare class ChannelSearchSource<TFilterContext extends CustomContext =
|
|
|
16
22
|
sort: ChannelSort | undefined;
|
|
17
23
|
searchOptions: Omit<ChannelOptions, 'limit' | 'offset'> | undefined;
|
|
18
24
|
filterBuilder: FilterBuilder<ChannelFilters, ChannelSearchSourceFilterBuilderContext<TFilterContext>>;
|
|
19
|
-
constructor(client: StreamChat, options?:
|
|
20
|
-
protected query(searchQuery: string): Promise<{
|
|
25
|
+
constructor(client: StreamChat, options?: ChannelSearchSourceOptions, filterBuilderOptions?: FilterBuilderOptions<ChannelFilters, ChannelSearchSourceFilterBuilderContext<TFilterContext>>);
|
|
26
|
+
protected query(searchQuery: string, queryOptions?: SearchQueryOptions): Promise<{
|
|
21
27
|
items: Channel[];
|
|
22
28
|
}>;
|
|
23
29
|
protected filterQueryResults(items: Channel[]): Channel[];
|