Files
ChatApp/packages/shared/src/chat/index.ts
T
byGalax 256a613134 feat(P5B.T2): GamePayload + games wrappers + winner-detect helpers + tests
Adds conversation_games table type + game_make_move RPC to db-types, GamePayload variant and parseMessagePayload branch to shared/attachments, games.ts with createGame/getGame/makeGameMove wrappers plus pure tttWinningLine/c4WinningCells/c4DropRow/isBoardFull helpers, 11 tests covering all winner helpers, and re-export from chat/index.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 21:47:36 +02:00

37 lines
1.1 KiB
TypeScript

import type { AppSupabaseClient } from '../supabase/client';
export * from './attachments';
export * from './conversations';
export * from './convKeys';
export * from './groups';
export * from './messages';
export * from './types';
export * from './userKeyMigration';
export * from './pinnedMessages';
export * from './mentions';
export * from './viewOnceAttachments';
export * from './whiteboards';
export * from './soundboards';
export * from './watchTogether';
export * from './games';
// ----- RPC wrappers ---------------------------------------------------------
export async function createDm(
client: AppSupabaseClient,
targetUserId: string,
): Promise<string> {
const { data, error } = await client.rpc('create_dm', { target_user_id: targetUserId });
if (error) throw error;
if (typeof data !== 'string') throw new Error('create_dm returned non-uuid');
return data;
}
export async function acceptDm(
client: AppSupabaseClient,
conversationId: string,
): Promise<void> {
const { error } = await client.rpc('accept_dm', { conversation_id: conversationId });
if (error) throw error;
}