stream-chat 9.50.2 → 9.51.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 +252 -94
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +252 -94
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +252 -94
- package/dist/esm/index.mjs.map +3 -3
- package/dist/types/channel.d.ts +3 -2
- package/dist/types/client.d.ts +13 -9
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +15 -9
- package/dist/types/offline-support/offline_support_api.d.ts +7 -1
- package/dist/types/offline-support/offline_sync_manager.d.ts +19 -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 +20 -1
- package/dist/types/utils.d.ts +1 -1
- package/package.json +7 -7
- package/src/channel.ts +4 -0
- package/src/client.ts +54 -12
- package/src/messageComposer/middleware/textComposer/mentions.ts +75 -23
- package/src/offline-support/offline_support_api.ts +17 -2
- package/src/offline-support/offline_sync_manager.ts +73 -14
- 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 +21 -1
- package/src/utils.ts +6 -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.
|
|
@@ -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
|
*
|
|
@@ -1427,7 +1431,7 @@ export declare class StreamChat {
|
|
|
1427
1431
|
*
|
|
1428
1432
|
* @returns {Promise<APIResponse>}
|
|
1429
1433
|
*/
|
|
1430
|
-
searchRoles(options: SearchRolesOptions): Promise<SearchRolesAPIResponse>;
|
|
1434
|
+
searchRoles(options: SearchRolesOptions, requestOptions?: RequestOptions): Promise<SearchRolesAPIResponse>;
|
|
1431
1435
|
/** deleteRole - deletes a custom role
|
|
1432
1436
|
*
|
|
1433
1437
|
* @param {string} name the role name
|
|
@@ -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[];
|
|
@@ -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.
|
|
@@ -58,6 +69,13 @@ export declare class OfflineDBSyncManager {
|
|
|
58
69
|
private sync;
|
|
59
70
|
/**
|
|
60
71
|
* Executes any tasks that were queued while offline and then performs a sync.
|
|
72
|
+
*
|
|
73
|
+
* Each step is isolated so a failure in one does not prevent the other, and
|
|
74
|
+
* neither can escape to the callers (init + the connection.changed handler).
|
|
75
|
+
* This guarantees the subsequent invokeSyncStatusListeners(true) always runs,
|
|
76
|
+
* so syncStatus recovers to true and gated channel queries are unblocked.
|
|
77
|
+
* Failed syncs degrade to "possibly stale data until the next query" rather
|
|
78
|
+
* than freezing all future queries. See issue #1816.
|
|
61
79
|
*/
|
|
62
80
|
private syncAndExecutePendingTasks;
|
|
63
81
|
}
|
|
@@ -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[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseSearchSource } from './BaseSearchSource';
|
|
1
|
+
import { BaseSearchSource, type SearchQueryOptions } from './BaseSearchSource';
|
|
2
2
|
import type { ChannelFilters, ChannelOptions, ChannelSort, MessageFilters, MessageResponse, SearchMessageSort } from '../types';
|
|
3
3
|
import type { StreamChat } from '../client';
|
|
4
4
|
import type { SearchSourceOptions } from './types';
|
|
@@ -26,6 +26,17 @@ export type MessageSearchSourceFilterBuilderOptions<TContexts extends MessageSea
|
|
|
26
26
|
messageSearch: FilterBuilderOptions<MessageFilters, MergeContext<BuiltInContexts['messageSearch'], TContexts['messageSearchContext']>>;
|
|
27
27
|
channelQuery: FilterBuilderOptions<ChannelFilters, MergeContext<BuiltInContexts['channelQuery'], TContexts['channelQueryContext']>>;
|
|
28
28
|
}>;
|
|
29
|
+
export type MessageSearchSourceOptions = SearchSourceOptions & {
|
|
30
|
+
/** Static base filters for the channel scope of the message search. */
|
|
31
|
+
messageSearchChannelFilters?: ChannelFilters;
|
|
32
|
+
/** Static base filters for the message search itself. */
|
|
33
|
+
messageSearchFilters?: MessageFilters;
|
|
34
|
+
messageSearchSort?: SearchMessageSort;
|
|
35
|
+
/** Static base filters for the follow-up query that hydrates unknown channels. */
|
|
36
|
+
channelQueryFilters?: ChannelFilters;
|
|
37
|
+
channelQuerySort?: ChannelSort;
|
|
38
|
+
channelQueryOptions?: Omit<ChannelOptions, 'limit' | 'offset'>;
|
|
39
|
+
};
|
|
29
40
|
export declare class MessageSearchSource<TContexts extends MessageSearchSourceContexts = {}> extends BaseSearchSource<MessageResponse> {
|
|
30
41
|
readonly type = "messages";
|
|
31
42
|
private client;
|
|
@@ -38,8 +49,8 @@ export declare class MessageSearchSource<TContexts extends MessageSearchSourceCo
|
|
|
38
49
|
messageSearchChannelFilterBuilder: FilterBuilder<ChannelFilters, MergeContext<BuiltInContexts['messageSearchChannel'], TContexts['messageSearchChannelContext']>>;
|
|
39
50
|
messageSearchFilterBuilder: FilterBuilder<MessageFilters, MergeContext<BuiltInContexts['messageSearch'], TContexts['messageSearchContext']>>;
|
|
40
51
|
channelQueryFilterBuilder: FilterBuilder<ChannelFilters, MergeContext<BuiltInContexts['channelQuery'], TContexts['channelQueryContext']>>;
|
|
41
|
-
constructor(client: StreamChat, options?:
|
|
42
|
-
protected query(searchQuery: string): Promise<{
|
|
52
|
+
constructor(client: StreamChat, options?: MessageSearchSourceOptions, filterBuilderOptions?: MessageSearchSourceFilterBuilderOptions<TContexts>);
|
|
53
|
+
protected query(searchQuery: string, queryOptions?: SearchQueryOptions): Promise<{
|
|
43
54
|
items: never[];
|
|
44
55
|
next?: undefined;
|
|
45
56
|
} | {
|
|
@@ -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 { StreamChat } from '../client';
|
|
4
4
|
import type { UserFilters, UserOptions, UserResponse, UserSort } from '../types';
|
|
@@ -7,6 +7,12 @@ type CustomContext = Record<string, unknown>;
|
|
|
7
7
|
export type UserSearchSourceFilterBuilderContext<C extends CustomContext = CustomContext> = {
|
|
8
8
|
searchQuery?: string;
|
|
9
9
|
} & C;
|
|
10
|
+
export type UserSearchSourceOptions = SearchSourceOptions & {
|
|
11
|
+
/** Static base filters merged under the dynamically generated ones. */
|
|
12
|
+
filters?: UserFilters;
|
|
13
|
+
sort?: UserSort;
|
|
14
|
+
searchOptions?: Omit<UserOptions, 'limit' | 'offset'>;
|
|
15
|
+
};
|
|
10
16
|
export declare class UserSearchSource<TFilterContext extends CustomContext = CustomContext> extends BaseSearchSource<UserResponse> {
|
|
11
17
|
readonly type = "users";
|
|
12
18
|
client: StreamChat;
|
|
@@ -14,8 +20,8 @@ export declare class UserSearchSource<TFilterContext extends CustomContext = Cus
|
|
|
14
20
|
sort: UserSort | undefined;
|
|
15
21
|
searchOptions: Omit<UserOptions, 'limit' | 'offset'> | undefined;
|
|
16
22
|
filterBuilder: FilterBuilder<UserFilters, UserSearchSourceFilterBuilderContext<TFilterContext>>;
|
|
17
|
-
constructor(client: StreamChat, options?:
|
|
18
|
-
protected query(searchQuery: string): Promise<{
|
|
23
|
+
constructor(client: StreamChat, options?: UserSearchSourceOptions, filterBuilderOptions?: FilterBuilderOptions<UserFilters, UserSearchSourceFilterBuilderContext<TFilterContext>>);
|
|
24
|
+
protected query(searchQuery: string, queryOptions?: SearchQueryOptions): Promise<{
|
|
19
25
|
items: UserResponse[];
|
|
20
26
|
}>;
|
|
21
27
|
protected filterQueryResults(items: UserResponse[]): UserResponse[];
|
|
@@ -9,8 +9,21 @@ export type SearchSourceState<T = any> = {
|
|
|
9
9
|
offset?: number;
|
|
10
10
|
};
|
|
11
11
|
export type SearchSourceOptions = {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Legacy single debounce interval. When set, it applies to both short and long queries,
|
|
14
|
+
* unless overridden by `shortQueryDebounceMs` / `longQueryDebounceMs`.
|
|
15
|
+
*/
|
|
13
16
|
debounceMs?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Debounce interval for queries no longer than `shortQueryMaxLength`. Such queries have
|
|
19
|
+
* low selectivity and are expensive server-side, so they are debounced harder.
|
|
20
|
+
* Defaults to 500ms.
|
|
21
|
+
*/
|
|
22
|
+
shortQueryDebounceMs?: number;
|
|
23
|
+
/** Debounce interval for queries longer than `shortQueryMaxLength`. Defaults to 300ms. */
|
|
24
|
+
longQueryDebounceMs?: number;
|
|
25
|
+
/** Query length (inclusive) that still counts as short. Defaults to 2. */
|
|
26
|
+
shortQueryMaxLength?: number;
|
|
14
27
|
pageSize?: number;
|
|
15
28
|
/** When true, the source can execute queries with an empty search string. Defaults to false. */
|
|
16
29
|
allowEmptySearchString?: boolean;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -121,6 +121,7 @@ export type AppSettingsAPIResponse = APIResponse & {
|
|
|
121
121
|
moderation_dashboard_preferences?: Record<string, unknown> | null;
|
|
122
122
|
moderation_audio_call_moderation_enabled?: boolean;
|
|
123
123
|
moderation_enabled?: boolean;
|
|
124
|
+
moderation_flood_rules_enabled?: boolean;
|
|
124
125
|
moderation_llm_configurability_enabled?: boolean;
|
|
125
126
|
moderation_multitenant_blocklist_enabled?: boolean;
|
|
126
127
|
moderation_video_call_moderation_enabled?: boolean;
|
|
@@ -259,6 +260,8 @@ export type QueryFutureChannelBansOptions = {
|
|
|
259
260
|
};
|
|
260
261
|
export type BlockListResponse = BlockList & {
|
|
261
262
|
created_at?: string;
|
|
263
|
+
id?: string;
|
|
264
|
+
owner_user_id?: string;
|
|
262
265
|
type?: string;
|
|
263
266
|
updated_at?: string;
|
|
264
267
|
};
|
|
@@ -878,6 +881,8 @@ export type UserResponse = CustomUserData & {
|
|
|
878
881
|
anon?: boolean;
|
|
879
882
|
banned?: boolean;
|
|
880
883
|
blocked_user_ids?: string[];
|
|
884
|
+
/** Set on the user of a read event, marking when they last read the event's channel. */
|
|
885
|
+
channel_last_read_at?: string;
|
|
881
886
|
created_at?: string;
|
|
882
887
|
deactivated_at?: string;
|
|
883
888
|
deleted_at?: string;
|
|
@@ -1003,7 +1008,13 @@ export type ChannelQueryOptions = {
|
|
|
1003
1008
|
watch?: boolean;
|
|
1004
1009
|
watchers?: PaginationOptions;
|
|
1005
1010
|
};
|
|
1006
|
-
|
|
1011
|
+
/**
|
|
1012
|
+
* Composed with RequestOptions because `queryChannels` carries the abort signal in this
|
|
1013
|
+
* bag; neither the state flags nor the signal are serialized into the request. Declaring
|
|
1014
|
+
* the composition keeps passing a RequestOptions here intentional rather than incidental
|
|
1015
|
+
* structural compatibility.
|
|
1016
|
+
*/
|
|
1017
|
+
export type ChannelStateOptions = RequestOptions & {
|
|
1007
1018
|
offlineMode?: boolean;
|
|
1008
1019
|
skipInitialization?: string[];
|
|
1009
1020
|
skipHydration?: boolean;
|
|
@@ -1348,6 +1359,11 @@ export type SearchOptions = {
|
|
|
1348
1359
|
offset?: number;
|
|
1349
1360
|
sort?: SearchMessageSort;
|
|
1350
1361
|
};
|
|
1362
|
+
/** Per-request options that are never part of the serialized request payload. */
|
|
1363
|
+
export type RequestOptions = {
|
|
1364
|
+
/** Aborts the request. See AbortController. */
|
|
1365
|
+
signal?: AbortSignal;
|
|
1366
|
+
};
|
|
1351
1367
|
export type StreamChatOptions = AxiosRequestConfig & {
|
|
1352
1368
|
/**
|
|
1353
1369
|
* Used to disable warnings that are triggered by using connectUser or connectAnonymousUser server-side.
|
|
@@ -2032,6 +2048,7 @@ export type BlockList = {
|
|
|
2032
2048
|
is_confusable_folding_enabled?: boolean;
|
|
2033
2049
|
is_leet_check_enabled?: boolean;
|
|
2034
2050
|
is_plural_check_enabled?: boolean;
|
|
2051
|
+
is_substring_matching_enabled?: boolean;
|
|
2035
2052
|
};
|
|
2036
2053
|
export type ChannelConfig = ChannelConfigFields & CreatedAtUpdatedAt & {
|
|
2037
2054
|
commands?: CommandVariants[];
|
|
@@ -2326,6 +2343,8 @@ export type PermissionAPIObject = {
|
|
|
2326
2343
|
level?: string;
|
|
2327
2344
|
name?: string;
|
|
2328
2345
|
owner?: boolean;
|
|
2346
|
+
/** Resource type that defines ownership for this permission's action, e.g. 'Channel' for CreateMessage. */
|
|
2347
|
+
owner_resource?: string;
|
|
2329
2348
|
same_team?: boolean;
|
|
2330
2349
|
tags?: string[];
|
|
2331
2350
|
};
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -227,7 +227,7 @@ export interface DebouncedFunc<T extends (...args: any[]) => any> {
|
|
|
227
227
|
*/
|
|
228
228
|
flush(): ReturnType<T> | undefined;
|
|
229
229
|
}
|
|
230
|
-
export declare const debounce: <T extends (...args: any[]) => any>(fn: T, timeout?: number, { leading, trailing }?: {
|
|
230
|
+
export declare const debounce: <T extends (...args: any[]) => any>(fn: T, timeout?: number | ((...args: Parameters<T>) => number), { leading, trailing }?: {
|
|
231
231
|
leading?: boolean;
|
|
232
232
|
trailing?: boolean;
|
|
233
233
|
}) => DebouncedFunc<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.51.0",
|
|
4
4
|
"description": "JS SDK for the Stream Chat API",
|
|
5
5
|
"homepage": "https://getstream.io/chat/",
|
|
6
6
|
"author": {
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@types/jsonwebtoken": "^9.0.8",
|
|
54
54
|
"@types/ws": "^8.18.1",
|
|
55
|
-
"axios": "^1.
|
|
55
|
+
"axios": "^1.19.0",
|
|
56
56
|
"base64-js": "^1.5.1",
|
|
57
|
-
"form-data": "^4.0.
|
|
57
|
+
"form-data": "^4.0.6",
|
|
58
58
|
"isomorphic-ws": "^5.0.0",
|
|
59
59
|
"jsonwebtoken": "^9.0.3",
|
|
60
60
|
"linkifyjs": "^4.3.3",
|
|
@@ -68,22 +68,22 @@
|
|
|
68
68
|
"@semantic-release/git": "^10.0.1",
|
|
69
69
|
"@types/node": "^22.19.19",
|
|
70
70
|
"@types/sinon": "^10.0.6",
|
|
71
|
-
"@vitest/coverage-v8": "^4.1.
|
|
71
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
72
72
|
"concurrently": "^9.2.1",
|
|
73
73
|
"conventional-changelog-conventionalcommits": "^9.3.1",
|
|
74
74
|
"dotenv": "^17.4.2",
|
|
75
|
-
"esbuild": "^0.28.
|
|
75
|
+
"esbuild": "^0.28.2",
|
|
76
76
|
"eslint": "^9.39.4",
|
|
77
77
|
"eslint-plugin-import": "^2.32.0",
|
|
78
78
|
"globals": "^17.6.0",
|
|
79
79
|
"husky": "^9.1.7",
|
|
80
80
|
"lint-staged": "^17.0.5",
|
|
81
81
|
"prettier": "^3.8.3",
|
|
82
|
-
"semantic-release": "^25.0.
|
|
82
|
+
"semantic-release": "^25.0.9",
|
|
83
83
|
"sinon": "^12.0.1",
|
|
84
84
|
"typescript": "^6.0.3",
|
|
85
85
|
"typescript-eslint": "^8.59.4",
|
|
86
|
-
"vitest": "^4.1.
|
|
86
|
+
"vitest": "^4.1.10"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|
|
89
89
|
"build": "rm -rf dist && concurrently 'tsc' './scripts/bundle.mjs'",
|