stream-chat 9.20.3 → 9.22.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.
package/src/types.ts CHANGED
@@ -713,6 +713,7 @@ export type MessageResponseBase = MessageBase & {
713
713
  status?: string;
714
714
  thread_participants?: UserResponse[];
715
715
  updated_at?: string;
716
+ deleted_for_me?: boolean;
716
717
  };
717
718
 
718
719
  export type ReactionGroupResponse = {
@@ -817,6 +818,8 @@ export type ReadResponse = {
817
818
  user: UserResponse;
818
819
  last_read_message_id?: string;
819
820
  unread_messages?: number;
821
+ last_delivered_at?: string;
822
+ last_delivered_message_id?: string;
820
823
  };
821
824
 
822
825
  export type SearchAPIResponse = APIResponse & {
@@ -919,6 +922,9 @@ export type PrivacySettings = {
919
922
  typing_indicators?: {
920
923
  enabled?: boolean;
921
924
  };
925
+ delivery_receipts?: {
926
+ enabled?: boolean;
927
+ };
922
928
  };
923
929
 
924
930
  export type PushNotificationSettings = {
@@ -963,7 +969,7 @@ export type BanUserOptions = UnBanUserOptions & {
963
969
  ip_ban?: boolean;
964
970
  reason?: string;
965
971
  timeout?: number;
966
- delete_messages?: DeleteMessagesOptions;
972
+ delete_messages?: MessageDeletionStrategy;
967
973
  };
968
974
 
969
975
  export type ChannelOptions = {
@@ -1135,6 +1141,7 @@ export type UpdateChannelTypeRequest =
1135
1141
  typing_events?: boolean;
1136
1142
  uploads?: boolean;
1137
1143
  url_enrichment?: boolean;
1144
+ count_messages?: boolean;
1138
1145
  };
1139
1146
 
1140
1147
  export type UpdateChannelTypeResponse = {
@@ -1171,6 +1178,7 @@ export type UpdateChannelTypeResponse = {
1171
1178
  blocklists?: BlockListOptions[];
1172
1179
  partition_size?: number;
1173
1180
  partition_ttl?: string;
1181
+ count_messages?: boolean;
1174
1182
  };
1175
1183
 
1176
1184
  export type GetChannelTypeResponse = {
@@ -1207,6 +1215,7 @@ export type GetChannelTypeResponse = {
1207
1215
  blocklists?: BlockListOptions[];
1208
1216
  partition_size?: number;
1209
1217
  partition_ttl?: string;
1218
+ count_messages?: boolean;
1210
1219
  };
1211
1220
 
1212
1221
  export type UpdateChannelOptions = Partial<{
@@ -1250,6 +1259,18 @@ export type MarkUnreadOptions = {
1250
1259
  user_id?: string;
1251
1260
  };
1252
1261
 
1262
+ export type DeliveredMessageConfirmation = {
1263
+ cid: string;
1264
+ id: string;
1265
+ parent_id?: string; // todo: should we include parent_id if thread delivery receipts are not yet supported?
1266
+ };
1267
+
1268
+ export type MarkDeliveredOptions = {
1269
+ latest_delivered_messages: DeliveredMessageConfirmation[];
1270
+ user?: UserResponse;
1271
+ user_id?: string;
1272
+ };
1273
+
1253
1274
  export type MuteUserOptions = {
1254
1275
  client_id?: string;
1255
1276
  connection_id?: string;
@@ -1448,18 +1469,21 @@ export type Event = CustomEventData & {
1448
1469
  ai_state?: AIState;
1449
1470
  channel?: ChannelResponse;
1450
1471
  channel_custom?: CustomChannelData;
1451
- channel_member_count?: number;
1452
1472
  channel_id?: string;
1473
+ channel_member_count?: number;
1453
1474
  channel_type?: string;
1454
1475
  cid?: string;
1455
1476
  clear_history?: boolean;
1456
1477
  connection_id?: string;
1457
1478
  // event creation timestamp, format Date ISO string
1458
1479
  created_at?: string;
1480
+ deleted_for_me?: boolean;
1459
1481
  draft?: DraftResponse;
1460
1482
  // id of the message that was marked as unread - all the following messages are considered unread. (notification.mark_unread)
1461
1483
  first_unread_message_id?: string;
1462
1484
  hard_delete?: boolean;
1485
+ last_delivered_at?: string;
1486
+ last_delivered_message_id?: string;
1463
1487
  // creation date of a message with last_read_message_id, formatted as Date ISO string
1464
1488
  last_read_at?: string;
1465
1489
  last_read_message_id?: string;
@@ -2373,7 +2397,7 @@ export type ChannelConfigFields = {
2373
2397
  replies?: boolean;
2374
2398
  search?: boolean;
2375
2399
  shared_locations?: boolean;
2376
- count_messages?: boolean; // Feature flag for message count
2400
+ count_messages?: boolean;
2377
2401
  typing_events?: boolean;
2378
2402
  uploads?: boolean;
2379
2403
  url_enrichment?: boolean;
@@ -3580,14 +3604,21 @@ export type CustomCheckFlag = {
3580
3604
  reason?: string;
3581
3605
  };
3582
3606
 
3583
- export type DeleteMessagesOptions = 'soft' | 'hard';
3607
+ export type MessageDeletionStrategy = 'soft' | 'hard';
3608
+ // @deprecated use type MessageDeletionStrategy instead
3609
+ export type DeleteMessagesOptions = MessageDeletionStrategy;
3610
+
3611
+ export type DeleteMessageOptions = {
3612
+ deleteForMe?: boolean;
3613
+ hardDelete?: boolean;
3614
+ };
3584
3615
 
3585
3616
  export type SubmitActionOptions = {
3586
3617
  ban?: {
3587
3618
  channel_ban_only?: boolean;
3588
3619
  reason?: string;
3589
3620
  timeout?: number;
3590
- delete_messages?: DeleteMessagesOptions;
3621
+ delete_messages?: MessageDeletionStrategy;
3591
3622
  };
3592
3623
  delete_message?: {
3593
3624
  hard_delete?: boolean;
package/src/utils.ts CHANGED
@@ -748,7 +748,8 @@ export const debounce = <T extends (...args: any[]) => any>(
748
748
  };
749
749
 
750
750
  // works exactly the same as lodash.throttle
751
- export const throttle = <T extends (...args: unknown[]) => unknown>(
751
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
752
+ export const throttle = <T extends (...args: any[]) => any>(
752
753
  fn: T,
753
754
  timeout = 200,
754
755
  { leading = true, trailing = false }: { leading?: boolean; trailing?: boolean } = {},