@reifydb/react 0.4.9 → 0.4.11

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,14 +1,14 @@
1
1
  import { Column, ShapeNode, InferShape } from '@reifydb/core';
2
2
  export * from '@reifydb/core';
3
- import { WsClientOptions, WsClient, HttpClient, JsonHttpClient, JsonWebsocketClient } from '@reifydb/client';
3
+ import { WsClientOptions, WsClient, HttpClient, JsonHttpClient, JsonWsClient } from '@reifydb/client';
4
4
  export * from '@reifydb/client';
5
5
  import React, { ReactNode } from 'react';
6
6
 
7
7
  interface ConnectionState {
8
- client: WsClient | HttpClient | JsonHttpClient | JsonWebsocketClient | null;
9
- isConnected: boolean;
10
- isConnecting: boolean;
11
- connectionError: string | null;
8
+ client: WsClient | HttpClient | JsonHttpClient | JsonWsClient | null;
9
+ is_connected: boolean;
10
+ is_connecting: boolean;
11
+ connection_error: string | null;
12
12
  listeners: Set<(state: ConnectionState) => void>;
13
13
  }
14
14
  interface ConnectionConfig {
@@ -22,33 +22,33 @@ declare const DEFAULT_URL = "ws://127.0.0.1:8090";
22
22
  declare class Connection {
23
23
  private state;
24
24
  private config;
25
- private connectPromise;
25
+ private connect_promise;
26
26
  constructor(config?: ConnectionConfig);
27
- setConfig(config: ConnectionConfig): void;
28
- getConfig(): ConnectionConfig;
27
+ set_config(config: ConnectionConfig): void;
28
+ get_config(): ConnectionConfig;
29
29
  connect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void>;
30
30
  disconnect(): Promise<void>;
31
31
  reconnect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void>;
32
- getClient(): WsClient | HttpClient | JsonHttpClient | JsonWebsocketClient | null;
33
- isConnected(): boolean;
34
- isConnecting(): boolean;
35
- getConnectionError(): string | null;
36
- getState(): Omit<ConnectionState, 'listeners'>;
32
+ get_client(): WsClient | HttpClient | JsonHttpClient | JsonWsClient | null;
33
+ is_connected(): boolean;
34
+ is_connecting(): boolean;
35
+ get_connection_error(): string | null;
36
+ get_state(): Omit<ConnectionState, 'listeners'>;
37
37
  subscribe(listener: (state: ConnectionState) => void): () => void;
38
- private updateState;
38
+ private update_state;
39
39
  }
40
40
 
41
41
  /**
42
42
  * Get the singleton connection instance.
43
- * If a config is provided, the connection's config will be updated via setConfig().
43
+ * If a config is provided, the connection's config will be updated via set_config().
44
44
  * @param config - Optional connection configuration
45
45
  * @returns The singleton Connection instance
46
46
  */
47
- declare function getConnection(config?: ConnectionConfig): Connection;
47
+ declare function get_connection(config?: ConnectionConfig): Connection;
48
48
  /**
49
49
  * Clear the singleton connection
50
50
  */
51
- declare function clearConnection(): Promise<void>;
51
+ declare function clear_connection(): Promise<void>;
52
52
 
53
53
  declare const ConnectionContext: React.Context<Connection | null>;
54
54
  interface ConnectionProviderProps {
@@ -57,50 +57,50 @@ interface ConnectionProviderProps {
57
57
  }
58
58
  declare function ConnectionProvider({ config, children }: ConnectionProviderProps): React.JSX.Element;
59
59
 
60
- declare function useConnection(overrideConfig?: ConnectionConfig): {
60
+ declare function useConnection(override_config?: ConnectionConfig): {
61
61
  connect: () => Promise<void>;
62
62
  disconnect: () => Promise<void>;
63
63
  reconnect: () => Promise<void>;
64
- client: WsClient | HttpClient | JsonHttpClient | JsonWebsocketClient | null;
65
- isConnected: boolean;
66
- isConnecting: boolean;
67
- connectionError: string | null;
64
+ client: WsClient | HttpClient | JsonHttpClient | JsonWsClient | null;
65
+ is_connected: boolean;
66
+ is_connecting: boolean;
67
+ connection_error: string | null;
68
68
  };
69
69
 
70
70
  interface QueryResult<T = any> {
71
71
  columns: Column[];
72
72
  rows: T[];
73
- executionTimeMs: number;
74
- rowsAffected?: number;
73
+ execution_time_ms: number;
74
+ rows_affected?: number;
75
75
  }
76
76
  interface QueryState<T = any> {
77
- isExecuting: boolean;
77
+ is_executing: boolean;
78
78
  results: QueryResult<T>[] | undefined;
79
79
  error: string | undefined;
80
- executionTime: number | undefined;
80
+ execution_time: number | undefined;
81
81
  }
82
82
  interface QueryExecutorOptions {
83
- connectionConfig?: ConnectionConfig;
83
+ connection_config?: ConnectionConfig;
84
84
  }
85
85
  declare function useQueryExecutor<T = any>(options?: QueryExecutorOptions): {
86
- isExecuting: boolean;
86
+ is_executing: boolean;
87
87
  results: QueryResult<T>[] | undefined;
88
88
  error: string | undefined;
89
- executionTime: number | undefined;
90
- query: (statements: string | string[], params?: any, shapes?: readonly ShapeNode[]) => Promise<void>;
91
- cancelQuery: () => void;
89
+ execution_time: number | undefined;
90
+ query: (rql: string, params?: any, shapes?: readonly ShapeNode[]) => Promise<void>;
91
+ cancel_query: () => void;
92
92
  };
93
93
 
94
94
  interface QueryOptions extends QueryExecutorOptions {
95
- connectionConfig?: ConnectionConfig;
95
+ connection_config?: ConnectionConfig;
96
96
  }
97
97
  declare function useQueryOne<S extends ShapeNode = any>(rql: string, params?: any, shape?: S, options?: QueryOptions): {
98
- isExecuting: boolean;
98
+ is_executing: boolean;
99
99
  result: QueryResult<S extends ShapeNode ? InferShape<S> : any> | undefined;
100
100
  error: string | undefined;
101
101
  };
102
- declare function useQueryMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(statements: string | string[], params?: any, shapes?: S, options?: QueryOptions): {
103
- isExecuting: boolean;
102
+ declare function useQueryMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(rql: string, params?: any, shapes?: S, options?: QueryOptions): {
103
+ is_executing: boolean;
104
104
  results: QueryResult<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>[] | undefined;
105
105
  error: string | undefined;
106
106
  };
@@ -108,37 +108,37 @@ declare function useQueryMany<S extends readonly ShapeNode[] = readonly ShapeNod
108
108
  interface CommandResult<T = any> {
109
109
  columns: Column[];
110
110
  rows: T[];
111
- executionTimeMs: number;
112
- rowsAffected?: number;
111
+ execution_time_ms: number;
112
+ rows_affected?: number;
113
113
  }
114
114
  interface CommandState<T = any> {
115
- isExecuting: boolean;
115
+ is_executing: boolean;
116
116
  results: CommandResult<T>[] | undefined;
117
117
  error: string | undefined;
118
- executionTime: number | undefined;
118
+ execution_time: number | undefined;
119
119
  }
120
120
  interface CommandExecutorOptions {
121
- connectionConfig?: ConnectionConfig;
121
+ connection_config?: ConnectionConfig;
122
122
  }
123
123
  declare function useCommandExecutor<T = any>(options?: CommandExecutorOptions): {
124
- isExecuting: boolean;
124
+ is_executing: boolean;
125
125
  results: CommandResult<T>[] | undefined;
126
126
  error: string | undefined;
127
- executionTime: number | undefined;
128
- command: (statements: string | string[], params?: any, shapes?: readonly ShapeNode[]) => Promise<void>;
129
- cancelCommand: () => void;
127
+ execution_time: number | undefined;
128
+ command: (rql: string, params?: any, shapes?: readonly ShapeNode[]) => Promise<void>;
129
+ cancel_command: () => void;
130
130
  };
131
131
 
132
132
  interface CommandOptions extends CommandExecutorOptions {
133
- connectionConfig?: ConnectionConfig;
133
+ connection_config?: ConnectionConfig;
134
134
  }
135
- declare function useCommandOne<S extends ShapeNode = any>(statement: string, params?: any, shape?: S, options?: CommandOptions): {
136
- isExecuting: boolean;
135
+ declare function useCommandOne<S extends ShapeNode = any>(rql: string, params?: any, shape?: S, options?: CommandOptions): {
136
+ is_executing: boolean;
137
137
  result: CommandResult<S extends ShapeNode ? InferShape<S> : any> | undefined;
138
138
  error: string | undefined;
139
139
  };
140
- declare function useCommandMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(statements: string | string[], params?: any, shapes?: S, options?: CommandOptions): {
141
- isExecuting: boolean;
140
+ declare function useCommandMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(rql: string, params?: any, shapes?: S, options?: CommandOptions): {
141
+ is_executing: boolean;
142
142
  results: CommandResult<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>[] | undefined;
143
143
  error: string | undefined;
144
144
  };
@@ -146,43 +146,43 @@ declare function useCommandMany<S extends readonly ShapeNode[] = readonly ShapeN
146
146
  interface AdminResult<T = any> {
147
147
  columns: Column[];
148
148
  rows: T[];
149
- executionTimeMs: number;
150
- rowsAffected?: number;
149
+ execution_time_ms: number;
150
+ rows_affected?: number;
151
151
  }
152
152
  interface AdminState<T = any> {
153
- isExecuting: boolean;
153
+ is_executing: boolean;
154
154
  results: AdminResult<T>[] | undefined;
155
155
  error: string | undefined;
156
- executionTime: number | undefined;
156
+ execution_time: number | undefined;
157
157
  }
158
158
  interface AdminExecutorOptions {
159
- connectionConfig?: ConnectionConfig;
159
+ connection_config?: ConnectionConfig;
160
160
  }
161
161
  declare function useAdminExecutor<T = any>(options?: AdminExecutorOptions): {
162
- isExecuting: boolean;
162
+ is_executing: boolean;
163
163
  results: AdminResult<T>[] | undefined;
164
164
  error: string | undefined;
165
- executionTime: number | undefined;
166
- admin: (statements: string | string[], params?: any, shapes?: readonly ShapeNode[]) => Promise<void>;
167
- cancelAdmin: () => void;
165
+ execution_time: number | undefined;
166
+ admin: (rql: string, params?: any, shapes?: readonly ShapeNode[]) => Promise<void>;
167
+ cancel_admin: () => void;
168
168
  };
169
169
 
170
170
  interface AdminOptions extends AdminExecutorOptions {
171
- connectionConfig?: ConnectionConfig;
171
+ connection_config?: ConnectionConfig;
172
172
  }
173
- declare function useAdminOne<S extends ShapeNode = any>(statement: string, params?: any, shape?: S, options?: AdminOptions): {
174
- isExecuting: boolean;
173
+ declare function useAdminOne<S extends ShapeNode = any>(rql: string, params?: any, shape?: S, options?: AdminOptions): {
174
+ is_executing: boolean;
175
175
  result: AdminResult<S extends ShapeNode ? InferShape<S> : any> | undefined;
176
176
  error: string | undefined;
177
177
  };
178
- declare function useAdminMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(statements: string | string[], params?: any, shapes?: S, options?: AdminOptions): {
179
- isExecuting: boolean;
178
+ declare function useAdminMany<S extends readonly ShapeNode[] = readonly ShapeNode[]>(rql: string, params?: any, shapes?: S, options?: AdminOptions): {
179
+ is_executing: boolean;
180
180
  results: AdminResult<S extends readonly ShapeNode[] ? InferShape<S[number]> : any>[] | undefined;
181
181
  error: string | undefined;
182
182
  };
183
183
 
184
184
  interface SubscriptionExecutorOptions {
185
- connectionConfig?: ConnectionConfig;
185
+ connection_config?: ConnectionConfig;
186
186
  }
187
187
  interface ChangeEvent<T> {
188
188
  operation: 'INSERT' | 'UPDATE' | 'REMOVE';
@@ -192,34 +192,34 @@ interface ChangeEvent<T> {
192
192
  interface SubscriptionState<T> {
193
193
  data: T[];
194
194
  changes: ChangeEvent<T>[];
195
- isSubscribed: boolean;
196
- isSubscribing: boolean;
195
+ is_subscribed: boolean;
196
+ is_subscribing: boolean;
197
197
  error: string | undefined;
198
- subscriptionId: string | undefined;
198
+ subscription_id: string | undefined;
199
199
  }
200
200
  declare function useSubscriptionExecutor<T = any>(options?: SubscriptionExecutorOptions): {
201
201
  state: SubscriptionState<T>;
202
- subscribe: (query: string, params?: any, shape?: ShapeNode) => Promise<void>;
202
+ subscribe: (rql: string, params?: any, shape?: ShapeNode) => Promise<void>;
203
203
  unsubscribe: () => Promise<void>;
204
- clearChanges: () => void;
205
- clearData: () => void;
204
+ clear_changes: () => void;
205
+ clear_data: () => void;
206
206
  };
207
207
 
208
208
  interface SubscriptionOptions extends SubscriptionExecutorOptions {
209
209
  enabled?: boolean;
210
210
  }
211
- declare function useSubscription<S extends ShapeNode = any>(query: string, params?: any, shape?: S, options?: SubscriptionOptions): {
211
+ declare function useSubscription<S extends ShapeNode = any>(rql: string, params?: any, shape?: S, options?: SubscriptionOptions): {
212
212
  data: InferShape<S>[];
213
213
  changes: ChangeEvent<InferShape<S>>[];
214
- isSubscribed: boolean;
215
- isSubscribing: boolean;
214
+ is_subscribed: boolean;
215
+ is_subscribing: boolean;
216
216
  error: string | undefined;
217
- subscriptionId: string | undefined;
217
+ subscription_id: string | undefined;
218
218
  };
219
219
 
220
220
  interface ColumnInfo {
221
221
  name: string;
222
- dataType: string;
222
+ data_type: string;
223
223
  }
224
224
  interface TableInfo {
225
225
  name: string;
@@ -227,4 +227,4 @@ interface TableInfo {
227
227
  }
228
228
  declare function useShape(): [boolean, TableInfo[], string | undefined];
229
229
 
230
- export { type AdminExecutorOptions, type AdminOptions, type AdminResult, type AdminState, type ChangeEvent, type ColumnInfo, type CommandExecutorOptions, type CommandOptions, type CommandResult, type CommandState, Connection, type ConnectionConfig, ConnectionContext, ConnectionProvider, type ConnectionProviderProps, DEFAULT_CONFIG, DEFAULT_URL, type QueryExecutorOptions, type QueryOptions, type QueryResult, type QueryState, type SubscriptionExecutorOptions, type SubscriptionOptions, type SubscriptionState, type TableInfo, clearConnection, getConnection, useAdminExecutor, useAdminMany, useAdminOne, useCommandExecutor, useCommandMany, useCommandOne, useConnection, useQueryExecutor, useQueryMany, useQueryOne, useShape, useSubscription, useSubscriptionExecutor };
230
+ export { type AdminExecutorOptions, type AdminOptions, type AdminResult, type AdminState, type ChangeEvent, type ColumnInfo, type CommandExecutorOptions, type CommandOptions, type CommandResult, type CommandState, Connection, type ConnectionConfig, ConnectionContext, ConnectionProvider, type ConnectionProviderProps, DEFAULT_CONFIG, DEFAULT_URL, type QueryExecutorOptions, type QueryOptions, type QueryResult, type QueryState, type SubscriptionExecutorOptions, type SubscriptionOptions, type SubscriptionState, type TableInfo, clear_connection, get_connection, useAdminExecutor, useAdminMany, useAdminOne, useCommandExecutor, useCommandMany, useCommandOne, useConnection, useQueryExecutor, useQueryMany, useQueryOne, useShape, useSubscription, useSubscriptionExecutor };