New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stream-chat

Package Overview
Dependencies
Maintainers
10
Versions
322
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-chat - npm Package Compare versions

Comparing version 8.47.0 to 8.47.1

3

dist/types/channel.d.ts
/// <reference types="node" />
import { ChannelState } from './channel_state';
import { StreamChat } from './client';
import { APIResponse, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelMemberResponse, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateCallOptions, CreateCallResponse, DefaultGenerics, DeleteChannelAPIResponse, Event, EventAPIResponse, EventHandler, EventTypes, ExtendableGenerics, FormatMessageResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, InviteOptions, MarkReadOptions, MarkUnreadOptions, MemberFilters, MemberSort, Message, MessageFilters, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, NewMemberPayload, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PartialUpdateMember, PinnedMessagePaginationOptions, PinnedMessagesSort, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchAPIResponse, SearchOptions, SendMessageAPIResponse, TruncateChannelAPIResponse, TruncateOptions, UpdateChannelAPIResponse, UserResponse, QueryChannelAPIResponse, PollVoteData, SendMessageOptions, AscDesc, PartialUpdateMemberAPIResponse, AIState } from './types';
import { APIResponse, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelMemberResponse, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateCallOptions, CreateCallResponse, DefaultGenerics, DeleteChannelAPIResponse, Event, EventAPIResponse, EventHandler, EventTypes, ExtendableGenerics, FormatMessageResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, InviteOptions, MarkReadOptions, MarkUnreadOptions, MemberFilters, MemberSort, Message, MessageFilters, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, NewMemberPayload, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PartialUpdateMember, PinnedMessagePaginationOptions, PinnedMessagesSort, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchAPIResponse, SearchOptions, SendMessageAPIResponse, TruncateChannelAPIResponse, TruncateOptions, UpdateChannelAPIResponse, UserResponse, QueryChannelAPIResponse, PollVoteData, SendMessageOptions, AscDesc, PartialUpdateMemberAPIResponse, AIState, MessageOptions } from './types';
import { Role } from './permissions';

@@ -101,2 +101,3 @@ /**

message_filter_conditions?: MessageFilters<StreamChatGenerics>;
message_options?: MessageOptions;
query?: string;

@@ -103,0 +104,0 @@ }): Promise<SearchAPIResponse<StreamChatGenerics>>;

@@ -54,11 +54,22 @@ /// <reference types="node" />

export declare function formatMessage<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics>(message: MessageResponse<StreamChatGenerics> | FormatMessageResponse<StreamChatGenerics>): FormatMessageResponse<StreamChatGenerics>;
export declare const findIndexInSortedArray: <T, L>({ needle, sortedArray, selectValueToCompare, sortDirection, }: {
export declare const findIndexInSortedArray: <T, L>({ needle, sortedArray, selectKey, selectValueToCompare, sortDirection, }: {
needle: T;
sortedArray: readonly T[];
/**
* In array of objects (like messages), pick a specific
* property to compare needle value to.
* In an array of objects (like messages), pick a unique property identifying
* an element. It will be used to find a direct match for the needle element
* in case compare values are not unique.
*
* @example
* ```ts
* selectKey: (message) => message.id
* ```
*/
selectKey?: ((arrayElement: T) => string) | undefined;
/**
* In an array of objects (like messages), pick a specific
* property to compare the needle value to.
*
* @example
* ```ts
* selectValueToCompare: (message) => message.created_at.getTime()

@@ -65,0 +76,0 @@ * ```

{
"name": "stream-chat",
"version": "8.47.0",
"version": "8.47.1",
"description": "JS SDK for the Stream Chat API",

@@ -5,0 +5,0 @@ "author": "GetStream",

@@ -63,2 +63,3 @@ import { ChannelState } from './channel_state';

AIState,
MessageOptions,
} from './types';

@@ -241,2 +242,3 @@ import { Role } from './permissions';

message_filter_conditions?: MessageFilters<StreamChatGenerics>;
message_options?: MessageOptions;
query?: string;

@@ -243,0 +245,0 @@ } = {},

@@ -357,8 +357,6 @@ import type { Channel } from './channel';

selectValueToCompare: (reply) => reply.created_at.getTime(),
selectKey: (reply) => reply.id,
});
const actualIndex =
replies[index]?.id === message.id ? index : replies[index - 1]?.id === message.id ? index - 1 : null;
if (actualIndex === null) {
if (replies[index]?.id !== message.id) {
return;

@@ -368,3 +366,3 @@ }

const updatedReplies = [...replies];
updatedReplies.splice(actualIndex, 1);
updatedReplies.splice(index, 1);

@@ -371,0 +369,0 @@ this.state.partialNext({

@@ -314,2 +314,3 @@ import FormData from 'form-data';

sortedArray,
selectKey,
selectValueToCompare = (e) => e,

@@ -321,7 +322,18 @@ sortDirection = 'ascending',

/**
* In array of objects (like messages), pick a specific
* property to compare needle value to.
* In an array of objects (like messages), pick a unique property identifying
* an element. It will be used to find a direct match for the needle element
* in case compare values are not unique.
*
* @example
* ```ts
* selectKey: (message) => message.id
* ```
*/
selectKey?: (arrayElement: T) => string;
/**
* In an array of objects (like messages), pick a specific
* property to compare the needle value to.
*
* @example
* ```ts
* selectValueToCompare: (message) => message.created_at.getTime()

@@ -358,7 +370,5 @@ * ```

// if (comparableNeedle === comparableMiddle) return middle;
if (
(sortDirection === 'ascending' && comparableNeedle < comparableMiddle) ||
(sortDirection === 'descending' && comparableNeedle > comparableMiddle)
(sortDirection === 'descending' && comparableNeedle >= comparableMiddle)
) {

@@ -371,2 +381,19 @@ right = middle - 1;

// In case there are several array elements with the same comparable value, search around the insertion
// point to possibly find an element with the same key. If found, prefer it.
// This, for example, prevents duplication of messages with the same creation date.
if (selectKey) {
const needleKey = selectKey(needle);
const step = sortDirection === 'ascending' ? -1 : +1;
for (
let i = left + step;
0 <= i && i < sortedArray.length && selectValueToCompare(sortedArray[i]) === comparableNeedle;
i += step
) {
if (selectKey(sortedArray[i]) === needleKey) {
return i;
}
}
}
return left;

@@ -417,15 +444,14 @@ };

selectValueToCompare: (m) => m[sortBy]!.getTime(),
selectKey: (m) => m.id,
});
// message already exists and not filtered with timestampChanged, update and return
if (!timestampChanged && newMessage.id) {
if (newMessages[insertionIndex] && newMessage.id === newMessages[insertionIndex].id) {
newMessages[insertionIndex] = newMessage;
return newMessages;
}
if (newMessages[insertionIndex - 1] && newMessage.id === newMessages[insertionIndex - 1].id) {
newMessages[insertionIndex - 1] = newMessage;
return newMessages;
}
if (
!timestampChanged &&
newMessage.id &&
newMessages[insertionIndex] &&
newMessage.id === newMessages[insertionIndex].id
) {
newMessages[insertionIndex] = newMessage;
return newMessages;
}

@@ -432,0 +458,0 @@

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 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 not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc