From 12aa4af73cade951dec21ec9b94b343eb36ec296 Mon Sep 17 00:00:00 2001 From: Anton Arnautov <43254280+arnautov-anton@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:23:22 +0100 Subject: [PATCH 01/10] fix: revert membership initialization behavior (#1417) --- src/channel.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/channel.ts b/src/channel.ts index f20d33b4d4..023956250c 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -1720,10 +1720,7 @@ export class Channel Date: Fri, 13 Dec 2024 08:26:14 -0500 Subject: [PATCH 02/10] feat: add team to channel template (#1416) Co-authored-by: Lennart Kuijs Co-authored-by: Lennart <1247198+totalimmersion@users.noreply.github.com> --- src/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/types.ts b/src/types.ts index 8a7c01e8cf..a2405b9664 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2970,6 +2970,7 @@ export type CampaignData = { custom?: {}; id?: string; members?: string[]; + team?: string; }; create_channels?: boolean; deleted_at?: string; From 24f1c732d4375f7ca7d1471ff63a6566bc60028e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:34:25 +0100 Subject: [PATCH 03/10] chore: release v8.47.0 (#1418) Co-authored-by: github-actions --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e495b910dc..3ab9506e33 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.47.0](https://github.com/GetStream/stream-chat-js/compare/v8.46.1...v8.47.0) (2024-12-13) + + +### Features + +* add team to channel template ([#1416](https://github.com/GetStream/stream-chat-js/issues/1416)) ([56bc83e](https://github.com/GetStream/stream-chat-js/commit/56bc83ee94d5f9859ebb24edd5f20f9a3b86aaca)) + + +### Bug Fixes + +* revert membership initialization behavior ([#1417](https://github.com/GetStream/stream-chat-js/issues/1417)) ([12aa4af](https://github.com/GetStream/stream-chat-js/commit/12aa4af73cade951dec21ec9b94b343eb36ec296)) + ### [8.46.1](https://github.com/GetStream/stream-chat-js/compare/v8.46.0...v8.46.1) (2024-12-11) diff --git a/package.json b/package.json index bb9c427977..d4e52021c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stream-chat", - "version": "8.46.1", + "version": "8.47.0", "description": "JS SDK for the Stream Chat API", "author": "GetStream", "homepage": "https://getstream.io/chat/", From af5cb81051cc7f1964fb17072fd07a2dd9f0b74b Mon Sep 17 00:00:00 2001 From: Kanat Kiialbaev Date: Wed, 18 Dec 2024 11:11:32 -0500 Subject: [PATCH 04/10] fix(search): missing thread_participants in message (#1412) --- src/channel.ts | 2 ++ src/types.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/channel.ts b/src/channel.ts index 023956250c..538c6c42aa 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -60,6 +60,7 @@ import { AscDesc, PartialUpdateMemberAPIResponse, AIState, + MessageOptions, } from './types'; import { Role } from './permissions'; import { DEFAULT_QUERY_CHANNEL_MESSAGE_LIST_PAGE_SIZE } from './constants'; @@ -237,6 +238,7 @@ export class Channel; + message_options?: MessageOptions; query?: string; } = {}, ) { diff --git a/src/types.ts b/src/types.ts index a2405b9664..2bd1cd5d0e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1713,6 +1713,10 @@ export type MessageFilters; +export type MessageOptions = { + include_thread_participants?: boolean; +}; + export type PrimitiveFilter = ObjectType | null; export type QueryFilter = NonNullable extends string | number | boolean @@ -2738,6 +2742,7 @@ export type SearchPayload; message_filter_conditions?: MessageFilters; + message_options?: MessageOptions; query?: string; sort?: Array<{ direction: AscDesc; From b7b019afa9bbe4d25c40ef6874f9219172991b7d Mon Sep 17 00:00:00 2001 From: Matvei Andrienko Date: Wed, 18 Dec 2024 18:20:35 +0100 Subject: [PATCH 05/10] fix: message duplication when some messages have the same creation timestamp (#1421) --- src/thread.ts | 8 +-- src/utils.ts | 56 ++++++++++----- test/unit/utils.test.ts | 146 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 189 insertions(+), 21 deletions(-) diff --git a/src/thread.ts b/src/thread.ts index f8f39beef0..24bbe072bc 100644 --- a/src/thread.ts +++ b/src/thread.ts @@ -354,17 +354,15 @@ export class Thread { sortedArray: replies, sortDirection: 'ascending', 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; } const updatedReplies = [...replies]; - updatedReplies.splice(actualIndex, 1); + updatedReplies.splice(index, 1); this.state.partialNext({ replies: updatedReplies, diff --git a/src/utils.ts b/src/utils.ts index ba63af8b6a..acb78dad97 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -311,14 +311,26 @@ export function formatMessage({ needle, sortedArray, + selectKey, selectValueToCompare = (e) => e, sortDirection = 'ascending', }: { 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; + /** + * In an array of objects (like messages), pick a specific + * property to compare the needle value to. * * @example * ```ts @@ -353,11 +365,9 @@ export const findIndexInSortedArray = ({ const comparableMiddle = selectValueToCompare(sortedArray[middle]); - // if (comparableNeedle === comparableMiddle) return middle; - if ( (sortDirection === 'ascending' && comparableNeedle < comparableMiddle) || - (sortDirection === 'descending' && comparableNeedle > comparableMiddle) + (sortDirection === 'descending' && comparableNeedle >= comparableMiddle) ) { right = middle - 1; } else { @@ -365,6 +375,23 @@ export const findIndexInSortedArray = ({ } } + // 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; }; @@ -410,19 +437,18 @@ export function addToMessageList( sortDirection: 'ascending', // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 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; } // do not add updated or deleted messages to the list if they already exist or come with a timestamp change diff --git a/test/unit/utils.test.ts b/test/unit/utils.test.ts index 04f1078045..93be91c471 100644 --- a/test/unit/utils.test.ts +++ b/test/unit/utils.test.ts @@ -3,7 +3,7 @@ import { v4 as uuidv4 } from 'uuid'; import { generateMsg } from './test-utils/generateMessage'; -import { addToMessageList, formatMessage } from '../../src/utils'; +import { addToMessageList, findIndexInSortedArray, formatMessage } from '../../src/utils'; import type { FormatMessageResponse, MessageResponse } from '../../src'; @@ -105,3 +105,147 @@ describe('addToMessageList', () => { expect(messagesAfter[4]).to.equal(newMessage); }); }); + +describe('findIndexInSortedArray', () => { + it('finds index in the middle of haystack (asc)', () => { + const needle = 5; + const haystack = [1, 2, 3, 4, 6, 7, 8, 9]; + const index = findIndexInSortedArray({ needle, sortedArray: haystack, sortDirection: 'ascending' }); + expect(index).to.eq(4); + }); + + it('finds index at the top of haystack (asc)', () => { + const needle = 0; + const haystack = [1, 2, 3, 4, 6, 7, 8, 9]; + const index = findIndexInSortedArray({ needle, sortedArray: haystack, sortDirection: 'ascending' }); + expect(index).to.eq(0); + }); + + it('finds index at the bottom of haystack (asc)', () => { + const needle = 10; + const haystack = [1, 2, 3, 4, 6, 7, 8, 9]; + const index = findIndexInSortedArray({ needle, sortedArray: haystack, sortDirection: 'ascending' }); + expect(index).to.eq(8); + }); + + it('in a haystack with duplicates, prefers index closer to the bottom (asc)', () => { + const needle = 5; + const haystack = [1, 5, 5, 5, 5, 5, 8, 9]; + const index = findIndexInSortedArray({ needle, sortedArray: haystack, sortDirection: 'ascending' }); + expect(index).to.eq(6); + }); + + it('in a haystack with duplicates, look up an item by key (asc)', () => { + const haystack: [key: string, value: number][] = [ + ['one', 1], + ['five-1', 5], + ['five-2', 5], + ['five-3', 5], + ['nine', 9], + ]; + + const selectKey = (tuple: [key: string, value: number]) => tuple[0]; + const selectValue = (tuple: [key: string, value: number]) => tuple[1]; + + expect( + findIndexInSortedArray({ + needle: ['five-1', 5], + sortedArray: haystack, + sortDirection: 'ascending', + selectKey, + selectValueToCompare: selectValue, + }), + ).to.eq(1); + + expect( + findIndexInSortedArray({ + needle: ['five-2', 5], + sortedArray: haystack, + sortDirection: 'ascending', + selectKey, + selectValueToCompare: selectValue, + }), + ).to.eq(2); + + expect( + findIndexInSortedArray({ + needle: ['five-3', 5], + sortedArray: haystack, + sortDirection: 'ascending', + selectKey, + selectValueToCompare: selectValue, + }), + ).to.eq(3); + }); + + it('finds index in the middle of haystack (desc)', () => { + const needle = 5; + const haystack = [9, 8, 7, 6, 4, 3, 2, 1]; + const index = findIndexInSortedArray({ needle, sortedArray: haystack, sortDirection: 'descending' }); + expect(index).to.eq(4); + }); + + it('finds index at the top of haystack (desc)', () => { + const needle = 10; + const haystack = [9, 8, 7, 6, 4, 3, 2, 1]; + const index = findIndexInSortedArray({ needle, sortedArray: haystack, sortDirection: 'descending' }); + expect(index).to.eq(0); + }); + + it('finds index at the bottom of haystack (desc)', () => { + const needle = 0; + const haystack = [9, 8, 7, 6, 4, 3, 2, 1]; + const index = findIndexInSortedArray({ needle, sortedArray: haystack, sortDirection: 'descending' }); + expect(index).to.eq(8); + }); + + it('in a haystack with duplicates, prefers index closer to the top (desc)', () => { + const needle = 5; + const haystack = [9, 8, 5, 5, 5, 5, 5, 1]; + const index = findIndexInSortedArray({ needle, sortedArray: haystack, sortDirection: 'descending' }); + expect(index).to.eq(2); + }); + + it('in a haystack with duplicates, look up an item by key (desc)', () => { + const haystack: [key: string, value: number][] = [ + ['nine', 9], + ['five-1', 5], + ['five-2', 5], + ['five-3', 5], + ['one', 1], + ]; + + const selectKey = (tuple: [key: string, value: number]) => tuple[0]; + const selectValue = (tuple: [key: string, value: number]) => tuple[1]; + + expect( + findIndexInSortedArray({ + needle: ['five-1', 5], + sortedArray: haystack, + sortDirection: 'descending', + selectKey, + selectValueToCompare: selectValue, + }), + ).to.eq(1); + + expect( + findIndexInSortedArray({ + needle: ['five-2', 5], + sortedArray: haystack, + sortDirection: 'descending', + selectKey, + selectValueToCompare: selectValue, + }), + ).to.eq(2); + + expect( + findIndexInSortedArray({ + needle: ['five-3', 5], + sortedArray: haystack, + sortDirection: 'descending', + selectKey, + selectValueToCompare: selectValue, + }), + ).to.eq(3); + }); +}); From 745c60752155d2798f5b9ea339d953cfb378113d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:56:38 +0100 Subject: [PATCH 06/10] chore: release v8.47.1 (#1422) Co-authored-by: github-actions --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ab9506e33..d66506ce0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ 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.47.1](https://github.com/GetStream/stream-chat-js/compare/v8.47.0...v8.47.1) (2024-12-18) + + +### Bug Fixes + +* message duplication when some messages have the same creation timestamp ([#1421](https://github.com/GetStream/stream-chat-js/issues/1421)) ([b7b019a](https://github.com/GetStream/stream-chat-js/commit/b7b019afa9bbe4d25c40ef6874f9219172991b7d)) +* **search:** missing thread_participants in message ([#1412](https://github.com/GetStream/stream-chat-js/issues/1412)) ([af5cb81](https://github.com/GetStream/stream-chat-js/commit/af5cb81051cc7f1964fb17072fd07a2dd9f0b74b)) + ## [8.47.0](https://github.com/GetStream/stream-chat-js/compare/v8.46.1...v8.47.0) (2024-12-13) diff --git a/package.json b/package.json index d4e52021c0..3e31a9a304 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stream-chat", - "version": "8.47.0", + "version": "8.47.1", "description": "JS SDK for the Stream Chat API", "author": "GetStream", "homepage": "https://getstream.io/chat/", From ce204d169d6f383cfa36853086c891eb6d13a968 Mon Sep 17 00:00:00 2001 From: Varsh Date: Thu, 19 Dec 2024 15:47:09 +0100 Subject: [PATCH 07/10] feat(moderation): add custom check API (#1411) Co-authored-by: Vishal Narkhede --- src/moderation.ts | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/types.ts | 8 ++++++++ 2 files changed, 55 insertions(+) diff --git a/src/moderation.ts b/src/moderation.ts index f166670f0e..0bc339d568 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -18,6 +18,8 @@ import { QueryModerationConfigsFilters, QueryModerationConfigsSort, Pager, + CustomCheckFlag, + ReviewQueueItem, } from './types'; import { StreamChat } from './client'; import { normalizeQuerySort } from './utils'; @@ -255,4 +257,49 @@ export class Moderation} flags Array of CustomCheckFlag to be passed to flag the entity + * @returns + */ + async addCustomFlags( + entityType: string, + entityID: string, + entityCreatorID: string, + moderationPayload: { + images?: string[]; + texts?: string[]; + videos?: string[]; + }, + flags: CustomCheckFlag[], + ) { + return await this.client.post<{ id: string; item: ReviewQueueItem; status: string } & APIResponse>( + this.client.baseURL + `/api/v2/moderation/custom_check`, + { + entity_type: entityType, + entity_id: entityID, + entity_creator_id: entityCreatorID, + moderation_payload: moderationPayload, + flags, + }, + ); + } + + /** + * Add custom flags to a message + * @param {string} messageID Message ID to be flagged + * @param {Array} flags Array of CustomCheckFlag to be passed to flag the message + * @returns + */ + async addCustomMessageFlags(messageID: string, flags: CustomCheckFlag[]) { + return await this.addCustomFlags(MODERATION_ENTITY_TYPES.message, messageID, '', {}, flags); + } } diff --git a/src/types.ts b/src/types.ts index 2bd1cd5d0e..342e403022 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3420,6 +3420,14 @@ export type ReviewQueueItem = { updated_at: string; }; +export type CustomCheckFlag = { + type: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + custom?: Record[]; + labels?: string[]; + reason?: string; +}; + export type SubmitActionOptions = { ban?: { channel_ban_only?: boolean; From 83ab1845ee1e47ec69571109567c82f1f0bae329 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 17:08:41 +0100 Subject: [PATCH 08/10] chore: release v8.48.0 (#1424) Co-authored-by: github-actions --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d66506ce0f..bef7c8efa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ 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.48.0](https://github.com/GetStream/stream-chat-js/compare/v8.47.1...v8.48.0) (2024-12-20) + + +### Features + +* **moderation:** add custom check API ([#1411](https://github.com/GetStream/stream-chat-js/issues/1411)) ([ce204d1](https://github.com/GetStream/stream-chat-js/commit/ce204d169d6f383cfa36853086c891eb6d13a968)) + ### [8.47.1](https://github.com/GetStream/stream-chat-js/compare/v8.47.0...v8.47.1) (2024-12-18) diff --git a/package.json b/package.json index 3e31a9a304..600d6fd6f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stream-chat", - "version": "8.47.1", + "version": "8.48.0", "description": "JS SDK for the Stream Chat API", "author": "GetStream", "homepage": "https://getstream.io/chat/", From ef8736db680d43f2be48cfaeeb90754b071fa38b Mon Sep 17 00:00:00 2001 From: Vishal Narkhede Date: Mon, 23 Dec 2024 20:35:10 +0100 Subject: [PATCH 09/10] feat: multi tenancy moderation configuration support (#1426) --- src/moderation.ts | 13 +++-- src/types.ts | 138 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 142 insertions(+), 9 deletions(-) diff --git a/src/moderation.ts b/src/moderation.ts index 0bc339d568..d9be41da47 100644 --- a/src/moderation.ts +++ b/src/moderation.ts @@ -20,6 +20,7 @@ import { Pager, CustomCheckFlag, ReviewQueueItem, + QueryConfigsResponse, } from './types'; import { StreamChat } from './client'; import { normalizeQuerySort } from './utils'; @@ -174,7 +175,7 @@ export class Moderation(this.client.baseURL + '/api/v2/moderation/config', config); } @@ -182,12 +183,12 @@ export class Moderation(this.client.baseURL + '/api/v2/moderation/config/' + key); + async getConfig(key: string, data?: { team?: string }) { + return await this.client.get(this.client.baseURL + '/api/v2/moderation/config/' + key, data); } - async deleteConfig(key: string) { - return await this.client.delete(this.client.baseURL + '/api/v2/moderation/config/' + key); + async deleteConfig(key: string, data?: { team?: string }) { + return await this.client.delete(this.client.baseURL + '/api/v2/moderation/config/' + key, data); } /** @@ -201,7 +202,7 @@ export class Moderation(this.client.baseURL + '/api/v2/moderation/configs', { filter: filterConditions, sort, ...options, diff --git a/src/types.ts b/src/types.ts index 342e403022..8fbc937d48 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3466,6 +3466,8 @@ export type QueryModerationConfigsFilters = QueryFilters< created_at?: PrimitiveFilter; } & { updated_at?: PrimitiveFilter; + } & { + team?: string; } >; @@ -3535,14 +3537,35 @@ export type ReviewQueueResponse = { prev?: string; }; -export type ModerationConfig = {}; +export type ModerationConfig = { + key: string; + ai_image_config?: AIImageConfig; + ai_text_config?: AITextConfig; + ai_video_config?: AIVideoConfig; + automod_platform_circumvention_config?: AutomodPlatformCircumventionConfig; + automod_semantic_filters_config?: AutomodSemanticFiltersConfig; + automod_toxicity_config?: AutomodToxicityConfig; + block_list_config?: BlockListConfig; + team?: string; +}; + +export type ModerationConfigResponse = ModerationConfig & { + created_at: string; + updated_at: string; +}; export type GetConfigResponse = { - config: ModerationConfig; + config: ModerationConfigResponse; +}; + +export type QueryConfigsResponse = { + configs: ModerationConfigResponse[]; + next?: string; + prev?: string; }; export type UpsertConfigResponse = { - config: ModerationConfig; + config: ModerationConfigResponse; }; export type ModerationFlagOptions = { @@ -3567,3 +3590,112 @@ export type AIState = | 'AI_STATE_THINKING' | 'AI_STATE_GENERATING' | (string & {}); + +export type ModerationActionType = 'flag' | 'shadow' | 'remove' | 'bounce' | 'bounce_flag' | 'bounce_remove'; + +export type AutomodRule = { + action: ModerationActionType; + label: string; + threshold: number; +}; + +export type BlockListRule = { + action: ModerationActionType; + name?: string; +}; + +export type BlockListConfig = { + enabled: boolean; + rules: BlockListRule[]; + async?: boolean; +}; + +export type AutomodToxicityConfig = { + enabled: boolean; + rules: AutomodRule[]; + async?: boolean; +}; + +export type AutomodPlatformCircumventionConfig = { + enabled: boolean; + rules: AutomodRule[]; + async?: boolean; +}; + +export type AutomodSemanticFiltersRule = { + action: ModerationActionType; + name: string; + threshold: number; +}; + +export type AutomodSemanticFiltersConfig = { + enabled: boolean; + rules: AutomodSemanticFiltersRule[]; + async?: boolean; +}; + +export type AITextSeverityRule = { + action: ModerationActionType; + severity: 'low' | 'medium' | 'high' | 'critical'; +}; + +export type AITextRule = { + label: string; + action?: ModerationActionType; + severity_rules?: AITextSeverityRule[]; +}; + +export type AITextConfig = { + enabled: boolean; + rules: AITextRule[]; + async?: boolean; + profile?: string; + severity_rules?: AITextSeverityRule[]; // Deprecated: use rules instead +}; + +export type AIImageRule = { + action: ModerationActionType; + label: string; + min_confidence?: number; +}; + +export type AIImageConfig = { + enabled: boolean; + rules: AIImageRule[]; + async?: boolean; +}; + +export type AIVideoRule = { + action: ModerationActionType; + label: string; + min_confidence?: number; +}; + +export type AIVideoConfig = { + enabled: boolean; + rules: AIVideoRule[]; + async?: boolean; +}; + +export type VelocityFilterConfigRule = { + action: 'flag' | 'shadow' | 'remove' | 'ban'; + ban_duration?: number; + cascading_action?: 'flag' | 'shadow' | 'remove' | 'ban'; + cascading_threshold?: number; + check_message_context?: boolean; + fast_spam_threshold?: number; + fast_spam_ttl?: number; + ip_ban?: boolean; + shadow_ban?: boolean; + slow_spam_ban_duration?: number; + slow_spam_threshold?: number; + slow_spam_ttl?: number; +}; + +export type VelocityFilterConfig = { + cascading_actions: boolean; + enabled: boolean; + first_message_only: boolean; + rules: VelocityFilterConfigRule[]; + async?: boolean; +}; From 0478adb4e6db39ca12e170e38399bc1b6fb819d8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:36:29 +0100 Subject: [PATCH 10/10] chore: release v8.49.0 (#1427) Co-authored-by: github-actions --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bef7c8efa1..833e2a1416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ 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.49.0](https://github.com/GetStream/stream-chat-js/compare/v8.48.0...v8.49.0) (2024-12-23) + + +### Features + +* multi tenancy moderation configuration support ([#1426](https://github.com/GetStream/stream-chat-js/issues/1426)) ([ef8736d](https://github.com/GetStream/stream-chat-js/commit/ef8736db680d43f2be48cfaeeb90754b071fa38b)) + ## [8.48.0](https://github.com/GetStream/stream-chat-js/compare/v8.47.1...v8.48.0) (2024-12-20) diff --git a/package.json b/package.json index 600d6fd6f3..b83403b536 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stream-chat", - "version": "8.48.0", + "version": "8.49.0", "description": "JS SDK for the Stream Chat API", "author": "GetStream", "homepage": "https://getstream.io/chat/",