UNPKG

@gftdcojp/gftd-orm

Version:

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

68 lines 2.59 kB
/** * Next.js用のReactフック(ブラウザ専用) */ import { BrowserClient, BrowserClientConfig } from '../browser-client'; export interface UseGftdOrmOptions { autoConnect?: boolean; autoReconnect?: boolean; } export interface UseGftdOrmResult { client: BrowserClient | null; isConnected: boolean; isLoading: boolean; error: Error | null; connect: () => Promise<void>; disconnect: () => void; health: () => Promise<any>; } export interface UseBrowserClientOptions { autoConnect?: boolean; autoReconnect?: boolean; } export interface UseBrowserClientResult { client: BrowserClient | null; isConnected: boolean; isLoading: boolean; error: Error | null; connect: () => Promise<void>; disconnect: () => void; health: () => Promise<any>; } /** * ブラウザクライアント専用のReactフック * README.mdで言及されている機能を実装 */ export declare function useBrowserClient(config: BrowserClientConfig, options?: UseBrowserClientOptions): UseBrowserClientResult; /** * GFTD-ORMクライアントのReactフック (legacy) */ export declare function useGftdOrm(config: BrowserClientConfig, options?: UseGftdOrmOptions): UseGftdOrmResult; /** * リアルタイムサブスクリプション用のフック * README.mdの例に合わせて改良 */ export declare function useRealtimeSubscription(client: BrowserClient | null, table: string, event: 'INSERT' | 'UPDATE' | 'DELETE' | '*', callback: (payload: any) => void): void; /** * カスタムチャンネルでのリアルタイムサブスクリプション用のフック */ export declare function useRealtimeSubscriptionWithChannel(client: BrowserClient | null, channel: string, table: string, event: 'INSERT' | 'UPDATE' | 'DELETE' | '*', callback: (payload: any) => void): void; /** * データフェッチ用のフック */ export declare function useGftdOrmQuery<T = any>(client: BrowserClient | null, table: string, queryBuilder?: (query: any) => any, dependencies?: any[]): { data: T[]; loading: boolean; error: Error | null; refetch: () => Promise<void>; }; /** * データミューテーション用のフック */ export declare function useGftdOrmMutation<T = any>(client: BrowserClient | null, table: string): { insert: (data: Partial<T>) => Promise<never[]>; update: (data: Partial<T>, where?: (query: any) => any) => Promise<never[]>; remove: (where?: (query: any) => any) => Promise<never[]>; loading: boolean; error: Error | null; }; //# sourceMappingURL=useGftdOrm.d.ts.map