diff --git a/CHANGELOG.md b/CHANGELOG.md index fc66fca2d..3931fb97d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [8.32.0](https://github.com/GetStream/stream-chat-js/compare/v8.31.0...v8.32.0) (2024-05-16) + + +### Features + +* add support for notifications_muted in queryMembers ([#1296](https://github.com/GetStream/stream-chat-js/issues/1296)) ([7e02ac8](https://github.com/GetStream/stream-chat-js/commit/7e02ac8f9d23fd5ca00c9e2c91b5e18ddb04fffb)) + + +### Bug Fixes + +* fix channel.membership type ([#1300](https://github.com/GetStream/stream-chat-js/issues/1300)) ([367cc20](https://github.com/GetStream/stream-chat-js/commit/367cc20a0609a7c144d08c9f5572b0088c45c13e)) + ## [8.31.0](https://github.com/GetStream/stream-chat-js/compare/v8.30.0...v8.31.0) (2024-05-02) diff --git a/package.json b/package.json index 1b62b3fc5..4ab2262cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stream-chat", - "version": "8.31.0", + "version": "8.32.0", "description": "JS SDK for the Stream Chat API", "author": "GetStream", "homepage": "https://getstream.io/chat/", diff --git a/src/channel_state.ts b/src/channel_state.ts index 34023b9d1..47d6de817 100644 --- a/src/channel_state.ts +++ b/src/channel_state.ts @@ -1,7 +1,6 @@ import { Channel } from './channel'; import { ChannelMemberResponse, - ChannelMembership, FormatMessageResponse, Event, ExtendableGenerics, @@ -42,7 +41,7 @@ export class ChannelState>; members: Record>; unreadCount: number; - membership: ChannelMembership; + membership: ChannelMemberResponse; last_message_at: Date | null; /** * Flag which indicates if channel state contain latest/recent messages or no. diff --git a/src/types.ts b/src/types.ts index fa039e219..4bfe05860 100644 --- a/src/types.ts +++ b/src/types.ts @@ -143,6 +143,7 @@ export type AppSettingsAPIResponse; + poll_enabled?: boolean; push_notifications?: { offline_only: boolean; version: string; @@ -313,7 +314,7 @@ export type ChannelAPIResponse[]; pinned_messages: MessageResponse[]; hidden?: boolean; - membership?: ChannelMembership | null; + membership?: ChannelMemberResponse | null; pending_messages?: PendingMessageResponse[]; read?: ReadResponse[]; threads?: ThreadResponse[]; @@ -331,6 +332,7 @@ export type ChannelMemberAPIResponse = { + ban_expires?: string; banned?: boolean; channel_role?: Role; created_at?: string; @@ -2042,18 +2044,12 @@ export type ChannelData< name?: string; }; -export type ChannelMembership = { - banned?: boolean; - channel_role?: Role; - created_at?: string; - is_moderator?: boolean; - notifications_muted?: boolean; - role?: string; - shadow_banned?: boolean; - status?: string; - updated_at?: string; - user?: UserResponse; -}; +/** + * @deprecated Use ChannelMemberResponse instead + */ +export type ChannelMembership< + StreamChatGenerics extends ExtendableGenerics = DefaultGenerics +> = ChannelMemberResponse; export type ChannelMute = { user: UserResponse; diff --git a/test/typescript/index.js b/test/typescript/index.js index d35c85fba..a5a5b8eaf 100644 --- a/test/typescript/index.js +++ b/test/typescript/index.js @@ -11,7 +11,7 @@ const executables = [ f: rg.acceptInvite, imports: ['Channel', 'Unpacked'], type: - "Unpacked['acceptInvite']>>", + "Unpacked['acceptInvite']>>", }, { f: rg.addDevice, @@ -22,13 +22,13 @@ const executables = [ f: rg.addMembers, imports: ['Channel', 'Unpacked'], type: - "Unpacked['addMembers']>>", + "Unpacked['addMembers']>>", }, { f: rg.addModerators, imports: ['Channel', 'Unpacked'], type: - "Unpacked['addModerators']>>", + "Unpacked['addModerators']>>", }, { f: rg.banUsers, @@ -60,13 +60,13 @@ const executables = [ f: rg.create, imports: ['Channel', 'Unpacked'], type: - "Unpacked['create']>>", + "Unpacked['create']>>", }, { f: rg.createBlockList, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['createBlockList']>>", + "Unpacked['createBlockList']>>", }, // createChannelType has a limit. So only run this when needed. // { @@ -78,7 +78,7 @@ const executables = [ f: rg.createCommand, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['createCommand']>>", + "Unpacked['createCommand']>>", }, { f: rg.createPermission, @@ -94,13 +94,13 @@ const executables = [ f: rg.deleteBlockList, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['deleteBlockList']>>", + "Unpacked['deleteBlockList']>>", }, { f: rg.deleteChannel, imports: ['Channel', 'Unpacked'], type: - "Unpacked['delete']>>", + "Unpacked['delete']>>", }, // TODO: Fix the error which results from deleteChannelType api call: // `deleteChannelType failed with error: { Error: StreamChat error code 16: DeleteChannelType failed with error: "bc0b09df-2cfd-4e80-93e7-1f0091e6a435 is not a defined channel type"` @@ -114,19 +114,19 @@ const executables = [ f: rg.deleteCommand, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['deleteCommand']>>", + "Unpacked['deleteCommand']>>", }, { f: rg.deleteFile, imports: ['Channel', 'Unpacked'], type: - "Unpacked['deleteFile']>>", + "Unpacked['deleteFile']>>", }, { f: rg.deleteImage, imports: ['Channel', 'Unpacked'], type: - "Unpacked['deleteImage']>>", + "Unpacked['deleteImage']>>", }, { f: rg.deleteMessage, @@ -142,7 +142,7 @@ const executables = [ f: rg.deleteReaction, imports: ['Channel', 'Unpacked'], type: - "Unpacked['deleteReaction']>>", + "Unpacked['deleteReaction']>>", }, { f: rg.deleteUser, @@ -153,7 +153,7 @@ const executables = [ f: rg.demoteModerators, imports: ['Channel', 'Unpacked'], type: - "Unpacked['demoteModerators']>>", + "Unpacked['demoteModerators']>>", }, // { // f: rg.disconnect, @@ -169,13 +169,13 @@ const executables = [ f: rg.flagMessage, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['flagMessage']>>", + "Unpacked['flagMessage']>>", }, { f: rg.flagUser, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['flagUser']>>", + "Unpacked['flagUser']>>", }, { f: rg.getAppSettings, @@ -196,13 +196,13 @@ const executables = [ f: rg.getCommand, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['getCommand']>>", + "Unpacked['getCommand']>>", }, { f: rg.getConfig, imports: ['Channel', 'Unpacked'], type: - "Unpacked['getConfig']>>", + "Unpacked['getConfig']>>", }, { f: rg.getDevices, @@ -218,13 +218,13 @@ const executables = [ f: rg.getMessagesById, imports: ['Channel', 'Unpacked'], type: - "Unpacked['getMessagesById']>>", + "Unpacked['getMessagesById']>>", }, { f: rg.getMessageWithReply, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['getMessage']>>", + "Unpacked['getMessage']>>", }, { f: rg.getPermission, @@ -235,37 +235,37 @@ const executables = [ f: rg.getReactions, imports: ['Channel', 'Unpacked'], type: - "Unpacked['getReactions']>>", + "Unpacked['getReactions']>>", }, { f: rg.getReplies, imports: ['Channel', 'Unpacked'], type: - "Unpacked['getReplies']>>", + "Unpacked['getReplies']>>", }, { f: rg.hide, imports: ['Channel', 'Unpacked'], type: - "Unpacked['hide']>>", + "Unpacked['hide']>>", }, { f: rg.inviteMembers, imports: ['Channel', 'Unpacked'], type: - "Unpacked['inviteMembers']>>", + "Unpacked['inviteMembers']>>", }, { f: rg.keystroke, imports: ['Channel', 'Unpacked'], type: - "Unpacked['keystroke']>>", + "Unpacked['keystroke']>>", }, { f: rg.lastMessage, imports: ['Channel', 'FormatMessageResponse', 'Unpacked'], type: - "Omit, 'created_at' | 'updated_at'> & { created_at?: string; updated_at?: string } | undefined", + "Omit, 'created_at' | 'updated_at'> & { created_at?: string; updated_at?: string } | undefined", }, { f: rg.listBlockLists, @@ -281,7 +281,7 @@ const executables = [ f: rg.listCommands, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['listCommands']>>", + "Unpacked['listCommands']>>", }, { f: rg.listPermissions, @@ -297,19 +297,19 @@ const executables = [ f: rg.markRead, imports: ['Channel', 'Unpacked'], type: - "Unpacked['markRead']>>", + "Unpacked['markRead']>>", }, { f: rg.mute, imports: ['Channel', 'Unpacked'], type: - "Unpacked['mute']>>", + "Unpacked['mute']>>", }, { f: rg.muteStatus, imports: ['Channel', 'Unpacked'], type: - "Unpacked['muteStatus']>>", + "Unpacked['muteStatus']>>", }, { f: rg.muteUser, @@ -320,19 +320,19 @@ const executables = [ f: rg.partialUpdateUser, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['partialUpdateUser']>>", + "Unpacked['partialUpdateUser']>>", }, { f: rg.partialUpdateUsers, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['partialUpdateUsers']>>", + "Unpacked['partialUpdateUsers']>>", }, { f: rg.query, imports: ['Channel', 'Unpacked'], type: - "Unpacked['query']>>", + "Unpacked['query']>>", }, // TODO: Add this back in when queryBannedUsers is deployed to all shards for testing // { @@ -345,13 +345,13 @@ const executables = [ f: rg.queryMembers, imports: ['Channel', 'Unpacked'], type: - "Unpacked['queryMembers']>>", + "Unpacked['queryMembers']>>", }, { f: rg.queryUsers, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['queryUsers']>>", + "Unpacked['queryUsers']>>", }, { f: rg.reactivateUser, @@ -362,13 +362,13 @@ const executables = [ f: rg.rejectInvite, imports: ['Channel', 'Unpacked'], type: - "Unpacked['rejectInvite']>>", + "Unpacked['rejectInvite']>>", }, { f: rg.removeMembers, imports: ['Channel', 'Unpacked'], type: - "Unpacked['removeMembers']>>", + "Unpacked['removeMembers']>>", }, { f: rg.removeShadowBan, @@ -379,37 +379,37 @@ const executables = [ f: rg.sendAction, imports: ['Channel', 'Unpacked'], type: - "Unpacked['sendAction']>>", + "Unpacked['sendAction']>>", }, { f: rg.sendFile, imports: ['Channel', 'Unpacked'], type: - "Unpacked['sendFile']>>", + "Unpacked['sendFile']>>", }, { f: rg.sendImage, imports: ['Channel', 'Unpacked'], type: - "Unpacked['sendImage']>>", + "Unpacked['sendImage']>>", }, { f: rg.sendMessage, imports: ['Channel', 'Unpacked'], type: - "Unpacked['sendMessage']>>", + "Unpacked['sendMessage']>>", }, { f: rg.sendMessageReadEvent, imports: ['Channel', 'Unpacked'], type: - "Unpacked['sendEvent']>>", + "Unpacked['sendEvent']>>", }, { f: rg.sendReaction, imports: ['Channel', 'Unpacked'], type: - "Unpacked['sendReaction']>>", + "Unpacked['sendReaction']>>", }, { f: rg.setGuestUser, @@ -425,31 +425,31 @@ const executables = [ f: rg.show, imports: ['Channel', 'Unpacked'], type: - "Unpacked['show']>>", + "Unpacked['show']>>", }, { f: rg.stopTyping, imports: ['Channel', 'Unpacked'], type: - "Unpacked['stopTyping']>>", + "Unpacked['stopTyping']>>", }, { f: rg.stopWatching, imports: ['Channel', 'Unpacked'], type: - "Unpacked['stopWatching']>>", + "Unpacked['stopWatching']>>", }, { f: rg.sync, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['sync']>>", + "Unpacked['sync']>>", }, { f: rg.syncTeam, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['sync']>>", + "Unpacked['sync']>>", }, // Need translation on the account to run this test // { @@ -462,7 +462,7 @@ const executables = [ f: rg.truncateChannel, imports: ['Channel', 'Unpacked'], type: - "Unpacked['truncate']>>", + "Unpacked['truncate']>>", }, { f: rg.unbanUsers, @@ -473,7 +473,7 @@ const executables = [ f: rg.unmute, imports: ['Channel', 'Unpacked'], type: - "Unpacked['unmute']>>", + "Unpacked['unmute']>>", }, { f: rg.unmuteUser, @@ -489,19 +489,19 @@ const executables = [ f: rg.updateBlockList, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['updateBlockList']>>", + "Unpacked['updateBlockList']>>", }, { f: rg.updateChannel, imports: ['Channel', 'Unpacked'], type: - "Unpacked['update']>>", + "Unpacked['update']>>", }, { f: rg.updateChannelFromOriginal, imports: ['Channel', 'Unpacked'], type: - "Unpacked['update']>>", + "Unpacked['update']>>", }, { f: rg.updateChannelType, @@ -512,13 +512,13 @@ const executables = [ f: rg.updateCommand, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['updateCommand']>>", + "Unpacked['updateCommand']>>", }, { f: rg.updateMessage, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['updateMessage']>>", + "Unpacked['updateMessage']>>", }, { f: rg.updatePermission, @@ -529,19 +529,19 @@ const executables = [ f: rg.upsertUsers, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['upsertUsers']>>", + "Unpacked['upsertUsers']>>", }, { f: rg.upsertUser, imports: ['StreamChat', 'Unpacked'], type: - "Unpacked['upsertUser']>>", + "Unpacked['upsertUser']>>", }, { f: rg.watch, imports: ['Channel', 'Unpacked'], type: - "Unpacked['watch']>>", + "Unpacked['watch']>>", }, // Currently roles do not return diff --git a/test/typescript/unit-test.ts b/test/typescript/unit-test.ts index bd2d52f27..cb15fce26 100644 --- a/test/typescript/unit-test.ts +++ b/test/typescript/unit-test.ts @@ -40,6 +40,8 @@ type EventType = UR; type MessageType = UR; type ReactionType = UR; type CommandType = string & {}; +type PollType = UR; +type PollOptionType = UR; type StreamTypes = { attachmentType: AttachmentType; @@ -49,6 +51,8 @@ type StreamTypes = { messageType: MessageType; reactionType: ReactionType; userType: UserType; + pollType: PollType; + pollOptionType: PollOptionType; }; let voidReturn: void | { unsubscribe: () => void }; @@ -67,6 +71,8 @@ const clientWithoutSecret: StreamChat<{ messageType: {}; reactionType: {}; userType: UserType; + pollType: {}; + pollOptionType: {}; }> = new StreamChat<{ attachmentType: {}; channelType: ChannelType; @@ -75,6 +81,8 @@ const clientWithoutSecret: StreamChat<{ messageType: {}; reactionType: {}; userType: UserType; + pollType: {}; + pollOptionType: {}; }>(apiKey, { timeout: 3000, logger: (logLevel: string, msg: string, extraData?: Record) => {}, @@ -90,6 +98,8 @@ const singletonClient1: StreamChat<{ messageType: {}; reactionType: {}; userType: UserType; + pollType: {}; + pollOptionType: {}; }> = StreamChat.getInstance<{ attachmentType: {}; channelType: ChannelType; @@ -98,6 +108,8 @@ const singletonClient1: StreamChat<{ messageType: {}; reactionType: {}; userType: UserType; + pollType: {}; + pollOptionType: {}; }>(apiKey); const singletonClient2: StreamChat<{ @@ -108,6 +120,8 @@ const singletonClient2: StreamChat<{ messageType: {}; reactionType: {}; userType: UserType; + pollType: {}; + pollOptionType: {}; }> = StreamChat.getInstance<{ attachmentType: {}; channelType: ChannelType; @@ -116,6 +130,8 @@ const singletonClient2: StreamChat<{ messageType: {}; reactionType: {}; userType: UserType; + pollType: {}; + pollOptionType: {}; }>(apiKey, '', {}); const devToken: string = client.devToken('joshua');