stream-chat 9.54.0 → 9.54.2
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/README.md +1 -1
- package/dist/cjs/index.browser.js +87 -19
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +87 -19
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +87 -19
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/channel.d.ts +1 -1
- package/dist/types/channel_state.d.ts +6 -0
- package/dist/types/client.d.ts +4 -68
- package/dist/types/connection.d.ts +12 -0
- package/dist/types/types.d.ts +26 -6
- package/dist/types/utils.d.ts +1 -0
- package/package.json +6 -1
- package/src/channel.ts +6 -0
- package/src/channel_state.ts +29 -0
- package/src/client.ts +4 -4
- package/src/connection.ts +47 -2
- package/src/messageComposer/middleware/messageComposer/attachments.ts +19 -8
- package/src/poll.ts +9 -1
- package/src/poll_optimistic_votes.ts +6 -1
- package/src/thread.ts +11 -4
- package/src/types.ts +27 -6
- package/src/utils.ts +20 -0
package/src/types.ts
CHANGED
|
@@ -523,8 +523,10 @@ export type FlagMessageResponse = APIResponse & {
|
|
|
523
523
|
user: UserResponse;
|
|
524
524
|
approved_at?: string;
|
|
525
525
|
channel_cid?: string;
|
|
526
|
+
custom?: Record<string, unknown>;
|
|
526
527
|
details?: object; // Any JSON
|
|
527
528
|
message_user_id?: string;
|
|
529
|
+
reason?: string;
|
|
528
530
|
rejected_at?: string;
|
|
529
531
|
reviewed_at?: string;
|
|
530
532
|
reviewed_by?: string;
|
|
@@ -750,6 +752,7 @@ export type PushPreferencesResponse = {
|
|
|
750
752
|
/** Per-channel push preferences returned by the API (matches OpenAPI `ChannelPushPreferencesResponse`). */
|
|
751
753
|
export type ChannelPushPreference = {
|
|
752
754
|
chat_level?: ChatLevelPushPreference; // "all", "mentions", "direct_mentions", "all_mentions", "none", "default" or other custom strings
|
|
755
|
+
chat_preferences?: ChatPreferences;
|
|
753
756
|
disabled_until?: string;
|
|
754
757
|
};
|
|
755
758
|
|
|
@@ -1061,6 +1064,7 @@ export type UserResponse = CustomUserData & {
|
|
|
1061
1064
|
deactivated_at?: string;
|
|
1062
1065
|
deleted_at?: string;
|
|
1063
1066
|
image?: string;
|
|
1067
|
+
invisible?: boolean;
|
|
1064
1068
|
language?: TranslationLanguages | '';
|
|
1065
1069
|
last_active?: string;
|
|
1066
1070
|
name?: string;
|
|
@@ -1455,7 +1459,7 @@ export type UpdateChannelOptions = Partial<{
|
|
|
1455
1459
|
data: Omit<ChannelResponse, 'id' | 'cid'>;
|
|
1456
1460
|
demote_moderators: string[];
|
|
1457
1461
|
invites: string[];
|
|
1458
|
-
message:
|
|
1462
|
+
message: Message;
|
|
1459
1463
|
reject_invite: boolean;
|
|
1460
1464
|
remove_members: string[];
|
|
1461
1465
|
user: UserResponse;
|
|
@@ -1992,6 +1996,7 @@ export type ChannelFilters = QueryFilters<
|
|
|
1992
1996
|
app_banned?: 'only' | 'excluded';
|
|
1993
1997
|
has_unread?: boolean;
|
|
1994
1998
|
archived?: boolean;
|
|
1999
|
+
invite?: { $eq?: Exclude<InviteStatus, 'member'> } | Exclude<InviteStatus, 'member'>;
|
|
1995
2000
|
'member.user.name'?:
|
|
1996
2001
|
| RequireOnlyOne<{
|
|
1997
2002
|
$autocomplete?: string;
|
|
@@ -2014,8 +2019,19 @@ export type ChannelFilters = QueryFilters<
|
|
|
2014
2019
|
last_updated?:
|
|
2015
2020
|
| RequireOnlyOne<Pick<QueryFilter<string>, '$eq' | '$gt' | '$gte' | '$lt' | '$lte'>>
|
|
2016
2021
|
| PrimitiveFilter<string>;
|
|
2022
|
+
/**
|
|
2023
|
+
* With multi-tenancy, client-side queries without a `team` filter only return channels of
|
|
2024
|
+
* the user's teams; an empty filter (`team: {}`) queries across all teams.
|
|
2025
|
+
*/
|
|
2026
|
+
team?:
|
|
2027
|
+
| RequireOnlyOne<QueryFilter<ChannelResponse['team']>>
|
|
2028
|
+
| PrimitiveFilter<ChannelResponse['team']>
|
|
2029
|
+
| Record<string, never>;
|
|
2017
2030
|
} & {
|
|
2018
|
-
[Key in keyof Omit<
|
|
2031
|
+
[Key in keyof Omit<
|
|
2032
|
+
ChannelResponse,
|
|
2033
|
+
'name' | 'members' | 'team' | keyof CustomChannelData
|
|
2034
|
+
>]:
|
|
2019
2035
|
| RequireOnlyOne<QueryFilter<ChannelResponse[Key]>>
|
|
2020
2036
|
| PrimitiveFilter<ChannelResponse[Key]>;
|
|
2021
2037
|
}
|
|
@@ -3083,9 +3099,12 @@ export type PartialUpdateChannelFields = Partial<ChannelResponse> & {
|
|
|
3083
3099
|
config_overrides?: Partial<ChannelConfigFields>;
|
|
3084
3100
|
};
|
|
3085
3101
|
|
|
3102
|
+
/** Dot-notation path to a nested custom field, e.g. `channel_detail.topic`. */
|
|
3103
|
+
type NestedFieldPath = `${string}.${string}`;
|
|
3104
|
+
|
|
3086
3105
|
export type PartialUpdateChannel = {
|
|
3087
|
-
set?: PartialUpdateChannelFields;
|
|
3088
|
-
unset?: Array<keyof PartialUpdateChannelFields>;
|
|
3106
|
+
set?: PartialUpdateChannelFields & { [path: NestedFieldPath]: unknown };
|
|
3107
|
+
unset?: Array<keyof PartialUpdateChannelFields | NestedFieldPath>;
|
|
3089
3108
|
};
|
|
3090
3109
|
|
|
3091
3110
|
export type PartialUpdateMember = {
|
|
@@ -3105,8 +3124,8 @@ export type MessageUpdatableFields = Omit<
|
|
|
3105
3124
|
>;
|
|
3106
3125
|
|
|
3107
3126
|
export type PartialMessageUpdate = {
|
|
3108
|
-
set?: Partial<MessageUpdatableFields
|
|
3109
|
-
unset?: Array<keyof MessageUpdatableFields>;
|
|
3127
|
+
set?: Partial<MessageUpdatableFields> & { [path: NestedFieldPath]: unknown };
|
|
3128
|
+
unset?: Array<keyof MessageUpdatableFields | NestedFieldPath>;
|
|
3110
3129
|
};
|
|
3111
3130
|
|
|
3112
3131
|
export type PendingMessageResponse = {
|
|
@@ -3492,6 +3511,7 @@ export type TaskStatus = {
|
|
|
3492
3511
|
|
|
3493
3512
|
export type TruncateOptions = {
|
|
3494
3513
|
hard_delete?: boolean;
|
|
3514
|
+
member_ids?: string[];
|
|
3495
3515
|
message?: Message;
|
|
3496
3516
|
skip_push?: boolean;
|
|
3497
3517
|
truncated_at?: Date;
|
|
@@ -3877,6 +3897,7 @@ export type ReviewQueueItem = {
|
|
|
3877
3897
|
id: string;
|
|
3878
3898
|
moderation_payload: ModerationPayload;
|
|
3879
3899
|
moderation_payload_hash: string;
|
|
3900
|
+
message?: MessageResponse;
|
|
3880
3901
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3881
3902
|
options: any;
|
|
3882
3903
|
recommended_action: string;
|
package/src/utils.ts
CHANGED
|
@@ -1164,7 +1164,27 @@ const messagePaginationLinear = ({
|
|
|
1164
1164
|
return newPagination;
|
|
1165
1165
|
};
|
|
1166
1166
|
|
|
1167
|
+
export const hasMessagePaginationCursor = (options?: MessagePaginationOptions) =>
|
|
1168
|
+
!!(
|
|
1169
|
+
options?.id_lt ||
|
|
1170
|
+
options?.id_lte ||
|
|
1171
|
+
options?.id_gt ||
|
|
1172
|
+
options?.id_gte ||
|
|
1173
|
+
options?.id_around ||
|
|
1174
|
+
options?.created_at_before ||
|
|
1175
|
+
options?.created_at_before_or_equal ||
|
|
1176
|
+
options?.created_at_after ||
|
|
1177
|
+
options?.created_at_after_or_equal ||
|
|
1178
|
+
options?.created_at_around ||
|
|
1179
|
+
options?.offset
|
|
1180
|
+
);
|
|
1181
|
+
|
|
1167
1182
|
export const messageSetPagination = (params: MessagePaginationUpdatedParams) => {
|
|
1183
|
+
// an empty page asked for says nothing about what else exists
|
|
1184
|
+
if (params.requestedPageSize === 0 && params.parentSet.messages.length > 0) {
|
|
1185
|
+
return params.parentSet.pagination;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1168
1188
|
if (
|
|
1169
1189
|
params.parentSet.messages.length +
|
|
1170
1190
|
(params.returnedPage.length - params.filteredReturnedPage.length) <
|