Client and services
The entry point of the SDK: how to create the client and which services it exposes.
Exported functions#
| Function | Description |
|---|---|
function createClient<Database = any>(baseUrl: string, apiKey: string, options?: AuraClientOptions): AuraClient<Database> | Create a new Aurabase client instance. |
function createAdminClient<Database = any>(baseUrl: string, serviceRoleKey: string, options?: AuraClientOptions): AuraClient<Database> | Creates a client for SERVER use only for administration operations (client.authAdmin: list/create/ban users, read audit). |
AuraClient#
| Property | Description |
|---|---|
readonly baseUrl: string | Project URL (https://<slug>.aurabase.dev), without trailing bar. |
readonly apiKey: string | null | Project API key (anon or service_role) sent in the apikey header; null if none was provided. |
readonly fetchFn: typeof globalThis.fetch | Function fetch used for all queries (that of options.fetch, otherwise globalThis.fetch). |
readonly authStore: BaseAuthStore | Session store (access token, refresh token, user): memory, localStorage or cookies depending on context. |
readonly retryConfig: { enabled: boolean; maxRetries: number; } | Read request resumption policy (GET, HEAD) on transient error: enabled or not, and maximum number of resumptions. |
readonly requestTimeoutMs?: number | Default timeout (ms) for JSON requests without signal. undefined → core fault (30s). |
readonly onEvent?: (event: AuraObservabilityEvent) => void | Observability hook — see AuraClientOptions.onEvent. |
readonly debug?: boolean | Journalise chaque AuraObservabilityEvent via console.debug — voir AuraClientOptions.debug. |
readonly parseBigIntAsString?: boolean | Preserves PostgreSQL 64-bit bigint values as strings instead of JSON numbers when enabled. |
get auth(): AuthService | Authentication service: registration, connection, session, MFA, OAuth, identities. |
get authAdmin(): AuthAdminService | Authentication administration API (users, sessions, audit log, email templates). |
get db(): DatabaseService<Database, Schema> | Database service: queries on tables and views, SQL function calls (rpc), raw SQL. |
get nosql(): NoSqlService | NoSQL service (MongoDB): collections, document queries and aggregation pipelines (aggregate). |
get storage(): StorageService | Storage service: buckets, sending, downloading, signed and public URLs, image transformations. |
get realtime(): RealtimeService | Real-time service: channels, Postgres changes, broadcast (broadcast) and presence. |
get functions(): FunctionsService | Edge Functions service: invocation, and management of jobs and cron with a service_role key. |
get ai(): AiService | AI service: conversation (chat), embeddings, RAG (ingest, queries, namespaces), semantic search and sessions. |
get notifications(): NotificationsService | Notifications service: sending (email, SMS, push, webhook), history, templates and administration. |
| Method | Description |
|---|---|
dispose(): void | Dismounts the client: stops proactive refresh (ticker + visibility + BroadcastChannel), disconnects realtime, empties auth listeners. |
from<TableName extends string & ValidRelationKeys<Schema['Tables']>, Table extends Schema['Tables'][TableName]>(table: TableName): AuraQueryBuilder<Schema, Table, TableName, AuraClientOptionsT>from<ViewName extends string & ValidRelationKeys<Schema['Views']>, View extends Schema['Views'][ViewName]>(view: ViewName): AuraQueryBuilder<Schema, View, ViewName, AuraClientOptionsT> | Shortcut: query a database table or view (Supabase-compatible API). |
rpc<FnName extends string = string, Args extends Record<string, unknown> = Record<string, unknown>>(fn: FnName, args?: Args, options?: Parameters<DatabaseService<Database, Schema>['rpc']>[2]): ReturnType<DatabaseService<Database, Schema>['rpc']> | Shortcut: call a stored procedure / PostgreSQL function via RPC (Supabase-compatible API). |
channel(name: string, options?: ChannelConfig): AuraChannel | Shortcut: create a realtime channel with Supabase-compatible API. |
removeChannel(channel: string | AuraChannel): void | Shortcut: remove a realtime channel by name or AuraChannel instance. |
removeAllChannels(): void | Shortcut: remove all realtime channels and unsubscribe. |
getChannels(): AuraChannel[] | Shortcut: list all active realtime channels. |
Generated page
This page is generated from the type declarations and comments of the SDK, so it cannot drift from the published code. For worked examples, read the guides.
@aurabase/aurabase-js@0.7.5 · aura@0.3.4↗ Report a problem