import { AuthClient } from '@skorpland/auth-js'; import { RealtimeClientOptions } from '@skorpland/realtime-js'; import { PostgrestError } from '@skorpland/postgrest-js'; type AuthClientOptions = ConstructorParameters[0]; export interface PowerbaseAuthClientOptions extends AuthClientOptions { } export type Fetch = typeof fetch; export type PowerbaseClientOptions = { /** * The Postgres schema which your tables belong to. Must be on the list of exposed schemas in Powerbase. Defaults to `public`. */ db?: { schema?: SchemaName; }; auth?: { /** * Automatically refreshes the token for logged-in users. Defaults to true. */ autoRefreshToken?: boolean; /** * Optional key name used for storing tokens in local storage. */ storageKey?: string; /** * Whether to persist a logged-in session to storage. Defaults to true. */ persistSession?: boolean; /** * Detect a session from the URL. Used for OAuth login callbacks. Defaults to true. */ detectSessionInUrl?: boolean; /** * A storage provider. Used to store the logged-in session. */ storage?: PowerbaseAuthClientOptions['storage']; /** * OAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications. */ flowType?: PowerbaseAuthClientOptions['flowType']; /** * If debug messages for authentication client are emitted. Can be used to inspect the behavior of the library. */ debug?: PowerbaseAuthClientOptions['debug']; /** * Provide your own locking mechanism based on the environment. By default no locking is done at this time. * * @experimental */ lock?: PowerbaseAuthClientOptions['lock']; }; /** * Options passed to the realtime-js instance */ realtime?: RealtimeClientOptions; global?: { /** * A custom `fetch` implementation. */ fetch?: Fetch; /** * Optional headers for initializing the client. */ headers?: Record; }; /** * Optional function for using a third-party authentication system with * Powerbase. The function should return an access token or ID token (JWT) by * obtaining it from the third-party auth client library. Note that this * function may be called concurrently and many times. Use memoization and * locking techniques if this is not supported by the client libraries. * * When set, the `auth` namespace of the Powerbase client cannot be used. * Create another client if you wish to use Powerbase Auth and third-party * authentications concurrently in the same application. */ accessToken?: () => Promise; }; export type GenericRelationship = { foreignKeyName: string; columns: string[]; isOneToOne?: boolean; referencedRelation: string; referencedColumns: string[]; }; export type GenericTable = { Row: Record; Insert: Record; Update: Record; Relationships: GenericRelationship[]; }; export type GenericUpdatableView = GenericTable; export type GenericNonUpdatableView = { Row: Record; Relationships: GenericRelationship[]; }; export type GenericView = GenericUpdatableView | GenericNonUpdatableView; export type GenericFunction = { Args: Record; Returns: unknown; }; export type GenericSchema = { Tables: Record; Views: Record; Functions: Record; }; /** * Helper types for query results. */ export type QueryResult = T extends PromiseLike ? U : never; export type QueryData = T extends PromiseLike<{ data: infer U; }> ? Exclude : never; export type QueryError = PostgrestError; export {}; //# sourceMappingURL=types.d.ts.map