@gftdcojp/gftd-orm
Version:
Enterprise-grade real-time data platform with ksqlDB, inspired by Supabase architecture
155 lines • 3.78 kB
TypeScript
/**
* ブラウザ専用クライアント(Next.js Client Components用)
*/
interface KsqlDbConfig {
url: string;
headers?: Record<string, string>;
apiKey?: string;
}
interface SchemaRegistryConfig {
url: string;
apiKey?: string;
}
declare class DatabaseClient {
constructor(config: any);
initialize(): Promise<void>;
from<T = any>(table: string): {
select: () => {
eq: () => {
execute: () => Promise<{
data: never[];
error: null;
}>;
};
};
insert: (data: any) => Promise<{
data: never[];
error: null;
}>;
update: (data: any) => Promise<{
data: never[];
error: null;
}>;
delete: () => Promise<{
data: never[];
error: null;
}>;
execute: () => Promise<{
data: never[];
error: null;
}>;
};
sql(query: string, params?: any[]): Promise<{
data: never[];
queryId: string;
}>;
health(): Promise<{
status: string;
}>;
}
import { RealtimeClient } from './realtime-client';
export interface BrowserClientConfig {
url: string;
key?: string;
database: {
ksql: Pick<KsqlDbConfig, 'url' | 'headers'> & {
apiKey?: string;
};
schemaRegistry: Pick<SchemaRegistryConfig, 'url'> & {
apiKey?: string;
};
};
realtime?: {
url: string;
apiKey?: string;
autoReconnect?: boolean;
reconnectInterval?: number;
maxReconnectAttempts?: number;
};
}
/**
* ブラウザ専用のGFTD-ORMクライアント
*/
export declare class BrowserClient {
private config;
private _database;
private _realtime;
private initialized;
constructor(config: BrowserClientConfig);
/**
* データベースクライアントを取得
*/
get database(): DatabaseClient;
/**
* リアルタイムクライアントを取得
*/
get realtime(): RealtimeClient;
/**
* クライアントを初期化
*/
initialize(): Promise<void>;
/**
* Supabaseライクなテーブルアクセス
*/
from<T = any>(table: string): {
select: () => {
eq: () => {
execute: () => Promise<{
data: never[];
error: null;
}>;
};
};
insert: (data: any) => Promise<{
data: never[];
error: null;
}>;
update: (data: any) => Promise<{
data: never[];
error: null;
}>;
delete: () => Promise<{
data: never[];
error: null;
}>;
execute: () => Promise<{
data: never[];
error: null;
}>;
};
/**
* リアルタイムチャンネル
*/
channel(name: string): import("./realtime-client").RealtimeChannel;
/**
* SQL クエリを直接実行
*/
sql(query: string, params?: any[]): Promise<{
data: never[];
queryId: string;
}>;
/**
* ヘルスチェック
*/
health(): Promise<{
database: {
status: string;
} | {
status: string;
details: any;
};
realtime: {
status: string;
};
}>;
/**
* すべての接続を閉じる
*/
disconnect(): Promise<void>;
}
/**
* ブラウザ専用クライアント作成関数
*/
export declare function createBrowserClient(config: BrowserClientConfig): BrowserClient;
export {};
//# sourceMappingURL=browser-client.d.ts.map