stream-chat 8.47.1 → 8.49.0

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.
@@ -1,4 +1,4 @@
1
- import { APIResponse, ModerationConfig, DefaultGenerics, ExtendableGenerics, GetConfigResponse, GetUserModerationReportResponse, ReviewQueueFilters, ReviewQueuePaginationOptions, ReviewQueueResponse, ReviewQueueSort, UpsertConfigResponse, ModerationFlagOptions, ModerationMuteOptions, GetUserModerationReportOptions, SubmitActionOptions, QueryModerationConfigsFilters, QueryModerationConfigsSort, Pager } from './types';
1
+ import { APIResponse, ModerationConfig, DefaultGenerics, ExtendableGenerics, GetConfigResponse, GetUserModerationReportResponse, ReviewQueueFilters, ReviewQueuePaginationOptions, ReviewQueueResponse, ReviewQueueSort, UpsertConfigResponse, ModerationFlagOptions, ModerationMuteOptions, GetUserModerationReportOptions, SubmitActionOptions, QueryModerationConfigsFilters, QueryModerationConfigsSort, Pager, CustomCheckFlag, ReviewQueueItem, QueryConfigsResponse } from './types';
2
2
  import { StreamChat } from './client';
3
3
  export declare const MODERATION_ENTITY_TYPES: {
4
4
  user: string;
@@ -94,20 +94,24 @@ export declare class Moderation<StreamChatGenerics extends ExtendableGenerics =
94
94
  * Upsert moderation config
95
95
  * @param {Object} config Moderation config to be upserted
96
96
  */
97
- upsertConfig(config?: ModerationConfig): Promise<UpsertConfigResponse>;
97
+ upsertConfig(config: ModerationConfig): Promise<UpsertConfigResponse>;
98
98
  /**
99
99
  * Get moderation config
100
100
  * @param {string} key Key for which moderation config is to be fetched
101
101
  */
102
- getConfig(key: string): Promise<GetConfigResponse>;
103
- deleteConfig(key: string): Promise<unknown>;
102
+ getConfig(key: string, data?: {
103
+ team?: string;
104
+ }): Promise<GetConfigResponse>;
105
+ deleteConfig(key: string, data?: {
106
+ team?: string;
107
+ }): Promise<unknown>;
104
108
  /**
105
109
  * Query moderation configs
106
110
  * @param {Object} filterConditions Filter conditions for querying moderation configs
107
111
  * @param {Object} sort Sort conditions for querying moderation configs
108
112
  * @param {Object} options Additional options for querying moderation configs
109
113
  */
110
- queryConfigs(filterConditions: QueryModerationConfigsFilters, sort: QueryModerationConfigsSort, options?: Pager): Promise<unknown>;
114
+ queryConfigs(filterConditions: QueryModerationConfigsFilters, sort: QueryModerationConfigsSort, options?: Pager): Promise<QueryConfigsResponse>;
111
115
  submitAction(actionType: string, itemID: string, options?: SubmitActionOptions): Promise<{
112
116
  item_id: string;
113
117
  } & APIResponse>;
@@ -132,5 +136,37 @@ export declare class Moderation<StreamChatGenerics extends ExtendableGenerics =
132
136
  }, configKey: string, options?: {
133
137
  force_sync?: boolean;
134
138
  }): Promise<unknown>;
139
+ /**
140
+ *
141
+ * @param {string} entityType string Type of entity to be checked E.g., stream:user, stream:chat:v1:message, or any custom string
142
+ * @param {string} entityID string ID of the entity to be checked. This is mainly for tracking purposes
143
+ * @param {string} entityCreatorID string ID of the entity creator
144
+ * @param {object} moderationPayload object Content to be checked for moderation. E.g., { texts: ['text1', 'text2'], images: ['image1', 'image2']}
145
+ * @param {Array} moderationPayload.texts array Array of texts to be checked for moderation
146
+ * @param {Array} moderationPayload.images array Array of images to be checked for moderation
147
+ * @param {Array} moderationPayload.videos array Array of videos to be checked for moderation
148
+ * @param {Array<CustomCheckFlag>} flags Array of CustomCheckFlag to be passed to flag the entity
149
+ * @returns
150
+ */
151
+ addCustomFlags(entityType: string, entityID: string, entityCreatorID: string, moderationPayload: {
152
+ images?: string[];
153
+ texts?: string[];
154
+ videos?: string[];
155
+ }, flags: CustomCheckFlag[]): Promise<{
156
+ id: string;
157
+ item: ReviewQueueItem;
158
+ status: string;
159
+ } & APIResponse>;
160
+ /**
161
+ * Add custom flags to a message
162
+ * @param {string} messageID Message ID to be flagged
163
+ * @param {Array<CustomCheckFlag>} flags Array of CustomCheckFlag to be passed to flag the message
164
+ * @returns
165
+ */
166
+ addCustomMessageFlags(messageID: string, flags: CustomCheckFlag[]): Promise<{
167
+ id: string;
168
+ item: ReviewQueueItem;
169
+ status: string;
170
+ } & APIResponse>;
135
171
  }
136
172
  //# sourceMappingURL=moderation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"moderation.d.ts","sourceRoot":"","sources":["../../src/moderation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,+BAA+B,EAE/B,kBAAkB,EAClB,4BAA4B,EAC5B,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,8BAA8B,EAC9B,mBAAmB,EACnB,6BAA6B,EAC7B,0BAA0B,EAC1B,KAAK,EACN,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,eAAO,MAAM,uBAAuB;;;CAGnC,CAAC;AAGF,qBAAa,UAAU,CAAC,kBAAkB,SAAS,kBAAkB,GAAG,eAAe;IACrF,MAAM,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC;gBAE3B,MAAM,EAAE,UAAU,CAAC,kBAAkB,CAAC;IAIlD;;;;;;;;;OASG;IACG,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B;;;IAIzF;;;;;;;;;OASG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B;;;IAIxF;;;;;;;;;;;;OAYG;IACG,IAAI,CACR,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,qBAA0B;iBAEM,MAAM;;IASjD;;;;;;;OAOG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B;;;;;IAUpE;;;;;;OAMG;IACG,UAAU,CACd,QAAQ,EAAE,MA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AEY,MAAM;cAAQ,eAAe;gBAAU,MAAM;;IAYnF;;;;;OAKG;IACG,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE;;;;;CAGxE"}
@@ -2489,6 +2489,12 @@ export declare type ReviewQueueItem = {
2489
2489
  status: string;
2490
2490
  updated_at: string;
2491
2491
  };
2492
+ export declare type CustomCheckFlag = {
2493
+ type: string;
2494
+ custom?: Record<string, any>[];
2495
+ labels?: string[];
2496
+ reason?: string;
2497
+ };
2492
2498
  export declare type SubmitActionOptions = {
2493
2499
  ban?: {
2494
2500
  channel_ban_only?: boolean;
@@ -2524,6 +2530,8 @@ export declare type QueryModerationConfigsFilters = QueryFilters<{
2524
2530
  created_at?: PrimitiveFilter<string>;
2525
2531
  } & {
2526
2532
  updated_at?: PrimitiveFilter<string>;
2533
+ } & {
2534
+ team?: string;
2527
2535
  }>;
2528
2536
  export declare type ReviewQueueFilters = QueryFilters<{
2529
2537
  assigned_to?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['assigned_to']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['assigned_to']>;
@@ -2562,12 +2570,31 @@ export declare type ReviewQueueResponse = {
2562
2570
  next?: string;
2563
2571
  prev?: string;
2564
2572
  };
2565
- export declare type ModerationConfig = {};
2573
+ export declare type ModerationConfig = {
2574
+ key: string;
2575
+ ai_image_config?: AIImageConfig;
2576
+ ai_text_config?: AITextConfig;
2577
+ ai_video_config?: AIVideoConfig;
2578
+ automod_platform_circumvention_config?: AutomodPlatformCircumventionConfig;
2579
+ automod_semantic_filters_config?: AutomodSemanticFiltersConfig;
2580
+ automod_toxicity_config?: AutomodToxicityConfig;
2581
+ block_list_config?: BlockListConfig;
2582
+ team?: string;
2583
+ };
2584
+ export declare type ModerationConfigResponse = ModerationConfig & {
2585
+ created_at: string;
2586
+ updated_at: string;
2587
+ };
2566
2588
  export declare type GetConfigResponse = {
2567
- config: ModerationConfig;
2589
+ config: ModerationConfigResponse;
2590
+ };
2591
+ export declare type QueryConfigsResponse = {
2592
+ configs: ModerationConfigResponse[];
2593
+ next?: string;
2594
+ prev?: string;
2568
2595
  };
2569
2596
  export declare type UpsertConfigResponse = {
2570
- config: ModerationConfig;
2597
+ config: ModerationConfigResponse;
2571
2598
  };
2572
2599
  export declare type ModerationFlagOptions = {
2573
2600
  custom?: Record<string, unknown>;
@@ -2584,5 +2611,97 @@ export declare type GetUserModerationReportOptions = {
2584
2611
  include_user_mutes?: boolean;
2585
2612
  };
2586
2613
  export declare type AIState = 'AI_STATE_ERROR' | 'AI_STATE_CHECKING_SOURCES' | 'AI_STATE_THINKING' | 'AI_STATE_GENERATING' | (string & {});
2614
+ export declare type ModerationActionType = 'flag' | 'shadow' | 'remove' | 'bounce' | 'bounce_flag' | 'bounce_remove';
2615
+ export declare type AutomodRule = {
2616
+ action: ModerationActionType;
2617
+ label: string;
2618
+ threshold: number;
2619
+ };
2620
+ export declare type BlockListRule = {
2621
+ action: ModerationActionType;
2622
+ name?: string;
2623
+ };
2624
+ export declare type BlockListConfig = {
2625
+ enabled: boolean;
2626
+ rules: BlockListRule[];
2627
+ async?: boolean;
2628
+ };
2629
+ export declare type AutomodToxicityConfig = {
2630
+ enabled: boolean;
2631
+ rules: AutomodRule[];
2632
+ async?: boolean;
2633
+ };
2634
+ export declare type AutomodPlatformCircumventionConfig = {
2635
+ enabled: boolean;
2636
+ rules: AutomodRule[];
2637
+ async?: boolean;
2638
+ };
2639
+ export declare type AutomodSemanticFiltersRule = {
2640
+ action: ModerationActionType;
2641
+ name: string;
2642
+ threshold: number;
2643
+ };
2644
+ export declare type AutomodSemanticFiltersConfig = {
2645
+ enabled: boolean;
2646
+ rules: AutomodSemanticFiltersRule[];
2647
+ async?: boolean;
2648
+ };
2649
+ export declare type AITextSeverityRule = {
2650
+ action: ModerationActionType;
2651
+ severity: 'low' | 'medium' | 'high' | 'critical';
2652
+ };
2653
+ export declare type AITextRule = {
2654
+ label: string;
2655
+ action?: ModerationActionType;
2656
+ severity_rules?: AITextSeverityRule[];
2657
+ };
2658
+ export declare type AITextConfig = {
2659
+ enabled: boolean;
2660
+ rules: AITextRule[];
2661
+ async?: boolean;
2662
+ profile?: string;
2663
+ severity_rules?: AITextSeverityRule[];
2664
+ };
2665
+ export declare type AIImageRule = {
2666
+ action: ModerationActionType;
2667
+ label: string;
2668
+ min_confidence?: number;
2669
+ };
2670
+ export declare type AIImageConfig = {
2671
+ enabled: boolean;
2672
+ rules: AIImageRule[];
2673
+ async?: boolean;
2674
+ };
2675
+ export declare type AIVideoRule = {
2676
+ action: ModerationActionType;
2677
+ label: string;
2678
+ min_confidence?: number;
2679
+ };
2680
+ export declare type AIVideoConfig = {
2681
+ enabled: boolean;
2682
+ rules: AIVideoRule[];
2683
+ async?: boolean;
2684
+ };
2685
+ export declare type VelocityFilterConfigRule = {
2686
+ action: 'flag' | 'shadow' | 'remove' | 'ban';
2687
+ ban_duration?: number;
2688
+ cascading_action?: 'flag' | 'shadow' | 'remove' | 'ban';
2689
+ cascading_threshold?: number;
2690
+ check_message_context?: boolean;
2691
+ fast_spam_threshold?: number;
2692
+ fast_spam_ttl?: number;
2693
+ ip_ban?: boolean;
2694
+ shadow_ban?: boolean;
2695
+ slow_spam_ban_duration?: number;
2696
+ slow_spam_threshold?: number;
2697
+ slow_spam_ttl?: number;
2698
+ };
2699
+ export declare type VelocityFilterConfig = {
2700
+ cascading_actions: boolean;
2701
+ enabled: boolean;
2702
+ first_message_only: boolean;
2703
+ rules: VelocityFilterConfigRule[];
2704
+ async?: boolean;
2705
+ };
2587
2706
  export {};
2588
2707
  //# sourceMappingURL=types.d.ts.map