From 1a9dc547c43116eea93d5bd63117e8aa3a44f487 Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Sat, 25 Apr 2026 21:19:40 +0200 Subject: [PATCH] feat(shared): types for federation user lookup + WS events Add FederationUserLookupRequest, FederationUserLookupProfile, and FederationUserLookupResponse for the peer lookup endpoint contract. Add friend_request_sent and friend_request_relay_failed ServerEvent variants alongside existing friend_request_* cases. --- packages/shared/src/types.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/shared/src/types.ts b/packages/shared/src/types.ts index 29faa8ec..678c9121 100644 --- a/packages/shared/src/types.ts +++ b/packages/shared/src/types.ts @@ -438,6 +438,8 @@ export type ServerEvent = | { type: 'friend_removed'; userId: string } | { type: 'friend_request_cancelled'; requestId: string; userId: string } | { type: 'friend_request_declined'; requestId: string; userId: string } + | { type: 'friend_request_sent'; request: FriendRequest } + | { type: 'friend_request_relay_failed'; requestId: string; reason: 'user_not_found' | 'peer_rejected'; message: string; targetHandle: string } | { type: 'channel_created'; channel: Channel; spaceId: string } | { type: 'channel_updated'; channel: Channel; spaceId: string } | { type: 'channel_deleted'; channelId: string; spaceId: string } @@ -993,6 +995,22 @@ export interface FederationSyncResponse { checkpoint: number; } +export interface FederationUserLookupRequest { + username: string; +} + +export interface FederationUserLookupProfile { + displayName: string | null; + avatar: string | null; + avatarColor: AvatarColor | null; + banner: string | null; + bio: string | null; +} + +export type FederationUserLookupResponse = + | { found: true; user: { homeUserId: string; username: string; profile: FederationUserLookupProfile } } + | { found: false; code: 'user_not_found' }; + export interface FederationPeer { id: string; origin: string;