@iveri/contracts 0.107.0 → 0.108.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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.107.0",
3
+ "version": "0.108.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {