@supabase/server
Advanced tools
@@ -66,2 +66,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| //#endregion | ||
| exports.SupabaseError = SupabaseError; | ||
| exports.withSupabase = withSupabase; |
| import { t as AuthError } from "../../errors-fa-CyugW.cjs"; | ||
| import { d as SupabaseContext, m as WithSupabaseConfig } from "../../types-CwKZOVIv.cjs"; | ||
| import * as elysia from "elysia"; | ||
| import { Elysia } from "elysia"; | ||
| import { Elysia, ExtractErrorFromHandle } from "elysia"; | ||
@@ -55,3 +54,3 @@ //#region src/adapters/elysia/plugin.d.ts | ||
| */ | ||
| declare function withSupabase(config?: Omit<WithSupabaseConfig, 'cors'>): Elysia<"", { | ||
| declare function withSupabase(config?: Omit<WithSupabaseConfig, 'cors'>): Elysia<'', { | ||
| decorator: {}; | ||
@@ -80,3 +79,3 @@ store: {}; | ||
| standaloneSchema: {}; | ||
| response: elysia.ExtractErrorFromHandle<{ | ||
| response: ExtractErrorFromHandle<{ | ||
| supabaseContext: SupabaseContext; | ||
@@ -92,2 +91,2 @@ }>; | ||
| //#endregion | ||
| export { withSupabase }; | ||
| export { SupabaseError, withSupabase }; |
| import { t as AuthError } from "../../errors-C43um2Gg.mjs"; | ||
| import { d as SupabaseContext, m as WithSupabaseConfig } from "../../types-DbvLfq25.mjs"; | ||
| import * as elysia from "elysia"; | ||
| import { Elysia } from "elysia"; | ||
| import { Elysia, ExtractErrorFromHandle } from "elysia"; | ||
@@ -55,3 +54,3 @@ //#region src/adapters/elysia/plugin.d.ts | ||
| */ | ||
| declare function withSupabase(config?: Omit<WithSupabaseConfig, 'cors'>): Elysia<"", { | ||
| declare function withSupabase(config?: Omit<WithSupabaseConfig, 'cors'>): Elysia<'', { | ||
| decorator: {}; | ||
@@ -80,3 +79,3 @@ store: {}; | ||
| standaloneSchema: {}; | ||
| response: elysia.ExtractErrorFromHandle<{ | ||
| response: ExtractErrorFromHandle<{ | ||
| supabaseContext: SupabaseContext; | ||
@@ -92,2 +91,2 @@ }>; | ||
| //#endregion | ||
| export { withSupabase }; | ||
| export { SupabaseError, withSupabase }; |
@@ -65,2 +65,2 @@ import { t as createSupabaseContext } from "../../create-supabase-context-BxSEJN8a.mjs"; | ||
| //#endregion | ||
| export { withSupabase }; | ||
| export { SupabaseError, withSupabase }; |
@@ -47,3 +47,4 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
| return (0, h3.defineMiddleware)(async (event, next) => { | ||
| if (event.context.supabaseContext) return next(); | ||
| const context = event.context; | ||
| if (context.supabaseContext) return next(); | ||
| const { data: ctx, error } = await require_create_supabase_context.createSupabaseContext(event.req, config); | ||
@@ -54,3 +55,3 @@ if (error) throw new h3.HTTPError(error.message, { | ||
| }); | ||
| event.context.supabaseContext = ctx; | ||
| context.supabaseContext = ctx; | ||
| return next(); | ||
@@ -57,0 +58,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
| import { d as SupabaseContext, m as WithSupabaseConfig } from "../../types-CwKZOVIv.cjs"; | ||
| import { m as WithSupabaseConfig } from "../../types-CwKZOVIv.cjs"; | ||
| import { Middleware } from "h3"; | ||
@@ -45,8 +45,3 @@ | ||
| declare function withSupabase(config?: Omit<WithSupabaseConfig, 'cors'>): Middleware; | ||
| declare module 'h3' { | ||
| interface H3EventContext { | ||
| supabaseContext: SupabaseContext; | ||
| } | ||
| } | ||
| //#endregion | ||
| export { withSupabase }; |
@@ -1,2 +0,2 @@ | ||
| import { d as SupabaseContext, m as WithSupabaseConfig } from "../../types-DbvLfq25.mjs"; | ||
| import { m as WithSupabaseConfig } from "../../types-DbvLfq25.mjs"; | ||
| import { Middleware } from "h3"; | ||
@@ -45,8 +45,3 @@ | ||
| declare function withSupabase(config?: Omit<WithSupabaseConfig, 'cors'>): Middleware; | ||
| declare module 'h3' { | ||
| interface H3EventContext { | ||
| supabaseContext: SupabaseContext; | ||
| } | ||
| } | ||
| //#endregion | ||
| export { withSupabase }; |
@@ -46,3 +46,4 @@ import { t as createSupabaseContext } from "../../create-supabase-context-BxSEJN8a.mjs"; | ||
| return defineMiddleware(async (event, next) => { | ||
| if (event.context.supabaseContext) return next(); | ||
| const context = event.context; | ||
| if (context.supabaseContext) return next(); | ||
| const { data: ctx, error } = await createSupabaseContext(event.req, config); | ||
@@ -53,3 +54,3 @@ if (error) throw new HTTPError(error.message, { | ||
| }); | ||
| event.context.supabaseContext = ctx; | ||
| context.supabaseContext = ctx; | ||
| return next(); | ||
@@ -56,0 +57,0 @@ }); |
+14
-0
@@ -13,2 +13,16 @@ # H3 / Nuxt Adapter | ||
| ## Typing `event.context.supabaseContext` | ||
| The middleware stores the context on `event.context.supabaseContext`. Add this declaration once in your project (e.g. in `types/h3.d.ts`) for typed access: | ||
| ```ts | ||
| import type { SupabaseContext } from '@supabase/server' | ||
| declare module 'h3' { | ||
| interface H3EventContext { | ||
| supabaseContext: SupabaseContext | ||
| } | ||
| } | ||
| ``` | ||
| ## Basic app with auth | ||
@@ -15,0 +29,0 @@ |
+1
-1
| { | ||
| "name": "@supabase/server", | ||
| "version": "1.1.0-rc.65", | ||
| "version": "1.1.0-rc.66", | ||
| "description": "Server-side utilities for Supabase. Handles auth, client creation, and context injection so you write business logic, not boilerplate.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
261111
0.08%2085
0.14%