@reifydb/react 0.9.0 → 0.9.1

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