stream-chat 9.30.0 → 9.31.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.
@@ -34,6 +34,11 @@ export type MessageComposerState = {
34
34
  pollId: string | null;
35
35
  quotedMessage: LocalMessageBase | null;
36
36
  showReplyInChannel: boolean;
37
+ /**
38
+ * Baseline snapshot of the message being edited (if any).
39
+ * This is intentionally immutable with respect to the editing session and can be used for restore/cancel.
40
+ */
41
+ editedMessage: LocalMessage | null;
37
42
  };
38
43
  export type MessageComposerOptions = {
39
44
  client: StreamChat;
@@ -49,7 +54,6 @@ export declare class MessageComposer extends WithSubscriptions {
49
54
  readonly compositionContext: CompositionContext;
50
55
  readonly compositionMiddlewareExecutor: MessageComposerMiddlewareExecutor;
51
56
  readonly draftCompositionMiddlewareExecutor: MessageDraftComposerMiddlewareExecutor;
52
- editedMessage?: LocalMessage;
53
57
  attachmentManager: AttachmentManager;
54
58
  linkPreviewsManager: LinkPreviewsManager;
55
59
  textComposer: TextComposer;
@@ -61,6 +65,9 @@ export declare class MessageComposer extends WithSubscriptions {
61
65
  static constructTag(compositionContext: CompositionContext): `${ReturnType<typeof MessageComposer.evaluateContextType>}_${string}`;
62
66
  static generateId: typeof generateUUIDv4;
63
67
  get config(): MessageComposerConfig;
68
+ get editedMessage(): LocalMessage | undefined;
69
+ set editedMessage(editedMessage: LocalMessage | undefined);
70
+ setEditedMessage: (editedMessage: LocalMessage | null | undefined) => void;
64
71
  get contextType(): "channel" | "message" | "thread" | "legacy_thread";
65
72
  get tag(): `channel_${string}` | `message_${string}` | `thread_${string}` | `legacy_thread_${string}`;
66
73
  get threadId(): string | null;
@@ -1,4 +1,4 @@
1
- import type { APIResponse, CustomCheckFlag, GetConfigResponse, GetUserModerationReportOptions, GetUserModerationReportResponse, ModerationConfig, ModerationFlagOptions, ModerationMuteOptions, ModerationRule, ModerationRuleRequest, Pager, QueryConfigsResponse, QueryModerationConfigsFilters, QueryModerationConfigsSort, QueryModerationRulesFilters, QueryModerationRulesResponse, QueryModerationRulesSort, RequireAtLeastOne, ReviewQueueFilters, ReviewQueueItem, ReviewQueuePaginationOptions, ReviewQueueResponse, ReviewQueueSort, SubmitActionOptions, UpsertConfigResponse, UpsertModerationRuleResponse } from './types';
1
+ import type { APIResponse, CheckResponse, CustomCheckFlag, CustomCheckResponse, GetConfigResponse, GetUserModerationReportOptions, GetUserModerationReportResponse, ModerationConfig, ModerationFlagOptions, ModerationMuteOptions, ModerationRule, ModerationRuleRequest, Pager, QueryConfigsResponse, QueryModerationConfigsFilters, QueryModerationConfigsSort, QueryModerationRulesFilters, QueryModerationRulesResponse, QueryModerationRulesSort, RequireAtLeastOne, ReviewQueueFilters, ReviewQueuePaginationOptions, ReviewQueueResponse, ReviewQueueSort, SubmitActionOptions, SubmitActionResponse, UnmuteUserResponse, UpsertConfigResponse, UpsertModerationRuleResponse } from './types';
2
2
  import type { StreamChat } from './client';
3
3
  export declare const MODERATION_ENTITY_TYPES: {
4
4
  user: string;
@@ -62,6 +62,7 @@ export declare class Moderation {
62
62
  mute?: import("./types").MuteResponse;
63
63
  mutes?: Array<import("./types").Mute>;
64
64
  own_user?: import("./types").OwnUserResponse;
65
+ non_existing_users?: string[];
65
66
  }>;
66
67
  /**
67
68
  * Unmute a user
@@ -72,9 +73,7 @@ export declare class Moderation {
72
73
  */
73
74
  unmuteUser(targetID: string, options: {
74
75
  user_id?: string;
75
- }): Promise<{
76
- item_id: string;
77
- } & APIResponse>;
76
+ }): Promise<UnmuteUserResponse>;
78
77
  /**
79
78
  * Get moderation report for a user
80
79
  * @param {string} userID User ID for which moderation report is to be fetched
@@ -105,7 +104,7 @@ export declare class Moderation {
105
104
  }): Promise<GetConfigResponse>;
106
105
  deleteConfig(key: string, data?: {
107
106
  team?: string;
108
- }): Promise<unknown>;
107
+ }): Promise<APIResponse>;
109
108
  /**
110
109
  * Query moderation configs
111
110
  * @param {Object} filterConditions Filter conditions for querying moderation configs
@@ -113,9 +112,7 @@ export declare class Moderation {
113
112
  * @param {Object} options Additional options for querying moderation configs
114
113
  */
115
114
  queryConfigs(filterConditions: QueryModerationConfigsFilters, sort: QueryModerationConfigsSort, options?: Pager): Promise<QueryConfigsResponse>;
116
- submitAction(actionType: string, itemID: string, options?: SubmitActionOptions): Promise<{
117
- item_id: string;
118
- } & APIResponse>;
115
+ submitAction(actionType: string, itemID: string, options?: SubmitActionOptions): Promise<SubmitActionResponse>;
119
116
  /**
120
117
  *
121
118
  * @param {string} entityType string Type of entity to be checked E.g., stream:user, stream:chat:v1:message, or any custom string
@@ -137,7 +134,7 @@ export declare class Moderation {
137
134
  }, configKey: string, options?: {
138
135
  force_sync?: boolean;
139
136
  test_mode?: boolean;
140
- }): Promise<unknown>;
137
+ }): Promise<CheckResponse>;
141
138
  /**
142
139
  * Experimental: Check user profile
143
140
  *
@@ -166,7 +163,7 @@ export declare class Moderation {
166
163
  checkUserProfile(userId: string, profile: RequireAtLeastOne<{
167
164
  image?: string;
168
165
  username?: string;
169
- }>): Promise<unknown>;
166
+ }>): Promise<CheckResponse>;
170
167
  /**
171
168
  *
172
169
  * @param {string} entityType string Type of entity to be checked E.g., stream:user, stream:chat:v1:message, or any custom string
@@ -183,22 +180,14 @@ export declare class Moderation {
183
180
  images?: string[];
184
181
  texts?: string[];
185
182
  videos?: string[];
186
- }, flags: CustomCheckFlag[]): Promise<{
187
- id: string;
188
- item: ReviewQueueItem;
189
- status: string;
190
- } & APIResponse>;
183
+ }, flags: CustomCheckFlag[]): Promise<CustomCheckResponse>;
191
184
  /**
192
185
  * Add custom flags to a message
193
186
  * @param {string} messageID Message ID to be flagged
194
187
  * @param {Array<CustomCheckFlag>} flags Array of CustomCheckFlag to be passed to flag the message
195
188
  * @returns
196
189
  */
197
- addCustomMessageFlags(messageID: string, flags: CustomCheckFlag[]): Promise<{
198
- id: string;
199
- item: ReviewQueueItem;
200
- status: string;
201
- } & APIResponse>;
190
+ addCustomMessageFlags(messageID: string, flags: CustomCheckFlag[]): Promise<CustomCheckResponse>;
202
191
  /**
203
192
  * Create or update a moderation rule
204
193
  * @param {ModerationRuleRequest} rule Rule configuration to be upserted
@@ -226,5 +215,5 @@ export declare class Moderation {
226
215
  * @param {string} id ID of the moderation rule to delete
227
216
  * @returns
228
217
  */
229
- deleteModerationRule(id: string): Promise<unknown>;
218
+ deleteModerationRule(id: string): Promise<APIResponse>;
230
219
  }
@@ -296,6 +296,7 @@ export type QueryReactionsAPIResponse = APIResponse & {
296
296
  };
297
297
  export type QueryChannelsAPIResponse = APIResponse & {
298
298
  channels: Omit<ChannelAPIResponse, keyof APIResponse>[];
299
+ predefined_filter?: ParsedPredefinedFilterResponse;
299
300
  };
300
301
  export type QueryChannelAPIResponse = APIResponse & ChannelAPIResponse;
301
302
  export type ChannelAPIResponse = {
@@ -683,6 +684,10 @@ export type MuteUserResponse = APIResponse & {
683
684
  mute?: MuteResponse;
684
685
  mutes?: Array<Mute>;
685
686
  own_user?: OwnUserResponse;
687
+ non_existing_users?: string[];
688
+ };
689
+ export type UnmuteUserResponse = APIResponse & {
690
+ non_existing_users?: string[];
686
691
  };
687
692
  export type BlockUserAPIResponse = APIResponse & {
688
693
  blocked_at: string;
@@ -2698,6 +2703,7 @@ export type ReviewQueueItem = {
2698
2703
  created_by: string;
2699
2704
  entity_id: string;
2700
2705
  entity_type: string;
2706
+ entity_creator_id?: string;
2701
2707
  flags: ModerationFlag[];
2702
2708
  has_image: boolean;
2703
2709
  has_text: boolean;
@@ -2711,6 +2717,7 @@ export type ReviewQueueItem = {
2711
2717
  reviewed_at: string;
2712
2718
  status: string;
2713
2719
  updated_at: string;
2720
+ latest_moderator_action?: string;
2714
2721
  };
2715
2722
  export type CustomCheckFlag = {
2716
2723
  type: string;
@@ -2745,6 +2752,9 @@ export type SubmitActionOptions = {
2745
2752
  };
2746
2753
  user_id?: string;
2747
2754
  };
2755
+ export type SubmitActionResponse = APIResponse & {
2756
+ item?: ReviewQueueItem;
2757
+ };
2748
2758
  export type GetUserModerationReportResponse = {
2749
2759
  user: UserResponse;
2750
2760
  user_blocks?: Array<{
@@ -2754,6 +2764,17 @@ export type GetUserModerationReportResponse = {
2754
2764
  }>;
2755
2765
  user_mutes?: Mute[];
2756
2766
  };
2767
+ export type CheckResponse = APIResponse & {
2768
+ status: string;
2769
+ task_id?: string;
2770
+ recommended_action: string;
2771
+ item?: ReviewQueueItem;
2772
+ };
2773
+ export type CustomCheckResponse = APIResponse & {
2774
+ id: string;
2775
+ item: ReviewQueueItem;
2776
+ status: string;
2777
+ };
2757
2778
  export type QueryModerationConfigsFilters = QueryFilters<{
2758
2779
  key?: string;
2759
2780
  } & {
@@ -2777,6 +2798,8 @@ export type ReviewQueueFilters = QueryFilters<{
2777
2798
  id?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['id']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['id']>;
2778
2799
  } & {
2779
2800
  entity_id?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['entity_id']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['entity_id']>;
2801
+ } & {
2802
+ entity_creator_id?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['entity_creator_id']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['entity_creator_id']>;
2780
2803
  } & {
2781
2804
  reviewed?: boolean;
2782
2805
  } & {
@@ -2812,6 +2835,7 @@ export type ReviewQueueFilters = QueryFilters<{
2812
2835
  } & {
2813
2836
  recommended_action?: RequireOnlyOne<{
2814
2837
  $eq?: string;
2838
+ $in?: string[];
2815
2839
  }>;
2816
2840
  } & {
2817
2841
  flagged_user_id?: RequireOnlyOne<{
@@ -2824,6 +2848,7 @@ export type ReviewQueueFilters = QueryFilters<{
2824
2848
  } & {
2825
2849
  label?: RequireOnlyOne<{
2826
2850
  $eq?: string;
2851
+ $in?: string[];
2827
2852
  }>;
2828
2853
  } & {
2829
2854
  reporter_type?: RequireOnlyOne<{
@@ -2838,12 +2863,41 @@ export type ReviewQueueFilters = QueryFilters<{
2838
2863
  date_range?: RequireOnlyOne<{
2839
2864
  $eq?: string;
2840
2865
  }>;
2866
+ } & {
2867
+ latest_moderator_action?: RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['latest_moderator_action']>, '$eq' | '$in'>> | PrimitiveFilter<ReviewQueueItem['latest_moderator_action']>;
2868
+ } & {
2869
+ flags_count?: RequireOnlyOne<{
2870
+ $eq?: number;
2871
+ }>;
2872
+ } & {
2873
+ ai_text_severity?: RequireOnlyOne<{
2874
+ $eq?: string;
2875
+ }>;
2876
+ } & {
2877
+ channel_cid?: RequireOnlyOne<{
2878
+ $eq?: string;
2879
+ }>;
2841
2880
  }>;
2842
2881
  export type ReviewQueueSort = Sort<Pick<ReviewQueueItem, 'id' | 'created_at' | 'updated_at'>> | Array<Sort<Pick<ReviewQueueItem, 'id' | 'created_at' | 'updated_at'>>>;
2843
2882
  export type QueryModerationConfigsSort = Array<Sort<'key' | 'created_at' | 'updated_at'>>;
2844
2883
  export type ReviewQueuePaginationOptions = Pager;
2884
+ export type FilterConfigResponse = {
2885
+ llm_labels: string[];
2886
+ ai_text_labels?: string[];
2887
+ };
2888
+ export type ModerationActionConfig = {
2889
+ entity_type: string;
2890
+ order: number;
2891
+ action: string;
2892
+ icon: string;
2893
+ description: string;
2894
+ custom?: Record<string, unknown>;
2895
+ };
2845
2896
  export type ReviewQueueResponse = {
2846
2897
  items: ReviewQueueItem[];
2898
+ action_config?: Record<string, ModerationActionConfig[]>;
2899
+ filter_config?: FilterConfigResponse;
2900
+ stats?: Record<string, unknown>;
2847
2901
  next?: string;
2848
2902
  prev?: string;
2849
2903
  };
@@ -3395,6 +3449,15 @@ export type ListPredefinedFiltersResponse = APIResponse & {
3395
3449
  next?: string;
3396
3450
  prev?: string;
3397
3451
  };
3452
+ /**
3453
+ * Contains the interpolated filter and sort from a predefined filter.
3454
+ * This is returned in the QueryChannels response when using a predefined filter.
3455
+ */
3456
+ export type ParsedPredefinedFilterResponse = {
3457
+ name: string;
3458
+ filter: Record<string, unknown>;
3459
+ sort?: PredefinedFilterSortParam[];
3460
+ };
3398
3461
  export type PredefinedFilterSort = SortParam[];
3399
3462
  export type ListPredefinedFiltersOptions = Pager & {
3400
3463
  sort?: PredefinedFilterSort;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat",
3
- "version": "9.30.0",
3
+ "version": "9.31.0",
4
4
  "description": "JS SDK for the Stream Chat API",
5
5
  "homepage": "https://getstream.io/chat/",
6
6
  "author": {
@@ -49,6 +49,11 @@ export type MessageComposerState = {
49
49
  pollId: string | null;
50
50
  quotedMessage: LocalMessageBase | null;
51
51
  showReplyInChannel: boolean;
52
+ /**
53
+ * Baseline snapshot of the message being edited (if any).
54
+ * This is intentionally immutable with respect to the editing session and can be used for restore/cancel.
55
+ */
56
+ editedMessage: LocalMessage | null;
52
57
  };
53
58
 
54
59
  export type MessageComposerOptions = {
@@ -91,10 +96,14 @@ const initState = (
91
96
  pollId: null,
92
97
  quotedMessage: null,
93
98
  showReplyInChannel: false,
99
+ editedMessage: null,
94
100
  };
95
101
  }
96
102
 
97
103
  const quotedMessage = composition.quoted_message;
104
+ const editedMessage = compositionIsDraftResponse(composition)
105
+ ? null
106
+ : formatMessage(composition);
98
107
  let message;
99
108
  let draftId = null;
100
109
  let id = MessageComposer.generateId(); // do not use draft id for messsage id
@@ -114,6 +123,7 @@ const initState = (
114
123
  ? formatMessage(quotedMessage as MessageResponseBase)
115
124
  : null,
116
125
  showReplyInChannel: false,
126
+ editedMessage,
117
127
  };
118
128
  };
119
129
 
@@ -126,7 +136,6 @@ export class MessageComposer extends WithSubscriptions {
126
136
  readonly compositionMiddlewareExecutor: MessageComposerMiddlewareExecutor;
127
137
  readonly draftCompositionMiddlewareExecutor: MessageDraftComposerMiddlewareExecutor;
128
138
 
129
- editedMessage?: LocalMessage;
130
139
  attachmentManager: AttachmentManager;
131
140
  linkPreviewsManager: LinkPreviewsManager;
132
141
  textComposer: TextComposer;
@@ -190,7 +199,6 @@ export class MessageComposer extends WithSubscriptions {
190
199
  message = composition.message;
191
200
  } else if (composition) {
192
201
  message = formatMessage(composition);
193
- this.editedMessage = message;
194
202
  }
195
203
 
196
204
  this.attachmentManager = new AttachmentManager({ composer: this, message });
@@ -241,6 +249,18 @@ export class MessageComposer extends WithSubscriptions {
241
249
  return this.configState.getLatestValue();
242
250
  }
243
251
 
252
+ get editedMessage(): LocalMessage | undefined {
253
+ return this.state.getLatestValue().editedMessage ?? undefined;
254
+ }
255
+
256
+ set editedMessage(editedMessage: LocalMessage | undefined) {
257
+ this.state.partialNext({ editedMessage: editedMessage ?? null });
258
+ }
259
+
260
+ setEditedMessage = (editedMessage: LocalMessage | null | undefined) => {
261
+ this.state.partialNext({ editedMessage: editedMessage ?? null });
262
+ };
263
+
244
264
  get contextType() {
245
265
  return MessageComposer.evaluateContextType(this.compositionContext);
246
266
  }
@@ -370,14 +390,6 @@ export class MessageComposer extends WithSubscriptions {
370
390
  this.pollComposer.initState();
371
391
  this.customDataManager.initState({ message });
372
392
  this.state.next(initState(composition));
373
- if (
374
- composition &&
375
- !compositionIsDraftResponse(composition) &&
376
- message &&
377
- isLocalMessage(message)
378
- ) {
379
- this.editedMessage = message;
380
- }
381
393
  };
382
394
 
383
395
  initStateFromChannelResponse = (channelApiResponse: ChannelAPIResponse) => {
package/src/moderation.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import type {
2
2
  APIResponse,
3
+ CheckResponse,
3
4
  CustomCheckFlag,
5
+ CustomCheckResponse,
4
6
  GetConfigResponse,
5
7
  GetUserModerationReportOptions,
6
8
  GetUserModerationReportResponse,
@@ -19,11 +21,12 @@ import type {
19
21
  QueryModerationRulesSort,
20
22
  RequireAtLeastOne,
21
23
  ReviewQueueFilters,
22
- ReviewQueueItem,
23
24
  ReviewQueuePaginationOptions,
24
25
  ReviewQueueResponse,
25
26
  ReviewQueueSort,
26
27
  SubmitActionOptions,
28
+ SubmitActionResponse,
29
+ UnmuteUserResponse,
27
30
  UpsertConfigResponse,
28
31
  UpsertModerationRuleResponse,
29
32
  } from './types';
@@ -135,7 +138,7 @@ export class Moderation {
135
138
  user_id?: string;
136
139
  },
137
140
  ) {
138
- return await this.client.post<{ item_id: string } & APIResponse>(
141
+ return await this.client.post<UnmuteUserResponse>(
139
142
  this.client.baseURL + '/api/v2/moderation/unmute',
140
143
  {
141
144
  target_ids: [targetID],
@@ -209,7 +212,7 @@ export class Moderation {
209
212
  }
210
213
 
211
214
  async deleteConfig(key: string, data?: { team?: string }) {
212
- return await this.client.delete(
215
+ return await this.client.delete<APIResponse>(
213
216
  this.client.baseURL + '/api/v2/moderation/config/' + key,
214
217
  data,
215
218
  );
@@ -241,7 +244,7 @@ export class Moderation {
241
244
  itemID: string,
242
245
  options: SubmitActionOptions = {},
243
246
  ) {
244
- return await this.client.post<{ item_id: string } & APIResponse>(
247
+ return await this.client.post<SubmitActionResponse>(
245
248
  this.client.baseURL + '/api/v2/moderation/submit_action',
246
249
  {
247
250
  action_type: actionType,
@@ -281,14 +284,17 @@ export class Moderation {
281
284
  test_mode?: boolean;
282
285
  },
283
286
  ) {
284
- return await this.client.post(this.client.baseURL + `/api/v2/moderation/check`, {
285
- entity_type: entityType,
286
- entity_id: entityID,
287
- entity_creator_id: entityCreatorID,
288
- moderation_payload: moderationPayload,
289
- config_key: configKey,
290
- options,
291
- });
287
+ return await this.client.post<CheckResponse>(
288
+ this.client.baseURL + `/api/v2/moderation/check`,
289
+ {
290
+ entity_type: entityType,
291
+ entity_id: entityID,
292
+ entity_creator_id: entityCreatorID,
293
+ moderation_payload: moderationPayload,
294
+ config_key: configKey,
295
+ options,
296
+ },
297
+ );
292
298
  }
293
299
 
294
300
  /**
@@ -368,15 +374,16 @@ export class Moderation {
368
374
  },
369
375
  flags: CustomCheckFlag[],
370
376
  ) {
371
- return await this.client.post<
372
- { id: string; item: ReviewQueueItem; status: string } & APIResponse
373
- >(this.client.baseURL + `/api/v2/moderation/custom_check`, {
374
- entity_type: entityType,
375
- entity_id: entityID,
376
- entity_creator_id: entityCreatorID,
377
- moderation_payload: moderationPayload,
378
- flags,
379
- });
377
+ return await this.client.post<CustomCheckResponse>(
378
+ this.client.baseURL + `/api/v2/moderation/custom_check`,
379
+ {
380
+ entity_type: entityType,
381
+ entity_id: entityID,
382
+ entity_creator_id: entityCreatorID,
383
+ moderation_payload: moderationPayload,
384
+ flags,
385
+ },
386
+ );
380
387
  }
381
388
 
382
389
  /**
@@ -446,7 +453,7 @@ export class Moderation {
446
453
  * @returns
447
454
  */
448
455
  async deleteModerationRule(id: string) {
449
- return await this.client.delete(
456
+ return await this.client.delete<APIResponse>(
450
457
  this.client.baseURL + '/api/v2/moderation/moderation_rule/' + id,
451
458
  );
452
459
  }
package/src/types.ts CHANGED
@@ -353,6 +353,7 @@ export type QueryReactionsAPIResponse = APIResponse & {
353
353
 
354
354
  export type QueryChannelsAPIResponse = APIResponse & {
355
355
  channels: Omit<ChannelAPIResponse, keyof APIResponse>[];
356
+ predefined_filter?: ParsedPredefinedFilterResponse;
356
357
  };
357
358
 
358
359
  export type QueryChannelAPIResponse = APIResponse & ChannelAPIResponse;
@@ -801,6 +802,11 @@ export type MuteUserResponse = APIResponse & {
801
802
  mute?: MuteResponse;
802
803
  mutes?: Array<Mute>;
803
804
  own_user?: OwnUserResponse;
805
+ non_existing_users?: string[];
806
+ };
807
+
808
+ export type UnmuteUserResponse = APIResponse & {
809
+ non_existing_users?: string[];
804
810
  };
805
811
 
806
812
  export type BlockUserAPIResponse = APIResponse & {
@@ -3670,6 +3676,7 @@ export type ReviewQueueItem = {
3670
3676
  created_by: string;
3671
3677
  entity_id: string;
3672
3678
  entity_type: string;
3679
+ entity_creator_id?: string;
3673
3680
  flags: ModerationFlag[];
3674
3681
  has_image: boolean;
3675
3682
  has_text: boolean;
@@ -3685,6 +3692,7 @@ export type ReviewQueueItem = {
3685
3692
  reviewed_at: string;
3686
3693
  status: string;
3687
3694
  updated_at: string;
3695
+ latest_moderator_action?: string;
3688
3696
  };
3689
3697
 
3690
3698
  export type CustomCheckFlag = {
@@ -3726,6 +3734,10 @@ export type SubmitActionOptions = {
3726
3734
  user_id?: string;
3727
3735
  };
3728
3736
 
3737
+ export type SubmitActionResponse = APIResponse & {
3738
+ item?: ReviewQueueItem;
3739
+ };
3740
+
3729
3741
  export type GetUserModerationReportResponse = {
3730
3742
  user: UserResponse;
3731
3743
  user_blocks?: Array<{
@@ -3736,6 +3748,19 @@ export type GetUserModerationReportResponse = {
3736
3748
  user_mutes?: Mute[];
3737
3749
  };
3738
3750
 
3751
+ export type CheckResponse = APIResponse & {
3752
+ status: string;
3753
+ task_id?: string;
3754
+ recommended_action: string;
3755
+ item?: ReviewQueueItem;
3756
+ };
3757
+
3758
+ export type CustomCheckResponse = APIResponse & {
3759
+ id: string;
3760
+ item: ReviewQueueItem;
3761
+ status: string;
3762
+ };
3763
+
3739
3764
  export type QueryModerationConfigsFilters = QueryFilters<
3740
3765
  {
3741
3766
  key?: string;
@@ -3787,6 +3812,12 @@ export type ReviewQueueFilters = QueryFilters<
3787
3812
  entity_id?:
3788
3813
  | RequireOnlyOne<Pick<QueryFilter<ReviewQueueItem['entity_id']>, '$eq' | '$in'>>
3789
3814
  | PrimitiveFilter<ReviewQueueItem['entity_id']>;
3815
+ } & {
3816
+ entity_creator_id?:
3817
+ | RequireOnlyOne<
3818
+ Pick<QueryFilter<ReviewQueueItem['entity_creator_id']>, '$eq' | '$in'>
3819
+ >
3820
+ | PrimitiveFilter<ReviewQueueItem['entity_creator_id']>;
3790
3821
  } & {
3791
3822
  reviewed?: boolean;
3792
3823
  } & {
@@ -3840,6 +3871,7 @@ export type ReviewQueueFilters = QueryFilters<
3840
3871
  } & {
3841
3872
  recommended_action?: RequireOnlyOne<{
3842
3873
  $eq?: string;
3874
+ $in?: string[];
3843
3875
  }>;
3844
3876
  } & {
3845
3877
  flagged_user_id?: RequireOnlyOne<{
@@ -3852,6 +3884,7 @@ export type ReviewQueueFilters = QueryFilters<
3852
3884
  } & {
3853
3885
  label?: RequireOnlyOne<{
3854
3886
  $eq?: string;
3887
+ $in?: string[];
3855
3888
  }>;
3856
3889
  } & {
3857
3890
  reporter_type?: RequireOnlyOne<{
@@ -3866,6 +3899,24 @@ export type ReviewQueueFilters = QueryFilters<
3866
3899
  date_range?: RequireOnlyOne<{
3867
3900
  $eq?: string; // Format: "date1_date2"
3868
3901
  }>;
3902
+ } & {
3903
+ latest_moderator_action?:
3904
+ | RequireOnlyOne<
3905
+ Pick<QueryFilter<ReviewQueueItem['latest_moderator_action']>, '$eq' | '$in'>
3906
+ >
3907
+ | PrimitiveFilter<ReviewQueueItem['latest_moderator_action']>;
3908
+ } & {
3909
+ flags_count?: RequireOnlyOne<{
3910
+ $eq?: number;
3911
+ }>;
3912
+ } & {
3913
+ ai_text_severity?: RequireOnlyOne<{
3914
+ $eq?: string;
3915
+ }>;
3916
+ } & {
3917
+ channel_cid?: RequireOnlyOne<{
3918
+ $eq?: string;
3919
+ }>;
3869
3920
  }
3870
3921
  >;
3871
3922
 
@@ -3877,8 +3928,25 @@ export type QueryModerationConfigsSort = Array<Sort<'key' | 'created_at' | 'upda
3877
3928
 
3878
3929
  export type ReviewQueuePaginationOptions = Pager;
3879
3930
 
3931
+ export type FilterConfigResponse = {
3932
+ llm_labels: string[];
3933
+ ai_text_labels?: string[];
3934
+ };
3935
+
3936
+ export type ModerationActionConfig = {
3937
+ entity_type: string;
3938
+ order: number;
3939
+ action: string;
3940
+ icon: string;
3941
+ description: string;
3942
+ custom?: Record<string, unknown>;
3943
+ };
3944
+
3880
3945
  export type ReviewQueueResponse = {
3881
3946
  items: ReviewQueueItem[];
3947
+ action_config?: Record<string, ModerationActionConfig[]>;
3948
+ filter_config?: FilterConfigResponse;
3949
+ stats?: Record<string, unknown>;
3882
3950
  next?: string;
3883
3951
  prev?: string;
3884
3952
  };
@@ -4625,6 +4693,16 @@ export type ListPredefinedFiltersResponse = APIResponse & {
4625
4693
  prev?: string;
4626
4694
  };
4627
4695
 
4696
+ /**
4697
+ * Contains the interpolated filter and sort from a predefined filter.
4698
+ * This is returned in the QueryChannels response when using a predefined filter.
4699
+ */
4700
+ export type ParsedPredefinedFilterResponse = {
4701
+ name: string;
4702
+ filter: Record<string, unknown>;
4703
+ sort?: PredefinedFilterSortParam[];
4704
+ };
4705
+
4628
4706
  export type PredefinedFilterSort = SortParam[];
4629
4707
 
4630
4708
  export type ListPredefinedFiltersOptions = Pager & {