@iveri/contracts 0.107.0 → 0.109.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.
@@ -0,0 +1,5 @@
1
+ /** Whether I rang them or they rang me. */
2
+ export declare enum ChatCallDirection {
3
+ OUTGOING = "outgoing",
4
+ INCOMING = "incoming"
5
+ }
@@ -0,0 +1,6 @@
1
+ /** Whether I rang them or they rang me. */
2
+ export var ChatCallDirection;
3
+ (function (ChatCallDirection) {
4
+ ChatCallDirection["OUTGOING"] = "outgoing";
5
+ ChatCallDirection["INCOMING"] = "incoming";
6
+ })(ChatCallDirection || (ChatCallDirection = {}));
@@ -0,0 +1,48 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ import type { ChatImage } from './chat-attachment.type.js';
5
+ import type { ChatCallDirection } from './chat-call-direction.enum.js';
6
+ import type { ChatCallEndReason } from './chat-call-end-reason.enum.js';
7
+ import type { ChatCallKind } from './chat-call-kind.enum.js';
8
+ import type { ChatCallStatus } from './chat-call-status.enum.js';
9
+ import type { ChatPersonCard } from './chat-person.type.js';
10
+ /**
11
+ * One row of `GET /me/calls`: a call I started, was rung for or joined, newest first. Only who, when, how long and
12
+ * how it ended; nothing of what was said.
13
+ */
14
+ export interface ChatCallHistoryEntry {
15
+ /** The call's id. */
16
+ id: UUID;
17
+ conversationId: UUID;
18
+ kind: ChatCallKind;
19
+ status: ChatCallStatus;
20
+ endReason: Nullable<ChatCallEndReason>;
21
+ direction: ChatCallDirection;
22
+ isGroup: boolean;
23
+ /** The group's title, or the other person's name as the conversation shows it. */
24
+ title: string;
25
+ avatar: Nullable<ChatImage>;
26
+ /** The other person in a call between two. */
27
+ other: Nullable<ChatPersonCard>;
28
+ /** Rung, and never in it: I did not answer, declined, or it stopped ringing. Never true of my own call. */
29
+ isMissed: boolean;
30
+ /** From the answer to the end, in whole seconds; null until both. */
31
+ durationSeconds: Nullable<number>;
32
+ /** How many people reached the call. */
33
+ participantCount: number;
34
+ createdAt: IsoDateTime;
35
+ endedAt: Nullable<IsoDateTime>;
36
+ }
37
+ export interface ChatCallHistoryPage {
38
+ calls: ChatCallHistoryEntry[];
39
+ /** Pass back as `cursor` for the next page. */
40
+ nextCursor: Nullable<string>;
41
+ }
42
+ /** `GET /me/calls`. */
43
+ export interface ChatCallHistoryQuery {
44
+ cursor?: string;
45
+ limit?: number;
46
+ /** Only the calls I missed. */
47
+ missed?: boolean;
48
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -4,6 +4,7 @@ import type { UUID } from '../../type/uuid.type.js';
4
4
  import type { ChatImage } from './chat-attachment.type.js';
5
5
  import type { ChatConversationKind } from './chat-conversation-kind.enum.js';
6
6
  import type { ChatMessageKind } from './chat-message-kind.enum.js';
7
+ import type { ChatPinnedMessage } from './chat-message.type.js';
7
8
  import type { ChatParticipantRole } from './chat-participant-role.enum.js';
8
9
  import type { ChatParticipantStatus } from './chat-participant-status.enum.js';
9
10
  import type { ChatPersonCard } from './chat-person.type.js';
@@ -62,11 +63,15 @@ export interface ChatConversationSummary {
62
63
  lastMessage: Nullable<ChatLastMessagePreview>;
63
64
  lastSeq: number;
64
65
  unreadCount: number;
66
+ /** Unread messages that name me with `@`, stopping at 99 like the unread count. */
67
+ unreadMentionCount: number;
65
68
  /** Waiting for me to accept it. */
66
69
  isRequest: boolean;
67
70
  mutedUntil: Nullable<IsoDateTime>;
68
71
  isPinned: boolean;
69
72
  isArchived: boolean;
73
+ /** A group where only its owners and admins write. Everybody else reads, reacts and joins its calls. */
74
+ onlyAdminsCanSend: boolean;
70
75
  /** Whether I can send here now. When false, `refusal` says why. */
71
76
  canSend: boolean;
72
77
  refusal: Nullable<ChatRefusal>;
@@ -100,6 +105,12 @@ export interface ChatConversation extends ChatConversationSummary {
100
105
  closedAt: Nullable<IsoDateTime>;
101
106
  /** A group's invitation code, shown to its owner and admins. */
102
107
  inviteCode: Nullable<string>;
108
+ /** What a group is for, written by its owners and admins. Null when nobody wrote one, and outside groups. */
109
+ description: Nullable<string>;
110
+ /** The pinned messages I can see, the latest pinned first, at most `CHAT_PINNED_MESSAGE_LIMIT`. */
111
+ pinnedMessages: ChatPinnedMessage[];
112
+ /** Whether I may pin and unpin messages here: a group's owners and admins, anybody who may send elsewhere. */
113
+ canPinMessages: boolean;
103
114
  }
104
115
  export interface ChatInboxPage {
105
116
  conversations: ChatConversationSummary[];
@@ -126,6 +137,9 @@ export interface UpdateGroupChatRequest {
126
137
  title?: string;
127
138
  /** An uploaded photo attachment. `null` removes the photograph. */
128
139
  avatarAttachmentId?: Nullable<UUID>;
140
+ /** `null` or an empty text removes it. At most `CHAT_GROUP_DESCRIPTION_MAX_LENGTH` characters. */
141
+ description?: Nullable<string>;
142
+ onlyAdminsCanSend?: boolean;
129
143
  }
130
144
  /** Exactly one of the two lists, as with {@link StartDirectChatRequest}. */
131
145
  export interface AddChatMembersRequest {
@@ -4,6 +4,12 @@ export declare const CHAT_MESSAGE_MAX_LENGTH = 4000;
4
4
  export declare const CHAT_GROUP_MAX_MEMBERS = 256;
5
5
  /** The longest group title. */
6
6
  export declare const CHAT_GROUP_TITLE_MAX_LENGTH = 80;
7
+ /** The longest group description. */
8
+ export declare const CHAT_GROUP_DESCRIPTION_MAX_LENGTH = 500;
9
+ /** How many people one message can name with `@`. */
10
+ export declare const CHAT_MENTIONS_PER_MESSAGE = 50;
11
+ /** How many messages one conversation can hold pinned at once. */
12
+ export declare const CHAT_PINNED_MESSAGE_LIMIT = 10;
7
13
  /** How long after sending a message its author may still change it. */
8
14
  export declare const CHAT_EDIT_WINDOW_HOURS = 48;
9
15
  /** How long after sending a message its author may still delete it for everyone. */
@@ -4,6 +4,12 @@ export const CHAT_MESSAGE_MAX_LENGTH = 4000;
4
4
  export const CHAT_GROUP_MAX_MEMBERS = 256;
5
5
  /** The longest group title. */
6
6
  export const CHAT_GROUP_TITLE_MAX_LENGTH = 80;
7
+ /** The longest group description. */
8
+ export const CHAT_GROUP_DESCRIPTION_MAX_LENGTH = 500;
9
+ /** How many people one message can name with `@`. */
10
+ export const CHAT_MENTIONS_PER_MESSAGE = 50;
11
+ /** How many messages one conversation can hold pinned at once. */
12
+ export const CHAT_PINNED_MESSAGE_LIMIT = 10;
7
13
  /** How long after sending a message its author may still change it. */
8
14
  export const CHAT_EDIT_WINDOW_HOURS = 48;
9
15
  /** How long after sending a message its author may still delete it for everyone. */
@@ -18,6 +18,11 @@ export interface ChatReplyPreview {
18
18
  excerpt: Nullable<string>;
19
19
  isDeleted: boolean;
20
20
  }
21
+ /** Somebody a message names with `@`, under the name this conversation shows them by. */
22
+ export interface ChatMention {
23
+ userId: UUID;
24
+ displayName: string;
25
+ }
21
26
  export interface ChatReactionSummary {
22
27
  emoji: string;
23
28
  count: number;
@@ -41,6 +46,13 @@ export interface ChatMessage {
41
46
  replyTo: Nullable<ChatReplyPreview>;
42
47
  attachments: ChatAttachment[];
43
48
  reactions: ChatReactionSummary[];
49
+ /**
50
+ * The people this message names with `@`, each still in the conversation when it was sent. The body carries
51
+ * `@` and the name as typed; a client draws each `@displayName` it finds here as a mention.
52
+ */
53
+ mentions: ChatMention[];
54
+ /** Set while the message is pinned at the top of its conversation. */
55
+ pinnedAt: Nullable<IsoDateTime>;
44
56
  isOwn: boolean;
45
57
  editedAt: Nullable<IsoDateTime>;
46
58
  isDeleted: boolean;
@@ -60,9 +72,27 @@ export interface SendChatMessageRequest {
60
72
  body?: Nullable<string>;
61
73
  replyToMessageId?: Nullable<UUID>;
62
74
  attachmentIds?: UUID[];
75
+ /**
76
+ * The people the body names with `@`. Anybody not present in the conversation is dropped, never refused, so a
77
+ * name somebody left with does not fail the send. At most `CHAT_MENTIONS_PER_MESSAGE`.
78
+ */
79
+ mentionUserIds?: UUID[];
63
80
  }
64
81
  export interface EditChatMessageRequest {
65
82
  body: string;
83
+ /** Replaces the message's mentions. Omitted keeps them as they were. */
84
+ mentionUserIds?: UUID[];
85
+ }
86
+ /** A pinned message as the bar over a conversation draws it. */
87
+ export interface ChatPinnedMessage {
88
+ id: UUID;
89
+ seq: number;
90
+ senderName: Nullable<string>;
91
+ kind: ChatMessageKind;
92
+ excerpt: Nullable<string>;
93
+ pinnedAt: IsoDateTime;
94
+ /** Who pinned it, under the name this conversation shows them by. */
95
+ pinnedByName: Nullable<string>;
66
96
  }
67
97
  export interface ReactToChatMessageRequest {
68
98
  emoji: string;
@@ -11,6 +11,10 @@ export declare enum ChatRefusal {
11
11
  NETWORK_ONLY = "network-only",
12
12
  NO_PROFILE = "no-profile",
13
13
  PIN_LIMIT = "pin-limit",
14
+ /** The conversation already holds as many pinned messages as it takes. */
15
+ MESSAGE_PIN_LIMIT = "message-pin-limit",
16
+ /** Only the group's owners and admins write here. */
17
+ ADMINS_ONLY = "admins-only",
14
18
  LAST_OWNER = "last-owner",
15
19
  INVITATION_EXPIRED = "invitation-expired",
16
20
  SUSPENDED = "suspended",
@@ -12,6 +12,10 @@ export var ChatRefusal;
12
12
  ChatRefusal["NETWORK_ONLY"] = "network-only";
13
13
  ChatRefusal["NO_PROFILE"] = "no-profile";
14
14
  ChatRefusal["PIN_LIMIT"] = "pin-limit";
15
+ /** The conversation already holds as many pinned messages as it takes. */
16
+ ChatRefusal["MESSAGE_PIN_LIMIT"] = "message-pin-limit";
17
+ /** Only the group's owners and admins write here. */
18
+ ChatRefusal["ADMINS_ONLY"] = "admins-only";
15
19
  ChatRefusal["LAST_OWNER"] = "last-owner";
16
20
  ChatRefusal["INVITATION_EXPIRED"] = "invitation-expired";
17
21
  ChatRefusal["SUSPENDED"] = "suspended";
@@ -6,7 +6,9 @@ export * from './chat-app.constant.js';
6
6
  export * from './chat-app.type.js';
7
7
  export * from './chat-attachment-kind.enum.js';
8
8
  export * from './chat-attachment.type.js';
9
+ export * from './chat-call-direction.enum.js';
9
10
  export * from './chat-call-end-reason.enum.js';
11
+ export * from './chat-call-history.type.js';
10
12
  export * from './chat-call-kind.enum.js';
11
13
  export * from './chat-call-participant-state.enum.js';
12
14
  export * from './chat-call-status.enum.js';
@@ -6,7 +6,9 @@ export * from './chat-app.constant.js';
6
6
  export * from './chat-app.type.js';
7
7
  export * from './chat-attachment-kind.enum.js';
8
8
  export * from './chat-attachment.type.js';
9
+ export * from './chat-call-direction.enum.js';
9
10
  export * from './chat-call-end-reason.enum.js';
11
+ export * from './chat-call-history.type.js';
10
12
  export * from './chat-call-kind.enum.js';
11
13
  export * from './chat-call-participant-state.enum.js';
12
14
  export * from './chat-call-status.enum.js';
@@ -18,3 +18,5 @@ export * from './social-refusal.enum.js';
18
18
  export * from './social-report-reason.enum.js';
19
19
  export * from './social-report-target.enum.js';
20
20
  export * from './social-story.type.js';
21
+ export * from './social-video-state.enum.js';
22
+ export * from './social-video.type.js';
@@ -18,3 +18,5 @@ export * from './social-refusal.enum.js';
18
18
  export * from './social-report-reason.enum.js';
19
19
  export * from './social-report-target.enum.js';
20
20
  export * from './social-story.type.js';
21
+ export * from './social-video-state.enum.js';
22
+ export * from './social-video.type.js';
@@ -14,9 +14,17 @@ export declare const SOCIAL_LIMITS: {
14
14
  readonly APPEAL_STATEMENT_MAX: 2000;
15
15
  readonly MODERATION_NOTE_MAX: 2000;
16
16
  readonly IMAGE_BYTES_MAX: number;
17
+ readonly VIDEO_BYTES_MAX: number;
18
+ /** A longer video is refused, never cut short. */
19
+ readonly VIDEO_SECONDS_MAX: 60;
17
20
  readonly MINIMUM_AGE: 16;
18
21
  };
19
22
  /** The characters a handle may use, in the form they are stored. */
20
23
  export declare const SOCIAL_HANDLE_PATTERN: RegExp;
21
24
  /** The version of the terms a new member accepts. A placeholder until the real terms exist. */
22
25
  export declare const SOCIAL_TERMS_VERSION = "2026-11-draft";
26
+ /**
27
+ * What a file picker offers for a video. Only a hint for the picker: the API decides by decoding,
28
+ * never by the type a browser or phone reports.
29
+ */
30
+ export declare const SOCIAL_VIDEO_MIME_TYPES: readonly ["video/mp4", "video/quicktime", "video/webm", "video/x-matroska"];
@@ -14,9 +14,17 @@ export const SOCIAL_LIMITS = {
14
14
  APPEAL_STATEMENT_MAX: 2000,
15
15
  MODERATION_NOTE_MAX: 2000,
16
16
  IMAGE_BYTES_MAX: 15 * 1024 * 1024,
17
+ VIDEO_BYTES_MAX: 100 * 1024 * 1024,
18
+ /** A longer video is refused, never cut short. */
19
+ VIDEO_SECONDS_MAX: 60,
17
20
  MINIMUM_AGE: 16,
18
21
  };
19
22
  /** The characters a handle may use, in the form they are stored. */
20
23
  export const SOCIAL_HANDLE_PATTERN = /^[a-z0-9](?:[a-z0-9._]*[a-z0-9])?$/;
21
24
  /** The version of the terms a new member accepts. A placeholder until the real terms exist. */
22
25
  export const SOCIAL_TERMS_VERSION = '2026-11-draft';
26
+ /**
27
+ * What a file picker offers for a video. Only a hint for the picker: the API decides by decoding,
28
+ * never by the type a browser or phone reports.
29
+ */
30
+ export const SOCIAL_VIDEO_MIME_TYPES = ['video/mp4', 'video/quicktime', 'video/webm', 'video/x-matroska'];
@@ -9,6 +9,7 @@ import type { SocialMemberCard } from './social-member.type.js';
9
9
  import type { SocialModerationReason } from './social-moderation-reason.enum.js';
10
10
  import type { SocialReportReason } from './social-report-reason.enum.js';
11
11
  import type { SocialReportTarget } from './social-report-target.enum.js';
12
+ import type { SocialVideoState } from './social-video-state.enum.js';
12
13
  export interface CreateSocialReportRequest {
13
14
  targetType: SocialReportTarget;
14
15
  targetId: UUID;
@@ -35,8 +36,23 @@ export interface CreateSocialAppealRequest {
35
36
  export interface SocialCaseEvidence {
36
37
  text: Nullable<string>;
37
38
  imageUrls: string[];
39
+ /** A reported video's poster only. Playing it goes through `SocialCaseVideoView`, which is logged. */
40
+ videos: SocialCaseVideo[];
38
41
  createdAt: Nullable<IsoDateTime>;
39
42
  }
43
+ export interface SocialCaseVideo {
44
+ id: UUID;
45
+ state: SocialVideoState;
46
+ width: number;
47
+ height: number;
48
+ durationMs: number;
49
+ posterUrl: Nullable<string>;
50
+ }
51
+ /** The address of a reported video, handed out once per request and written to the access log. */
52
+ export interface SocialCaseVideoView {
53
+ url: string;
54
+ expiresAt: IsoDateTime;
55
+ }
40
56
  export interface SocialCaseSummary {
41
57
  id: UUID;
42
58
  targetType: SocialReportTarget;
@@ -3,11 +3,14 @@ import type { Nullable } from '../../type/nil.type.js';
3
3
  import type { UUID } from '../../type/uuid.type.js';
4
4
  import type { SocialImage } from './social-image.type.js';
5
5
  import type { SocialMemberCard } from './social-member.type.js';
6
+ import type { SocialVideo } from './social-video.type.js';
6
7
  export interface SocialPost {
7
8
  id: UUID;
8
9
  author: SocialMemberCard;
9
10
  caption: Nullable<string>;
10
11
  images: SocialImage[];
12
+ /** A post carries photographs or one video, never both. */
13
+ video: Nullable<SocialVideo>;
11
14
  commentsDisabled: boolean;
12
15
  likeCount: number;
13
16
  commentCount: number;
@@ -17,6 +20,7 @@ export interface SocialPost {
17
20
  createdAt: IsoDateTime;
18
21
  editedAt: Nullable<IsoDateTime>;
19
22
  }
23
+ /** A photograph or a video upload. A post names up to ten photographs or exactly one video. */
20
24
  export interface CreateSocialPostMedia {
21
25
  id: UUID;
22
26
  altText?: Nullable<string>;
@@ -20,6 +20,11 @@ export declare enum SocialRefusal {
20
20
  IMAGE_UNREADABLE = "image-unreadable",
21
21
  IMAGE_TOO_LARGE = "image-too-large",
22
22
  MEDIA_UNAVAILABLE = "media-unavailable",
23
+ VIDEO_UNREADABLE = "video-unreadable",
24
+ VIDEO_TOO_LARGE = "video-too-large",
25
+ VIDEO_TOO_LONG = "video-too-long",
26
+ /** A post carries photographs or one video, never both and never two videos. */
27
+ POST_MEDIA_MIXED = "post-media-mixed",
23
28
  POST_EMPTY = "post-empty",
24
29
  COMMENTS_DISABLED = "comments-disabled",
25
30
  CANNOT_FOLLOW_SELF = "cannot-follow-self",
@@ -21,6 +21,11 @@ export var SocialRefusal;
21
21
  SocialRefusal["IMAGE_UNREADABLE"] = "image-unreadable";
22
22
  SocialRefusal["IMAGE_TOO_LARGE"] = "image-too-large";
23
23
  SocialRefusal["MEDIA_UNAVAILABLE"] = "media-unavailable";
24
+ SocialRefusal["VIDEO_UNREADABLE"] = "video-unreadable";
25
+ SocialRefusal["VIDEO_TOO_LARGE"] = "video-too-large";
26
+ SocialRefusal["VIDEO_TOO_LONG"] = "video-too-long";
27
+ /** A post carries photographs or one video, never both and never two videos. */
28
+ SocialRefusal["POST_MEDIA_MIXED"] = "post-media-mixed";
24
29
  SocialRefusal["POST_EMPTY"] = "post-empty";
25
30
  SocialRefusal["COMMENTS_DISABLED"] = "comments-disabled";
26
31
  SocialRefusal["CANNOT_FOLLOW_SELF"] = "cannot-follow-self";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Where a posted video is between upload and playback.
3
+ *
4
+ * Only its author ever sees one that is not `ready`: a post carrying such a video is shown to nobody
5
+ * else until processing finishes.
6
+ */
7
+ export declare enum SocialVideoState {
8
+ PROCESSING = "processing",
9
+ READY = "ready",
10
+ /** It could not be decoded or encoded. Nothing will change it; the author deletes the post. */
11
+ FAILED = "failed"
12
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Where a posted video is between upload and playback.
3
+ *
4
+ * Only its author ever sees one that is not `ready`: a post carrying such a video is shown to nobody
5
+ * else until processing finishes.
6
+ */
7
+ export var SocialVideoState;
8
+ (function (SocialVideoState) {
9
+ SocialVideoState["PROCESSING"] = "processing";
10
+ SocialVideoState["READY"] = "ready";
11
+ /** It could not be decoded or encoded. Nothing will change it; the author deletes the post. */
12
+ SocialVideoState["FAILED"] = "failed";
13
+ })(SocialVideoState || (SocialVideoState = {}));
@@ -0,0 +1,32 @@
1
+ import type { Nullable } from '../../type/nil.type.js';
2
+ import type { UUID } from '../../type/uuid.type.js';
3
+ import type { SocialImageUrls } from './social-image.type.js';
4
+ import type { SocialVideoState } from './social-video-state.enum.js';
5
+ /**
6
+ * A short video on a post.
7
+ *
8
+ * `url` and `posterUrls` are signed like a photograph's and are null until the video is `ready`.
9
+ * Everybody but the author only ever receives a ready one.
10
+ */
11
+ export interface SocialVideo {
12
+ id: UUID;
13
+ state: SocialVideoState;
14
+ width: number;
15
+ height: number;
16
+ durationMs: number;
17
+ /** A solid colour to paint while the poster loads. */
18
+ placeholderColor: string;
19
+ altText: Nullable<string>;
20
+ /** The still shown before playing, in the three photograph sizes. */
21
+ posterUrls: Nullable<SocialImageUrls>;
22
+ /** One MP4 (H.264 and AAC) every browser and phone plays. */
23
+ url: Nullable<string>;
24
+ }
25
+ /** What a video upload answers. It is decoded enough to be refused at once; encoding happens afterwards. */
26
+ export interface SocialVideoUpload {
27
+ id: UUID;
28
+ state: SocialVideoState;
29
+ width: number;
30
+ height: number;
31
+ durationMs: number;
32
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.107.0",
3
+ "version": "0.109.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {