@ermis-network/ermis-chat-sdk 1.0.5 → 1.0.7

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/index.d.mts CHANGED
@@ -222,6 +222,7 @@ type ChannelResponse<ErmisChatGenerics extends ExtendableGenerics = DefaultGener
222
222
  member_capabilities?: string[];
223
223
  is_pinned?: boolean;
224
224
  topics_enabled?: boolean;
225
+ parent_cid?: string;
225
226
  is_closed_topic?: boolean;
226
227
  };
227
228
  type QueryChannelsAPIResponse<ErmisChatGenerics extends ExtendableGenerics = DefaultGenerics> = APIResponse & {
@@ -401,6 +402,7 @@ type Event$1<ErmisChatGenerics extends ExtendableGenerics = DefaultGenerics> = E
401
402
  message?: MessageResponse<ErmisChatGenerics>;
402
403
  online?: boolean;
403
404
  parent_id?: string;
405
+ parent_cid?: string;
404
406
  reaction?: ReactionResponse<ErmisChatGenerics>;
405
407
  received_at?: string | Date;
406
408
  unread_messages?: number;
@@ -428,6 +430,16 @@ type ChannelFilters = {
428
430
  parent_id?: string;
429
431
  include_parent?: boolean;
430
432
  };
433
+ type CreateTopicData = {
434
+ name: string;
435
+ image?: string;
436
+ [key: string]: any;
437
+ };
438
+ type EditTopicData = {
439
+ name?: string;
440
+ image?: string;
441
+ description?: string;
442
+ };
431
443
  type ChannelSort = {
432
444
  field: string;
433
445
  direction: -1 | 1;
@@ -863,6 +875,8 @@ declare class Channel<ErmisChatGenerics extends ExtendableGenerics = DefaultGene
863
875
  }): Promise<SendMessageAPIResponse<ErmisChatGenerics>>;
864
876
  pinMessage(messageID: string): Promise<unknown>;
865
877
  unpinMessage(messageID: string): Promise<unknown>;
878
+ pin(): Promise<APIResponse>;
879
+ unpin(): Promise<APIResponse>;
866
880
  editMessage(oldMessageID: string, message: EditMessage): Promise<unknown>;
867
881
  sendFile(uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse<ErmisChatGenerics>): Promise<SendFileAPIResponse>;
868
882
  /**
@@ -961,7 +975,7 @@ declare class Channel<ErmisChatGenerics extends ExtendableGenerics = DefaultGene
961
975
  }[];
962
976
  getCapabilitiesMember(): unknown;
963
977
  create: () => Promise<QueryChannelAPIResponse<ErmisChatGenerics>>;
964
- createTopic(data: any): Promise<QueryChannelAPIResponse<ErmisChatGenerics>>;
978
+ createTopic(data: CreateTopicData): Promise<QueryChannelAPIResponse<ErmisChatGenerics>>;
965
979
  query(options: ChannelQueryOptions, messageSetToAddToIfDoesNotExist?: MessageSetType): Promise<QueryChannelAPIResponse<ErmisChatGenerics>>;
966
980
  createDirectChannel(messageSetToAddToIfDoesNotExist?: MessageSetType): Promise<QueryChannelAPIResponse<ErmisChatGenerics>>;
967
981
  queryMessagesLessThanId(message_id: string, limit?: number): Promise<MessageResponse<ErmisChatGenerics>[]>;
@@ -978,7 +992,7 @@ declare class Channel<ErmisChatGenerics extends ExtendableGenerics = DefaultGene
978
992
  disableTopics(): Promise<unknown>;
979
993
  closeTopic(topicCID: string): Promise<unknown>;
980
994
  reopenTopic(topicCID: string): Promise<unknown>;
981
- editTopic(topicCID: string, data: any): Promise<any>;
995
+ editTopic(topicCID: string, data: EditTopicData): Promise<any>;
982
996
  on(eventType: EventTypes, callback: EventHandler<ErmisChatGenerics>): {
983
997
  unsubscribe: () => void;
984
998
  };
@@ -1132,8 +1146,8 @@ declare class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGe
1132
1146
  * @param extenal_auth - Set to `true` to use your custom backend external authentication flow.
1133
1147
  * @returns A promise resolving to the API connection response once authenticated.
1134
1148
  */
1135
- connectUser: (user: UserResponse<ErmisChatGenerics>, userTokenOrProvider: string | null, extenal_auth?: boolean) => Promise<void | ConnectionOpen<ErmisChatGenerics>>;
1136
- setUser: (user: UserResponse<ErmisChatGenerics>, userTokenOrProvider: string | null, extenal_auth?: boolean) => Promise<void | ConnectionOpen<ErmisChatGenerics>>;
1149
+ connectUser: (user: UserResponse<ErmisChatGenerics>, userTokenOrProvider: string | null, external_auth?: boolean) => Promise<void | ConnectionOpen<ErmisChatGenerics>>;
1150
+ setUser: (user: UserResponse<ErmisChatGenerics>, userTokenOrProvider: string | null, external_auth?: boolean) => Promise<void | ConnectionOpen<ErmisChatGenerics>>;
1137
1151
  _setToken: (user: UserResponse<ErmisChatGenerics>, userTokenOrProvider: string | null) => Promise<void>;
1138
1152
  _setUser(user: UserResponse<ErmisChatGenerics>): void;
1139
1153
  closeConnection: (timeout?: number) => Promise<void>;
@@ -1218,10 +1232,17 @@ declare class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGe
1218
1232
  searchUsers(page: number, page_size: number, name?: string): Promise<UsersResponse>;
1219
1233
  queryContacts(): Promise<ContactResult>;
1220
1234
  _updateProjectID(project_id: string): void;
1221
- uploadFile(file: File): Promise<{
1235
+ /**
1236
+ * Uploads a new avatar image for the current user.
1237
+ * The user's avatar URL is automatically updated in both the client and the local state.
1238
+ *
1239
+ * @param file - The image file to upload.
1240
+ * @returns The response containing the new avatar URL.
1241
+ */
1242
+ uploadAvatar(file: File): Promise<{
1222
1243
  avatar: string;
1223
1244
  }>;
1224
- updateProfile(name: string, about_me: string): Promise<UserResponse<ErmisChatGenerics>>;
1245
+ updateProfile(updates: Partial<UserResponse<ErmisChatGenerics>>): Promise<UserResponse<ErmisChatGenerics>>;
1225
1246
  /**
1226
1247
  * Queries the API for a list of channels based on provided search filters and sort conditions.
1227
1248
  * Also hydrates these channels into the local SDK state memory.
@@ -1262,6 +1283,24 @@ declare class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGe
1262
1283
  channel(type: string, id: string, custom?: ChannelData<ErmisChatGenerics>): Channel<ErmisChatGenerics>;
1263
1284
  getChannelById: (channelType: string, channelID: string | undefined, custom: ChannelData<ErmisChatGenerics>) => Channel<ErmisChatGenerics>;
1264
1285
  getChannel: (channelType: string, custom: ChannelData<ErmisChatGenerics>) => Channel<ErmisChatGenerics>;
1286
+ /**
1287
+ * Creates a quick channel and immediately registers it on the server.
1288
+ * Quick channels are public group channels that anyone can join without an invitation.
1289
+ * The creator is added as the first member automatically.
1290
+ *
1291
+ * @param name - An optional display name for the channel.
1292
+ * @returns A promise that resolves to the created `Channel` object.
1293
+ */
1294
+ createQuickChannel(name?: string): Promise<Channel<ErmisChatGenerics>>;
1295
+ /**
1296
+ * Joins a quick channel by its ID.
1297
+ * Automatically checks whether the caller is already a member.
1298
+ * If not, it joins the channel and synchronizes state.
1299
+ *
1300
+ * @param channelId - The ID of the quick channel to join.
1301
+ * @returns A promise that resolves to the joined `Channel` object.
1302
+ */
1303
+ joinQuickChannel(channelId: string): Promise<Channel<ErmisChatGenerics>>;
1265
1304
  _normalizeExpiration(timeoutOrExpirationDate?: null | number | string | Date): string | null;
1266
1305
  getUserAgent(): string;
1267
1306
  setUserAgent(userAgent: string): void;
@@ -1659,4 +1698,4 @@ interface SignalMessageResult {
1659
1698
  */
1660
1699
  declare function parseSignalMessage(value: string, myUserId: string): SignalMessageResult | null;
1661
1700
 
1662
- export { type APIErrorResponse, type APIResponse, type AscDesc, type Attachment, type AttachmentResponse, type AudioConfig, CallAction, type CallEventData, type CallEventType, CallStatus, CallType, type CallTypeValue, Channel, type ChannelAPIResponse, type ChannelData, type ChannelFilters, type ChannelMemberResponse, type ChannelMembership, type ChannelQueryOptions, type ChannelResponse, type ChannelSort, ChannelState, type ChannelStateOptions, ClientState, type ConnectAPIResponse, type ConnectionOpen, type Contact, type ContactResponse, type ContactResult, type DefaultGenerics, EVENT_MAP, type EditMessage, ErmisAuthProvider, ErmisCallNode, ErmisChat, type ErmisChatOptions, ErrorFromResponse, type Event$1 as Event, type EventHandler, type EventTypes, type ExtendableGenerics, FRAME_TYPE, type FormatMessageResponse, type ForwardMessage, type IMediaReceiverEvents, type INodeCall, type LiteralStringForUnion, type LogLevel, type Logger, type Message, type MessageBase, type MessageLabel, type MessageResponse, type MessageResponseBase, type MessageSetType, type Metadata, type PollMessage, type QueryChannelAPIResponse, type QueryChannelsAPIResponse, type Reaction, type ReactionAPIResponse, type ReactionResponse, type ReadResponse, type Role, type SendFileAPIResponse, type SendMessageAPIResponse, type SignalData, type SignalMessageResult, StableWSConnection, TokenManager, type TransceiverState, type UR, type UpdateChannelAPIResponse, type UserCallInfo, type UserResponse, type UsersResponse, type VideoConfig, type VoiceRecordingMeta, buildAttachmentPayload, chatCodes, createForwardMessagePayload, formatMessage, getAttachmentCategory, isHeicFile, isVideoFile, logChatPromiseExecution, normalizeFileName, parseSignalMessage, parseSystemMessage };
1701
+ export { type APIErrorResponse, type APIResponse, type AscDesc, type Attachment, type AttachmentResponse, type AudioConfig, CallAction, type CallEventData, type CallEventType, CallStatus, CallType, type CallTypeValue, Channel, type ChannelAPIResponse, type ChannelData, type ChannelFilters, type ChannelMemberResponse, type ChannelMembership, type ChannelQueryOptions, type ChannelResponse, type ChannelSort, ChannelState, type ChannelStateOptions, ClientState, type ConnectAPIResponse, type ConnectionOpen, type Contact, type ContactResponse, type ContactResult, type CreateTopicData, type DefaultGenerics, EVENT_MAP, type EditMessage, type EditTopicData, ErmisAuthProvider, ErmisCallNode, ErmisChat, type ErmisChatOptions, ErrorFromResponse, type Event$1 as Event, type EventHandler, type EventTypes, type ExtendableGenerics, FRAME_TYPE, type FormatMessageResponse, type ForwardMessage, type IMediaReceiverEvents, type INodeCall, type LiteralStringForUnion, type LogLevel, type Logger, type Message, type MessageBase, type MessageLabel, type MessageResponse, type MessageResponseBase, type MessageSetType, type Metadata, type PollMessage, type QueryChannelAPIResponse, type QueryChannelsAPIResponse, type Reaction, type ReactionAPIResponse, type ReactionResponse, type ReadResponse, type Role, type SendFileAPIResponse, type SendMessageAPIResponse, type SignalData, type SignalMessageResult, StableWSConnection, TokenManager, type TransceiverState, type UR, type UpdateChannelAPIResponse, type UserCallInfo, type UserResponse, type UsersResponse, type VideoConfig, type VoiceRecordingMeta, buildAttachmentPayload, chatCodes, createForwardMessagePayload, formatMessage, getAttachmentCategory, isHeicFile, isVideoFile, logChatPromiseExecution, normalizeFileName, parseSignalMessage, parseSystemMessage };
package/dist/index.d.ts CHANGED
@@ -222,6 +222,7 @@ type ChannelResponse<ErmisChatGenerics extends ExtendableGenerics = DefaultGener
222
222
  member_capabilities?: string[];
223
223
  is_pinned?: boolean;
224
224
  topics_enabled?: boolean;
225
+ parent_cid?: string;
225
226
  is_closed_topic?: boolean;
226
227
  };
227
228
  type QueryChannelsAPIResponse<ErmisChatGenerics extends ExtendableGenerics = DefaultGenerics> = APIResponse & {
@@ -401,6 +402,7 @@ type Event$1<ErmisChatGenerics extends ExtendableGenerics = DefaultGenerics> = E
401
402
  message?: MessageResponse<ErmisChatGenerics>;
402
403
  online?: boolean;
403
404
  parent_id?: string;
405
+ parent_cid?: string;
404
406
  reaction?: ReactionResponse<ErmisChatGenerics>;
405
407
  received_at?: string | Date;
406
408
  unread_messages?: number;
@@ -428,6 +430,16 @@ type ChannelFilters = {
428
430
  parent_id?: string;
429
431
  include_parent?: boolean;
430
432
  };
433
+ type CreateTopicData = {
434
+ name: string;
435
+ image?: string;
436
+ [key: string]: any;
437
+ };
438
+ type EditTopicData = {
439
+ name?: string;
440
+ image?: string;
441
+ description?: string;
442
+ };
431
443
  type ChannelSort = {
432
444
  field: string;
433
445
  direction: -1 | 1;
@@ -863,6 +875,8 @@ declare class Channel<ErmisChatGenerics extends ExtendableGenerics = DefaultGene
863
875
  }): Promise<SendMessageAPIResponse<ErmisChatGenerics>>;
864
876
  pinMessage(messageID: string): Promise<unknown>;
865
877
  unpinMessage(messageID: string): Promise<unknown>;
878
+ pin(): Promise<APIResponse>;
879
+ unpin(): Promise<APIResponse>;
866
880
  editMessage(oldMessageID: string, message: EditMessage): Promise<unknown>;
867
881
  sendFile(uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse<ErmisChatGenerics>): Promise<SendFileAPIResponse>;
868
882
  /**
@@ -961,7 +975,7 @@ declare class Channel<ErmisChatGenerics extends ExtendableGenerics = DefaultGene
961
975
  }[];
962
976
  getCapabilitiesMember(): unknown;
963
977
  create: () => Promise<QueryChannelAPIResponse<ErmisChatGenerics>>;
964
- createTopic(data: any): Promise<QueryChannelAPIResponse<ErmisChatGenerics>>;
978
+ createTopic(data: CreateTopicData): Promise<QueryChannelAPIResponse<ErmisChatGenerics>>;
965
979
  query(options: ChannelQueryOptions, messageSetToAddToIfDoesNotExist?: MessageSetType): Promise<QueryChannelAPIResponse<ErmisChatGenerics>>;
966
980
  createDirectChannel(messageSetToAddToIfDoesNotExist?: MessageSetType): Promise<QueryChannelAPIResponse<ErmisChatGenerics>>;
967
981
  queryMessagesLessThanId(message_id: string, limit?: number): Promise<MessageResponse<ErmisChatGenerics>[]>;
@@ -978,7 +992,7 @@ declare class Channel<ErmisChatGenerics extends ExtendableGenerics = DefaultGene
978
992
  disableTopics(): Promise<unknown>;
979
993
  closeTopic(topicCID: string): Promise<unknown>;
980
994
  reopenTopic(topicCID: string): Promise<unknown>;
981
- editTopic(topicCID: string, data: any): Promise<any>;
995
+ editTopic(topicCID: string, data: EditTopicData): Promise<any>;
982
996
  on(eventType: EventTypes, callback: EventHandler<ErmisChatGenerics>): {
983
997
  unsubscribe: () => void;
984
998
  };
@@ -1132,8 +1146,8 @@ declare class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGe
1132
1146
  * @param extenal_auth - Set to `true` to use your custom backend external authentication flow.
1133
1147
  * @returns A promise resolving to the API connection response once authenticated.
1134
1148
  */
1135
- connectUser: (user: UserResponse<ErmisChatGenerics>, userTokenOrProvider: string | null, extenal_auth?: boolean) => Promise<void | ConnectionOpen<ErmisChatGenerics>>;
1136
- setUser: (user: UserResponse<ErmisChatGenerics>, userTokenOrProvider: string | null, extenal_auth?: boolean) => Promise<void | ConnectionOpen<ErmisChatGenerics>>;
1149
+ connectUser: (user: UserResponse<ErmisChatGenerics>, userTokenOrProvider: string | null, external_auth?: boolean) => Promise<void | ConnectionOpen<ErmisChatGenerics>>;
1150
+ setUser: (user: UserResponse<ErmisChatGenerics>, userTokenOrProvider: string | null, external_auth?: boolean) => Promise<void | ConnectionOpen<ErmisChatGenerics>>;
1137
1151
  _setToken: (user: UserResponse<ErmisChatGenerics>, userTokenOrProvider: string | null) => Promise<void>;
1138
1152
  _setUser(user: UserResponse<ErmisChatGenerics>): void;
1139
1153
  closeConnection: (timeout?: number) => Promise<void>;
@@ -1218,10 +1232,17 @@ declare class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGe
1218
1232
  searchUsers(page: number, page_size: number, name?: string): Promise<UsersResponse>;
1219
1233
  queryContacts(): Promise<ContactResult>;
1220
1234
  _updateProjectID(project_id: string): void;
1221
- uploadFile(file: File): Promise<{
1235
+ /**
1236
+ * Uploads a new avatar image for the current user.
1237
+ * The user's avatar URL is automatically updated in both the client and the local state.
1238
+ *
1239
+ * @param file - The image file to upload.
1240
+ * @returns The response containing the new avatar URL.
1241
+ */
1242
+ uploadAvatar(file: File): Promise<{
1222
1243
  avatar: string;
1223
1244
  }>;
1224
- updateProfile(name: string, about_me: string): Promise<UserResponse<ErmisChatGenerics>>;
1245
+ updateProfile(updates: Partial<UserResponse<ErmisChatGenerics>>): Promise<UserResponse<ErmisChatGenerics>>;
1225
1246
  /**
1226
1247
  * Queries the API for a list of channels based on provided search filters and sort conditions.
1227
1248
  * Also hydrates these channels into the local SDK state memory.
@@ -1262,6 +1283,24 @@ declare class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGe
1262
1283
  channel(type: string, id: string, custom?: ChannelData<ErmisChatGenerics>): Channel<ErmisChatGenerics>;
1263
1284
  getChannelById: (channelType: string, channelID: string | undefined, custom: ChannelData<ErmisChatGenerics>) => Channel<ErmisChatGenerics>;
1264
1285
  getChannel: (channelType: string, custom: ChannelData<ErmisChatGenerics>) => Channel<ErmisChatGenerics>;
1286
+ /**
1287
+ * Creates a quick channel and immediately registers it on the server.
1288
+ * Quick channels are public group channels that anyone can join without an invitation.
1289
+ * The creator is added as the first member automatically.
1290
+ *
1291
+ * @param name - An optional display name for the channel.
1292
+ * @returns A promise that resolves to the created `Channel` object.
1293
+ */
1294
+ createQuickChannel(name?: string): Promise<Channel<ErmisChatGenerics>>;
1295
+ /**
1296
+ * Joins a quick channel by its ID.
1297
+ * Automatically checks whether the caller is already a member.
1298
+ * If not, it joins the channel and synchronizes state.
1299
+ *
1300
+ * @param channelId - The ID of the quick channel to join.
1301
+ * @returns A promise that resolves to the joined `Channel` object.
1302
+ */
1303
+ joinQuickChannel(channelId: string): Promise<Channel<ErmisChatGenerics>>;
1265
1304
  _normalizeExpiration(timeoutOrExpirationDate?: null | number | string | Date): string | null;
1266
1305
  getUserAgent(): string;
1267
1306
  setUserAgent(userAgent: string): void;
@@ -1659,4 +1698,4 @@ interface SignalMessageResult {
1659
1698
  */
1660
1699
  declare function parseSignalMessage(value: string, myUserId: string): SignalMessageResult | null;
1661
1700
 
1662
- export { type APIErrorResponse, type APIResponse, type AscDesc, type Attachment, type AttachmentResponse, type AudioConfig, CallAction, type CallEventData, type CallEventType, CallStatus, CallType, type CallTypeValue, Channel, type ChannelAPIResponse, type ChannelData, type ChannelFilters, type ChannelMemberResponse, type ChannelMembership, type ChannelQueryOptions, type ChannelResponse, type ChannelSort, ChannelState, type ChannelStateOptions, ClientState, type ConnectAPIResponse, type ConnectionOpen, type Contact, type ContactResponse, type ContactResult, type DefaultGenerics, EVENT_MAP, type EditMessage, ErmisAuthProvider, ErmisCallNode, ErmisChat, type ErmisChatOptions, ErrorFromResponse, type Event$1 as Event, type EventHandler, type EventTypes, type ExtendableGenerics, FRAME_TYPE, type FormatMessageResponse, type ForwardMessage, type IMediaReceiverEvents, type INodeCall, type LiteralStringForUnion, type LogLevel, type Logger, type Message, type MessageBase, type MessageLabel, type MessageResponse, type MessageResponseBase, type MessageSetType, type Metadata, type PollMessage, type QueryChannelAPIResponse, type QueryChannelsAPIResponse, type Reaction, type ReactionAPIResponse, type ReactionResponse, type ReadResponse, type Role, type SendFileAPIResponse, type SendMessageAPIResponse, type SignalData, type SignalMessageResult, StableWSConnection, TokenManager, type TransceiverState, type UR, type UpdateChannelAPIResponse, type UserCallInfo, type UserResponse, type UsersResponse, type VideoConfig, type VoiceRecordingMeta, buildAttachmentPayload, chatCodes, createForwardMessagePayload, formatMessage, getAttachmentCategory, isHeicFile, isVideoFile, logChatPromiseExecution, normalizeFileName, parseSignalMessage, parseSystemMessage };
1701
+ export { type APIErrorResponse, type APIResponse, type AscDesc, type Attachment, type AttachmentResponse, type AudioConfig, CallAction, type CallEventData, type CallEventType, CallStatus, CallType, type CallTypeValue, Channel, type ChannelAPIResponse, type ChannelData, type ChannelFilters, type ChannelMemberResponse, type ChannelMembership, type ChannelQueryOptions, type ChannelResponse, type ChannelSort, ChannelState, type ChannelStateOptions, ClientState, type ConnectAPIResponse, type ConnectionOpen, type Contact, type ContactResponse, type ContactResult, type CreateTopicData, type DefaultGenerics, EVENT_MAP, type EditMessage, type EditTopicData, ErmisAuthProvider, ErmisCallNode, ErmisChat, type ErmisChatOptions, ErrorFromResponse, type Event$1 as Event, type EventHandler, type EventTypes, type ExtendableGenerics, FRAME_TYPE, type FormatMessageResponse, type ForwardMessage, type IMediaReceiverEvents, type INodeCall, type LiteralStringForUnion, type LogLevel, type Logger, type Message, type MessageBase, type MessageLabel, type MessageResponse, type MessageResponseBase, type MessageSetType, type Metadata, type PollMessage, type QueryChannelAPIResponse, type QueryChannelsAPIResponse, type Reaction, type ReactionAPIResponse, type ReactionResponse, type ReadResponse, type Role, type SendFileAPIResponse, type SendMessageAPIResponse, type SignalData, type SignalMessageResult, StableWSConnection, TokenManager, type TransceiverState, type UR, type UpdateChannelAPIResponse, type UserCallInfo, type UserResponse, type UsersResponse, type VideoConfig, type VoiceRecordingMeta, buildAttachmentPayload, chatCodes, createForwardMessagePayload, formatMessage, getAttachmentCategory, isHeicFile, isVideoFile, logChatPromiseExecution, normalizeFileName, parseSignalMessage, parseSystemMessage };