import "server-only"; import { auth } from "@/auth"; /** Returns the current session's user id, or throws if unauthenticated. */ export async function requireUserId(): Promise { const session = await auth(); if (!session?.user?.id) { throw new Error("Unauthorized"); } return session.user.id; }