UNPKG

@gftdcojp/gftd-orm

Version:

Enterprise-grade real-time data platform with ksqlDB, inspired by Supabase architecture

87 lines 2.05 kB
/** * Supabase風クライアント - 匿名キーベースの統合クライアント */ import { UserPayload, AuthResult, PullQueryOptions } from './types'; /** * キーの種類 */ export declare enum KeyType { ANON = "anon", SERVICE_ROLE = "service_role" } /** * クライアント設定 */ export interface GftdClientConfig { url: string; key: string; options?: { realtime?: { url?: string; autoReconnect?: boolean; }; auth?: { autoRefreshToken?: boolean; persistSession?: boolean; }; db?: { schema?: string; }; }; } /** * 認証状態 */ export interface AuthState { user: UserPayload | null; session: AuthResult | null; isAuthenticated: boolean; isAnonymous: boolean; } /** * Supabase風クライアント */ export declare class GftdClient { private config; private authState; private realtimeClient?; private tokenRefreshInterval?; constructor(config: GftdClientConfig); /** * クライアントを初期化 */ private initializeClient; /** * 認証状態を取得 */ get auth(): AuthState; /** * 直接SQLクエリを実行 */ query(sql: string, options?: PullQueryOptions): Promise<{ data: any[]; error: any; }>; /** * プッシュクエリを実行(ストリーミング) */ stream(sql: string, onData: (data: any) => void, onError?: (error: Error) => void): Promise<{ terminate: () => void; }>; /** * 接続をクリーンアップ */ dispose(): void; /** * 公開キーを取得(互換性のため) */ getKeys(): { anonKey: string | null; serviceRoleKey: string | null; }; } /** * Supabase風クライアント作成関数 */ export declare function createClient(url: string, key: string, options?: GftdClientConfig['options']): GftdClient; //# sourceMappingURL=supabase-like-client.d.ts.map