Creates a SupabaseContext directly from a request.
Use this when you need the context without the full withSupabase wrapper — e.g., inside framework route handlers or custom middleware. Returns a result tuple instead of producing a Response.
The incoming HTTP request.
Auth modes, environment overrides. The `cors` option is ignored here.
const { data: ctx, error } = await createSupabaseContext(request, { auth: 'user' })
if (error) {
// `toJSON()` yields { source, code, message, hint, docs, details }
return Response.json(error.toJSON(), { status: error.status })
}
const { data } = await ctx.supabase.rpc('get_my_items')