feat(supabase): @faunosteo/supabase package with PGlite harness and typed client
- tests/db: PGlite (PostgreSQL 17 WASM) applies the Supabase shim + migrations and runs supabase/tests/*.sql through pgTAP without Docker - schema-types test pins tables, columns, enums, RPC args, RLS-on, no using(true) - database.types.ts in supabase gen types format; createBrowserClient (PKCE) - Supabase CLI pinned as root devDependency; db:* root scripts
This commit is contained in:
1 parent
2d5ff0c33e
commit
ce76c6597a
15 files changed
+1020
-2
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { createClient, type SupabaseClient } from '@supabase/supabase-js'
|
||||
import type { Database } from './database.types'
|
||||
|
||||
/** Typed Supabase client for the Faunosteo database. */
|
||||
export type FaunosteoClient = SupabaseClient<Database>
|
||||
|
||||
/**
|
||||
* Public connection settings. The anon (publishable) key is safe to ship to
|
||||
* the browser: every table is behind RLS. The service-role key never is.
|
||||
*/
|
||||
export interface SupabaseConnection {
|
||||
url: string
|
||||
anonKey: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Browser client: session persisted in localStorage, tokens refreshed in the
|
||||
* background, PKCE for OAuth and magic-link redirects.
|
||||
*/
|
||||
export function createBrowserClient(connection: SupabaseConnection): FaunosteoClient {
|
||||
return createClient<Database>(connection.url, connection.anonKey, {
|
||||
auth: {
|
||||
persistSession: true,
|
||||
autoRefreshToken: true,
|
||||
detectSessionInUrl: true,
|
||||
flowType: 'pkce',
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user