stream-chat
Advanced tools
Comparing version 8.38.0 to 8.39.0
import { Channel } from './channel'; | ||
import { ChannelMemberResponse, DefaultGenerics, Event, ExtendableGenerics, FormatMessageResponse, MessageResponse, MessageSetType, PendingMessageResponse, PollResponse, PollVote, ReactionResponse, UserResponse } from './types'; | ||
import { ChannelMemberResponse, DefaultGenerics, Event, ExtendableGenerics, FormatMessageResponse, MessageResponse, MessageSet, MessageSetType, PendingMessageResponse, PollResponse, PollVote, ReactionResponse, UserResponse } from './types'; | ||
declare type ChannelReadStatus<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = Record<string, { | ||
@@ -40,7 +40,3 @@ last_read: Date; | ||
*/ | ||
messageSets: { | ||
isCurrent: boolean; | ||
isLatest: boolean; | ||
messages: Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>; | ||
}[]; | ||
messageSets: MessageSet[]; | ||
constructor(channel: Channel<StreamChatGenerics>); | ||
@@ -55,2 +51,6 @@ get messages(): Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>; | ||
set latestMessages(messages: Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>); | ||
get messagePagination(): { | ||
hasNext: boolean; | ||
hasPrev: boolean; | ||
}; | ||
/** | ||
@@ -65,7 +65,3 @@ * addMessageSorted - Add a message to the state | ||
addMessageSorted(newMessage: MessageResponse<StreamChatGenerics>, timestampChanged?: boolean, addIfDoesNotExist?: boolean, messageSetToAddToIfDoesNotExist?: MessageSetType): { | ||
messageSet: { | ||
isCurrent: boolean; | ||
isLatest: boolean; | ||
messages: FormatMessageResponse<StreamChatGenerics>[]; | ||
}; | ||
messageSet: MessageSet<DefaultGenerics>; | ||
}; | ||
@@ -91,7 +87,3 @@ /** | ||
addMessagesSorted(newMessages: MessageResponse<StreamChatGenerics>[], timestampChanged?: boolean, initializing?: boolean, addIfDoesNotExist?: boolean, messageSetToAddToIfDoesNotExist?: MessageSetType): { | ||
messageSet: { | ||
isCurrent: boolean; | ||
isLatest: boolean; | ||
messages: FormatMessageResponse<StreamChatGenerics>[]; | ||
}; | ||
messageSet: MessageSet<DefaultGenerics>; | ||
}; | ||
@@ -210,2 +202,3 @@ /** | ||
* @param {string} parentMessageId The id of the parent message, if we want load a thread reply | ||
* @param {number} limit The page size if the message has to be queried from the server | ||
*/ | ||
@@ -221,3 +214,3 @@ loadMessageIntoState(messageId: string | 'latest', parentMessageId?: string, limit?: number): Promise<void>; | ||
*/ | ||
findMessage(messageId: string, parentMessageId?: string): FormatMessageResponse<StreamChatGenerics> | undefined; | ||
findMessage(messageId: string, parentMessageId?: string): FormatMessageResponse<DefaultGenerics> | undefined; | ||
private switchToMessageSet; | ||
@@ -224,0 +217,0 @@ private areMessageSetsOverlap; |
@@ -443,3 +443,3 @@ /// <reference types="node" /> | ||
*/ | ||
query(options: ChannelQueryOptions<StreamChatGenerics>, messageSetToAddToIfDoesNotExist?: MessageSetType): Promise<QueryChannelAPIResponse<StreamChatGenerics>>; | ||
query(options?: ChannelQueryOptions<StreamChatGenerics>, messageSetToAddToIfDoesNotExist?: MessageSetType): Promise<QueryChannelAPIResponse<StreamChatGenerics>>; | ||
/** | ||
@@ -540,7 +540,3 @@ * banUser - Bans a user from a channel | ||
_initializeState(state: ChannelAPIResponse<StreamChatGenerics>, messageSetToAddToIfDoesNotExist?: MessageSetType): { | ||
messageSet: { | ||
isCurrent: boolean; | ||
isLatest: boolean; | ||
messages: FormatMessageResponse<StreamChatGenerics>[]; | ||
}; | ||
messageSet: import("./types").MessageSet<DefaultGenerics>; | ||
}; | ||
@@ -547,0 +543,0 @@ _extendEventWithOwnReactions(event: Event<StreamChatGenerics>): void; |
/// <reference types="node" /> | ||
import FormData from 'form-data'; | ||
import { AscDesc, ExtendableGenerics, DefaultGenerics, OwnUserResponse, UserResponse, MessageResponse, FormatMessageResponse } from './types'; | ||
import { AscDesc, ExtendableGenerics, DefaultGenerics, Logger, OwnUserResponse, UserResponse, MessageResponse, FormatMessageResponse, MessageSet, MessagePaginationOptions } from './types'; | ||
import { AxiosRequestConfig } from 'axios'; | ||
@@ -56,2 +56,17 @@ /** | ||
export declare function addToMessageList<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics>(messages: Array<FormatMessageResponse<StreamChatGenerics>>, message: FormatMessageResponse<StreamChatGenerics>, timestampChanged?: boolean, sortBy?: 'pinned_at' | 'created_at', addIfDoesNotExist?: boolean): FormatMessageResponse<StreamChatGenerics>[]; | ||
declare type MessagePaginationUpdatedParams<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = { | ||
parentSet: MessageSet; | ||
requestedPageSize: number; | ||
returnedPage: MessageResponse<StreamChatGenerics>[]; | ||
logger?: Logger; | ||
messagePaginationOptions?: MessagePaginationOptions; | ||
}; | ||
export declare function binarySearchByDateEqualOrNearestGreater(array: { | ||
created_at?: string; | ||
}[], targetDate: Date): number; | ||
export declare const messageSetPagination: <StreamChatGenerics extends ExtendableGenerics = DefaultGenerics>(params: MessagePaginationUpdatedParams<StreamChatGenerics>) => { | ||
hasNext: boolean; | ||
hasPrev: boolean; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=utils.d.ts.map |
{ | ||
"name": "stream-chat", | ||
"version": "8.38.0", | ||
"version": "8.39.0", | ||
"description": "JS SDK for the Stream Chat API", | ||
@@ -5,0 +5,0 @@ "author": "GetStream", |
@@ -124,9 +124,22 @@ # Official JavaScript SDK for [Stream Chat](https://getstream.io/chat/) | ||
```javascript | ||
const streamChatRoot = '{{CHANGE_TO_THE_PATH_TO_YOUR_PROJECT}}/stream-chat-js' | ||
module.exports = { | ||
// the rest of the metro config goes here | ||
... | ||
watchFolders: [projectRoot].concat(alternateRoots).concat(['{{CHANGE_TO_THE_PATH_TO_YOUR_PROJECT}}/stream-chat-js']) | ||
watchFolders: [projectRoot].concat(alternateRoots).concat([streamChatRoot]), | ||
resolver: { | ||
// the other resolver configurations go here | ||
... | ||
extraNodeModules: { | ||
// the other extra node modules go here | ||
... | ||
'stream-chat': streamChatRoot | ||
} | ||
} | ||
}; | ||
``` | ||
Make sure to replace `{{CHANGE_TO_THE_PATH_TO_YOUR_PROJECT}}` with the correct path for stream-chat-js folder as per your directory structure | ||
Make sure to replace `{{CHANGE_TO_THE_PATH_TO_YOUR_PROJECT}}` with the correct path for the `stream-chat-js` folder as per your directory structure. | ||
Run in the root of this repo | ||
@@ -133,0 +146,0 @@ |
@@ -9,2 +9,3 @@ import { Channel } from './channel'; | ||
MessageResponse, | ||
MessageSet, | ||
MessageSetType, | ||
@@ -18,2 +19,3 @@ PendingMessageResponse, | ||
import { addToMessageList } from './utils'; | ||
import { DEFAULT_MESSAGE_SET_PAGINATION } from './constants'; | ||
@@ -61,7 +63,3 @@ type ChannelReadStatus<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = Record< | ||
*/ | ||
messageSets: { | ||
isCurrent: boolean; | ||
isLatest: boolean; | ||
messages: Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>; | ||
}[] = []; | ||
messageSets: MessageSet[] = []; | ||
constructor(channel: Channel<StreamChatGenerics>) { | ||
@@ -114,2 +112,6 @@ this._channel = channel; | ||
get messagePagination() { | ||
return this.messageSets.find((s) => s.isCurrent)?.pagination || DEFAULT_MESSAGE_SET_PAGINATION; | ||
} | ||
/** | ||
@@ -724,3 +726,3 @@ * addMessageSorted - Add a message to the state | ||
initMessages() { | ||
this.messageSets = [{ messages: [], isLatest: true, isCurrent: true }]; | ||
this.messageSets = [{ messages: [], isLatest: true, isCurrent: true, pagination: DEFAULT_MESSAGE_SET_PAGINATION }]; | ||
} | ||
@@ -733,2 +735,3 @@ | ||
* @param {string} parentMessageId The id of the parent message, if we want load a thread reply | ||
* @param {number} limit The page size if the message has to be queried from the server | ||
*/ | ||
@@ -829,3 +832,8 @@ async loadMessageIntoState(messageId: string | 'latest', parentMessageId?: string, limit = 25) { | ||
} else if (newMessages.some((m) => !m.parent_id)) { | ||
this.messageSets.push({ messages: [], isCurrent: false, isLatest: false }); | ||
this.messageSets.push({ | ||
messages: [], | ||
isCurrent: false, | ||
isLatest: false, | ||
pagination: DEFAULT_MESSAGE_SET_PAGINATION, | ||
}); | ||
targetMessageSetIndex = this.messageSets.length - 1; | ||
@@ -856,2 +864,10 @@ } | ||
target.isCurrent = target.isCurrent || messageSet.isCurrent; | ||
target.pagination.hasPrev = | ||
messageSet.messages[0].created_at < target.messages[0].created_at | ||
? messageSet.pagination.hasPrev | ||
: target.pagination.hasPrev; | ||
target.pagination.hasNext = | ||
target.messages.slice(-1)[0].created_at < messageSet.messages.slice(-1)[0].created_at | ||
? messageSet.pagination.hasNext | ||
: target.pagination.hasNext; | ||
messagesToAdd = [...messagesToAdd, ...messageSet.messages]; | ||
@@ -858,0 +874,0 @@ }); |
import { ChannelState } from './channel_state'; | ||
import { logChatPromiseExecution, normalizeQuerySort } from './utils'; | ||
import { logChatPromiseExecution, messageSetPagination, normalizeQuerySort } from './utils'; | ||
import { StreamChat } from './client'; | ||
@@ -61,2 +61,3 @@ import { | ||
import { Role } from './permissions'; | ||
import { DEFAULT_QUERY_CHANNEL_MESSAGE_LIST_PAGE_SIZE } from './constants'; | ||
@@ -323,3 +324,3 @@ /** | ||
return await this.getClient().post<ReactionAPIResponse<StreamChatGenerics>>( | ||
this.getClient().baseURL + `/messages/${messageID}/reaction`, | ||
this.getClient().baseURL + `/messages/${encodeURIComponent(messageID)}/reaction`, | ||
{ | ||
@@ -347,3 +348,5 @@ reaction, | ||
const url = this.getClient().baseURL + `/messages/${messageID}/reaction/${reactionType}`; | ||
const url = | ||
this.getClient().baseURL + | ||
`/messages/${encodeURIComponent(messageID)}/reaction/${encodeURIComponent(reactionType)}`; | ||
//provided when server side request | ||
@@ -645,3 +648,3 @@ if (user_id) { | ||
return this.getClient().post<SendMessageAPIResponse<StreamChatGenerics>>( | ||
this.getClient().baseURL + `/messages/${messageID}/action`, | ||
this.getClient().baseURL + `/messages/${encodeURIComponent(messageID)}/action`, | ||
{ | ||
@@ -842,3 +845,3 @@ message_id: messageID, | ||
const data = await this.getClient().get<GetRepliesAPIResponse<StreamChatGenerics>>( | ||
this.getClient().baseURL + `/messages/${parent_id}/replies`, | ||
this.getClient().baseURL + `/messages/${encodeURIComponent(parent_id)}/replies`, | ||
{ | ||
@@ -871,3 +874,3 @@ sort: normalizedSort, | ||
return await this.getClient().get<GetRepliesAPIResponse<StreamChatGenerics>>( | ||
this.getClient().baseURL + `/channels/${this.type}/${this.id}/pinned_messages`, | ||
this._channelURL() + '/pinned_messages', | ||
{ | ||
@@ -892,3 +895,3 @@ payload: { | ||
return this.getClient().get<GetReactionsAPIResponse<StreamChatGenerics>>( | ||
this.getClient().baseURL + `/messages/${message_id}/reactions`, | ||
this.getClient().baseURL + `/messages/${encodeURIComponent(message_id)}/reactions`, | ||
{ | ||
@@ -1010,3 +1013,3 @@ ...options, | ||
async query( | ||
options: ChannelQueryOptions<StreamChatGenerics>, | ||
options?: ChannelQueryOptions<StreamChatGenerics>, | ||
messageSetToAddToIfDoesNotExist: MessageSetType = 'current', | ||
@@ -1017,5 +1020,5 @@ ) { | ||
let queryURL = `${this.getClient().baseURL}/channels/${this.type}`; | ||
let queryURL = `${this.getClient().baseURL}/channels/${encodeURIComponent(this.type)}`; | ||
if (this.id) { | ||
queryURL += `/${this.id}`; | ||
queryURL += `/${encodeURIComponent(this.id)}`; | ||
} | ||
@@ -1056,2 +1059,12 @@ | ||
const { messageSet } = this._initializeState(state, messageSetToAddToIfDoesNotExist); | ||
messageSet.pagination = { | ||
...messageSet.pagination, | ||
...messageSetPagination({ | ||
parentSet: messageSet, | ||
messagePaginationOptions: options?.messages, | ||
requestedPageSize: options?.messages?.limit ?? DEFAULT_QUERY_CHANNEL_MESSAGE_LIST_PAGE_SIZE, | ||
returnedPage: state.messages, | ||
logger: this.getClient().logger, | ||
}), | ||
}; | ||
@@ -1546,3 +1559,3 @@ const areCapabilitiesChanged = | ||
} | ||
return `${this.getClient().baseURL}/channels/${this.type}/${this.id}`; | ||
return `${this.getClient().baseURL}/channels/${encodeURIComponent(this.type)}/${encodeURIComponent(this.id)}`; | ||
}; | ||
@@ -1549,0 +1562,0 @@ |
233
src/utils.ts
@@ -6,2 +6,3 @@ import FormData from 'form-data'; | ||
DefaultGenerics, | ||
Logger, | ||
OwnUserBase, | ||
@@ -13,2 +14,4 @@ OwnUserResponse, | ||
ReactionGroupResponse, | ||
MessageSet, | ||
MessagePaginationOptions, | ||
} from './types'; | ||
@@ -401,1 +404,231 @@ import { AxiosRequestConfig } from 'axios'; | ||
} | ||
type MessagePaginationUpdatedParams<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = { | ||
parentSet: MessageSet; | ||
requestedPageSize: number; | ||
returnedPage: MessageResponse<StreamChatGenerics>[]; | ||
logger?: Logger; | ||
messagePaginationOptions?: MessagePaginationOptions; | ||
}; | ||
export function binarySearchByDateEqualOrNearestGreater( | ||
array: { | ||
created_at?: string; | ||
}[], | ||
targetDate: Date, | ||
): number { | ||
let left = 0; | ||
let right = array.length - 1; | ||
while (left <= right) { | ||
const mid = Math.floor((left + right) / 2); | ||
const midCreatedAt = array[mid].created_at; | ||
if (!midCreatedAt) { | ||
left += 1; | ||
continue; | ||
} | ||
const midDate = new Date(midCreatedAt); | ||
if (midDate.getTime() === targetDate.getTime()) { | ||
return mid; | ||
} else if (midDate.getTime() < targetDate.getTime()) { | ||
left = mid + 1; | ||
} else { | ||
right = mid - 1; | ||
} | ||
} | ||
return left; | ||
} | ||
const messagePaginationCreatedAtAround = <StreamChatGenerics extends ExtendableGenerics = DefaultGenerics>({ | ||
parentSet, | ||
requestedPageSize, | ||
returnedPage, | ||
messagePaginationOptions, | ||
}: MessagePaginationUpdatedParams<StreamChatGenerics>) => { | ||
const newPagination = { ...parentSet.pagination }; | ||
if (!messagePaginationOptions?.created_at_around) return newPagination; | ||
let hasPrev; | ||
let hasNext; | ||
let updateHasPrev; | ||
let updateHasNext; | ||
const createdAtAroundDate = new Date(messagePaginationOptions.created_at_around); | ||
const [firstPageMsg, lastPageMsg] = [returnedPage[0], returnedPage.slice(-1)[0]]; | ||
// expect ASC order (from oldest to newest) | ||
const wholePageHasNewerMessages = | ||
!!firstPageMsg?.created_at && new Date(firstPageMsg.created_at) > createdAtAroundDate; | ||
const wholePageHasOlderMessages = !!lastPageMsg?.created_at && new Date(lastPageMsg.created_at) < createdAtAroundDate; | ||
const requestedPageSizeNotMet = | ||
requestedPageSize > parentSet.messages.length && requestedPageSize > returnedPage.length; | ||
const noMoreMessages = | ||
(requestedPageSize > parentSet.messages.length || parentSet.messages.length >= returnedPage.length) && | ||
requestedPageSize > returnedPage.length; | ||
if (wholePageHasNewerMessages) { | ||
hasPrev = false; | ||
updateHasPrev = true; | ||
if (requestedPageSizeNotMet) { | ||
hasNext = false; | ||
updateHasNext = true; | ||
} | ||
} else if (wholePageHasOlderMessages) { | ||
hasNext = false; | ||
updateHasNext = true; | ||
if (requestedPageSizeNotMet) { | ||
hasPrev = false; | ||
updateHasPrev = true; | ||
} | ||
} else if (noMoreMessages) { | ||
hasNext = hasPrev = false; | ||
updateHasPrev = updateHasNext = true; | ||
} else { | ||
const [firstPageMsgIsFirstInSet, lastPageMsgIsLastInSet] = [ | ||
firstPageMsg?.id && firstPageMsg.id === parentSet.messages[0]?.id, | ||
lastPageMsg?.id && lastPageMsg.id === parentSet.messages.slice(-1)[0]?.id, | ||
]; | ||
updateHasPrev = firstPageMsgIsFirstInSet; | ||
updateHasNext = lastPageMsgIsLastInSet; | ||
const midPointByCount = Math.floor(returnedPage.length / 2); | ||
const midPointByCreationDate = binarySearchByDateEqualOrNearestGreater(returnedPage, createdAtAroundDate); | ||
if (midPointByCreationDate !== -1) { | ||
hasPrev = midPointByCount <= midPointByCreationDate; | ||
hasNext = midPointByCount >= midPointByCreationDate; | ||
} | ||
} | ||
if (updateHasPrev && typeof hasPrev !== 'undefined') newPagination.hasPrev = hasPrev; | ||
if (updateHasNext && typeof hasNext !== 'undefined') newPagination.hasNext = hasNext; | ||
return newPagination; | ||
}; | ||
const messagePaginationIdAround = <StreamChatGenerics extends ExtendableGenerics = DefaultGenerics>({ | ||
parentSet, | ||
requestedPageSize, | ||
returnedPage, | ||
messagePaginationOptions, | ||
}: MessagePaginationUpdatedParams<StreamChatGenerics>) => { | ||
const newPagination = { ...parentSet.pagination }; | ||
const { id_around } = messagePaginationOptions || {}; | ||
if (!id_around) return newPagination; | ||
let hasPrev; | ||
let hasNext; | ||
const [firstPageMsg, lastPageMsg] = [returnedPage[0], returnedPage.slice(-1)[0]]; | ||
const [firstPageMsgIsFirstInSet, lastPageMsgIsLastInSet] = [ | ||
firstPageMsg?.id === parentSet.messages[0]?.id, | ||
lastPageMsg?.id === parentSet.messages.slice(-1)[0]?.id, | ||
]; | ||
let updateHasPrev = firstPageMsgIsFirstInSet; | ||
let updateHasNext = lastPageMsgIsLastInSet; | ||
const midPoint = Math.floor(returnedPage.length / 2); | ||
const noMoreMessages = | ||
(requestedPageSize > parentSet.messages.length || parentSet.messages.length >= returnedPage.length) && | ||
requestedPageSize > returnedPage.length; | ||
if (noMoreMessages) { | ||
hasNext = hasPrev = false; | ||
updateHasPrev = updateHasNext = true; | ||
} else if (!returnedPage[midPoint]) { | ||
return newPagination; | ||
} else if (returnedPage[midPoint].id === id_around) { | ||
hasPrev = hasNext = true; | ||
} else { | ||
let targetMsg; | ||
const halves = [returnedPage.slice(0, midPoint), returnedPage.slice(midPoint)]; | ||
hasPrev = hasNext = true; | ||
for (let i = 0; i < halves.length; i++) { | ||
targetMsg = halves[i].find((message) => message.id === id_around); | ||
if (targetMsg && i === 0) { | ||
hasPrev = false; | ||
} | ||
if (targetMsg && i === 1) { | ||
hasNext = false; | ||
} | ||
} | ||
} | ||
if (updateHasPrev && typeof hasPrev !== 'undefined') newPagination.hasPrev = hasPrev; | ||
if (updateHasNext && typeof hasNext !== 'undefined') newPagination.hasNext = hasNext; | ||
return newPagination; | ||
}; | ||
const messagePaginationLinear = <StreamChatGenerics extends ExtendableGenerics = DefaultGenerics>({ | ||
parentSet, | ||
requestedPageSize, | ||
returnedPage, | ||
messagePaginationOptions, | ||
}: MessagePaginationUpdatedParams<StreamChatGenerics>) => { | ||
const newPagination = { ...parentSet.pagination }; | ||
let hasPrev; | ||
let hasNext; | ||
const [firstPageMsg, lastPageMsg] = [returnedPage[0], returnedPage.slice(-1)[0]]; | ||
const [firstPageMsgIsFirstInSet, lastPageMsgIsLastInSet] = [ | ||
firstPageMsg?.id && firstPageMsg.id === parentSet.messages[0]?.id, | ||
lastPageMsg?.id && lastPageMsg.id === parentSet.messages.slice(-1)[0]?.id, | ||
]; | ||
const queriedNextMessages = | ||
messagePaginationOptions && | ||
(messagePaginationOptions.created_at_after_or_equal || | ||
messagePaginationOptions.created_at_after || | ||
messagePaginationOptions.id_gt || | ||
messagePaginationOptions.id_gte); | ||
const queriedPrevMessages = | ||
typeof messagePaginationOptions === 'undefined' | ||
? true | ||
: messagePaginationOptions.created_at_before_or_equal || | ||
messagePaginationOptions.created_at_before || | ||
messagePaginationOptions.id_lt || | ||
messagePaginationOptions.id_lte || | ||
messagePaginationOptions.offset; | ||
const containsUnrecognizedOptionsOnly = | ||
!queriedNextMessages && | ||
!queriedPrevMessages && | ||
!messagePaginationOptions?.id_around && | ||
!messagePaginationOptions?.created_at_around; | ||
const hasMore = returnedPage.length >= requestedPageSize; | ||
if (typeof queriedPrevMessages !== 'undefined' || containsUnrecognizedOptionsOnly) { | ||
hasPrev = hasMore; | ||
} | ||
if (typeof queriedNextMessages !== 'undefined') { | ||
hasNext = hasMore; | ||
} | ||
const returnedPageIsEmpty = returnedPage.length === 0; | ||
if ((firstPageMsgIsFirstInSet || returnedPageIsEmpty) && typeof hasPrev !== 'undefined') | ||
newPagination.hasPrev = hasPrev; | ||
if ((lastPageMsgIsLastInSet || returnedPageIsEmpty) && typeof hasNext !== 'undefined') | ||
newPagination.hasNext = hasNext; | ||
return newPagination; | ||
}; | ||
export const messageSetPagination = <StreamChatGenerics extends ExtendableGenerics = DefaultGenerics>( | ||
params: MessagePaginationUpdatedParams<StreamChatGenerics>, | ||
) => { | ||
if (params.parentSet.messages.length < params.returnedPage.length) { | ||
params.logger?.('error', 'Corrupted message set state: parent set size < returned page size'); | ||
return params.parentSet.pagination; | ||
} | ||
if (params.messagePaginationOptions?.created_at_around) { | ||
return messagePaginationCreatedAtAround(params); | ||
} else if (params.messagePaginationOptions?.id_around) { | ||
return messagePaginationIdAround(params); | ||
} else { | ||
return messagePaginationLinear(params); | ||
} | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6352860
76
66478
166