@reifydb/react 0.4.13 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Column, ShapeNode, InferShape } from '@reifydb/core';
2
2
  export * from '@reifydb/core';
3
- import { WsClientOptions, WsClient, HttpClient, JsonHttpClient, JsonWsClient } from '@reifydb/client';
3
+ import { WsClientOptions, WsClient, HttpClient, JsonHttpClient, JsonWsClient, SubscriptionConfig } from '@reifydb/client';
4
4
  export * from '@reifydb/client';
5
5
  import React, { ReactNode } from 'react';
6
6
 
@@ -199,7 +199,7 @@ interface SubscriptionState<T> {
199
199
  }
200
200
  declare function useSubscriptionExecutor<T = any>(options?: SubscriptionExecutorOptions): {
201
201
  state: SubscriptionState<T>;
202
- subscribe: (rql: string, params?: any, shape?: ShapeNode) => Promise<void>;
202
+ subscribe: (rql: string, params?: any, shape?: ShapeNode, config?: SubscriptionConfig) => Promise<void>;
203
203
  unsubscribe: () => Promise<void>;
204
204
  clear_changes: () => void;
205
205
  clear_data: () => void;
@@ -207,6 +207,7 @@ declare function useSubscriptionExecutor<T = any>(options?: SubscriptionExecutor
207
207
 
208
208
  interface SubscriptionOptions extends SubscriptionExecutorOptions {
209
209
  enabled?: boolean;
210
+ config?: SubscriptionConfig;
210
211
  }
211
212
  declare function useSubscription<S extends ShapeNode = any>(rql: string, params?: any, shape?: S, options?: SubscriptionOptions): {
212
213
  data: InferShape<S>[];
package/dist/index.js CHANGED
@@ -704,6 +704,7 @@ function useSubscriptionExecutor(options) {
704
704
  const rql_ref = useRef5(void 0);
705
705
  const params_ref = useRef5(void 0);
706
706
  const shape_ref = useRef5(void 0);
707
+ const config_ref = useRef5(void 0);
707
708
  useEffect9(() => {
708
709
  client_ref.current = client;
709
710
  }, [client]);
@@ -731,7 +732,7 @@ function useSubscriptionExecutor(options) {
731
732
  const handle_remove = useCallback4((rows) => {
732
733
  add_change_event("REMOVE", rows);
733
734
  }, [add_change_event]);
734
- const subscribe = useCallback4(async (rql, params, shape) => {
735
+ const subscribe = useCallback4(async (rql, params, shape, config) => {
735
736
  const current_client = client_ref.current;
736
737
  if (!current_client) {
737
738
  setState((prev) => ({ ...prev, error: "Client not connected" }));
@@ -744,6 +745,7 @@ function useSubscriptionExecutor(options) {
744
745
  rql_ref.current = rql;
745
746
  params_ref.current = params;
746
747
  shape_ref.current = shape;
748
+ config_ref.current = config;
747
749
  setState((prev) => ({
748
750
  ...prev,
749
751
  is_subscribing: true,
@@ -754,7 +756,7 @@ function useSubscriptionExecutor(options) {
754
756
  on_insert: handle_insert,
755
757
  on_update: handle_update,
756
758
  on_remove: handle_remove
757
- });
759
+ }, config);
758
760
  subscriptionIdRef.current = sub_id;
759
761
  setState((prev) => ({
760
762
  ...prev,
@@ -780,6 +782,7 @@ function useSubscriptionExecutor(options) {
780
782
  rql_ref.current = void 0;
781
783
  params_ref.current = void 0;
782
784
  shape_ref.current = void 0;
785
+ config_ref.current = void 0;
783
786
  setState((prev) => ({
784
787
  ...prev,
785
788
  is_subscribed: false,
@@ -823,13 +826,14 @@ function useSubscription(rql, params, shape, options) {
823
826
  unsubscribe
824
827
  } = useSubscriptionExecutor(options);
825
828
  const params_key = useMemo4(() => JSON.stringify(params), [params]);
829
+ const config_key = useMemo4(() => JSON.stringify(options?.config), [options?.config]);
826
830
  useEffect10(() => {
827
831
  if (options?.enabled === false) return;
828
- subscribe(rql, params, shape);
832
+ subscribe(rql, params, shape, options?.config);
829
833
  return () => {
830
834
  unsubscribe();
831
835
  };
832
- }, [rql, params_key, shape, options?.enabled, subscribe, unsubscribe]);
836
+ }, [rql, params_key, shape, config_key, options?.enabled, subscribe, unsubscribe]);
833
837
  return {
834
838
  data: state.data,
835
839
  changes: state.changes,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/connection/connection.ts","../src/connection/connection-pool.ts","../src/connection/connection-context.tsx","../src/hooks/use-connection.ts","../src/hooks/use-query-executor.ts","../src/hooks/use-query.ts","../src/hooks/use-command-executor.ts","../src/hooks/use-command.ts","../src/hooks/use-admin-executor.ts","../src/hooks/use-admin.ts","../src/hooks/use-subscription-executor.ts","../src/hooks/use-subscription.ts","../src/hooks/use-shape.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nexport * from '@reifydb/core';\nexport * from '@reifydb/client';\n\n// Export connection utilities\nexport {Connection, type ConnectionConfig, DEFAULT_CONFIG, DEFAULT_URL} from './connection/connection';\nexport {get_connection, clear_connection} from './connection/connection-pool';\nexport {ConnectionProvider, ConnectionContext, type ConnectionProviderProps} from './connection/connection-context';\n\n// Export React hooks\nexport {useConnection} from './hooks/use-connection';\nexport {useQueryExecutor, type QueryResult, type QueryState, type QueryExecutorOptions} from './hooks/use-query-executor';\nexport {useQueryOne, useQueryMany, type QueryOptions} from './hooks/use-query';\nexport {useCommandExecutor, type CommandResult, type CommandState, type CommandExecutorOptions} from './hooks/use-command-executor';\nexport {useCommandOne, useCommandMany, type CommandOptions} from './hooks/use-command';\nexport {useAdminExecutor, type AdminResult, type AdminState, type AdminExecutorOptions} from './hooks/use-admin-executor';\nexport {useAdminOne, useAdminMany, type AdminOptions} from './hooks/use-admin';\nexport {\n useSubscriptionExecutor,\n type SubscriptionExecutorOptions,\n type SubscriptionState,\n type ChangeEvent\n} from './hooks/use-subscription-executor';\nexport {\n useSubscription,\n type SubscriptionOptions\n} from './hooks/use-subscription';\nexport {useShape, type TableInfo, type ColumnInfo} from './hooks/use-shape';","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {Client, WsClient, HttpClient, JsonHttpClient, JsonWsClient, type WsClientOptions} from '@reifydb/client';\n\ninterface ConnectionState {\n client: WsClient | HttpClient | JsonHttpClient | JsonWsClient | null;\n is_connected: boolean;\n is_connecting: boolean;\n connection_error: string | null;\n listeners: Set<(state: ConnectionState) => void>;\n}\n\nexport interface ConnectionConfig {\n url?: string;\n token?: string;\n format?: 'json';\n options?: Omit<WsClientOptions, 'url' | 'token'>;\n}\n\nexport const DEFAULT_CONFIG: ConnectionConfig = {\n url: 'ws://127.0.0.1:8090',\n options: {timeout_ms: 30_000},\n};\n\nexport const DEFAULT_URL = 'ws://127.0.0.1:8090';\n\nexport class Connection {\n private state: ConnectionState = {\n client: null,\n is_connected: false,\n is_connecting: false,\n connection_error: null,\n listeners: new Set(),\n };\n private config: ConnectionConfig;\n private connect_promise: Promise<void> | null = null;\n\n constructor(config: ConnectionConfig = DEFAULT_CONFIG) {\n this.config = {...DEFAULT_CONFIG, ...config};\n }\n\n set_config(config: ConnectionConfig): void {\n this.config = config;\n }\n\n get_config(): ConnectionConfig {\n return this.config;\n }\n\n async connect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void> {\n if (this.state.is_connected) {\n return;\n }\n\n // If already connecting, wait for the in-flight connection\n if (this.connect_promise) {\n return this.connect_promise;\n }\n\n const connect_url = url || this.config.url || DEFAULT_CONFIG.url!;\n const connect_options = {token: this.config.token, ...this.config.options, ...options};\n\n this.update_state({\n is_connecting: true,\n connection_error: null,\n });\n\n this.connect_promise = (async () => {\n try {\n const isHttp = connect_url.startsWith('http://') || connect_url.startsWith('https://');\n const isJson = this.config.format === 'json';\n let client: WsClient | HttpClient | JsonHttpClient | JsonWsClient;\n if (isHttp) {\n client = isJson\n ? Client.connect_json_http(connect_url, connect_options)\n : Client.connect_http(connect_url, connect_options);\n } else {\n client = isJson\n ? await Client.connect_json_ws(connect_url, connect_options)\n : await Client.connect_ws(connect_url, connect_options);\n }\n this.update_state({\n client,\n is_connected: true,\n is_connecting: false,\n connection_error: null,\n });\n } catch (err) {\n const error_message = err instanceof Error ? err.message : 'Failed to connect to ReifyDB';\n console.error('[Connection] Connection failed:', error_message, err);\n this.update_state({\n client: null,\n is_connected: false,\n is_connecting: false,\n connection_error: error_message,\n });\n throw err;\n } finally {\n this.connect_promise = null;\n }\n })();\n\n return this.connect_promise;\n }\n\n async disconnect(): Promise<void> {\n this.connect_promise = null;\n if (this.state.client) {\n try {\n if ('disconnect' in this.state.client) {\n (this.state.client as WsClient).disconnect();\n // Small delay to ensure WebSocket closes cleanly\n await new Promise(resolve => setTimeout(resolve, 10));\n }\n } catch (err) {\n console.error('Error disconnecting:', err);\n }\n }\n\n this.update_state({\n client: null,\n is_connected: false,\n is_connecting: false,\n connection_error: null,\n });\n }\n\n async reconnect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void> {\n await this.disconnect();\n await this.connect(url, options);\n }\n\n get_client(): WsClient | HttpClient | JsonHttpClient | JsonWsClient | null {\n return this.state.client;\n }\n\n is_connected(): boolean {\n return this.state.is_connected;\n }\n\n is_connecting(): boolean {\n return this.state.is_connecting;\n }\n\n get_connection_error(): string | null {\n return this.state.connection_error;\n }\n\n get_state(): Omit<ConnectionState, 'listeners'> {\n const {listeners, ...state} = this.state;\n return state;\n }\n\n // Subscribe to state changes\n subscribe(listener: (state: ConnectionState) => void): () => void {\n this.state.listeners.add(listener);\n // Return unsubscribe function\n return () => {\n this.state.listeners.delete(listener);\n };\n }\n\n private update_state(updates: Partial<ConnectionState>): void {\n this.state = {\n ...this.state,\n ...updates,\n };\n\n // Notify all listeners\n this.state.listeners.forEach(listener => {\n listener(this.state);\n });\n }\n}\n\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport { Connection, ConnectionConfig, DEFAULT_CONFIG } from './connection';\n\n/**\n * Singleton default connection instance.\n * This ensures a single global connection that gets reused and updated.\n */\nlet default_connection: Connection | null = null;\n\n/**\n * Get the singleton connection instance.\n * If a config is provided, the connection's config will be updated via set_config().\n * @param config - Optional connection configuration\n * @returns The singleton Connection instance\n */\nexport function get_connection(config?: ConnectionConfig): Connection {\n // Create singleton on first call\n if (!default_connection) {\n const merged_config = {...DEFAULT_CONFIG, ...config};\n default_connection = new Connection(merged_config);\n // Start connection immediately - don't wait for React's useEffect\n default_connection.connect().catch(err => {\n console.error('[ConnectionPool] Eager connect failed:', err);\n });\n } else if (config) {\n // Only update config when explicitly provided, to avoid\n // stripping fields (e.g. token) that were set on creation.\n default_connection.set_config({...DEFAULT_CONFIG, ...config});\n }\n\n return default_connection;\n}\n\n/**\n * Clear the singleton connection\n */\nexport async function clear_connection(): Promise<void> {\n if (default_connection) {\n await default_connection.disconnect();\n default_connection = null;\n }\n}","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport React, { createContext, useEffect, useRef, ReactNode } from 'react';\nimport { Connection, ConnectionConfig } from './connection';\nimport { get_connection } from './connection-pool';\n\nexport const ConnectionContext = createContext<Connection | null>(null);\n\nexport interface ConnectionProviderProps {\n config?: ConnectionConfig;\n children: ReactNode;\n}\n\nexport function ConnectionProvider({ config, children }: ConnectionProviderProps) {\n // Get the singleton connection - this always returns the same instance\n // but updates its config via set_config()\n const connection = get_connection(config);\n\n // Track previous config to detect changes\n const prev_config_ref = useRef<string | undefined>(undefined);\n const current_config_str = JSON.stringify(config);\n\n useEffect(() => {\n const config_changed = prev_config_ref.current !== undefined &&\n prev_config_ref.current !== current_config_str;\n\n if (config_changed && connection.is_connected()) {\n // Config changed while connected - reconnect with new config\n connection.reconnect().catch(err => {\n console.error('[ConnectionProvider] Failed to reconnect:', err);\n });\n } else if (!connection.is_connected() && !connection.is_connecting()) {\n // Auto-connect if not connected\n connection.connect().catch(err => {\n console.error('[ConnectionProvider] Failed to connect:', err);\n });\n }\n\n // Update previous config reference\n prev_config_ref.current = current_config_str;\n }, [current_config_str, connection]);\n\n return (\n <ConnectionContext.Provider value={connection}>\n {children}\n </ConnectionContext.Provider>\n );\n}","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useContext, useEffect, useState} from 'react';\nimport {ConnectionConfig} from '../connection/connection';\nimport {get_connection} from '../connection/connection-pool';\nimport {ConnectionContext} from '../connection/connection-context';\nimport {WsClient, HttpClient, JsonHttpClient, JsonWsClient} from '@reifydb/client';\n\ninterface ConnectionState {\n client: WsClient | HttpClient | JsonHttpClient | JsonWsClient | null;\n is_connected: boolean;\n is_connecting: boolean;\n connection_error: string | null;\n}\n\nexport function useConnection(override_config?: ConnectionConfig) {\n const context_connection = useContext(ConnectionContext);\n\n // Use override config if provided, otherwise use context, otherwise get default\n const [connection] = useState(() => {\n if (override_config) {\n return get_connection(override_config);\n }\n if (context_connection) {\n return context_connection;\n }\n return get_connection();\n });\n\n const [state, setState] = useState<ConnectionState>(() => connection.get_state());\n\n useEffect(() => {\n // Get initial state immediately\n const current_state = connection.get_state();\n setState(current_state);\n\n // Subscribe to connection state changes\n const unsubscribe = connection.subscribe((new_state) => {\n setState({\n client: new_state.client,\n is_connected: new_state.is_connected,\n is_connecting: new_state.is_connecting,\n connection_error: new_state.connection_error,\n });\n });\n\n // No auto-connect - ConnectionProvider handles all auto-connection\n // Users must either wrap with ConnectionProvider or manually call connect()\n\n return unsubscribe;\n }, [connection]);\n\n return {\n ...state,\n connect: () => connection.connect(),\n disconnect: () => connection.disconnect(),\n reconnect: () => connection.reconnect(),\n };\n}","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useState, useCallback, useRef, useEffect} from 'react';\nimport {Column, ShapeNode} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useConnection} from './use-connection';\n\nexport interface QueryResult<T = any> {\n columns: Column[];\n rows: T[];\n execution_time_ms: number;\n rows_affected?: number;\n}\n\nexport interface QueryState<T = any> {\n is_executing: boolean;\n results: QueryResult<T>[] | undefined;\n error: string | undefined;\n execution_time: number | undefined;\n}\n\nexport interface QueryExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\nexport function useQueryExecutor<T = any>(options?: QueryExecutorOptions) {\n const {client} = useConnection(options?.connection_config);\n\n const [state, setState] = useState<QueryState<T>>({\n is_executing: false,\n results: undefined,\n error: undefined,\n execution_time: undefined,\n });\n\n const client_ref = useRef(client);\n client_ref.current = client;\n\n const is_mounted_ref = useRef(true);\n useEffect(() => {\n return () => { is_mounted_ref.current = false; };\n }, []);\n\n const execution_id_ref = useRef(0);\n const pending_ref = useRef<{rql: string, params?: any, shapes?: readonly ShapeNode[]} | null>(null);\n\n const query = useCallback(\n (rql: string, params?: any, shapes?: readonly ShapeNode[]): Promise<void> => {\n const current_client = client_ref.current;\n\n if (!current_client) {\n pending_ref.current = {rql, params, shapes};\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n return Promise.resolve();\n }\n\n pending_ref.current = null;\n const this_execution = ++execution_id_ref.current;\n\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n\n const start_time = Date.now();\n\n return (async () => {\n try {\n const frame_results = await current_client.query(rql, params || null, shapes || []) || [];\n\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n\n const results: QueryResult<T>[] = frame_results.map((frame: any) => {\n if (Array.isArray(frame) && frame.length > 0) {\n const first_row = frame[0];\n let columns: Column[] = [];\n\n const has_value_objects = first_row && typeof first_row === 'object' &&\n Object.values(first_row).some(v => v && typeof v === 'object' && 'type' in v);\n\n if (has_value_objects) {\n columns = Object.keys(first_row).map((key) => {\n const value = first_row[key];\n const data_type = value?.type || 'Utf8';\n return {\n name: key,\n type: data_type,\n payload: [],\n };\n });\n } else {\n columns = Object.keys(first_row).map((key) => ({\n name: key,\n type: 'Utf8',\n payload: [],\n }));\n }\n\n return {\n columns,\n rows: frame as T[],\n execution_time_ms: execution_time,\n };\n } else {\n return {\n columns: [],\n rows: [],\n execution_time_ms: execution_time,\n };\n }\n });\n\n if (!is_mounted_ref.current) return;\n setState({\n is_executing: false,\n results,\n error: undefined,\n execution_time,\n });\n } catch (err) {\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n let error_message = 'Query execution failed';\n\n if (err instanceof Error) {\n error_message = err.message;\n } else if (typeof err === 'string') {\n error_message = err;\n } else if (err && typeof err === 'object' && 'message' in err) {\n error_message = (err as { message: string }).message;\n }\n\n console.error('Query execution failed:', error_message);\n\n if (!is_mounted_ref.current) return;\n setState(prev => ({\n ...prev,\n is_executing: false,\n error: error_message,\n execution_time,\n }));\n\n }\n })();\n },\n []\n );\n\n useEffect(() => {\n if (client && pending_ref.current) {\n const {rql, params, shapes} = pending_ref.current;\n query(rql, params, shapes);\n }\n }, [client, query]);\n\n const cancel_query = useCallback(() => {\n execution_id_ref.current++;\n setState((prev) => ({\n ...prev,\n is_executing: false,\n error: 'Query cancelled',\n }));\n }, []);\n\n return {\n is_executing: state.is_executing,\n results: state.results,\n error: state.error,\n execution_time: state.execution_time,\n query,\n cancel_query,\n };\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useEffect, useMemo} from 'react';\nimport {ShapeNode, InferShape} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useQueryExecutor, type QueryResult, type QueryExecutorOptions} from './use-query-executor';\n\nexport interface QueryOptions extends QueryExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\n// Single query hook - returns a single result\nexport function useQueryOne<S extends ShapeNode = any>(\n rql: string,\n params?: any,\n shape?: S,\n options?: QueryOptions\n): {\n is_executing: boolean;\n result: QueryResult<S extends ShapeNode ? InferShape<S> : any> | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n query\n } = useQueryExecutor<S extends ShapeNode ? InferShape<S> : any>(options);\n\n useEffect(() => {\n // Pass shape as array for the executor\n const shapes = shape ? [shape] : undefined;\n query(rql, params, shapes);\n }, [rql, params, query]);\n\n // Extract first result for single query convenience\n const result = useMemo(() => {\n return results && results.length > 0 ? results[0] : undefined;\n }, [results]);\n\n return {is_executing, result, error};\n}\n\n// Multiple query hook - returns multiple results\nexport function useQueryMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(\n rql: string,\n params?: any,\n shapes?: S,\n options?: QueryOptions\n): {\n is_executing: boolean;\n results: QueryResult<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>[] | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n query\n } = useQueryExecutor<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>(options);\n\n useEffect(() => {\n query(rql, params, shapes);\n }, [rql, params, query]);\n\n return {is_executing, results, error};\n}","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useState, useCallback, useRef, useEffect} from 'react';\nimport {Column, ShapeNode} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useConnection} from './use-connection';\n\nexport interface CommandResult<T = any> {\n columns: Column[];\n rows: T[];\n execution_time_ms: number;\n rows_affected?: number;\n}\n\nexport interface CommandState<T = any> {\n is_executing: boolean;\n results: CommandResult<T>[] | undefined;\n error: string | undefined;\n execution_time: number | undefined;\n}\n\nexport interface CommandExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\nexport function useCommandExecutor<T = any>(options?: CommandExecutorOptions) {\n const {client} = useConnection(options?.connection_config);\n\n const [state, setState] = useState<CommandState<T>>({\n is_executing: false,\n results: undefined,\n error: undefined,\n execution_time: undefined,\n });\n\n const client_ref = useRef(client);\n client_ref.current = client;\n\n const is_mounted_ref = useRef(false);\n useEffect(() => {\n is_mounted_ref.current = true;\n return () => { is_mounted_ref.current = false; };\n }, []);\n\n const execution_id_ref = useRef(0);\n const pending_ref = useRef<{rql: string, params?: any, shapes?: readonly ShapeNode[]} | null>(null);\n\n const command = useCallback(\n (rql: string, params?: any, shapes?: readonly ShapeNode[]): Promise<void> => {\n const current_client = client_ref.current;\n\n if (!current_client) {\n pending_ref.current = {rql, params, shapes};\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n return Promise.resolve();\n }\n\n pending_ref.current = null;\n const this_execution = ++execution_id_ref.current;\n\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n\n const start_time = Date.now();\n\n return (async () => {\n try {\n const frame_results = await current_client.command(rql, params || null, shapes || []) || [];\n\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n\n const results: CommandResult<T>[] = frame_results.map((frame: any) => {\n if (Array.isArray(frame) && frame.length > 0) {\n const first_row = frame[0];\n let columns: Column[] = [];\n\n const has_value_objects = first_row && typeof first_row === 'object' &&\n Object.values(first_row).some(v => v && typeof v === 'object' && 'type' in v);\n\n if (has_value_objects) {\n columns = Object.keys(first_row).map((key) => {\n const value = first_row[key];\n const data_type = value?.type || 'Utf8';\n return {\n name: key,\n type: data_type,\n payload: [],\n };\n });\n } else {\n columns = Object.keys(first_row).map((key) => ({\n name: key,\n type: 'Utf8',\n payload: [],\n }));\n }\n\n return {\n columns,\n rows: frame as T[],\n execution_time_ms: execution_time,\n };\n } else {\n return {\n columns: [],\n rows: [],\n execution_time_ms: execution_time,\n rows_affected: typeof frame === 'number' ? frame : undefined,\n };\n }\n });\n\n if (!is_mounted_ref.current) return;\n setState({\n is_executing: false,\n results,\n error: undefined,\n execution_time,\n });\n } catch (err) {\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n let error_message = 'Command execution failed';\n\n if (err instanceof Error) {\n error_message = err.message;\n } else if (typeof err === 'string') {\n error_message = err;\n } else if (err && typeof err === 'object' && 'message' in err) {\n error_message = (err as { message: string }).message;\n }\n\n console.error('Command execution failed:', error_message);\n\n if (!is_mounted_ref.current) return;\n setState(prev => ({\n ...prev,\n is_executing: false,\n error: error_message,\n execution_time,\n }));\n\n }\n })();\n },\n []\n );\n\n useEffect(() => {\n if (client && pending_ref.current) {\n const {rql, params, shapes} = pending_ref.current;\n command(rql, params, shapes);\n }\n }, [client, command]);\n\n const cancel_command = useCallback(() => {\n execution_id_ref.current++;\n setState((prev) => ({\n ...prev,\n is_executing: false,\n error: 'Command cancelled',\n }));\n }, []);\n\n return {\n is_executing: state.is_executing,\n results: state.results,\n error: state.error,\n execution_time: state.execution_time,\n command,\n cancel_command,\n };\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useEffect, useMemo} from 'react';\nimport {ShapeNode, InferShape} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useCommandExecutor, type CommandResult, type CommandExecutorOptions} from './use-command-executor';\n\nexport interface CommandOptions extends CommandExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\n// Single command hook - returns a single result\nexport function useCommandOne<S extends ShapeNode = any>(\n rql: string,\n params?: any,\n shape?: S,\n options?: CommandOptions\n): {\n is_executing: boolean;\n result: CommandResult<S extends ShapeNode ? InferShape<S> : any> | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n command\n } = useCommandExecutor<S extends ShapeNode ? InferShape<S> : any>(options);\n\n useEffect(() => {\n // Pass shape as array for the executor\n const shapes = shape ? [shape] : undefined;\n command(rql, params, shapes);\n }, [rql, params, command]);\n\n // Extract first result for single command convenience\n const result = useMemo(() => {\n return results && results.length > 0 ? results[0] : undefined;\n }, [results]);\n\n return {is_executing, result, error};\n}\n\n// Multiple command hook - returns multiple results\nexport function useCommandMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(\n rql: string,\n params?: any,\n shapes?: S,\n options?: CommandOptions\n): {\n is_executing: boolean;\n results: CommandResult<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>[] | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n command\n } = useCommandExecutor<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>(options);\n\n useEffect(() => {\n command(rql, params, shapes);\n }, [rql, params, command]);\n\n return {is_executing, results, error};\n}","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useState, useCallback, useRef, useEffect} from 'react';\nimport {Column, ShapeNode} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useConnection} from './use-connection';\n\nexport interface AdminResult<T = any> {\n columns: Column[];\n rows: T[];\n execution_time_ms: number;\n rows_affected?: number;\n}\n\nexport interface AdminState<T = any> {\n is_executing: boolean;\n results: AdminResult<T>[] | undefined;\n error: string | undefined;\n execution_time: number | undefined;\n}\n\nexport interface AdminExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\nexport function useAdminExecutor<T = any>(options?: AdminExecutorOptions) {\n const {client} = useConnection(options?.connection_config);\n\n const [state, setState] = useState<AdminState<T>>({\n is_executing: false,\n results: undefined,\n error: undefined,\n execution_time: undefined,\n });\n\n // Stable refs so the callback never recreates\n const client_ref = useRef(client);\n client_ref.current = client;\n\n const is_mounted_ref = useRef(false);\n useEffect(() => {\n is_mounted_ref.current = true;\n return () => { is_mounted_ref.current = false; };\n }, []);\n\n // Counter to detect superseded executions\n const execution_id_ref = useRef(0);\n\n // Stash pending call if client isn't ready yet\n const pending_ref = useRef<{rql: string, params?: any, shapes?: readonly ShapeNode[]} | null>(null);\n\n const admin = useCallback(\n (rql: string, params?: any, shapes?: readonly ShapeNode[]): Promise<void> => {\n const current_client = client_ref.current;\n // If no client yet, stash the request for replay when client connects\n if (!current_client) {\n pending_ref.current = {rql, params, shapes};\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n return Promise.resolve();\n }\n\n pending_ref.current = null;\n const this_execution = ++execution_id_ref.current;\n\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n\n const start_time = Date.now();\n\n return (async () => {\n try {\n const frame_results = await current_client.admin(rql, params || null, shapes || []) || [];\n\n // If this execution was superseded by a newer one, discard results\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n\n // Process each frame into a AdminResult\n const results: AdminResult<T>[] = frame_results.map((frame: any) => {\n if (Array.isArray(frame) && frame.length > 0) {\n const first_row = frame[0];\n let columns: Column[] = [];\n\n // Check if we have Value objects or plain objects\n const has_value_objects = first_row && typeof first_row === 'object' &&\n Object.values(first_row).some(v => v && typeof v === 'object' && 'type' in v);\n\n if (has_value_objects) {\n columns = Object.keys(first_row).map((key) => {\n const value = first_row[key];\n const data_type = value?.type || 'Utf8';\n return {\n name: key,\n type: data_type,\n payload: [],\n };\n });\n } else {\n columns = Object.keys(first_row).map((key) => ({\n name: key,\n type: 'Utf8',\n payload: [],\n }));\n }\n\n return {\n columns,\n rows: frame as T[],\n execution_time_ms: execution_time,\n };\n } else {\n return {\n columns: [],\n rows: [],\n execution_time_ms: execution_time,\n rows_affected: typeof frame === 'number' ? frame : undefined,\n };\n }\n });\n\n if (!is_mounted_ref.current) return;\n setState({\n is_executing: false,\n results,\n error: undefined,\n execution_time,\n });\n } catch (err) {\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n let error_message = 'Admin execution failed';\n\n if (err instanceof Error) {\n error_message = err.message;\n } else if (typeof err === 'string') {\n error_message = err;\n } else if (err && typeof err === 'object' && 'message' in err) {\n error_message = (err as { message: string }).message;\n }\n\n console.error('Admin execution failed:', error_message);\n\n if (!is_mounted_ref.current) return;\n setState(prev => ({\n ...prev,\n is_executing: false,\n error: error_message,\n execution_time,\n }));\n\n }\n })();\n },\n [] // stable — never recreates\n );\n\n // Replay pending request when client becomes available\n useEffect(() => {\n if (client && pending_ref.current) {\n const {rql, params, shapes} = pending_ref.current;\n admin(rql, params, shapes);\n }\n }, [client, admin]);\n\n const cancel_admin = useCallback(() => {\n // Bump execution ID so any in-flight request is ignored on completion\n execution_id_ref.current++;\n setState((prev) => ({\n ...prev,\n is_executing: false,\n error: 'Admin cancelled',\n }));\n }, []);\n\n return {\n is_executing: state.is_executing,\n results: state.results,\n error: state.error,\n execution_time: state.execution_time,\n admin,\n cancel_admin,\n };\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useEffect, useMemo} from 'react';\nimport {ShapeNode, InferShape} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useAdminExecutor, type AdminResult, type AdminExecutorOptions} from './use-admin-executor';\n\nexport interface AdminOptions extends AdminExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\n// Single admin hook - returns a single result\nexport function useAdminOne<S extends ShapeNode = any>(\n rql: string,\n params?: any,\n shape?: S,\n options?: AdminOptions\n): {\n is_executing: boolean;\n result: AdminResult<S extends ShapeNode ? InferShape<S> : any> | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n admin\n } = useAdminExecutor<S extends ShapeNode ? InferShape<S> : any>(options);\n\n useEffect(() => {\n // Pass shape as array for the executor\n const shapes = shape ? [shape] : undefined;\n admin(rql, params, shapes);\n }, [rql, params, admin]);\n\n // Extract first result for single admin convenience\n const result = useMemo(() => {\n return results && results.length > 0 ? results[0] : undefined;\n }, [results]);\n\n return {is_executing, result, error};\n}\n\n// Multiple admin hook - returns multiple results\nexport function useAdminMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(\n rql: string,\n params?: any,\n shapes?: S,\n options?: AdminOptions\n): {\n is_executing: boolean;\n results: AdminResult<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>[] | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n admin\n } = useAdminExecutor<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>(options);\n\n useEffect(() => {\n admin(rql, params, shapes);\n }, [rql, params, admin]);\n\n return {is_executing, results, error};\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport { useState, useCallback, useRef, useEffect } from 'react';\nimport { ShapeNode } from '@reifydb/core';\nimport { useConnection } from './use-connection';\nimport type { ConnectionConfig } from '../connection/connection';\n\nexport interface SubscriptionExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\nexport interface ChangeEvent<T> {\n operation: 'INSERT' | 'UPDATE' | 'REMOVE';\n rows: T[];\n timestamp: number;\n}\n\nexport interface SubscriptionState<T> {\n data: T[];\n changes: ChangeEvent<T>[];\n is_subscribed: boolean;\n is_subscribing: boolean;\n error: string | undefined;\n subscription_id: string | undefined;\n}\n\nexport function useSubscriptionExecutor<T = any>(\n options?: SubscriptionExecutorOptions\n) {\n const { client } = useConnection(options?.connection_config);\n\n const [state, setState] = useState<SubscriptionState<T>>({\n data: [],\n changes: [],\n is_subscribed: false,\n is_subscribing: false,\n error: undefined,\n subscription_id: undefined\n });\n\n // Use a ref for client to avoid recreating callbacks when client changes\n const client_ref = useRef(client);\n\n const subscriptionIdRef = useRef<string | undefined>(undefined);\n const rql_ref = useRef<string | undefined>(undefined);\n const params_ref = useRef<any>(undefined);\n const shape_ref = useRef<ShapeNode | undefined>(undefined);\n\n // Keep client_ref in sync with client\n useEffect(() => {\n client_ref.current = client;\n }, [client]);\n\n // Helper to add change event\n const add_change_event = useCallback((\n operation: 'INSERT' | 'UPDATE' | 'REMOVE',\n rows: T[]\n ) => {\n setState(prev => {\n const new_change: ChangeEvent<T> = {\n operation,\n rows,\n timestamp: Date.now()\n };\n\n const new_changes = [...prev.changes, new_change];\n\n return {\n ...prev,\n data: prev.data,\n changes: new_changes\n };\n });\n }, []);\n\n // Separate callbacks for each operation type\n const handle_insert = useCallback((rows: T[]) => {\n add_change_event('INSERT', rows);\n }, [add_change_event]);\n\n const handle_update = useCallback((rows: T[]) => {\n add_change_event('UPDATE', rows);\n }, [add_change_event]);\n\n const handle_remove = useCallback((rows: T[]) => {\n add_change_event('REMOVE', rows);\n }, [add_change_event]);\n\n const subscribe = useCallback(async (\n rql: string,\n params?: any,\n shape?: ShapeNode\n ) => {\n const current_client = client_ref.current;\n if (!current_client) {\n setState(prev => ({ ...prev, error: 'Client not connected' }));\n return;\n }\n\n if (!('subscribe' in current_client)) {\n setState(prev => ({ ...prev, error: 'Subscriptions require a WebSocket connection' }));\n return;\n }\n\n // Store refs for reconnection\n rql_ref.current = rql;\n params_ref.current = params;\n shape_ref.current = shape;\n\n setState(prev => ({\n ...prev,\n is_subscribing: true,\n error: undefined\n }));\n\n try {\n const sub_id = await current_client.subscribe(rql, params, shape, {\n on_insert: handle_insert,\n on_update: handle_update,\n on_remove: handle_remove\n });\n\n subscriptionIdRef.current = sub_id;\n setState(prev => ({\n ...prev,\n is_subscribing: false,\n is_subscribed: true,\n subscription_id: sub_id\n }));\n } catch (err: any) {\n setState(prev => ({\n ...prev,\n is_subscribing: false,\n error: err.message || 'Subscription failed'\n }));\n }\n }, [handle_insert, handle_update, handle_remove]);\n\n const unsubscribe = useCallback(async () => {\n const current_client = client_ref.current;\n if (!current_client || !subscriptionIdRef.current) return;\n if (!('unsubscribe' in current_client)) return;\n\n try {\n await current_client.unsubscribe(subscriptionIdRef.current);\n subscriptionIdRef.current = undefined;\n rql_ref.current = undefined;\n params_ref.current = undefined;\n shape_ref.current = undefined;\n\n setState(prev => ({\n ...prev,\n is_subscribed: false,\n subscription_id: undefined\n }));\n } catch (err: any) {\n setState(prev => ({\n ...prev,\n error: err.message || 'Unsubscribe failed'\n }));\n }\n }, []);\n\n const clear_changes = useCallback(() => {\n setState(prev => ({ ...prev, changes: [] }));\n }, []);\n\n const clear_data = useCallback(() => {\n setState(prev => ({ ...prev, data: [] }));\n }, []);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (subscriptionIdRef.current && client_ref.current && 'unsubscribe' in client_ref.current) {\n client_ref.current.unsubscribe(subscriptionIdRef.current).catch(console.error);\n }\n };\n }, []);\n\n return {\n state,\n subscribe,\n unsubscribe,\n clear_changes,\n clear_data\n };\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport { useEffect, useMemo } from 'react';\nimport { ShapeNode, InferShape } from '@reifydb/core';\nimport {\n useSubscriptionExecutor,\n type SubscriptionExecutorOptions,\n type ChangeEvent\n} from './use-subscription-executor';\n\nexport interface SubscriptionOptions extends SubscriptionExecutorOptions {\n enabled?: boolean; // Auto-subscribe (default: true)\n}\n\nexport function useSubscription<S extends ShapeNode = any>(\n rql: string,\n params?: any,\n shape?: S,\n options?: SubscriptionOptions\n): {\n data: InferShape<S>[];\n changes: ChangeEvent<InferShape<S>>[];\n is_subscribed: boolean;\n is_subscribing: boolean;\n error: string | undefined;\n subscription_id: string | undefined;\n} {\n const {\n state,\n subscribe,\n unsubscribe\n } = useSubscriptionExecutor<InferShape<S>>(options);\n\n // Serialize params for stable comparison (objects create new refs each render)\n const params_key = useMemo(() => JSON.stringify(params), [params]);\n\n useEffect(() => {\n if (options?.enabled === false) return;\n\n subscribe(rql, params, shape);\n\n return () => {\n unsubscribe();\n };\n }, [rql, params_key, shape, options?.enabled, subscribe, unsubscribe]);\n\n return {\n data: state.data,\n changes: state.changes,\n is_subscribed: state.is_subscribed,\n is_subscribing: state.is_subscribing,\n error: state.error,\n subscription_id: state.subscription_id\n };\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useEffect, useState} from 'react';\nimport {Shape, InferShape} from '@reifydb/core';\nimport {useQueryExecutor} from './use-query-executor';\n\nexport interface ColumnInfo {\n name: string;\n data_type: string;\n}\n\nexport interface TableInfo {\n name: string;\n columns: ColumnInfo[];\n}\n\nconst namespace_shape = Shape.object({\n id: Shape.number(),\n name: Shape.string(),\n});\n\nconst table_shape = Shape.object({\n id: Shape.number(),\n namespace_id: Shape.number(),\n name: Shape.string(),\n primary_key_id: Shape.number(),\n});\n\nconst view_shape = Shape.object({\n id: Shape.number(),\n namespace_id: Shape.number(),\n name: Shape.string(),\n});\n\nconst column_shape = Shape.object({\n id: Shape.number(),\n shape_id: Shape.number(),\n shape_type: Shape.number(),\n name: Shape.string(),\n type: Shape.number(),\n position: Shape.number(),\n auto_increment: Shape.boolean(),\n});\n\ntype NamespaceRow = InferShape<typeof namespace_shape>;\ntype TableRow = InferShape<typeof table_shape>;\ntype ViewRow = InferShape<typeof view_shape>;\ntype ColumnRow = InferShape<typeof column_shape>;\n\nexport function useShape(): [boolean, TableInfo[], string | undefined] {\n const {is_executing, results, error, query} = useQueryExecutor();\n const [shape, set_shape] = useState<TableInfo[]>([]);\n const [is_loading, set_is_loading] = useState(true);\n\n useEffect(() => {\n if (!query) return;\n\n const fetch_shape = async () => {\n set_is_loading(true);\n\n try {\n await query(\n `OUTPUT FROM system::namespaces; OUTPUT FROM system::tables; OUTPUT FROM system::views; OUTPUT FROM system::columns;`,\n undefined,\n [namespace_shape, table_shape, view_shape, column_shape]\n );\n } catch (err) {\n console.error('Failed to fetch shape:', err);\n }\n };\n\n fetch_shape();\n }, [query]);\n\n useEffect(() => {\n if (!results || results.length < 4) {\n set_is_loading(is_executing);\n return;\n }\n\n const tables_result = results[1];\n const views_result = results[2];\n const columns_result = results[3];\n\n if (!tables_result?.rows || !views_result?.rows || !columns_result?.rows) {\n set_is_loading(false);\n return;\n }\n\n const namespaces_result = results[0];\n const namespaces = namespaces_result.rows as unknown as NamespaceRow[];\n const tables = tables_result.rows as unknown as TableRow[];\n const views = views_result.rows as unknown as ViewRow[];\n const columns = columns_result.rows as unknown as ColumnRow[];\n\n const namespace_map = new Map<number, string>();\n namespaces.forEach((ns) => {\n const id = ns.id?.valueOf() as number;\n const name = ns.name?.valueOf() as string;\n if (id !== undefined && name) {\n namespace_map.set(id, name);\n }\n });\n\n const table_info_map = new Map<number, TableInfo>();\n\n tables.forEach((table) => {\n const table_id = table.id?.valueOf() as number;\n const namespace_id = table.namespace_id?.valueOf() as number;\n const table_name = table.name?.valueOf() as string;\n\n if (table_id === undefined || !table_name || namespace_id === undefined) return;\n\n const namespace = namespace_map.get(namespace_id);\n if (!namespace) return;\n\n const full_table_name = `${namespace}::${table_name}`;\n\n table_info_map.set(table_id, {\n name: full_table_name,\n columns: [],\n });\n });\n\n views.forEach((view) => {\n const view_id = view.id?.valueOf() as number;\n const namespace_id = view.namespace_id?.valueOf() as number;\n const view_name = view.name?.valueOf() as string;\n\n if (view_id === undefined || !view_name || namespace_id === undefined) return;\n\n const namespace = namespace_map.get(namespace_id);\n if (!namespace) return;\n\n const full_view_name = `${namespace}::${view_name}`;\n\n table_info_map.set(view_id, {\n name: full_view_name,\n columns: [],\n });\n });\n\n const type_map: Record<number, string> = {\n 0: 'None',\n 1: 'Float4',\n 2: 'Float8',\n 3: 'Int1',\n 4: 'Int2',\n 5: 'Int4',\n 6: 'Int8',\n 7: 'Int16',\n 8: 'Utf8',\n 9: 'Uint1',\n 10: 'Uint2',\n 11: 'Uint4',\n 12: 'Uint8',\n 13: 'Uint16',\n 14: 'Boolean',\n 15: 'Date',\n 16: 'DateTime',\n 17: 'Time',\n 18: 'Duration',\n 19: 'IdentityId',\n 20: 'Uuid4',\n 21: 'Uuid7',\n 22: 'Blob',\n 23: 'Int',\n 24: 'Decimal',\n 25: 'Uint',\n 26: 'Any',\n };\n\n // Create a map to collect columns with their positions\n const table_columns_map = new Map<number, Array<{name: string; data_type: string; position: number}>>();\n\n columns.forEach((column) => {\n const shape_id = column.shape_id?.valueOf() as number;\n const shape_type = column.shape_type?.valueOf() as number;\n const column_name = column.name?.valueOf() as string;\n const type_id = column.type?.valueOf() as number;\n const position = column.position?.valueOf() as number;\n\n if (shape_id === undefined || !column_name || type_id === undefined) return;\n if (shape_type !== 0 && shape_type !== 1) return;\n\n if (!table_columns_map.has(shape_id)) {\n table_columns_map.set(shape_id, []);\n }\n\n table_columns_map.get(shape_id)!.push({\n name: column_name,\n data_type: type_map[type_id] || `Unknown(${type_id})`,\n position: position ?? 0,\n });\n });\n\n // Sort columns by position and add to table info\n table_columns_map.forEach((cols, shape_id) => {\n const table_info = table_info_map.get(shape_id);\n if (table_info) {\n cols.sort((a, b) => a.position - b.position);\n table_info.columns = cols.map((c) => ({name: c.name, data_type: c.data_type}));\n }\n });\n\n const shape_array = Array.from(table_info_map.values())\n .filter((table) => table.name !== 'reifydb::flows')\n .sort((a, b) => a.name.localeCompare(b.name));\n\n set_shape(shape_array);\n set_is_loading(false);\n }, [results, is_executing]);\n\n return [is_loading, shape, error];\n}\n"],"mappings":";AAGA,cAAc;AACd,cAAc;;;ACDd,SAAQ,cAAuF;AAiBxF,IAAM,iBAAmC;AAAA,EAC5C,KAAK;AAAA,EACL,SAAS,EAAC,YAAY,IAAM;AAChC;AAEO,IAAM,cA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K,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,QAAQ;AAC3C,mBAAW,UAAU,KAAK,IAAI,CAAC,OAAO,EAAC,MAAM,EAAE,MAAM,WAAW,EAAE,UAAS,EAAE;AAAA,MACjF;AAAA,IACJ,CAAC;AAED,UAAM,cAAc,MAAM,KAAK,eAAe,OAAO,CAAC,EACjD,OAAO,CAAC,UAAU,MAAM,SAAS,gBAAgB,EACjD,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;AAEhD,cAAU,WAAW;AACrB,mBAAe,KAAK;AAAA,EACxB,GAAG,CAAC,SAAS,YAAY,CAAC;AAE1B,SAAO,CAAC,YAAY,OAAO,KAAK;AACpC;","names":["useEffect","useEffect","useState","useRef","useEffect","useState","useRef","useEffect","useEffect","useEffect","useState","useCallback","useRef","useEffect","useState","useRef","useEffect","useCallback","useEffect","useMemo","useEffect","useMemo","useState","useCallback","useRef","useEffect","useState","useRef","useEffect","useCallback","useEffect","useMemo","useEffect","useMemo","useState","useCallback","useRef","useEffect","useState","useRef","useEffect","useCallback","useEffect","useMemo","useMemo","useEffect","useEffect","useState","useState","useEffect"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/connection/connection.ts","../src/connection/connection-pool.ts","../src/connection/connection-context.tsx","../src/hooks/use-connection.ts","../src/hooks/use-query-executor.ts","../src/hooks/use-query.ts","../src/hooks/use-command-executor.ts","../src/hooks/use-command.ts","../src/hooks/use-admin-executor.ts","../src/hooks/use-admin.ts","../src/hooks/use-subscription-executor.ts","../src/hooks/use-subscription.ts","../src/hooks/use-shape.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nexport * from '@reifydb/core';\nexport * from '@reifydb/client';\n\n// Export connection utilities\nexport {Connection, type ConnectionConfig, DEFAULT_CONFIG, DEFAULT_URL} from './connection/connection';\nexport {get_connection, clear_connection} from './connection/connection-pool';\nexport {ConnectionProvider, ConnectionContext, type ConnectionProviderProps} from './connection/connection-context';\n\n// Export React hooks\nexport {useConnection} from './hooks/use-connection';\nexport {useQueryExecutor, type QueryResult, type QueryState, type QueryExecutorOptions} from './hooks/use-query-executor';\nexport {useQueryOne, useQueryMany, type QueryOptions} from './hooks/use-query';\nexport {useCommandExecutor, type CommandResult, type CommandState, type CommandExecutorOptions} from './hooks/use-command-executor';\nexport {useCommandOne, useCommandMany, type CommandOptions} from './hooks/use-command';\nexport {useAdminExecutor, type AdminResult, type AdminState, type AdminExecutorOptions} from './hooks/use-admin-executor';\nexport {useAdminOne, useAdminMany, type AdminOptions} from './hooks/use-admin';\nexport {\n useSubscriptionExecutor,\n type SubscriptionExecutorOptions,\n type SubscriptionState,\n type ChangeEvent\n} from './hooks/use-subscription-executor';\nexport {\n useSubscription,\n type SubscriptionOptions\n} from './hooks/use-subscription';\nexport {useShape, type TableInfo, type ColumnInfo} from './hooks/use-shape';","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {Client, WsClient, HttpClient, JsonHttpClient, JsonWsClient, type WsClientOptions} from '@reifydb/client';\n\ninterface ConnectionState {\n client: WsClient | HttpClient | JsonHttpClient | JsonWsClient | null;\n is_connected: boolean;\n is_connecting: boolean;\n connection_error: string | null;\n listeners: Set<(state: ConnectionState) => void>;\n}\n\nexport interface ConnectionConfig {\n url?: string;\n token?: string;\n format?: 'json';\n options?: Omit<WsClientOptions, 'url' | 'token'>;\n}\n\nexport const DEFAULT_CONFIG: ConnectionConfig = {\n url: 'ws://127.0.0.1:8090',\n options: {timeout_ms: 30_000},\n};\n\nexport const DEFAULT_URL = 'ws://127.0.0.1:8090';\n\nexport class Connection {\n private state: ConnectionState = {\n client: null,\n is_connected: false,\n is_connecting: false,\n connection_error: null,\n listeners: new Set(),\n };\n private config: ConnectionConfig;\n private connect_promise: Promise<void> | null = null;\n\n constructor(config: ConnectionConfig = DEFAULT_CONFIG) {\n this.config = {...DEFAULT_CONFIG, ...config};\n }\n\n set_config(config: ConnectionConfig): void {\n this.config = config;\n }\n\n get_config(): ConnectionConfig {\n return this.config;\n }\n\n async connect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void> {\n if (this.state.is_connected) {\n return;\n }\n\n // If already connecting, wait for the in-flight connection\n if (this.connect_promise) {\n return this.connect_promise;\n }\n\n const connect_url = url || this.config.url || DEFAULT_CONFIG.url!;\n const connect_options = {token: this.config.token, ...this.config.options, ...options};\n\n this.update_state({\n is_connecting: true,\n connection_error: null,\n });\n\n this.connect_promise = (async () => {\n try {\n const isHttp = connect_url.startsWith('http://') || connect_url.startsWith('https://');\n const isJson = this.config.format === 'json';\n let client: WsClient | HttpClient | JsonHttpClient | JsonWsClient;\n if (isHttp) {\n client = isJson\n ? Client.connect_json_http(connect_url, connect_options)\n : Client.connect_http(connect_url, connect_options);\n } else {\n client = isJson\n ? await Client.connect_json_ws(connect_url, connect_options)\n : await Client.connect_ws(connect_url, connect_options);\n }\n this.update_state({\n client,\n is_connected: true,\n is_connecting: false,\n connection_error: null,\n });\n } catch (err) {\n const error_message = err instanceof Error ? err.message : 'Failed to connect to ReifyDB';\n console.error('[Connection] Connection failed:', error_message, err);\n this.update_state({\n client: null,\n is_connected: false,\n is_connecting: false,\n connection_error: error_message,\n });\n throw err;\n } finally {\n this.connect_promise = null;\n }\n })();\n\n return this.connect_promise;\n }\n\n async disconnect(): Promise<void> {\n this.connect_promise = null;\n if (this.state.client) {\n try {\n if ('disconnect' in this.state.client) {\n (this.state.client as WsClient).disconnect();\n // Small delay to ensure WebSocket closes cleanly\n await new Promise(resolve => setTimeout(resolve, 10));\n }\n } catch (err) {\n console.error('Error disconnecting:', err);\n }\n }\n\n this.update_state({\n client: null,\n is_connected: false,\n is_connecting: false,\n connection_error: null,\n });\n }\n\n async reconnect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void> {\n await this.disconnect();\n await this.connect(url, options);\n }\n\n get_client(): WsClient | HttpClient | JsonHttpClient | JsonWsClient | null {\n return this.state.client;\n }\n\n is_connected(): boolean {\n return this.state.is_connected;\n }\n\n is_connecting(): boolean {\n return this.state.is_connecting;\n }\n\n get_connection_error(): string | null {\n return this.state.connection_error;\n }\n\n get_state(): Omit<ConnectionState, 'listeners'> {\n const {listeners, ...state} = this.state;\n return state;\n }\n\n // Subscribe to state changes\n subscribe(listener: (state: ConnectionState) => void): () => void {\n this.state.listeners.add(listener);\n // Return unsubscribe function\n return () => {\n this.state.listeners.delete(listener);\n };\n }\n\n private update_state(updates: Partial<ConnectionState>): void {\n this.state = {\n ...this.state,\n ...updates,\n };\n\n // Notify all listeners\n this.state.listeners.forEach(listener => {\n listener(this.state);\n });\n }\n}\n\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport { Connection, ConnectionConfig, DEFAULT_CONFIG } from './connection';\n\n/**\n * Singleton default connection instance.\n * This ensures a single global connection that gets reused and updated.\n */\nlet default_connection: Connection | null = null;\n\n/**\n * Get the singleton connection instance.\n * If a config is provided, the connection's config will be updated via set_config().\n * @param config - Optional connection configuration\n * @returns The singleton Connection instance\n */\nexport function get_connection(config?: ConnectionConfig): Connection {\n // Create singleton on first call\n if (!default_connection) {\n const merged_config = {...DEFAULT_CONFIG, ...config};\n default_connection = new Connection(merged_config);\n // Start connection immediately - don't wait for React's useEffect\n default_connection.connect().catch(err => {\n console.error('[ConnectionPool] Eager connect failed:', err);\n });\n } else if (config) {\n // Only update config when explicitly provided, to avoid\n // stripping fields (e.g. token) that were set on creation.\n default_connection.set_config({...DEFAULT_CONFIG, ...config});\n }\n\n return default_connection;\n}\n\n/**\n * Clear the singleton connection\n */\nexport async function clear_connection(): Promise<void> {\n if (default_connection) {\n await default_connection.disconnect();\n default_connection = null;\n }\n}","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport React, { createContext, useEffect, useRef, ReactNode } from 'react';\nimport { Connection, ConnectionConfig } from './connection';\nimport { get_connection } from './connection-pool';\n\nexport const ConnectionContext = createContext<Connection | null>(null);\n\nexport interface ConnectionProviderProps {\n config?: ConnectionConfig;\n children: ReactNode;\n}\n\nexport function ConnectionProvider({ config, children }: ConnectionProviderProps) {\n // Get the singleton connection - this always returns the same instance\n // but updates its config via set_config()\n const connection = get_connection(config);\n\n // Track previous config to detect changes\n const prev_config_ref = useRef<string | undefined>(undefined);\n const current_config_str = JSON.stringify(config);\n\n useEffect(() => {\n const config_changed = prev_config_ref.current !== undefined &&\n prev_config_ref.current !== current_config_str;\n\n if (config_changed && connection.is_connected()) {\n // Config changed while connected - reconnect with new config\n connection.reconnect().catch(err => {\n console.error('[ConnectionProvider] Failed to reconnect:', err);\n });\n } else if (!connection.is_connected() && !connection.is_connecting()) {\n // Auto-connect if not connected\n connection.connect().catch(err => {\n console.error('[ConnectionProvider] Failed to connect:', err);\n });\n }\n\n // Update previous config reference\n prev_config_ref.current = current_config_str;\n }, [current_config_str, connection]);\n\n return (\n <ConnectionContext.Provider value={connection}>\n {children}\n </ConnectionContext.Provider>\n );\n}","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useContext, useEffect, useState} from 'react';\nimport {ConnectionConfig} from '../connection/connection';\nimport {get_connection} from '../connection/connection-pool';\nimport {ConnectionContext} from '../connection/connection-context';\nimport {WsClient, HttpClient, JsonHttpClient, JsonWsClient} from '@reifydb/client';\n\ninterface ConnectionState {\n client: WsClient | HttpClient | JsonHttpClient | JsonWsClient | null;\n is_connected: boolean;\n is_connecting: boolean;\n connection_error: string | null;\n}\n\nexport function useConnection(override_config?: ConnectionConfig) {\n const context_connection = useContext(ConnectionContext);\n\n // Use override config if provided, otherwise use context, otherwise get default\n const [connection] = useState(() => {\n if (override_config) {\n return get_connection(override_config);\n }\n if (context_connection) {\n return context_connection;\n }\n return get_connection();\n });\n\n const [state, setState] = useState<ConnectionState>(() => connection.get_state());\n\n useEffect(() => {\n // Get initial state immediately\n const current_state = connection.get_state();\n setState(current_state);\n\n // Subscribe to connection state changes\n const unsubscribe = connection.subscribe((new_state) => {\n setState({\n client: new_state.client,\n is_connected: new_state.is_connected,\n is_connecting: new_state.is_connecting,\n connection_error: new_state.connection_error,\n });\n });\n\n // No auto-connect - ConnectionProvider handles all auto-connection\n // Users must either wrap with ConnectionProvider or manually call connect()\n\n return unsubscribe;\n }, [connection]);\n\n return {\n ...state,\n connect: () => connection.connect(),\n disconnect: () => connection.disconnect(),\n reconnect: () => connection.reconnect(),\n };\n}","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useState, useCallback, useRef, useEffect} from 'react';\nimport {Column, ShapeNode} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useConnection} from './use-connection';\n\nexport interface QueryResult<T = any> {\n columns: Column[];\n rows: T[];\n execution_time_ms: number;\n rows_affected?: number;\n}\n\nexport interface QueryState<T = any> {\n is_executing: boolean;\n results: QueryResult<T>[] | undefined;\n error: string | undefined;\n execution_time: number | undefined;\n}\n\nexport interface QueryExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\nexport function useQueryExecutor<T = any>(options?: QueryExecutorOptions) {\n const {client} = useConnection(options?.connection_config);\n\n const [state, setState] = useState<QueryState<T>>({\n is_executing: false,\n results: undefined,\n error: undefined,\n execution_time: undefined,\n });\n\n const client_ref = useRef(client);\n client_ref.current = client;\n\n const is_mounted_ref = useRef(true);\n useEffect(() => {\n return () => { is_mounted_ref.current = false; };\n }, []);\n\n const execution_id_ref = useRef(0);\n const pending_ref = useRef<{rql: string, params?: any, shapes?: readonly ShapeNode[]} | null>(null);\n\n const query = useCallback(\n (rql: string, params?: any, shapes?: readonly ShapeNode[]): Promise<void> => {\n const current_client = client_ref.current;\n\n if (!current_client) {\n pending_ref.current = {rql, params, shapes};\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n return Promise.resolve();\n }\n\n pending_ref.current = null;\n const this_execution = ++execution_id_ref.current;\n\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n\n const start_time = Date.now();\n\n return (async () => {\n try {\n const frame_results = await current_client.query(rql, params || null, shapes || []) || [];\n\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n\n const results: QueryResult<T>[] = frame_results.map((frame: any) => {\n if (Array.isArray(frame) && frame.length > 0) {\n const first_row = frame[0];\n let columns: Column[] = [];\n\n const has_value_objects = first_row && typeof first_row === 'object' &&\n Object.values(first_row).some(v => v && typeof v === 'object' && 'type' in v);\n\n if (has_value_objects) {\n columns = Object.keys(first_row).map((key) => {\n const value = first_row[key];\n const data_type = value?.type || 'Utf8';\n return {\n name: key,\n type: data_type,\n payload: [],\n };\n });\n } else {\n columns = Object.keys(first_row).map((key) => ({\n name: key,\n type: 'Utf8',\n payload: [],\n }));\n }\n\n return {\n columns,\n rows: frame as T[],\n execution_time_ms: execution_time,\n };\n } else {\n return {\n columns: [],\n rows: [],\n execution_time_ms: execution_time,\n };\n }\n });\n\n if (!is_mounted_ref.current) return;\n setState({\n is_executing: false,\n results,\n error: undefined,\n execution_time,\n });\n } catch (err) {\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n let error_message = 'Query execution failed';\n\n if (err instanceof Error) {\n error_message = err.message;\n } else if (typeof err === 'string') {\n error_message = err;\n } else if (err && typeof err === 'object' && 'message' in err) {\n error_message = (err as { message: string }).message;\n }\n\n console.error('Query execution failed:', error_message);\n\n if (!is_mounted_ref.current) return;\n setState(prev => ({\n ...prev,\n is_executing: false,\n error: error_message,\n execution_time,\n }));\n\n }\n })();\n },\n []\n );\n\n useEffect(() => {\n if (client && pending_ref.current) {\n const {rql, params, shapes} = pending_ref.current;\n query(rql, params, shapes);\n }\n }, [client, query]);\n\n const cancel_query = useCallback(() => {\n execution_id_ref.current++;\n setState((prev) => ({\n ...prev,\n is_executing: false,\n error: 'Query cancelled',\n }));\n }, []);\n\n return {\n is_executing: state.is_executing,\n results: state.results,\n error: state.error,\n execution_time: state.execution_time,\n query,\n cancel_query,\n };\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useEffect, useMemo} from 'react';\nimport {ShapeNode, InferShape} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useQueryExecutor, type QueryResult, type QueryExecutorOptions} from './use-query-executor';\n\nexport interface QueryOptions extends QueryExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\n// Single query hook - returns a single result\nexport function useQueryOne<S extends ShapeNode = any>(\n rql: string,\n params?: any,\n shape?: S,\n options?: QueryOptions\n): {\n is_executing: boolean;\n result: QueryResult<S extends ShapeNode ? InferShape<S> : any> | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n query\n } = useQueryExecutor<S extends ShapeNode ? InferShape<S> : any>(options);\n\n useEffect(() => {\n // Pass shape as array for the executor\n const shapes = shape ? [shape] : undefined;\n query(rql, params, shapes);\n }, [rql, params, query]);\n\n // Extract first result for single query convenience\n const result = useMemo(() => {\n return results && results.length > 0 ? results[0] : undefined;\n }, [results]);\n\n return {is_executing, result, error};\n}\n\n// Multiple query hook - returns multiple results\nexport function useQueryMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(\n rql: string,\n params?: any,\n shapes?: S,\n options?: QueryOptions\n): {\n is_executing: boolean;\n results: QueryResult<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>[] | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n query\n } = useQueryExecutor<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>(options);\n\n useEffect(() => {\n query(rql, params, shapes);\n }, [rql, params, query]);\n\n return {is_executing, results, error};\n}","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useState, useCallback, useRef, useEffect} from 'react';\nimport {Column, ShapeNode} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useConnection} from './use-connection';\n\nexport interface CommandResult<T = any> {\n columns: Column[];\n rows: T[];\n execution_time_ms: number;\n rows_affected?: number;\n}\n\nexport interface CommandState<T = any> {\n is_executing: boolean;\n results: CommandResult<T>[] | undefined;\n error: string | undefined;\n execution_time: number | undefined;\n}\n\nexport interface CommandExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\nexport function useCommandExecutor<T = any>(options?: CommandExecutorOptions) {\n const {client} = useConnection(options?.connection_config);\n\n const [state, setState] = useState<CommandState<T>>({\n is_executing: false,\n results: undefined,\n error: undefined,\n execution_time: undefined,\n });\n\n const client_ref = useRef(client);\n client_ref.current = client;\n\n const is_mounted_ref = useRef(false);\n useEffect(() => {\n is_mounted_ref.current = true;\n return () => { is_mounted_ref.current = false; };\n }, []);\n\n const execution_id_ref = useRef(0);\n const pending_ref = useRef<{rql: string, params?: any, shapes?: readonly ShapeNode[]} | null>(null);\n\n const command = useCallback(\n (rql: string, params?: any, shapes?: readonly ShapeNode[]): Promise<void> => {\n const current_client = client_ref.current;\n\n if (!current_client) {\n pending_ref.current = {rql, params, shapes};\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n return Promise.resolve();\n }\n\n pending_ref.current = null;\n const this_execution = ++execution_id_ref.current;\n\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n\n const start_time = Date.now();\n\n return (async () => {\n try {\n const frame_results = await current_client.command(rql, params || null, shapes || []) || [];\n\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n\n const results: CommandResult<T>[] = frame_results.map((frame: any) => {\n if (Array.isArray(frame) && frame.length > 0) {\n const first_row = frame[0];\n let columns: Column[] = [];\n\n const has_value_objects = first_row && typeof first_row === 'object' &&\n Object.values(first_row).some(v => v && typeof v === 'object' && 'type' in v);\n\n if (has_value_objects) {\n columns = Object.keys(first_row).map((key) => {\n const value = first_row[key];\n const data_type = value?.type || 'Utf8';\n return {\n name: key,\n type: data_type,\n payload: [],\n };\n });\n } else {\n columns = Object.keys(first_row).map((key) => ({\n name: key,\n type: 'Utf8',\n payload: [],\n }));\n }\n\n return {\n columns,\n rows: frame as T[],\n execution_time_ms: execution_time,\n };\n } else {\n return {\n columns: [],\n rows: [],\n execution_time_ms: execution_time,\n rows_affected: typeof frame === 'number' ? frame : undefined,\n };\n }\n });\n\n if (!is_mounted_ref.current) return;\n setState({\n is_executing: false,\n results,\n error: undefined,\n execution_time,\n });\n } catch (err) {\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n let error_message = 'Command execution failed';\n\n if (err instanceof Error) {\n error_message = err.message;\n } else if (typeof err === 'string') {\n error_message = err;\n } else if (err && typeof err === 'object' && 'message' in err) {\n error_message = (err as { message: string }).message;\n }\n\n console.error('Command execution failed:', error_message);\n\n if (!is_mounted_ref.current) return;\n setState(prev => ({\n ...prev,\n is_executing: false,\n error: error_message,\n execution_time,\n }));\n\n }\n })();\n },\n []\n );\n\n useEffect(() => {\n if (client && pending_ref.current) {\n const {rql, params, shapes} = pending_ref.current;\n command(rql, params, shapes);\n }\n }, [client, command]);\n\n const cancel_command = useCallback(() => {\n execution_id_ref.current++;\n setState((prev) => ({\n ...prev,\n is_executing: false,\n error: 'Command cancelled',\n }));\n }, []);\n\n return {\n is_executing: state.is_executing,\n results: state.results,\n error: state.error,\n execution_time: state.execution_time,\n command,\n cancel_command,\n };\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useEffect, useMemo} from 'react';\nimport {ShapeNode, InferShape} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useCommandExecutor, type CommandResult, type CommandExecutorOptions} from './use-command-executor';\n\nexport interface CommandOptions extends CommandExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\n// Single command hook - returns a single result\nexport function useCommandOne<S extends ShapeNode = any>(\n rql: string,\n params?: any,\n shape?: S,\n options?: CommandOptions\n): {\n is_executing: boolean;\n result: CommandResult<S extends ShapeNode ? InferShape<S> : any> | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n command\n } = useCommandExecutor<S extends ShapeNode ? InferShape<S> : any>(options);\n\n useEffect(() => {\n // Pass shape as array for the executor\n const shapes = shape ? [shape] : undefined;\n command(rql, params, shapes);\n }, [rql, params, command]);\n\n // Extract first result for single command convenience\n const result = useMemo(() => {\n return results && results.length > 0 ? results[0] : undefined;\n }, [results]);\n\n return {is_executing, result, error};\n}\n\n// Multiple command hook - returns multiple results\nexport function useCommandMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(\n rql: string,\n params?: any,\n shapes?: S,\n options?: CommandOptions\n): {\n is_executing: boolean;\n results: CommandResult<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>[] | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n command\n } = useCommandExecutor<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>(options);\n\n useEffect(() => {\n command(rql, params, shapes);\n }, [rql, params, command]);\n\n return {is_executing, results, error};\n}","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useState, useCallback, useRef, useEffect} from 'react';\nimport {Column, ShapeNode} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useConnection} from './use-connection';\n\nexport interface AdminResult<T = any> {\n columns: Column[];\n rows: T[];\n execution_time_ms: number;\n rows_affected?: number;\n}\n\nexport interface AdminState<T = any> {\n is_executing: boolean;\n results: AdminResult<T>[] | undefined;\n error: string | undefined;\n execution_time: number | undefined;\n}\n\nexport interface AdminExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\nexport function useAdminExecutor<T = any>(options?: AdminExecutorOptions) {\n const {client} = useConnection(options?.connection_config);\n\n const [state, setState] = useState<AdminState<T>>({\n is_executing: false,\n results: undefined,\n error: undefined,\n execution_time: undefined,\n });\n\n // Stable refs so the callback never recreates\n const client_ref = useRef(client);\n client_ref.current = client;\n\n const is_mounted_ref = useRef(false);\n useEffect(() => {\n is_mounted_ref.current = true;\n return () => { is_mounted_ref.current = false; };\n }, []);\n\n // Counter to detect superseded executions\n const execution_id_ref = useRef(0);\n\n // Stash pending call if client isn't ready yet\n const pending_ref = useRef<{rql: string, params?: any, shapes?: readonly ShapeNode[]} | null>(null);\n\n const admin = useCallback(\n (rql: string, params?: any, shapes?: readonly ShapeNode[]): Promise<void> => {\n const current_client = client_ref.current;\n // If no client yet, stash the request for replay when client connects\n if (!current_client) {\n pending_ref.current = {rql, params, shapes};\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n return Promise.resolve();\n }\n\n pending_ref.current = null;\n const this_execution = ++execution_id_ref.current;\n\n setState(prev => ({...prev, is_executing: true, error: undefined}));\n\n const start_time = Date.now();\n\n return (async () => {\n try {\n const frame_results = await current_client.admin(rql, params || null, shapes || []) || [];\n\n // If this execution was superseded by a newer one, discard results\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n\n // Process each frame into a AdminResult\n const results: AdminResult<T>[] = frame_results.map((frame: any) => {\n if (Array.isArray(frame) && frame.length > 0) {\n const first_row = frame[0];\n let columns: Column[] = [];\n\n // Check if we have Value objects or plain objects\n const has_value_objects = first_row && typeof first_row === 'object' &&\n Object.values(first_row).some(v => v && typeof v === 'object' && 'type' in v);\n\n if (has_value_objects) {\n columns = Object.keys(first_row).map((key) => {\n const value = first_row[key];\n const data_type = value?.type || 'Utf8';\n return {\n name: key,\n type: data_type,\n payload: [],\n };\n });\n } else {\n columns = Object.keys(first_row).map((key) => ({\n name: key,\n type: 'Utf8',\n payload: [],\n }));\n }\n\n return {\n columns,\n rows: frame as T[],\n execution_time_ms: execution_time,\n };\n } else {\n return {\n columns: [],\n rows: [],\n execution_time_ms: execution_time,\n rows_affected: typeof frame === 'number' ? frame : undefined,\n };\n }\n });\n\n if (!is_mounted_ref.current) return;\n setState({\n is_executing: false,\n results,\n error: undefined,\n execution_time,\n });\n } catch (err) {\n if (execution_id_ref.current !== this_execution) return;\n\n const execution_time = Date.now() - start_time;\n let error_message = 'Admin execution failed';\n\n if (err instanceof Error) {\n error_message = err.message;\n } else if (typeof err === 'string') {\n error_message = err;\n } else if (err && typeof err === 'object' && 'message' in err) {\n error_message = (err as { message: string }).message;\n }\n\n console.error('Admin execution failed:', error_message);\n\n if (!is_mounted_ref.current) return;\n setState(prev => ({\n ...prev,\n is_executing: false,\n error: error_message,\n execution_time,\n }));\n\n }\n })();\n },\n [] // stable — never recreates\n );\n\n // Replay pending request when client becomes available\n useEffect(() => {\n if (client && pending_ref.current) {\n const {rql, params, shapes} = pending_ref.current;\n admin(rql, params, shapes);\n }\n }, [client, admin]);\n\n const cancel_admin = useCallback(() => {\n // Bump execution ID so any in-flight request is ignored on completion\n execution_id_ref.current++;\n setState((prev) => ({\n ...prev,\n is_executing: false,\n error: 'Admin cancelled',\n }));\n }, []);\n\n return {\n is_executing: state.is_executing,\n results: state.results,\n error: state.error,\n execution_time: state.execution_time,\n admin,\n cancel_admin,\n };\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useEffect, useMemo} from 'react';\nimport {ShapeNode, InferShape} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useAdminExecutor, type AdminResult, type AdminExecutorOptions} from './use-admin-executor';\n\nexport interface AdminOptions extends AdminExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\n// Single admin hook - returns a single result\nexport function useAdminOne<S extends ShapeNode = any>(\n rql: string,\n params?: any,\n shape?: S,\n options?: AdminOptions\n): {\n is_executing: boolean;\n result: AdminResult<S extends ShapeNode ? InferShape<S> : any> | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n admin\n } = useAdminExecutor<S extends ShapeNode ? InferShape<S> : any>(options);\n\n useEffect(() => {\n // Pass shape as array for the executor\n const shapes = shape ? [shape] : undefined;\n admin(rql, params, shapes);\n }, [rql, params, admin]);\n\n // Extract first result for single admin convenience\n const result = useMemo(() => {\n return results && results.length > 0 ? results[0] : undefined;\n }, [results]);\n\n return {is_executing, result, error};\n}\n\n// Multiple admin hook - returns multiple results\nexport function useAdminMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(\n rql: string,\n params?: any,\n shapes?: S,\n options?: AdminOptions\n): {\n is_executing: boolean;\n results: AdminResult<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>[] | undefined;\n error: string | undefined;\n} {\n const {\n is_executing,\n results,\n error,\n admin\n } = useAdminExecutor<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>(options);\n\n useEffect(() => {\n admin(rql, params, shapes);\n }, [rql, params, admin]);\n\n return {is_executing, results, error};\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport { useState, useCallback, useRef, useEffect } from 'react';\nimport { ShapeNode } from '@reifydb/core';\nimport type { SubscriptionConfig } from '@reifydb/client';\nimport { useConnection } from './use-connection';\nimport type { ConnectionConfig } from '../connection/connection';\n\nexport interface SubscriptionExecutorOptions {\n connection_config?: ConnectionConfig;\n}\n\nexport interface ChangeEvent<T> {\n operation: 'INSERT' | 'UPDATE' | 'REMOVE';\n rows: T[];\n timestamp: number;\n}\n\nexport interface SubscriptionState<T> {\n data: T[];\n changes: ChangeEvent<T>[];\n is_subscribed: boolean;\n is_subscribing: boolean;\n error: string | undefined;\n subscription_id: string | undefined;\n}\n\nexport function useSubscriptionExecutor<T = any>(\n options?: SubscriptionExecutorOptions\n) {\n const { client } = useConnection(options?.connection_config);\n\n const [state, setState] = useState<SubscriptionState<T>>({\n data: [],\n changes: [],\n is_subscribed: false,\n is_subscribing: false,\n error: undefined,\n subscription_id: undefined\n });\n\n // Use a ref for client to avoid recreating callbacks when client changes\n const client_ref = useRef(client);\n\n const subscriptionIdRef = useRef<string | undefined>(undefined);\n const rql_ref = useRef<string | undefined>(undefined);\n const params_ref = useRef<any>(undefined);\n const shape_ref = useRef<ShapeNode | undefined>(undefined);\n const config_ref = useRef<SubscriptionConfig | undefined>(undefined);\n\n // Keep client_ref in sync with client\n useEffect(() => {\n client_ref.current = client;\n }, [client]);\n\n // Helper to add change event\n const add_change_event = useCallback((\n operation: 'INSERT' | 'UPDATE' | 'REMOVE',\n rows: T[]\n ) => {\n setState(prev => {\n const new_change: ChangeEvent<T> = {\n operation,\n rows,\n timestamp: Date.now()\n };\n\n const new_changes = [...prev.changes, new_change];\n\n return {\n ...prev,\n data: prev.data,\n changes: new_changes\n };\n });\n }, []);\n\n // Separate callbacks for each operation type\n const handle_insert = useCallback((rows: T[]) => {\n add_change_event('INSERT', rows);\n }, [add_change_event]);\n\n const handle_update = useCallback((rows: T[]) => {\n add_change_event('UPDATE', rows);\n }, [add_change_event]);\n\n const handle_remove = useCallback((rows: T[]) => {\n add_change_event('REMOVE', rows);\n }, [add_change_event]);\n\n const subscribe = useCallback(async (\n rql: string,\n params?: any,\n shape?: ShapeNode,\n config?: SubscriptionConfig\n ) => {\n const current_client = client_ref.current;\n if (!current_client) {\n setState(prev => ({ ...prev, error: 'Client not connected' }));\n return;\n }\n\n if (!('subscribe' in current_client)) {\n setState(prev => ({ ...prev, error: 'Subscriptions require a WebSocket connection' }));\n return;\n }\n\n // Store refs for reconnection\n rql_ref.current = rql;\n params_ref.current = params;\n shape_ref.current = shape;\n config_ref.current = config;\n\n setState(prev => ({\n ...prev,\n is_subscribing: true,\n error: undefined\n }));\n\n try {\n const sub_id = await current_client.subscribe(rql, params, shape, {\n on_insert: handle_insert,\n on_update: handle_update,\n on_remove: handle_remove\n }, config);\n\n subscriptionIdRef.current = sub_id;\n setState(prev => ({\n ...prev,\n is_subscribing: false,\n is_subscribed: true,\n subscription_id: sub_id\n }));\n } catch (err: any) {\n setState(prev => ({\n ...prev,\n is_subscribing: false,\n error: err.message || 'Subscription failed'\n }));\n }\n }, [handle_insert, handle_update, handle_remove]);\n\n const unsubscribe = useCallback(async () => {\n const current_client = client_ref.current;\n if (!current_client || !subscriptionIdRef.current) return;\n if (!('unsubscribe' in current_client)) return;\n\n try {\n await current_client.unsubscribe(subscriptionIdRef.current);\n subscriptionIdRef.current = undefined;\n rql_ref.current = undefined;\n params_ref.current = undefined;\n shape_ref.current = undefined;\n config_ref.current = undefined;\n\n setState(prev => ({\n ...prev,\n is_subscribed: false,\n subscription_id: undefined\n }));\n } catch (err: any) {\n setState(prev => ({\n ...prev,\n error: err.message || 'Unsubscribe failed'\n }));\n }\n }, []);\n\n const clear_changes = useCallback(() => {\n setState(prev => ({ ...prev, changes: [] }));\n }, []);\n\n const clear_data = useCallback(() => {\n setState(prev => ({ ...prev, data: [] }));\n }, []);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (subscriptionIdRef.current && client_ref.current && 'unsubscribe' in client_ref.current) {\n client_ref.current.unsubscribe(subscriptionIdRef.current).catch(console.error);\n }\n };\n }, []);\n\n return {\n state,\n subscribe,\n unsubscribe,\n clear_changes,\n clear_data\n };\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport { useEffect, useMemo } from 'react';\nimport { ShapeNode, InferShape } from '@reifydb/core';\nimport type { SubscriptionConfig } from '@reifydb/client';\nimport {\n useSubscriptionExecutor,\n type SubscriptionExecutorOptions,\n type ChangeEvent\n} from './use-subscription-executor';\n\nexport interface SubscriptionOptions extends SubscriptionExecutorOptions {\n enabled?: boolean; // Auto-subscribe (default: true)\n config?: SubscriptionConfig;\n}\n\nexport function useSubscription<S extends ShapeNode = any>(\n rql: string,\n params?: any,\n shape?: S,\n options?: SubscriptionOptions\n): {\n data: InferShape<S>[];\n changes: ChangeEvent<InferShape<S>>[];\n is_subscribed: boolean;\n is_subscribing: boolean;\n error: string | undefined;\n subscription_id: string | undefined;\n} {\n const {\n state,\n subscribe,\n unsubscribe\n } = useSubscriptionExecutor<InferShape<S>>(options);\n\n // Serialize params for stable comparison (objects create new refs each render)\n const params_key = useMemo(() => JSON.stringify(params), [params]);\n const config_key = useMemo(() => JSON.stringify(options?.config), [options?.config]);\n\n useEffect(() => {\n if (options?.enabled === false) return;\n\n subscribe(rql, params, shape, options?.config);\n\n return () => {\n unsubscribe();\n };\n }, [rql, params_key, shape, config_key, options?.enabled, subscribe, unsubscribe]);\n\n return {\n data: state.data,\n changes: state.changes,\n is_subscribed: state.is_subscribed,\n is_subscribing: state.is_subscribing,\n error: state.error,\n subscription_id: state.subscription_id\n };\n}\n","// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport {useEffect, useState} from 'react';\nimport {Shape, InferShape} from '@reifydb/core';\nimport {useQueryExecutor} from './use-query-executor';\n\nexport interface ColumnInfo {\n name: string;\n data_type: string;\n}\n\nexport interface TableInfo {\n name: string;\n columns: ColumnInfo[];\n}\n\nconst namespace_shape = Shape.object({\n id: Shape.number(),\n name: Shape.string(),\n});\n\nconst table_shape = Shape.object({\n id: Shape.number(),\n namespace_id: Shape.number(),\n name: Shape.string(),\n primary_key_id: Shape.number(),\n});\n\nconst view_shape = Shape.object({\n id: Shape.number(),\n namespace_id: Shape.number(),\n name: Shape.string(),\n});\n\nconst column_shape = Shape.object({\n id: Shape.number(),\n shape_id: Shape.number(),\n shape_type: Shape.number(),\n name: Shape.string(),\n type: Shape.number(),\n position: Shape.number(),\n auto_increment: Shape.boolean(),\n});\n\ntype NamespaceRow = InferShape<typeof namespace_shape>;\ntype TableRow = InferShape<typeof table_shape>;\ntype ViewRow = InferShape<typeof view_shape>;\ntype ColumnRow = InferShape<typeof column_shape>;\n\nexport function useShape(): [boolean, TableInfo[], string | undefined] {\n const {is_executing, results, error, query} = useQueryExecutor();\n const [shape, set_shape] = useState<TableInfo[]>([]);\n const [is_loading, set_is_loading] = useState(true);\n\n useEffect(() => {\n if (!query) return;\n\n const fetch_shape = async () => {\n set_is_loading(true);\n\n try {\n await query(\n `OUTPUT FROM system::namespaces; OUTPUT FROM system::tables; OUTPUT FROM system::views; OUTPUT FROM system::columns;`,\n undefined,\n [namespace_shape, table_shape, view_shape, column_shape]\n );\n } catch (err) {\n console.error('Failed to fetch shape:', err);\n }\n };\n\n fetch_shape();\n }, [query]);\n\n useEffect(() => {\n if (!results || results.length < 4) {\n set_is_loading(is_executing);\n return;\n }\n\n const tables_result = results[1];\n const views_result = results[2];\n const columns_result = results[3];\n\n if (!tables_result?.rows || !views_result?.rows || !columns_result?.rows) {\n set_is_loading(false);\n return;\n }\n\n const namespaces_result = results[0];\n const namespaces = namespaces_result.rows as unknown as NamespaceRow[];\n const tables = tables_result.rows as unknown as TableRow[];\n const views = views_result.rows as unknown as ViewRow[];\n const columns = columns_result.rows as unknown as ColumnRow[];\n\n const namespace_map = new Map<number, string>();\n namespaces.forEach((ns) => {\n const id = ns.id?.valueOf() as number;\n const name = ns.name?.valueOf() as string;\n if (id !== undefined && name) {\n namespace_map.set(id, name);\n }\n });\n\n const table_info_map = new Map<number, TableInfo>();\n\n tables.forEach((table) => {\n const table_id = table.id?.valueOf() as number;\n const namespace_id = table.namespace_id?.valueOf() as number;\n const table_name = table.name?.valueOf() as string;\n\n if (table_id === undefined || !table_name || namespace_id === undefined) return;\n\n const namespace = namespace_map.get(namespace_id);\n if (!namespace) return;\n\n const full_table_name = `${namespace}::${table_name}`;\n\n table_info_map.set(table_id, {\n name: full_table_name,\n columns: [],\n });\n });\n\n views.forEach((view) => {\n const view_id = view.id?.valueOf() as number;\n const namespace_id = view.namespace_id?.valueOf() as number;\n const view_name = view.name?.valueOf() as string;\n\n if (view_id === undefined || !view_name || namespace_id === undefined) return;\n\n const namespace = namespace_map.get(namespace_id);\n if (!namespace) return;\n\n const full_view_name = `${namespace}::${view_name}`;\n\n table_info_map.set(view_id, {\n name: full_view_name,\n columns: [],\n });\n });\n\n const type_map: Record<number, string> = {\n 0: 'None',\n 1: 'Float4',\n 2: 'Float8',\n 3: 'Int1',\n 4: 'Int2',\n 5: 'Int4',\n 6: 'Int8',\n 7: 'Int16',\n 8: 'Utf8',\n 9: 'Uint1',\n 10: 'Uint2',\n 11: 'Uint4',\n 12: 'Uint8',\n 13: 'Uint16',\n 14: 'Boolean',\n 15: 'Date',\n 16: 'DateTime',\n 17: 'Time',\n 18: 'Duration',\n 19: 'IdentityId',\n 20: 'Uuid4',\n 21: 'Uuid7',\n 22: 'Blob',\n 23: 'Int',\n 24: 'Decimal',\n 25: 'Uint',\n 26: 'Any',\n };\n\n // Create a map to collect columns with their positions\n const table_columns_map = new Map<number, Array<{name: string; data_type: string; position: number}>>();\n\n columns.forEach((column) => {\n const shape_id = column.shape_id?.valueOf() as number;\n const shape_type = column.shape_type?.valueOf() as number;\n const column_name = column.name?.valueOf() as string;\n const type_id = column.type?.valueOf() as number;\n const position = column.position?.valueOf() as number;\n\n if (shape_id === undefined || !column_name || type_id === undefined) return;\n if (shape_type !== 0 && shape_type !== 1) return;\n\n if (!table_columns_map.has(shape_id)) {\n table_columns_map.set(shape_id, []);\n }\n\n table_columns_map.get(shape_id)!.push({\n name: column_name,\n data_type: type_map[type_id] || `Unknown(${type_id})`,\n position: position ?? 0,\n });\n });\n\n // Sort columns by position and add to table info\n table_columns_map.forEach((cols, shape_id) => {\n const table_info = table_info_map.get(shape_id);\n if (table_info) {\n cols.sort((a, b) => a.position - b.position);\n table_info.columns = cols.map((c) => ({name: c.name, data_type: c.data_type}));\n }\n });\n\n const shape_array = Array.from(table_info_map.values())\n .filter((table) => table.name !== 'reifydb::flows')\n .sort((a, b) => a.name.localeCompare(b.name));\n\n set_shape(shape_array);\n set_is_loading(false);\n }, [results, is_executing]);\n\n return [is_loading, shape, error];\n}\n"],"mappings":";AAGA,cAAc;AACd,cAAc;;;ACDd,SAAQ,cAAuF;AAiBxF,IAAM,iBAAmC;AAAA,EAC5C,KAAK;AAAA,EACL,SAAS,EAAC,YAAY,IAAM;AAChC;AAEO,IAAM,cAAc;AAEpB,IAAM,aAAN,MAAiB;AAAA,EAWpB,YAAY,SAA2B,gBAAgB;AAVvD,SAAQ,QAAyB;AAAA,MAC7B,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,eAAe;AAAA,MACf,kBAAkB;AAAA,MAClB,WAAW,oBAAI,IAAI;AAAA,IACvB;AAEA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E,WAAW,EAAE,QAAQ;AAC3C,mBAAW,UAAU,KAAK,IAAI,CAAC,OAAO,EAAC,MAAM,EAAE,MAAM,WAAW,EAAE,UAAS,EAAE;AAAA,MACjF;AAAA,IACJ,CAAC;AAED,UAAM,cAAc,MAAM,KAAK,eAAe,OAAO,CAAC,EACjD,OAAO,CAAC,UAAU,MAAM,SAAS,gBAAgB,EACjD,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;AAEhD,cAAU,WAAW;AACrB,mBAAe,KAAK;AAAA,EACxB,GAAG,CAAC,SAAS,YAAY,CAAC;AAE1B,SAAO,CAAC,YAAY,OAAO,KAAK;AACpC;","names":["useEffect","useEffect","useState","useRef","useEffect","useState","useRef","useEffect","useEffect","useEffect","useState","useCallback","useRef","useEffect","useState","useRef","useEffect","useCallback","useEffect","useMemo","useEffect","useMemo","useState","useCallback","useRef","useEffect","useState","useRef","useEffect","useCallback","useEffect","useMemo","useEffect","useMemo","useState","useCallback","useRef","useEffect","useState","useRef","useEffect","useCallback","useEffect","useMemo","useMemo","useEffect","useEffect","useState","useState","useEffect"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@reifydb/react",
3
- "version": "0.4.13",
3
+ "version": "0.5.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "dependencies": {
8
- "@reifydb/client": "0.4.13",
9
- "@reifydb/core": "0.4.13"
8
+ "@reifydb/client": "0.5.6",
9
+ "@reifydb/core": "0.5.6"
10
10
  },
11
11
  "peerDependencies": {
12
12
  "react": ">=16.8.0"