import { db } from "./db.js"; export function isMemberOfContext(userId: string, contextId: string): boolean { const row = db .prepare( `SELECT 1 FROM context_members WHERE user_id = ? AND context_id = ?` ) .get(userId, contextId) as { 1: number } | undefined; return !!row; } export function requireContextMember( userId: string, contextId: string ): boolean { return isMemberOfContext(userId, contextId); }