diff --git a/examples/SampleApp/src/utils/DraftsManager.ts b/examples/SampleApp/src/utils/DraftsManager.ts index b82f2b8dfa..2ec9b68897 100644 --- a/examples/SampleApp/src/utils/DraftsManager.ts +++ b/examples/SampleApp/src/utils/DraftsManager.ts @@ -1,10 +1,13 @@ -import { DraftFilters, DraftResponse, DraftSort, Pager, StateStore, StreamChat } from 'stream-chat'; +import { DraftFilters, DraftResponse, SortParamRequest, StateStore, StreamChat } from 'stream-chat'; import { WithSubscriptions } from './WithSubscription'; -export type QueryDraftOptions = Pager & { +export type QueryDraftOptions = { + limit?: number; + next?: string; + prev?: string; filter?: DraftFilters; - sort?: DraftSort; + sort?: SortParamRequest[]; user_id?: string; }; diff --git a/package/src/__tests__/offline-support/offline-feature.tsx b/package/src/__tests__/offline-support/offline-feature.tsx index 49d657dac8..dbecb04045 100644 --- a/package/src/__tests__/offline-support/offline-feature.tsx +++ b/package/src/__tests__/offline-support/offline-feature.tsx @@ -9,7 +9,7 @@ import type { Channel as ChannelLLC, ChannelFilters, ChannelMemberResponse, - ChannelSort, + SortParamRequest, Event, LocalMessage, MessageResponse, @@ -255,7 +255,7 @@ export const Generic = () => { foo: 'bar', type: 'messaging', } as ChannelFilters; - const sort: ChannelSort = [{ direction: 1, field: 'last_updated' }]; + const sort: SortParamRequest[] = [{ direction: 1, field: 'last_updated' }]; const renderComponent = async () => { const result = render( diff --git a/package/src/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.tsx b/package/src/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.tsx index e457544782..ec31457963 100644 --- a/package/src/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.tsx +++ b/package/src/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.tsx @@ -1,12 +1,10 @@ import React from 'react'; import { StyleSheet, View } from 'react-native'; -import { CommandVariants } from 'stream-chat'; - import { useComponentsContext } from '../../contexts/componentsContext/ComponentsContext'; import { useTheme } from '../../contexts/themeContext/ThemeContext'; -export const SuggestionCommandIcon = ({ name }: { name: CommandVariants }) => { +export const SuggestionCommandIcon = ({ name }: { name: string }) => { const { theme: { semantics }, } = useTheme(); @@ -31,7 +29,7 @@ export const SuggestionCommandIcon = ({ name }: { name: CommandVariants }) => { } }; -export const AutoCompleteSuggestionCommandIcon = ({ name }: { name: CommandVariants }) => { +export const AutoCompleteSuggestionCommandIcon = ({ name }: { name: string }) => { const { theme: { messageComposer: { diff --git a/package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx b/package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx index 313d32b319..65d8ecdbcb 100644 --- a/package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx +++ b/package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx @@ -1,12 +1,7 @@ import React, { useCallback, useMemo } from 'react'; import { Pressable, StyleSheet, Text, View } from 'react-native'; -import type { - CommandSuggestion, - CommandVariants, - MentionSuggestion, - TextComposerSuggestion, -} from 'stream-chat'; +import type { CommandSuggestion, MentionSuggestion, TextComposerSuggestion } from 'stream-chat'; import { AutoCompleteSuggestionCommandIcon } from './AutoCompleteSuggestionCommandIcon'; import { @@ -93,7 +88,7 @@ export const CommandSuggestionItem = (item: CommandSuggestion) => { return ( - {name ? : null} + {name ? : null} & /** * Overrides the Stream default update message request (Advanced usage only) * @param channelId - * @param updatedMessage UpdatedMessage object + * @param updatedMessage The update-message request payload */ doUpdateMessageRequest?: ( channelId: string, diff --git a/package/src/components/ChannelList/ChannelList.tsx b/package/src/components/ChannelList/ChannelList.tsx index 4899e99be7..2e12c3ea04 100644 --- a/package/src/components/ChannelList/ChannelList.tsx +++ b/package/src/components/ChannelList/ChannelList.tsx @@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react'; import { StyleSheet, View } from 'react-native'; import type { FlatList } from 'react-native-gesture-handler'; -import { Channel, ChannelFilters, ChannelOptions, ChannelSort } from 'stream-chat'; +import { Channel, ChannelFilters, ChannelOptions, SortParamRequest } from 'stream-chat'; import { ChannelListView } from './ChannelListView'; import { useCreateChannelsContext } from './hooks/useCreateChannelsContext'; @@ -61,7 +61,7 @@ export type ChannelListProps = Partial< * Object containing channel sort parameters * @see See [Channel query documentation](https://getstream.io/chat/docs/query_channels) for a list of available sorting fields * */ - sort?: ChannelSort; + sort?: SortParamRequest[]; /** * A custom request implementation for this list's `ChannelPaginator` (its `doRequest`). Use it to @@ -77,7 +77,7 @@ export type ChannelListProps = Partial< const DEFAULT_FILTERS = {}; const DEFAULT_OPTIONS = {}; -const DEFAULT_SORT: ChannelSort = []; +const DEFAULT_SORT: SortParamRequest[] = []; /** * This component fetches a list of channels, allowing you to select the channel you want to open. diff --git a/package/src/components/ChannelList/hooks/usePaginatedChannels.ts b/package/src/components/ChannelList/hooks/usePaginatedChannels.ts index 9f9b470dcc..f87927ecf0 100644 --- a/package/src/components/ChannelList/hooks/usePaginatedChannels.ts +++ b/package/src/components/ChannelList/hooks/usePaginatedChannels.ts @@ -7,7 +7,7 @@ import { ChannelPaginator, ChannelPaginatorState, ChannelQueryShape, - ChannelSort, + SortParamRequest, PaginatorOptions, } from 'stream-chat'; @@ -31,7 +31,7 @@ export type ChannelListQueryChannelsOverride = PaginatorOptions< type Parameters = { filters: ChannelFilters; options: ChannelOptions; - sort: ChannelSort; + sort: SortParamRequest[]; lockChannelOrder?: boolean; queryChannelsOverride?: ChannelListQueryChannelsOverride; }; diff --git a/package/src/components/Message/hooks/useMessageActionHandlers.ts b/package/src/components/Message/hooks/useMessageActionHandlers.ts index a11fea726e..f58e56a2ec 100644 --- a/package/src/components/Message/hooks/useMessageActionHandlers.ts +++ b/package/src/components/Message/hooks/useMessageActionHandlers.ts @@ -170,7 +170,7 @@ export const useMessageActionHandlers = ({ try { if (isMuted) { - await client.unmuteUser(message.user.id); + await client.moderation.unmute({ target_ids: [message.user.id] }); addNotification({ message: t('message.userUnmuted.text', '{{ user }} has been unmuted', { user: message.user?.name || message.user?.id, @@ -179,7 +179,7 @@ export const useMessageActionHandlers = ({ origin: { context: { message }, emitter: 'MessageActions' }, }); } else { - await client.muteUser(message.user.id); + await client.moderation.mute({ target_ids: [message.user.id] }); addNotification({ message: t('message.userMuted.text', '{{ user }} has been muted', { user: message.user?.name || message.user?.id, @@ -215,7 +215,7 @@ export const useMessageActionHandlers = ({ if (messageUser.banned) { await client.unbanUser(messageUser.id); } else { - await client.banUser(messageUser.id); + await client.moderation.ban({ target_user_id: messageUser.id }); } }); @@ -274,7 +274,7 @@ export const useMessageActionHandlers = ({ { onPress: async () => { try { - await client.flagMessage(message.id); + await client.moderation.flagMessage(message.id); addNotification({ message: t('message.flagged.text', 'Message has been successfully flagged'), options: { severity: 'success', type: 'api:message:flag:success' }, diff --git a/package/src/components/MessageMenu/MessageUserReactions.tsx b/package/src/components/MessageMenu/MessageUserReactions.tsx index 56208fe82f..f522a58ed0 100644 --- a/package/src/components/MessageMenu/MessageUserReactions.tsx +++ b/package/src/components/MessageMenu/MessageUserReactions.tsx @@ -4,7 +4,7 @@ import { FlatList } from 'react-native-gesture-handler'; import Animated, { FadeIn, FadeOut } from 'react-native-reanimated'; -import { ReactionSort } from 'stream-chat'; +import { SortParamRequest } from 'stream-chat'; import { EmojiPickerList } from './EmojiPickerList'; import { useFetchReactions } from './hooks/useFetchReactions'; @@ -51,7 +51,7 @@ export type MessageUserReactionsProps = Partial void; diff --git a/package/src/components/MessageMenu/hooks/useFetchReactions.ts b/package/src/components/MessageMenu/hooks/useFetchReactions.ts index 34d23769b3..3af0d8c0b7 100644 --- a/package/src/components/MessageMenu/hooks/useFetchReactions.ts +++ b/package/src/components/MessageMenu/hooks/useFetchReactions.ts @@ -1,6 +1,6 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; -import { LocalMessage, ReactionResponse, ReactionSort } from 'stream-chat'; +import { LocalMessage, ReactionResponse, SortParamRequest } from 'stream-chat'; import { useChatContext } from '../../../contexts/chatContext/ChatContext'; import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext'; @@ -10,7 +10,7 @@ export type UseFetchReactionParams = { limit?: number; message?: LocalMessage; reactionType?: string; - sort?: ReactionSort; + sort?: SortParamRequest[]; }; const isSameReaction = (left: ReactionResponse, right: ReactionResponse) => diff --git a/package/src/components/Poll/CreatePollContent.tsx b/package/src/components/Poll/CreatePollContent.tsx index 754508ceeb..4d75268d8d 100644 --- a/package/src/components/Poll/CreatePollContent.tsx +++ b/package/src/components/Poll/CreatePollContent.tsx @@ -4,7 +4,7 @@ import { StyleSheet, Switch, Text, View } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; import Animated, { LinearTransition, useSharedValue } from 'react-native-reanimated'; -import { PollComposerState, StateStore, VotingVisibility } from 'stream-chat'; +import { PollComposerState, StateStore } from 'stream-chat'; import { CreatePollOptions, CurrentOptionPositionsCache } from './components'; @@ -120,7 +120,7 @@ export const CreatePollContent = () => { async (value: boolean) => { setIsAnonymousPoll(value); await pollComposer.updateFields({ - voting_visibility: value ? VotingVisibility.anonymous : VotingVisibility.public, + voting_visibility: value ? 'anonymous' : 'public', }); }, [pollComposer], diff --git a/package/src/components/Poll/components/PollAnswersList.tsx b/package/src/components/Poll/components/PollAnswersList.tsx index d107503143..61c7da878d 100644 --- a/package/src/components/Poll/components/PollAnswersList.tsx +++ b/package/src/components/Poll/components/PollAnswersList.tsx @@ -1,7 +1,7 @@ import React, { useCallback, useMemo, useState } from 'react'; import { FlatList, type FlatListProps, StyleSheet, Text, View } from 'react-native'; -import { PollVoteResponseData, VotingVisibility } from 'stream-chat'; +import { PollVoteResponseData } from 'stream-chat'; import { PollButtonProps } from './Button'; import { PollInputDialog } from './PollInputDialog'; @@ -99,7 +99,7 @@ export const PollAnswerListItem = ({ answer }: { answer: PollVoteResponseData }) const isMyAnswer = client.userID === answer.user?.id; const isAnonymous = useMemo( - () => votingVisibility === VotingVisibility.anonymous && !isMyAnswer, + () => votingVisibility === 'anonymous' && !isMyAnswer, [votingVisibility, isMyAnswer], ); diff --git a/package/src/components/Poll/components/PollResults/PollVote.tsx b/package/src/components/Poll/components/PollResults/PollVote.tsx index 96892dd22f..69263643b8 100644 --- a/package/src/components/Poll/components/PollResults/PollVote.tsx +++ b/package/src/components/Poll/components/PollResults/PollVote.tsx @@ -2,7 +2,7 @@ import React, { useMemo } from 'react'; import { StyleSheet, Text, View } from 'react-native'; -import { PollVoteResponseData as PollVoteClass, VotingVisibility } from 'stream-chat'; +import { PollVoteResponseData as PollVoteClass } from 'stream-chat'; import { useTheme, useTranslationContext } from '../../../../contexts'; import { primitives } from '../../../../theme'; @@ -36,10 +36,7 @@ export const PollVote = ({ vote }: { vote: PollVoteClass }) => { [vote.created_at, t, tDateTimeParser], ); - const isAnonymous = useMemo( - () => votingVisibility === VotingVisibility.anonymous, - [votingVisibility], - ); + const isAnonymous = useMemo(() => votingVisibility === 'anonymous', [votingVisibility]); return ( diff --git a/package/src/components/Poll/hooks/usePollState.ts b/package/src/components/Poll/hooks/usePollState.ts index 4ebf42b516..f6e9895c7f 100644 --- a/package/src/components/Poll/hooks/usePollState.ts +++ b/package/src/components/Poll/hooks/usePollState.ts @@ -1,8 +1,6 @@ import { useCallback } from 'react'; import { - APIResponse, - PollOptionData, PollOptionResponseData, PollResponse, PollState, @@ -37,9 +35,9 @@ export type UsePollStateSelectorReturnType = { }; export type UsePollStateReturnType = UsePollStateSelectorReturnType & { - addComment: (answerText: string) => Promise; + addComment: (answerText: string) => Promise; addOption: (optionText: string) => Promise; - endVote: () => Promise; + endVote: () => Promise; }; const selector = (nextValue: PollState): UsePollStateSelectorReturnType => ({ @@ -84,7 +82,7 @@ export const usePollState = (): UsePollStateReturnType => { const addOption = useCallback( async (optionText: string) => { - await poll.createOption({ text: optionText } as PollOptionData); + await poll.createOption({ text: optionText }); }, [poll], ); diff --git a/package/src/hooks/actions/__tests__/useUserActions.test.tsx b/package/src/hooks/actions/__tests__/useUserActions.test.tsx index 2888ccc147..65fc91450b 100644 --- a/package/src/hooks/actions/__tests__/useUserActions.test.tsx +++ b/package/src/hooks/actions/__tests__/useUserActions.test.tsx @@ -32,9 +32,8 @@ describe('useUserActions', () => { ({ client: { blockUser, - muteUser, + moderation: { mute: muteUser, unmute: unmuteUser }, unBlockUser, - unmuteUser, }, }) as unknown as ChatContext.ChatContextValue, ); @@ -75,7 +74,7 @@ describe('useUserActions', () => { await result.current.muteUser({ onSuccess }); - expect(muteUser).toHaveBeenCalledWith('target-user-id'); + expect(muteUser).toHaveBeenCalledWith({ target_ids: ['target-user-id'] }); expect(onSuccess).toHaveBeenCalledTimes(1); expect(addNotification).toHaveBeenCalledWith( expect.objectContaining({ @@ -119,7 +118,7 @@ describe('useUserActions', () => { await result.current.unmuteUser({ onSuccess }); - expect(unmuteUser).toHaveBeenCalledWith('target-user-id'); + expect(unmuteUser).toHaveBeenCalledWith({ target_ids: ['target-user-id'] }); expect(onSuccess).toHaveBeenCalledTimes(1); expect(addNotification).toHaveBeenCalledWith( expect.objectContaining({ diff --git a/package/src/hooks/actions/useChannelActions.ts b/package/src/hooks/actions/useChannelActions.ts index c3093a8c72..3cff198c76 100644 --- a/package/src/hooks/actions/useChannelActions.ts +++ b/package/src/hooks/actions/useChannelActions.ts @@ -296,7 +296,7 @@ export const useChannelActions = (channel: Channel) => { try { if (otherUser?.user?.id) { - await client.muteUser(otherUser.user.id); + await client.moderation.mute({ target_ids: [otherUser.user.id] }); addNotification({ message: t('message.userMuted.text', '{{ user }} has been muted', { user: otherUser.user.name || otherUser.user.id, @@ -329,7 +329,7 @@ export const useChannelActions = (channel: Channel) => { try { if (otherUser?.user?.id) { - await client.unmuteUser(otherUser.user.id); + await client.moderation.unmute({ target_ids: [otherUser.user.id] }); addNotification({ message: t('message.userUnmuted.text', '{{ user }} has been unmuted', { user: otherUser.user.name || otherUser.user.id, diff --git a/package/src/hooks/actions/useUserActions.ts b/package/src/hooks/actions/useUserActions.ts index ee4926e2ef..2aaa8f7ef2 100644 --- a/package/src/hooks/actions/useUserActions.ts +++ b/package/src/hooks/actions/useUserActions.ts @@ -31,7 +31,7 @@ export const useUserActions = (user: UserResponse | undefined): UserActions => { } try { - await client.muteUser(user.id); + await client.moderation.mute({ target_ids: [user.id] }); addNotification({ message: t('message.userMuted.text', '{{ user }} has been muted', { user: user.name || user.id, @@ -59,7 +59,7 @@ export const useUserActions = (user: UserResponse | undefined): UserActions => { } try { - await client.unmuteUser(user.id); + await client.moderation.unmute({ target_ids: [user.id] }); addNotification({ message: t('message.userUnmuted.text', '{{ user }} has been unmuted', { user: user.name || user.id, diff --git a/package/src/hooks/messagePreview/useMessagePreviewText.tsx b/package/src/hooks/messagePreview/useMessagePreviewText.tsx index 9eef9486d4..f2ea5b0ca6 100644 --- a/package/src/hooks/messagePreview/useMessagePreviewText.tsx +++ b/package/src/hooks/messagePreview/useMessagePreviewText.tsx @@ -1,7 +1,7 @@ import dayjs from 'dayjs'; import { DraftMessage, - LiveLocationPayload, + SharedLocation, LocalMessage, MessageResponse, PollState, @@ -46,11 +46,10 @@ export const useMessagePreviewText = ({ } if (message?.shared_location) { - if ( - // There is a problem with types in Draft Message, and its not able to infer the type of `end_at` correctly, so the `as` is used. - (message?.shared_location as LiveLocationPayload)?.end_at && - new Date((message?.shared_location as LiveLocationPayload)?.end_at) > new Date() - ) { + // Draft messages type `shared_location` loosely, hence the cast. `end_at` is optional + // because a static location has no expiry — only a live one does. + const { end_at: endAt } = message.shared_location as SharedLocation; + if (endAt && new Date(endAt) > new Date()) { return t('messagePreview.liveLocation.label', 'Live Location'); } return t('messagePreview.location.label', 'Location'); diff --git a/package/src/mock-builders/api/channelMocks.tsx b/package/src/mock-builders/api/channelMocks.tsx index 46d16ca26b..611da7ae64 100644 --- a/package/src/mock-builders/api/channelMocks.tsx +++ b/package/src/mock-builders/api/channelMocks.tsx @@ -36,7 +36,7 @@ const CHANNEL_WITH_MESSAGES_TEXT = { deleted_at: new Date('2021-02-12T12:12:35.862Z'), id: 'ljkblk', text: 'jkbkbiubicbi', - type: 'MessageLabel', + type: 'regular', user: mockUser({ id: 'okechukwu' }), }), mockMessage({ @@ -50,7 +50,7 @@ const CHANNEL_WITH_MESSAGES_TEXT = { deleted_at: new Date('2021-02-12T12:12:35.862Z'), id: 'jbkjb', text: 'jkbkbiubicbi', - type: 'MessageLabel', + type: 'regular', user: mockUser({ id: 'okechukwu' }), }), ], @@ -149,7 +149,7 @@ const LATEST_MESSAGE = mockMessage({ deleted_at: new Date('2021-02-12T12:12:35.862Z'), id: 'string', text: 'jkbkbiubicbi', - type: 'MessageLabel', + type: 'regular', user: mockUser({ id: 'okechukwu' }), }); diff --git a/package/src/mock-builders/generator/channel.ts b/package/src/mock-builders/generator/channel.ts index 551e16a89c..c0605e1747 100644 --- a/package/src/mock-builders/generator/channel.ts +++ b/package/src/mock-builders/generator/channel.ts @@ -30,8 +30,8 @@ const defaultCapabilities: ChannelOwnCapability[] = [ ]; const defaultConfig = { - automod: 'disabled', - automod_behavior: 'flag', + automod: 'disabled' as const, + automod_behavior: 'flag' as const, commands: [ { args: '[text]', diff --git a/package/src/state-store/__tests__/edit-channel-details-store.test.ts b/package/src/state-store/__tests__/edit-channel-details-store.test.ts index 930c0f4f10..6d1982eb02 100644 --- a/package/src/state-store/__tests__/edit-channel-details-store.test.ts +++ b/package/src/state-store/__tests__/edit-channel-details-store.test.ts @@ -1,6 +1,6 @@ import { act, renderHook } from '@testing-library/react-native'; -import type { Channel, ChannelData } from 'stream-chat'; +import type { Channel, ChannelInput } from 'stream-chat'; import { generateChannelResponse } from '../../mock-builders/generator/channel'; import { getTestClientWithUser } from '../../mock-builders/mock'; @@ -26,7 +26,7 @@ const createChannel = async (data: { image?: string; name?: string } = {}) => { return client.channel( 'messaging', response.channel.id, - response.channel as unknown as ChannelData, + response.channel as unknown as ChannelInput, ) as Channel; }; diff --git a/package/src/store/apis/getChannelsForFilterSort.ts b/package/src/store/apis/getChannelsForFilterSort.ts index c23c2eb8d7..5d4b37b2f2 100644 --- a/package/src/store/apis/getChannelsForFilterSort.ts +++ b/package/src/store/apis/getChannelsForFilterSort.ts @@ -1,7 +1,7 @@ import type { ChannelFilters, ChannelOptions, - ChannelSort, + SortParamRequest, ChannelStateResponseFields, } from 'stream-chat'; @@ -29,7 +29,7 @@ export const getChannelsForFilterSort = async ({ currentUserId: string; filters?: ChannelFilters; options?: ChannelOptions; - sort?: ChannelSort; + sort?: SortParamRequest[]; }): Promise[] | null> => { if (!filters && !sort && !options?.predefined_filter) { console.warn( diff --git a/package/src/store/apis/getReactionsforFilterSort.ts b/package/src/store/apis/getReactionsforFilterSort.ts index 629ec450a5..51e50a2436 100644 --- a/package/src/store/apis/getReactionsforFilterSort.ts +++ b/package/src/store/apis/getReactionsforFilterSort.ts @@ -1,4 +1,4 @@ -import type { ReactionFilters, ReactionResponse, ReactionSort } from 'stream-chat'; +import type { ReactionFilters, ReactionResponse, SortParamRequest } from 'stream-chat'; import { getReactions } from './getReactions'; import { selectReactionsForMessages } from './queries/selectReactionsForMessages'; @@ -20,7 +20,7 @@ export const getReactionsForFilterSort = async ({ }: { messageId: string; filters?: Pick; - sort?: ReactionSort; + sort?: SortParamRequest[]; limit?: number; }): Promise => { if (!filters && !sort) { diff --git a/package/src/store/apis/queries/selectChannelIdsForFilterSort.ts b/package/src/store/apis/queries/selectChannelIdsForFilterSort.ts index cf62bbe0c0..38eefe9093 100644 --- a/package/src/store/apis/queries/selectChannelIdsForFilterSort.ts +++ b/package/src/store/apis/queries/selectChannelIdsForFilterSort.ts @@ -1,4 +1,4 @@ -import type { ChannelFilters, ChannelOptions, ChannelSort } from 'stream-chat'; +import type { ChannelFilters, ChannelOptions, SortParamRequest } from 'stream-chat'; import { createSelectQuery } from '../../sqlite-utils/createSelectQuery'; import { SqliteClient } from '../../SqliteClient'; @@ -22,7 +22,7 @@ export const selectChannelIdsForFilterSort = async ({ }: { filters?: ChannelFilters; options?: ChannelOptions; - sort?: ChannelSort; + sort?: SortParamRequest[]; }): Promise => { const query = convertFilterSortToQuery({ filters, options, sort }); diff --git a/package/src/store/apis/queries/selectReactionsForMessages.ts b/package/src/store/apis/queries/selectReactionsForMessages.ts index 3239dd1d89..aae60585f2 100644 --- a/package/src/store/apis/queries/selectReactionsForMessages.ts +++ b/package/src/store/apis/queries/selectReactionsForMessages.ts @@ -1,4 +1,4 @@ -import type { ReactionFilters, ReactionSort } from 'stream-chat'; +import type { ReactionFilters, SortParamRequest } from 'stream-chat'; import { tables } from '../../schema'; import { SqliteClient } from '../../SqliteClient'; @@ -15,7 +15,7 @@ export const selectReactionsForMessages = async ( messageIds: string[], limit: number | null = 25, filters?: Pick, - sort?: ReactionSort, + sort?: SortParamRequest[], ): Promise[]> => { const questionMarks = Array(messageIds.length).fill('?').join(','); const reactionsColumnNames = Object.keys(tables.reactions.columns) diff --git a/package/src/store/apis/upsertCidsForQuery.ts b/package/src/store/apis/upsertCidsForQuery.ts index 3076d60d47..4a2695379a 100644 --- a/package/src/store/apis/upsertCidsForQuery.ts +++ b/package/src/store/apis/upsertCidsForQuery.ts @@ -1,4 +1,4 @@ -import type { ChannelFilters, ChannelOptions, ChannelSort } from 'stream-chat'; +import type { ChannelFilters, ChannelOptions, SortParamRequest } from 'stream-chat'; import { convertFilterSortToQuery } from './utils/convertFilterSortToQuery'; @@ -16,7 +16,7 @@ export const upsertCidsForQuery = async ({ filters?: ChannelFilters; execute?: boolean; options?: ChannelOptions; - sort?: ChannelSort; + sort?: SortParamRequest[]; }) => { // Update the database only if the query is provided. const cidsString = JSON.stringify(cids); diff --git a/package/src/store/apis/upsertPoll.ts b/package/src/store/apis/upsertPoll.ts index 84f9fba657..6d65861d0c 100644 --- a/package/src/store/apis/upsertPoll.ts +++ b/package/src/store/apis/upsertPoll.ts @@ -1,4 +1,4 @@ -import type { PollResponse_old } from 'stream-chat'; +import type { PollResponseData } from 'stream-chat'; import { mapPollToStorable } from '../mappers/mapPollToStorable'; import { createUpsertQuery } from '../sqlite-utils/createUpsertQuery'; @@ -9,7 +9,7 @@ export const upsertPoll = async ({ execute = true, poll, }: { - poll: PollResponse_old; + poll: PollResponseData; execute?: boolean; }) => { const queries: PreparedQueries[] = []; diff --git a/package/src/store/apis/utils/convertFilterSortToQuery.ts b/package/src/store/apis/utils/convertFilterSortToQuery.ts index 3dc11eabfc..09c6b41d76 100644 --- a/package/src/store/apis/utils/convertFilterSortToQuery.ts +++ b/package/src/store/apis/utils/convertFilterSortToQuery.ts @@ -1,4 +1,4 @@ -import type { ChannelFilters, ChannelOptions, ChannelSort } from 'stream-chat'; +import type { ChannelFilters, ChannelOptions, SortParamRequest } from 'stream-chat'; type PredefinedFilterCacheKeyOptions = Pick< ChannelOptions, @@ -26,7 +26,7 @@ export const convertFilterSortToQuery = ({ }: { filters?: ChannelFilters; options?: ChannelOptions; - sort?: ChannelSort; + sort?: SortParamRequest[]; }) => { const predefinedFilterOptions = getPredefinedFilterOptions(options); diff --git a/package/src/store/mappers/mapPollToStorable.ts b/package/src/store/mappers/mapPollToStorable.ts index 848c3ddd35..f822fff0c9 100644 --- a/package/src/store/mappers/mapPollToStorable.ts +++ b/package/src/store/mappers/mapPollToStorable.ts @@ -1,10 +1,10 @@ -import type { PollResponse_old } from 'stream-chat'; +import type { PollResponseData } from 'stream-chat'; import { mapDateTimeToStorable } from './mapDateTimeToStorable'; import type { TableRow } from '../types'; -export const mapPollToStorable = (poll: PollResponse_old): TableRow<'poll'> => { +export const mapPollToStorable = (poll: PollResponseData): TableRow<'poll'> => { const { allow_answers, allow_user_suggested_options, diff --git a/package/src/store/mappers/mapStorableToPoll.ts b/package/src/store/mappers/mapStorableToPoll.ts index 4f9bab5768..a6e90b0108 100644 --- a/package/src/store/mappers/mapStorableToPoll.ts +++ b/package/src/store/mappers/mapStorableToPoll.ts @@ -1,8 +1,8 @@ -import type { PollResponse_old } from 'stream-chat'; +import type { PollResponseData } from 'stream-chat'; import type { TableRow } from '../types'; -export const mapStorableToPoll = (pollRow: TableRow<'poll'>): PollResponse_old => { +export const mapStorableToPoll = (pollRow: TableRow<'poll'>): PollResponseData => { const { allow_answers, allow_user_suggested_options, diff --git a/package/src/types/types.ts b/package/src/types/types.ts index 27a4ef5e50..eadacca8c5 100644 --- a/package/src/types/types.ts +++ b/package/src/types/types.ts @@ -1,6 +1,6 @@ import type { ChannelFilters, - ChannelSort, + SortParamRequest, ChannelState, FileReference, LocalAudioAttachment, @@ -87,7 +87,7 @@ export type Reaction = { export type ChannelListEventListenerOptions = { filters?: ChannelFilters; - sort?: ChannelSort; + sort?: SortParamRequest[]; }; export type UnknownType = Record;