update
CI / Lint, types, build, tests (push) Canceled after 0s
CI / Docker images build (push) Canceled after 0s

This commit is contained in:
olehhapuk
2026-12-03 10:53:09 +02:00
parent f8de87955b
commit 98b2e0ce4b
182 changed files with 24134 additions and 288 deletions
+60
View File
@@ -0,0 +1,60 @@
import type { Call } from './calls';
import type {
ConversationRead,
Message,
MessageDeletion,
ReactionChange,
} from './conversations';
/**
* Events the API pushes over the socket. Changes are always made with an
* HTTP request; the socket only tells the other tabs and people about them.
*/
export interface ServerToClientEvents {
/**
* A message was posted in a conversation or cauldron the user can read
* (their own messages too). `realmId` is set for a cauldron's message.
*/
'message:created': (
message: Message,
context: { realmId: string | null },
) => void;
/**
* A message the user can read was deleted, by its author or by someone
* who looks after the place.
*/
'message:deleted': (deletion: MessageDeletion) => void;
/**
* Someone added or took back a reaction on a message the user can read.
* It carries the new count, so applying it twice does no harm.
*/
'reaction:changed': (change: ReactionChange) => void;
/**
* The user read a conversation or cauldron somewhere (this tab included):
* its unread count is now this.
*/
'conversation:read': (read: ConversationRead) => void;
/**
* Someone joined or left the call in a conversation or cauldron the user
* can read. No participants left means the call is over.
*/
'call:changed': (call: Call) => void;
/**
* A realm the user is (or just stopped being) in changed. "details" covers
* its name, cauldrons, roles, what the user may do in it and whether they
* are still in it: fetch GET /realms and GET /realms/:id again. "members"
* is a change to who is in it or which roles they hold: fetch
* GET /realms/:id (for the member count) and GET /realms/:id/members.
*/
'realm:changed': (realmId: string, what: 'details' | 'members') => void;
/**
* A conversation the user is (or just stopped being) in was created,
* renamed or changed members; fetch GET /conversations again.
*/
'conversations:changed': () => void;
/** The user's friends or friend requests changed; fetch GET /friends again. */
'friends:changed': () => void;
}
/** Nothing yet: clients only listen. */
export type ClientToServerEvents = Record<string, never>;