@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.js CHANGED
@@ -6,74 +6,74 @@ export * from "@reifydb/client";
6
6
  import { Client } from "@reifydb/client";
7
7
  var DEFAULT_CONFIG = {
8
8
  url: "ws://127.0.0.1:8090",
9
- options: { timeoutMs: 3e4 }
9
+ options: { timeout_ms: 3e4 }
10
10
  };
11
11
  var DEFAULT_URL = "ws://127.0.0.1:8090";
12
12
  var Connection = class {
13
13
  constructor(config = DEFAULT_CONFIG) {
14
14
  this.state = {
15
15
  client: null,
16
- isConnected: false,
17
- isConnecting: false,
18
- connectionError: null,
16
+ is_connected: false,
17
+ is_connecting: false,
18
+ connection_error: null,
19
19
  listeners: /* @__PURE__ */ new Set()
20
20
  };
21
- this.connectPromise = null;
21
+ this.connect_promise = null;
22
22
  this.config = { ...DEFAULT_CONFIG, ...config };
23
23
  }
24
- setConfig(config) {
24
+ set_config(config) {
25
25
  this.config = config;
26
26
  }
27
- getConfig() {
27
+ get_config() {
28
28
  return this.config;
29
29
  }
30
30
  async connect(url, options) {
31
- if (this.state.isConnected) {
31
+ if (this.state.is_connected) {
32
32
  return;
33
33
  }
34
- if (this.connectPromise) {
35
- return this.connectPromise;
34
+ if (this.connect_promise) {
35
+ return this.connect_promise;
36
36
  }
37
- const connectUrl = url || this.config.url || DEFAULT_CONFIG.url;
38
- const connectOptions = { token: this.config.token, ...this.config.options, ...options };
39
- this.updateState({
40
- isConnecting: true,
41
- connectionError: null
37
+ const connect_url = url || this.config.url || DEFAULT_CONFIG.url;
38
+ const connect_options = { token: this.config.token, ...this.config.options, ...options };
39
+ this.update_state({
40
+ is_connecting: true,
41
+ connection_error: null
42
42
  });
43
- this.connectPromise = (async () => {
43
+ this.connect_promise = (async () => {
44
44
  try {
45
- const isHttp = connectUrl.startsWith("http://") || connectUrl.startsWith("https://");
45
+ const isHttp = connect_url.startsWith("http://") || connect_url.startsWith("https://");
46
46
  const isJson = this.config.format === "json";
47
47
  let client;
48
48
  if (isHttp) {
49
- client = isJson ? Client.connect_json_http(connectUrl, connectOptions) : Client.connect_http(connectUrl, connectOptions);
49
+ client = isJson ? Client.connect_json_http(connect_url, connect_options) : Client.connect_http(connect_url, connect_options);
50
50
  } else {
51
- client = isJson ? await Client.connect_json_ws(connectUrl, connectOptions) : await Client.connect_ws(connectUrl, connectOptions);
51
+ client = isJson ? await Client.connect_json_ws(connect_url, connect_options) : await Client.connect_ws(connect_url, connect_options);
52
52
  }
53
- this.updateState({
53
+ this.update_state({
54
54
  client,
55
- isConnected: true,
56
- isConnecting: false,
57
- connectionError: null
55
+ is_connected: true,
56
+ is_connecting: false,
57
+ connection_error: null
58
58
  });
59
59
  } catch (err) {
60
- const errorMessage = err instanceof Error ? err.message : "Failed to connect to ReifyDB";
61
- console.error("[Connection] Connection failed:", errorMessage, err);
62
- this.updateState({
60
+ const error_message = err instanceof Error ? err.message : "Failed to connect to ReifyDB";
61
+ console.error("[Connection] Connection failed:", error_message, err);
62
+ this.update_state({
63
63
  client: null,
64
- isConnected: false,
65
- isConnecting: false,
66
- connectionError: errorMessage
64
+ is_connected: false,
65
+ is_connecting: false,
66
+ connection_error: error_message
67
67
  });
68
68
  throw err;
69
69
  } finally {
70
- this.connectPromise = null;
70
+ this.connect_promise = null;
71
71
  }
72
72
  })();
73
- return this.connectPromise;
73
+ return this.connect_promise;
74
74
  }
75
75
  async disconnect() {
76
- this.connectPromise = null;
76
+ this.connect_promise = null;
77
77
  if (this.state.client) {
78
78
  try {
79
79
  if ("disconnect" in this.state.client) {
@@ -84,30 +84,30 @@ var Connection = class {
84
84
  console.error("Error disconnecting:", err);
85
85
  }
86
86
  }
87
- this.updateState({
87
+ this.update_state({
88
88
  client: null,
89
- isConnected: false,
90
- isConnecting: false,
91
- connectionError: null
89
+ is_connected: false,
90
+ is_connecting: false,
91
+ connection_error: null
92
92
  });
93
93
  }
94
94
  async reconnect(url, options) {
95
95
  await this.disconnect();
96
96
  await this.connect(url, options);
97
97
  }
98
- getClient() {
98
+ get_client() {
99
99
  return this.state.client;
100
100
  }
101
- isConnected() {
102
- return this.state.isConnected;
101
+ is_connected() {
102
+ return this.state.is_connected;
103
103
  }
104
- isConnecting() {
105
- return this.state.isConnecting;
104
+ is_connecting() {
105
+ return this.state.is_connecting;
106
106
  }
107
- getConnectionError() {
108
- return this.state.connectionError;
107
+ get_connection_error() {
108
+ return this.state.connection_error;
109
109
  }
110
- getState() {
110
+ get_state() {
111
111
  const { listeners, ...state } = this.state;
112
112
  return state;
113
113
  }
@@ -118,7 +118,7 @@ var Connection = class {
118
118
  this.state.listeners.delete(listener);
119
119
  };
120
120
  }
121
- updateState(updates) {
121
+ update_state(updates) {
122
122
  this.state = {
123
123
  ...this.state,
124
124
  ...updates
@@ -130,23 +130,23 @@ var Connection = class {
130
130
  };
131
131
 
132
132
  // src/connection/connection-pool.ts
133
- var defaultConnection = null;
134
- function getConnection(config) {
135
- if (!defaultConnection) {
136
- const mergedConfig = { ...DEFAULT_CONFIG, ...config };
137
- defaultConnection = new Connection(mergedConfig);
138
- defaultConnection.connect().catch((err) => {
133
+ var default_connection = null;
134
+ function get_connection(config) {
135
+ if (!default_connection) {
136
+ const merged_config = { ...DEFAULT_CONFIG, ...config };
137
+ default_connection = new Connection(merged_config);
138
+ default_connection.connect().catch((err) => {
139
139
  console.error("[ConnectionPool] Eager connect failed:", err);
140
140
  });
141
141
  } else if (config) {
142
- defaultConnection.setConfig({ ...DEFAULT_CONFIG, ...config });
142
+ default_connection.set_config({ ...DEFAULT_CONFIG, ...config });
143
143
  }
144
- return defaultConnection;
144
+ return default_connection;
145
145
  }
146
- async function clearConnection() {
147
- if (defaultConnection) {
148
- await defaultConnection.disconnect();
149
- defaultConnection = null;
146
+ async function clear_connection() {
147
+ if (default_connection) {
148
+ await default_connection.disconnect();
149
+ default_connection = null;
150
150
  }
151
151
  }
152
152
 
@@ -154,48 +154,48 @@ async function clearConnection() {
154
154
  import React, { createContext, useEffect, useRef } from "react";
155
155
  var ConnectionContext = createContext(null);
156
156
  function ConnectionProvider({ config, children }) {
157
- const connection = getConnection(config);
158
- const prevConfigRef = useRef(void 0);
159
- const currentConfigStr = JSON.stringify(config);
157
+ const connection = get_connection(config);
158
+ const prev_config_ref = useRef(void 0);
159
+ const current_config_str = JSON.stringify(config);
160
160
  useEffect(() => {
161
- const configChanged = prevConfigRef.current !== void 0 && prevConfigRef.current !== currentConfigStr;
162
- if (configChanged && connection.isConnected()) {
161
+ const config_changed = prev_config_ref.current !== void 0 && prev_config_ref.current !== current_config_str;
162
+ if (config_changed && connection.is_connected()) {
163
163
  connection.reconnect().catch((err) => {
164
164
  console.error("[ConnectionProvider] Failed to reconnect:", err);
165
165
  });
166
- } else if (!connection.isConnected() && !connection.isConnecting()) {
166
+ } else if (!connection.is_connected() && !connection.is_connecting()) {
167
167
  connection.connect().catch((err) => {
168
168
  console.error("[ConnectionProvider] Failed to connect:", err);
169
169
  });
170
170
  }
171
- prevConfigRef.current = currentConfigStr;
172
- }, [currentConfigStr, connection]);
171
+ prev_config_ref.current = current_config_str;
172
+ }, [current_config_str, connection]);
173
173
  return /* @__PURE__ */ React.createElement(ConnectionContext.Provider, { value: connection }, children);
174
174
  }
175
175
 
176
176
  // src/hooks/use-connection.ts
177
177
  import { useContext, useEffect as useEffect2, useState } from "react";
178
- function useConnection(overrideConfig) {
179
- const contextConnection = useContext(ConnectionContext);
178
+ function useConnection(override_config) {
179
+ const context_connection = useContext(ConnectionContext);
180
180
  const [connection] = useState(() => {
181
- if (overrideConfig) {
182
- return getConnection(overrideConfig);
181
+ if (override_config) {
182
+ return get_connection(override_config);
183
183
  }
184
- if (contextConnection) {
185
- return contextConnection;
184
+ if (context_connection) {
185
+ return context_connection;
186
186
  }
187
- return getConnection();
187
+ return get_connection();
188
188
  });
189
- const [state, setState] = useState(() => connection.getState());
189
+ const [state, setState] = useState(() => connection.get_state());
190
190
  useEffect2(() => {
191
- const currentState = connection.getState();
192
- setState(currentState);
193
- const unsubscribe = connection.subscribe((newState) => {
191
+ const current_state = connection.get_state();
192
+ setState(current_state);
193
+ const unsubscribe = connection.subscribe((new_state) => {
194
194
  setState({
195
- client: newState.client,
196
- isConnected: newState.isConnected,
197
- isConnecting: newState.isConnecting,
198
- connectionError: newState.connectionError
195
+ client: new_state.client,
196
+ is_connected: new_state.is_connected,
197
+ is_connecting: new_state.is_connecting,
198
+ connection_error: new_state.connection_error
199
199
  });
200
200
  });
201
201
  return unsubscribe;
@@ -211,57 +211,57 @@ function useConnection(overrideConfig) {
211
211
  // src/hooks/use-query-executor.ts
212
212
  import { useState as useState2, useCallback, useRef as useRef2, useEffect as useEffect3 } from "react";
213
213
  function useQueryExecutor(options) {
214
- const { client } = useConnection(options?.connectionConfig);
214
+ const { client } = useConnection(options?.connection_config);
215
215
  const [state, setState] = useState2({
216
- isExecuting: false,
216
+ is_executing: false,
217
217
  results: void 0,
218
218
  error: void 0,
219
- executionTime: void 0
219
+ execution_time: void 0
220
220
  });
221
- const clientRef = useRef2(client);
222
- clientRef.current = client;
223
- const isMountedRef = useRef2(true);
221
+ const client_ref = useRef2(client);
222
+ client_ref.current = client;
223
+ const is_mounted_ref = useRef2(true);
224
224
  useEffect3(() => {
225
225
  return () => {
226
- isMountedRef.current = false;
226
+ is_mounted_ref.current = false;
227
227
  };
228
228
  }, []);
229
- const executionIdRef = useRef2(0);
230
- const pendingRef = useRef2(null);
229
+ const execution_id_ref = useRef2(0);
230
+ const pending_ref = useRef2(null);
231
231
  const query = useCallback(
232
- (statements, params, shapes) => {
233
- const currentClient = clientRef.current;
234
- if (!currentClient) {
235
- pendingRef.current = { statements, params, shapes };
236
- setState((prev) => ({ ...prev, isExecuting: true, error: void 0 }));
232
+ (rql, params, shapes) => {
233
+ const current_client = client_ref.current;
234
+ if (!current_client) {
235
+ pending_ref.current = { rql, params, shapes };
236
+ setState((prev) => ({ ...prev, is_executing: true, error: void 0 }));
237
237
  return Promise.resolve();
238
238
  }
239
- pendingRef.current = null;
240
- const thisExecution = ++executionIdRef.current;
241
- setState((prev) => ({ ...prev, isExecuting: true, error: void 0 }));
242
- const startTime = Date.now();
239
+ pending_ref.current = null;
240
+ const this_execution = ++execution_id_ref.current;
241
+ setState((prev) => ({ ...prev, is_executing: true, error: void 0 }));
242
+ const start_time = Date.now();
243
243
  return (async () => {
244
244
  try {
245
- const frameResults = await currentClient.query(statements, params || null, shapes || []) || [];
246
- if (executionIdRef.current !== thisExecution) return;
247
- const executionTime = Date.now() - startTime;
248
- const results = frameResults.map((frame) => {
245
+ const frame_results = await current_client.query(rql, params || null, shapes || []) || [];
246
+ if (execution_id_ref.current !== this_execution) return;
247
+ const execution_time = Date.now() - start_time;
248
+ const results = frame_results.map((frame) => {
249
249
  if (Array.isArray(frame) && frame.length > 0) {
250
- const firstRow = frame[0];
250
+ const first_row = frame[0];
251
251
  let columns = [];
252
- const hasValueObjects = firstRow && typeof firstRow === "object" && Object.values(firstRow).some((v) => v && typeof v === "object" && "type" in v);
253
- if (hasValueObjects) {
254
- columns = Object.keys(firstRow).map((key) => {
255
- const value = firstRow[key];
256
- const dataType = value?.type || "Utf8";
252
+ const has_value_objects = first_row && typeof first_row === "object" && Object.values(first_row).some((v) => v && typeof v === "object" && "type" in v);
253
+ if (has_value_objects) {
254
+ columns = Object.keys(first_row).map((key) => {
255
+ const value = first_row[key];
256
+ const data_type = value?.type || "Utf8";
257
257
  return {
258
258
  name: key,
259
- type: dataType,
259
+ type: data_type,
260
260
  payload: []
261
261
  };
262
262
  });
263
263
  } else {
264
- columns = Object.keys(firstRow).map((key) => ({
264
+ columns = Object.keys(first_row).map((key) => ({
265
265
  name: key,
266
266
  type: "Utf8",
267
267
  payload: []
@@ -270,41 +270,41 @@ function useQueryExecutor(options) {
270
270
  return {
271
271
  columns,
272
272
  rows: frame,
273
- executionTimeMs: executionTime
273
+ execution_time_ms: execution_time
274
274
  };
275
275
  } else {
276
276
  return {
277
277
  columns: [],
278
278
  rows: [],
279
- executionTimeMs: executionTime
279
+ execution_time_ms: execution_time
280
280
  };
281
281
  }
282
282
  });
283
- if (!isMountedRef.current) return;
283
+ if (!is_mounted_ref.current) return;
284
284
  setState({
285
- isExecuting: false,
285
+ is_executing: false,
286
286
  results,
287
287
  error: void 0,
288
- executionTime
288
+ execution_time
289
289
  });
290
290
  } catch (err) {
291
- if (executionIdRef.current !== thisExecution) return;
292
- const executionTime = Date.now() - startTime;
293
- let errorMessage = "Query execution failed";
291
+ if (execution_id_ref.current !== this_execution) return;
292
+ const execution_time = Date.now() - start_time;
293
+ let error_message = "Query execution failed";
294
294
  if (err instanceof Error) {
295
- errorMessage = err.message;
295
+ error_message = err.message;
296
296
  } else if (typeof err === "string") {
297
- errorMessage = err;
297
+ error_message = err;
298
298
  } else if (err && typeof err === "object" && "message" in err) {
299
- errorMessage = err.message;
299
+ error_message = err.message;
300
300
  }
301
- console.error("Query execution failed:", errorMessage);
302
- if (!isMountedRef.current) return;
301
+ console.error("Query execution failed:", error_message);
302
+ if (!is_mounted_ref.current) return;
303
303
  setState((prev) => ({
304
304
  ...prev,
305
- isExecuting: false,
306
- error: errorMessage,
307
- executionTime
305
+ is_executing: false,
306
+ error: error_message,
307
+ execution_time
308
308
  }));
309
309
  }
310
310
  })();
@@ -312,26 +312,26 @@ function useQueryExecutor(options) {
312
312
  []
313
313
  );
314
314
  useEffect3(() => {
315
- if (client && pendingRef.current) {
316
- const { statements, params, shapes } = pendingRef.current;
317
- query(statements, params, shapes);
315
+ if (client && pending_ref.current) {
316
+ const { rql, params, shapes } = pending_ref.current;
317
+ query(rql, params, shapes);
318
318
  }
319
319
  }, [client, query]);
320
- const cancelQuery = useCallback(() => {
321
- executionIdRef.current++;
320
+ const cancel_query = useCallback(() => {
321
+ execution_id_ref.current++;
322
322
  setState((prev) => ({
323
323
  ...prev,
324
- isExecuting: false,
324
+ is_executing: false,
325
325
  error: "Query cancelled"
326
326
  }));
327
327
  }, []);
328
328
  return {
329
- isExecuting: state.isExecuting,
329
+ is_executing: state.is_executing,
330
330
  results: state.results,
331
331
  error: state.error,
332
- executionTime: state.executionTime,
332
+ execution_time: state.execution_time,
333
333
  query,
334
- cancelQuery
334
+ cancel_query
335
335
  };
336
336
  }
337
337
 
@@ -339,7 +339,7 @@ function useQueryExecutor(options) {
339
339
  import { useEffect as useEffect4, useMemo } from "react";
340
340
  function useQueryOne(rql, params, shape, options) {
341
341
  const {
342
- isExecuting,
342
+ is_executing,
343
343
  results,
344
344
  error,
345
345
  query
@@ -351,76 +351,76 @@ function useQueryOne(rql, params, shape, options) {
351
351
  const result = useMemo(() => {
352
352
  return results && results.length > 0 ? results[0] : void 0;
353
353
  }, [results]);
354
- return { isExecuting, result, error };
354
+ return { is_executing, result, error };
355
355
  }
356
- function useQueryMany(statements, params, shapes, options) {
356
+ function useQueryMany(rql, params, shapes, options) {
357
357
  const {
358
- isExecuting,
358
+ is_executing,
359
359
  results,
360
360
  error,
361
361
  query
362
362
  } = useQueryExecutor(options);
363
363
  useEffect4(() => {
364
- query(statements, params, shapes);
365
- }, [statements, params, query]);
366
- return { isExecuting, results, error };
364
+ query(rql, params, shapes);
365
+ }, [rql, params, query]);
366
+ return { is_executing, results, error };
367
367
  }
368
368
 
369
369
  // src/hooks/use-command-executor.ts
370
370
  import { useState as useState3, useCallback as useCallback2, useRef as useRef3, useEffect as useEffect5 } from "react";
371
371
  function useCommandExecutor(options) {
372
- const { client } = useConnection(options?.connectionConfig);
372
+ const { client } = useConnection(options?.connection_config);
373
373
  const [state, setState] = useState3({
374
- isExecuting: false,
374
+ is_executing: false,
375
375
  results: void 0,
376
376
  error: void 0,
377
- executionTime: void 0
377
+ execution_time: void 0
378
378
  });
379
- const clientRef = useRef3(client);
380
- clientRef.current = client;
381
- const isMountedRef = useRef3(false);
379
+ const client_ref = useRef3(client);
380
+ client_ref.current = client;
381
+ const is_mounted_ref = useRef3(false);
382
382
  useEffect5(() => {
383
- isMountedRef.current = true;
383
+ is_mounted_ref.current = true;
384
384
  return () => {
385
- isMountedRef.current = false;
385
+ is_mounted_ref.current = false;
386
386
  };
387
387
  }, []);
388
- const executionIdRef = useRef3(0);
389
- const pendingRef = useRef3(null);
388
+ const execution_id_ref = useRef3(0);
389
+ const pending_ref = useRef3(null);
390
390
  const command = useCallback2(
391
- (statements, params, shapes) => {
392
- const currentClient = clientRef.current;
393
- if (!currentClient) {
394
- pendingRef.current = { statements, params, shapes };
395
- setState((prev) => ({ ...prev, isExecuting: true, error: void 0 }));
391
+ (rql, params, shapes) => {
392
+ const current_client = client_ref.current;
393
+ if (!current_client) {
394
+ pending_ref.current = { rql, params, shapes };
395
+ setState((prev) => ({ ...prev, is_executing: true, error: void 0 }));
396
396
  return Promise.resolve();
397
397
  }
398
- pendingRef.current = null;
399
- const thisExecution = ++executionIdRef.current;
400
- setState((prev) => ({ ...prev, isExecuting: true, error: void 0 }));
401
- const startTime = Date.now();
398
+ pending_ref.current = null;
399
+ const this_execution = ++execution_id_ref.current;
400
+ setState((prev) => ({ ...prev, is_executing: true, error: void 0 }));
401
+ const start_time = Date.now();
402
402
  return (async () => {
403
403
  try {
404
- const frameResults = await currentClient.command(statements, params || null, shapes || []) || [];
405
- if (executionIdRef.current !== thisExecution) return;
406
- const executionTime = Date.now() - startTime;
407
- const results = frameResults.map((frame) => {
404
+ const frame_results = await current_client.command(rql, params || null, shapes || []) || [];
405
+ if (execution_id_ref.current !== this_execution) return;
406
+ const execution_time = Date.now() - start_time;
407
+ const results = frame_results.map((frame) => {
408
408
  if (Array.isArray(frame) && frame.length > 0) {
409
- const firstRow = frame[0];
409
+ const first_row = frame[0];
410
410
  let columns = [];
411
- const hasValueObjects = firstRow && typeof firstRow === "object" && Object.values(firstRow).some((v) => v && typeof v === "object" && "type" in v);
412
- if (hasValueObjects) {
413
- columns = Object.keys(firstRow).map((key) => {
414
- const value = firstRow[key];
415
- const dataType = value?.type || "Utf8";
411
+ const has_value_objects = first_row && typeof first_row === "object" && Object.values(first_row).some((v) => v && typeof v === "object" && "type" in v);
412
+ if (has_value_objects) {
413
+ columns = Object.keys(first_row).map((key) => {
414
+ const value = first_row[key];
415
+ const data_type = value?.type || "Utf8";
416
416
  return {
417
417
  name: key,
418
- type: dataType,
418
+ type: data_type,
419
419
  payload: []
420
420
  };
421
421
  });
422
422
  } else {
423
- columns = Object.keys(firstRow).map((key) => ({
423
+ columns = Object.keys(first_row).map((key) => ({
424
424
  name: key,
425
425
  type: "Utf8",
426
426
  payload: []
@@ -429,42 +429,42 @@ function useCommandExecutor(options) {
429
429
  return {
430
430
  columns,
431
431
  rows: frame,
432
- executionTimeMs: executionTime
432
+ execution_time_ms: execution_time
433
433
  };
434
434
  } else {
435
435
  return {
436
436
  columns: [],
437
437
  rows: [],
438
- executionTimeMs: executionTime,
439
- rowsAffected: typeof frame === "number" ? frame : void 0
438
+ execution_time_ms: execution_time,
439
+ rows_affected: typeof frame === "number" ? frame : void 0
440
440
  };
441
441
  }
442
442
  });
443
- if (!isMountedRef.current) return;
443
+ if (!is_mounted_ref.current) return;
444
444
  setState({
445
- isExecuting: false,
445
+ is_executing: false,
446
446
  results,
447
447
  error: void 0,
448
- executionTime
448
+ execution_time
449
449
  });
450
450
  } catch (err) {
451
- if (executionIdRef.current !== thisExecution) return;
452
- const executionTime = Date.now() - startTime;
453
- let errorMessage = "Command execution failed";
451
+ if (execution_id_ref.current !== this_execution) return;
452
+ const execution_time = Date.now() - start_time;
453
+ let error_message = "Command execution failed";
454
454
  if (err instanceof Error) {
455
- errorMessage = err.message;
455
+ error_message = err.message;
456
456
  } else if (typeof err === "string") {
457
- errorMessage = err;
457
+ error_message = err;
458
458
  } else if (err && typeof err === "object" && "message" in err) {
459
- errorMessage = err.message;
459
+ error_message = err.message;
460
460
  }
461
- console.error("Command execution failed:", errorMessage);
462
- if (!isMountedRef.current) return;
461
+ console.error("Command execution failed:", error_message);
462
+ if (!is_mounted_ref.current) return;
463
463
  setState((prev) => ({
464
464
  ...prev,
465
- isExecuting: false,
466
- error: errorMessage,
467
- executionTime
465
+ is_executing: false,
466
+ error: error_message,
467
+ execution_time
468
468
  }));
469
469
  }
470
470
  })();
@@ -472,115 +472,115 @@ function useCommandExecutor(options) {
472
472
  []
473
473
  );
474
474
  useEffect5(() => {
475
- if (client && pendingRef.current) {
476
- const { statements, params, shapes } = pendingRef.current;
477
- command(statements, params, shapes);
475
+ if (client && pending_ref.current) {
476
+ const { rql, params, shapes } = pending_ref.current;
477
+ command(rql, params, shapes);
478
478
  }
479
479
  }, [client, command]);
480
- const cancelCommand = useCallback2(() => {
481
- executionIdRef.current++;
480
+ const cancel_command = useCallback2(() => {
481
+ execution_id_ref.current++;
482
482
  setState((prev) => ({
483
483
  ...prev,
484
- isExecuting: false,
484
+ is_executing: false,
485
485
  error: "Command cancelled"
486
486
  }));
487
487
  }, []);
488
488
  return {
489
- isExecuting: state.isExecuting,
489
+ is_executing: state.is_executing,
490
490
  results: state.results,
491
491
  error: state.error,
492
- executionTime: state.executionTime,
492
+ execution_time: state.execution_time,
493
493
  command,
494
- cancelCommand
494
+ cancel_command
495
495
  };
496
496
  }
497
497
 
498
498
  // src/hooks/use-command.ts
499
499
  import { useEffect as useEffect6, useMemo as useMemo2 } from "react";
500
- function useCommandOne(statement, params, shape, options) {
500
+ function useCommandOne(rql, params, shape, options) {
501
501
  const {
502
- isExecuting,
502
+ is_executing,
503
503
  results,
504
504
  error,
505
505
  command
506
506
  } = useCommandExecutor(options);
507
507
  useEffect6(() => {
508
508
  const shapes = shape ? [shape] : void 0;
509
- command(statement, params, shapes);
510
- }, [statement, params, command]);
509
+ command(rql, params, shapes);
510
+ }, [rql, params, command]);
511
511
  const result = useMemo2(() => {
512
512
  return results && results.length > 0 ? results[0] : void 0;
513
513
  }, [results]);
514
- return { isExecuting, result, error };
514
+ return { is_executing, result, error };
515
515
  }
516
- function useCommandMany(statements, params, shapes, options) {
516
+ function useCommandMany(rql, params, shapes, options) {
517
517
  const {
518
- isExecuting,
518
+ is_executing,
519
519
  results,
520
520
  error,
521
521
  command
522
522
  } = useCommandExecutor(options);
523
523
  useEffect6(() => {
524
- command(statements, params, shapes);
525
- }, [statements, params, command]);
526
- return { isExecuting, results, error };
524
+ command(rql, params, shapes);
525
+ }, [rql, params, command]);
526
+ return { is_executing, results, error };
527
527
  }
528
528
 
529
529
  // src/hooks/use-admin-executor.ts
530
530
  import { useState as useState4, useCallback as useCallback3, useRef as useRef4, useEffect as useEffect7 } from "react";
531
531
  function useAdminExecutor(options) {
532
- const { client } = useConnection(options?.connectionConfig);
532
+ const { client } = useConnection(options?.connection_config);
533
533
  const [state, setState] = useState4({
534
- isExecuting: false,
534
+ is_executing: false,
535
535
  results: void 0,
536
536
  error: void 0,
537
- executionTime: void 0
537
+ execution_time: void 0
538
538
  });
539
- const clientRef = useRef4(client);
540
- clientRef.current = client;
541
- const isMountedRef = useRef4(false);
539
+ const client_ref = useRef4(client);
540
+ client_ref.current = client;
541
+ const is_mounted_ref = useRef4(false);
542
542
  useEffect7(() => {
543
- isMountedRef.current = true;
543
+ is_mounted_ref.current = true;
544
544
  return () => {
545
- isMountedRef.current = false;
545
+ is_mounted_ref.current = false;
546
546
  };
547
547
  }, []);
548
- const executionIdRef = useRef4(0);
549
- const pendingRef = useRef4(null);
548
+ const execution_id_ref = useRef4(0);
549
+ const pending_ref = useRef4(null);
550
550
  const admin = useCallback3(
551
- (statements, params, shapes) => {
552
- const currentClient = clientRef.current;
553
- if (!currentClient) {
554
- pendingRef.current = { statements, params, shapes };
555
- setState((prev) => ({ ...prev, isExecuting: true, error: void 0 }));
551
+ (rql, params, shapes) => {
552
+ const current_client = client_ref.current;
553
+ if (!current_client) {
554
+ pending_ref.current = { rql, params, shapes };
555
+ setState((prev) => ({ ...prev, is_executing: true, error: void 0 }));
556
556
  return Promise.resolve();
557
557
  }
558
- pendingRef.current = null;
559
- const thisExecution = ++executionIdRef.current;
560
- setState((prev) => ({ ...prev, isExecuting: true, error: void 0 }));
561
- const startTime = Date.now();
558
+ pending_ref.current = null;
559
+ const this_execution = ++execution_id_ref.current;
560
+ setState((prev) => ({ ...prev, is_executing: true, error: void 0 }));
561
+ const start_time = Date.now();
562
562
  return (async () => {
563
563
  try {
564
- const frameResults = await currentClient.admin(statements, params || null, shapes || []) || [];
565
- if (executionIdRef.current !== thisExecution) return;
566
- const executionTime = Date.now() - startTime;
567
- const results = frameResults.map((frame) => {
564
+ const frame_results = await current_client.admin(rql, params || null, shapes || []) || [];
565
+ if (execution_id_ref.current !== this_execution) return;
566
+ const execution_time = Date.now() - start_time;
567
+ const results = frame_results.map((frame) => {
568
568
  if (Array.isArray(frame) && frame.length > 0) {
569
- const firstRow = frame[0];
569
+ const first_row = frame[0];
570
570
  let columns = [];
571
- const hasValueObjects = firstRow && typeof firstRow === "object" && Object.values(firstRow).some((v) => v && typeof v === "object" && "type" in v);
572
- if (hasValueObjects) {
573
- columns = Object.keys(firstRow).map((key) => {
574
- const value = firstRow[key];
575
- const dataType = value?.type || "Utf8";
571
+ const has_value_objects = first_row && typeof first_row === "object" && Object.values(first_row).some((v) => v && typeof v === "object" && "type" in v);
572
+ if (has_value_objects) {
573
+ columns = Object.keys(first_row).map((key) => {
574
+ const value = first_row[key];
575
+ const data_type = value?.type || "Utf8";
576
576
  return {
577
577
  name: key,
578
- type: dataType,
578
+ type: data_type,
579
579
  payload: []
580
580
  };
581
581
  });
582
582
  } else {
583
- columns = Object.keys(firstRow).map((key) => ({
583
+ columns = Object.keys(first_row).map((key) => ({
584
584
  name: key,
585
585
  type: "Utf8",
586
586
  payload: []
@@ -589,42 +589,42 @@ function useAdminExecutor(options) {
589
589
  return {
590
590
  columns,
591
591
  rows: frame,
592
- executionTimeMs: executionTime
592
+ execution_time_ms: execution_time
593
593
  };
594
594
  } else {
595
595
  return {
596
596
  columns: [],
597
597
  rows: [],
598
- executionTimeMs: executionTime,
599
- rowsAffected: typeof frame === "number" ? frame : void 0
598
+ execution_time_ms: execution_time,
599
+ rows_affected: typeof frame === "number" ? frame : void 0
600
600
  };
601
601
  }
602
602
  });
603
- if (!isMountedRef.current) return;
603
+ if (!is_mounted_ref.current) return;
604
604
  setState({
605
- isExecuting: false,
605
+ is_executing: false,
606
606
  results,
607
607
  error: void 0,
608
- executionTime
608
+ execution_time
609
609
  });
610
610
  } catch (err) {
611
- if (executionIdRef.current !== thisExecution) return;
612
- const executionTime = Date.now() - startTime;
613
- let errorMessage = "Admin execution failed";
611
+ if (execution_id_ref.current !== this_execution) return;
612
+ const execution_time = Date.now() - start_time;
613
+ let error_message = "Admin execution failed";
614
614
  if (err instanceof Error) {
615
- errorMessage = err.message;
615
+ error_message = err.message;
616
616
  } else if (typeof err === "string") {
617
- errorMessage = err;
617
+ error_message = err;
618
618
  } else if (err && typeof err === "object" && "message" in err) {
619
- errorMessage = err.message;
619
+ error_message = err.message;
620
620
  }
621
- console.error("Admin execution failed:", errorMessage);
622
- if (!isMountedRef.current) return;
621
+ console.error("Admin execution failed:", error_message);
622
+ if (!is_mounted_ref.current) return;
623
623
  setState((prev) => ({
624
624
  ...prev,
625
- isExecuting: false,
626
- error: errorMessage,
627
- executionTime
625
+ is_executing: false,
626
+ error: error_message,
627
+ execution_time
628
628
  }));
629
629
  }
630
630
  })();
@@ -633,157 +633,157 @@ function useAdminExecutor(options) {
633
633
  // stable — never recreates
634
634
  );
635
635
  useEffect7(() => {
636
- if (client && pendingRef.current) {
637
- const { statements, params, shapes } = pendingRef.current;
638
- admin(statements, params, shapes);
636
+ if (client && pending_ref.current) {
637
+ const { rql, params, shapes } = pending_ref.current;
638
+ admin(rql, params, shapes);
639
639
  }
640
640
  }, [client, admin]);
641
- const cancelAdmin = useCallback3(() => {
642
- executionIdRef.current++;
641
+ const cancel_admin = useCallback3(() => {
642
+ execution_id_ref.current++;
643
643
  setState((prev) => ({
644
644
  ...prev,
645
- isExecuting: false,
645
+ is_executing: false,
646
646
  error: "Admin cancelled"
647
647
  }));
648
648
  }, []);
649
649
  return {
650
- isExecuting: state.isExecuting,
650
+ is_executing: state.is_executing,
651
651
  results: state.results,
652
652
  error: state.error,
653
- executionTime: state.executionTime,
653
+ execution_time: state.execution_time,
654
654
  admin,
655
- cancelAdmin
655
+ cancel_admin
656
656
  };
657
657
  }
658
658
 
659
659
  // src/hooks/use-admin.ts
660
660
  import { useEffect as useEffect8, useMemo as useMemo3 } from "react";
661
- function useAdminOne(statement, params, shape, options) {
661
+ function useAdminOne(rql, params, shape, options) {
662
662
  const {
663
- isExecuting,
663
+ is_executing,
664
664
  results,
665
665
  error,
666
666
  admin
667
667
  } = useAdminExecutor(options);
668
668
  useEffect8(() => {
669
669
  const shapes = shape ? [shape] : void 0;
670
- admin(statement, params, shapes);
671
- }, [statement, params, admin]);
670
+ admin(rql, params, shapes);
671
+ }, [rql, params, admin]);
672
672
  const result = useMemo3(() => {
673
673
  return results && results.length > 0 ? results[0] : void 0;
674
674
  }, [results]);
675
- return { isExecuting, result, error };
675
+ return { is_executing, result, error };
676
676
  }
677
- function useAdminMany(statements, params, shapes, options) {
677
+ function useAdminMany(rql, params, shapes, options) {
678
678
  const {
679
- isExecuting,
679
+ is_executing,
680
680
  results,
681
681
  error,
682
682
  admin
683
683
  } = useAdminExecutor(options);
684
684
  useEffect8(() => {
685
- admin(statements, params, shapes);
686
- }, [statements, params, admin]);
687
- return { isExecuting, results, error };
685
+ admin(rql, params, shapes);
686
+ }, [rql, params, admin]);
687
+ return { is_executing, results, error };
688
688
  }
689
689
 
690
690
  // src/hooks/use-subscription-executor.ts
691
691
  import { useState as useState5, useCallback as useCallback4, useRef as useRef5, useEffect as useEffect9 } from "react";
692
692
  function useSubscriptionExecutor(options) {
693
- const { client } = useConnection(options?.connectionConfig);
693
+ const { client } = useConnection(options?.connection_config);
694
694
  const [state, setState] = useState5({
695
695
  data: [],
696
696
  changes: [],
697
- isSubscribed: false,
698
- isSubscribing: false,
697
+ is_subscribed: false,
698
+ is_subscribing: false,
699
699
  error: void 0,
700
- subscriptionId: void 0
700
+ subscription_id: void 0
701
701
  });
702
- const clientRef = useRef5(client);
702
+ const client_ref = useRef5(client);
703
703
  const subscriptionIdRef = useRef5(void 0);
704
- const queryRef = useRef5(void 0);
705
- const paramsRef = useRef5(void 0);
706
- const shapeRef = useRef5(void 0);
704
+ const rql_ref = useRef5(void 0);
705
+ const params_ref = useRef5(void 0);
706
+ const shape_ref = useRef5(void 0);
707
707
  useEffect9(() => {
708
- clientRef.current = client;
708
+ client_ref.current = client;
709
709
  }, [client]);
710
- const addChangeEvent = useCallback4((operation, rows) => {
710
+ const add_change_event = useCallback4((operation, rows) => {
711
711
  setState((prev) => {
712
- const newChange = {
712
+ const new_change = {
713
713
  operation,
714
714
  rows,
715
715
  timestamp: Date.now()
716
716
  };
717
- const newChanges = [...prev.changes, newChange];
717
+ const new_changes = [...prev.changes, new_change];
718
718
  return {
719
719
  ...prev,
720
720
  data: prev.data,
721
- changes: newChanges
721
+ changes: new_changes
722
722
  };
723
723
  });
724
724
  }, []);
725
- const handleInsert = useCallback4((rows) => {
726
- addChangeEvent("INSERT", rows);
727
- }, [addChangeEvent]);
728
- const handleUpdate = useCallback4((rows) => {
729
- addChangeEvent("UPDATE", rows);
730
- }, [addChangeEvent]);
731
- const handleRemove = useCallback4((rows) => {
732
- addChangeEvent("REMOVE", rows);
733
- }, [addChangeEvent]);
734
- const subscribe = useCallback4(async (query, params, shape) => {
735
- const currentClient = clientRef.current;
736
- if (!currentClient) {
725
+ const handle_insert = useCallback4((rows) => {
726
+ add_change_event("INSERT", rows);
727
+ }, [add_change_event]);
728
+ const handle_update = useCallback4((rows) => {
729
+ add_change_event("UPDATE", rows);
730
+ }, [add_change_event]);
731
+ const handle_remove = useCallback4((rows) => {
732
+ add_change_event("REMOVE", rows);
733
+ }, [add_change_event]);
734
+ const subscribe = useCallback4(async (rql, params, shape) => {
735
+ const current_client = client_ref.current;
736
+ if (!current_client) {
737
737
  setState((prev) => ({ ...prev, error: "Client not connected" }));
738
738
  return;
739
739
  }
740
- if (!("subscribe" in currentClient)) {
740
+ if (!("subscribe" in current_client)) {
741
741
  setState((prev) => ({ ...prev, error: "Subscriptions require a WebSocket connection" }));
742
742
  return;
743
743
  }
744
- queryRef.current = query;
745
- paramsRef.current = params;
746
- shapeRef.current = shape;
744
+ rql_ref.current = rql;
745
+ params_ref.current = params;
746
+ shape_ref.current = shape;
747
747
  setState((prev) => ({
748
748
  ...prev,
749
- isSubscribing: true,
749
+ is_subscribing: true,
750
750
  error: void 0
751
751
  }));
752
752
  try {
753
- const subId = await currentClient.subscribe(query, params, shape, {
754
- onInsert: handleInsert,
755
- onUpdate: handleUpdate,
756
- onRemove: handleRemove
753
+ const sub_id = await current_client.subscribe(rql, params, shape, {
754
+ on_insert: handle_insert,
755
+ on_update: handle_update,
756
+ on_remove: handle_remove
757
757
  });
758
- subscriptionIdRef.current = subId;
758
+ subscriptionIdRef.current = sub_id;
759
759
  setState((prev) => ({
760
760
  ...prev,
761
- isSubscribing: false,
762
- isSubscribed: true,
763
- subscriptionId: subId
761
+ is_subscribing: false,
762
+ is_subscribed: true,
763
+ subscription_id: sub_id
764
764
  }));
765
765
  } catch (err) {
766
766
  setState((prev) => ({
767
767
  ...prev,
768
- isSubscribing: false,
768
+ is_subscribing: false,
769
769
  error: err.message || "Subscription failed"
770
770
  }));
771
771
  }
772
- }, [handleInsert, handleUpdate, handleRemove]);
772
+ }, [handle_insert, handle_update, handle_remove]);
773
773
  const unsubscribe = useCallback4(async () => {
774
- const currentClient = clientRef.current;
775
- if (!currentClient || !subscriptionIdRef.current) return;
776
- if (!("unsubscribe" in currentClient)) return;
774
+ const current_client = client_ref.current;
775
+ if (!current_client || !subscriptionIdRef.current) return;
776
+ if (!("unsubscribe" in current_client)) return;
777
777
  try {
778
- await currentClient.unsubscribe(subscriptionIdRef.current);
778
+ await current_client.unsubscribe(subscriptionIdRef.current);
779
779
  subscriptionIdRef.current = void 0;
780
- queryRef.current = void 0;
781
- paramsRef.current = void 0;
782
- shapeRef.current = void 0;
780
+ rql_ref.current = void 0;
781
+ params_ref.current = void 0;
782
+ shape_ref.current = void 0;
783
783
  setState((prev) => ({
784
784
  ...prev,
785
- isSubscribed: false,
786
- subscriptionId: void 0
785
+ is_subscribed: false,
786
+ subscription_id: void 0
787
787
  }));
788
788
  } catch (err) {
789
789
  setState((prev) => ({
@@ -792,16 +792,16 @@ function useSubscriptionExecutor(options) {
792
792
  }));
793
793
  }
794
794
  }, []);
795
- const clearChanges = useCallback4(() => {
795
+ const clear_changes = useCallback4(() => {
796
796
  setState((prev) => ({ ...prev, changes: [] }));
797
797
  }, []);
798
- const clearData = useCallback4(() => {
798
+ const clear_data = useCallback4(() => {
799
799
  setState((prev) => ({ ...prev, data: [] }));
800
800
  }, []);
801
801
  useEffect9(() => {
802
802
  return () => {
803
- if (subscriptionIdRef.current && clientRef.current && "unsubscribe" in clientRef.current) {
804
- clientRef.current.unsubscribe(subscriptionIdRef.current).catch(console.error);
803
+ if (subscriptionIdRef.current && client_ref.current && "unsubscribe" in client_ref.current) {
804
+ client_ref.current.unsubscribe(subscriptionIdRef.current).catch(console.error);
805
805
  }
806
806
  };
807
807
  }, []);
@@ -809,56 +809,56 @@ function useSubscriptionExecutor(options) {
809
809
  state,
810
810
  subscribe,
811
811
  unsubscribe,
812
- clearChanges,
813
- clearData
812
+ clear_changes,
813
+ clear_data
814
814
  };
815
815
  }
816
816
 
817
817
  // src/hooks/use-subscription.ts
818
818
  import { useEffect as useEffect10, useMemo as useMemo4 } from "react";
819
- function useSubscription(query, params, shape, options) {
819
+ function useSubscription(rql, params, shape, options) {
820
820
  const {
821
821
  state,
822
822
  subscribe,
823
823
  unsubscribe
824
824
  } = useSubscriptionExecutor(options);
825
- const paramsKey = useMemo4(() => JSON.stringify(params), [params]);
825
+ const params_key = useMemo4(() => JSON.stringify(params), [params]);
826
826
  useEffect10(() => {
827
827
  if (options?.enabled === false) return;
828
- subscribe(query, params, shape);
828
+ subscribe(rql, params, shape);
829
829
  return () => {
830
830
  unsubscribe();
831
831
  };
832
- }, [query, paramsKey, shape, options?.enabled, subscribe, unsubscribe]);
832
+ }, [rql, params_key, shape, options?.enabled, subscribe, unsubscribe]);
833
833
  return {
834
834
  data: state.data,
835
835
  changes: state.changes,
836
- isSubscribed: state.isSubscribed,
837
- isSubscribing: state.isSubscribing,
836
+ is_subscribed: state.is_subscribed,
837
+ is_subscribing: state.is_subscribing,
838
838
  error: state.error,
839
- subscriptionId: state.subscriptionId
839
+ subscription_id: state.subscription_id
840
840
  };
841
841
  }
842
842
 
843
843
  // src/hooks/use-shape.ts
844
844
  import { useEffect as useEffect11, useState as useState6 } from "react";
845
845
  import { Shape } from "@reifydb/core";
846
- var namespaceShape = Shape.object({
846
+ var namespace_shape = Shape.object({
847
847
  id: Shape.number(),
848
848
  name: Shape.string()
849
849
  });
850
- var tableShape = Shape.object({
850
+ var table_shape = Shape.object({
851
851
  id: Shape.number(),
852
852
  namespace_id: Shape.number(),
853
853
  name: Shape.string(),
854
854
  primary_key_id: Shape.number()
855
855
  });
856
- var viewShape = Shape.object({
856
+ var view_shape = Shape.object({
857
857
  id: Shape.number(),
858
858
  namespace_id: Shape.number(),
859
859
  name: Shape.string()
860
860
  });
861
- var columnShape = Shape.object({
861
+ var column_shape = Shape.object({
862
862
  id: Shape.number(),
863
863
  shape_id: Shape.number(),
864
864
  shape_type: Shape.number(),
@@ -868,78 +868,78 @@ var columnShape = Shape.object({
868
868
  auto_increment: Shape.boolean()
869
869
  });
870
870
  function useShape() {
871
- const { isExecuting, results, error, query } = useQueryExecutor();
872
- const [shape, setShape] = useState6([]);
873
- const [isLoading, setIsLoading] = useState6(true);
871
+ const { is_executing, results, error, query } = useQueryExecutor();
872
+ const [shape, set_shape] = useState6([]);
873
+ const [is_loading, set_is_loading] = useState6(true);
874
874
  useEffect11(() => {
875
875
  if (!query) return;
876
- const fetchShape = async () => {
877
- setIsLoading(true);
876
+ const fetch_shape = async () => {
877
+ set_is_loading(true);
878
878
  try {
879
879
  await query(
880
880
  `OUTPUT FROM system::namespaces; OUTPUT FROM system::tables; OUTPUT FROM system::views; OUTPUT FROM system::columns;`,
881
881
  void 0,
882
- [namespaceShape, tableShape, viewShape, columnShape]
882
+ [namespace_shape, table_shape, view_shape, column_shape]
883
883
  );
884
884
  } catch (err) {
885
885
  console.error("Failed to fetch shape:", err);
886
886
  }
887
887
  };
888
- fetchShape();
888
+ fetch_shape();
889
889
  }, [query]);
890
890
  useEffect11(() => {
891
891
  if (!results || results.length < 4) {
892
- setIsLoading(isExecuting);
892
+ set_is_loading(is_executing);
893
893
  return;
894
894
  }
895
- const tablesResult = results[1];
896
- const viewsResult = results[2];
897
- const columnsResult = results[3];
898
- if (!tablesResult?.rows || !viewsResult?.rows || !columnsResult?.rows) {
899
- setIsLoading(false);
895
+ const tables_result = results[1];
896
+ const views_result = results[2];
897
+ const columns_result = results[3];
898
+ if (!tables_result?.rows || !views_result?.rows || !columns_result?.rows) {
899
+ set_is_loading(false);
900
900
  return;
901
901
  }
902
- const namespacesResult = results[0];
903
- const namespaces = namespacesResult.rows;
904
- const tables = tablesResult.rows;
905
- const views = viewsResult.rows;
906
- const columns = columnsResult.rows;
907
- const namespaceMap = /* @__PURE__ */ new Map();
902
+ const namespaces_result = results[0];
903
+ const namespaces = namespaces_result.rows;
904
+ const tables = tables_result.rows;
905
+ const views = views_result.rows;
906
+ const columns = columns_result.rows;
907
+ const namespace_map = /* @__PURE__ */ new Map();
908
908
  namespaces.forEach((ns) => {
909
909
  const id = ns.id?.valueOf();
910
910
  const name = ns.name?.valueOf();
911
911
  if (id !== void 0 && name) {
912
- namespaceMap.set(id, name);
912
+ namespace_map.set(id, name);
913
913
  }
914
914
  });
915
- const tableInfoMap = /* @__PURE__ */ new Map();
915
+ const table_info_map = /* @__PURE__ */ new Map();
916
916
  tables.forEach((table) => {
917
- const tableId = table.id?.valueOf();
918
- const namespaceId = table.namespace_id?.valueOf();
919
- const tableName = table.name?.valueOf();
920
- if (tableId === void 0 || !tableName || namespaceId === void 0) return;
921
- const namespace = namespaceMap.get(namespaceId);
917
+ const table_id = table.id?.valueOf();
918
+ const namespace_id = table.namespace_id?.valueOf();
919
+ const table_name = table.name?.valueOf();
920
+ if (table_id === void 0 || !table_name || namespace_id === void 0) return;
921
+ const namespace = namespace_map.get(namespace_id);
922
922
  if (!namespace) return;
923
- const fullTableName = `${namespace}::${tableName}`;
924
- tableInfoMap.set(tableId, {
925
- name: fullTableName,
923
+ const full_table_name = `${namespace}::${table_name}`;
924
+ table_info_map.set(table_id, {
925
+ name: full_table_name,
926
926
  columns: []
927
927
  });
928
928
  });
929
929
  views.forEach((view) => {
930
- const viewId = view.id?.valueOf();
931
- const namespaceId = view.namespace_id?.valueOf();
932
- const viewName = view.name?.valueOf();
933
- if (viewId === void 0 || !viewName || namespaceId === void 0) return;
934
- const namespace = namespaceMap.get(namespaceId);
930
+ const view_id = view.id?.valueOf();
931
+ const namespace_id = view.namespace_id?.valueOf();
932
+ const view_name = view.name?.valueOf();
933
+ if (view_id === void 0 || !view_name || namespace_id === void 0) return;
934
+ const namespace = namespace_map.get(namespace_id);
935
935
  if (!namespace) return;
936
- const fullViewName = `${namespace}::${viewName}`;
937
- tableInfoMap.set(viewId, {
938
- name: fullViewName,
936
+ const full_view_name = `${namespace}::${view_name}`;
937
+ table_info_map.set(view_id, {
938
+ name: full_view_name,
939
939
  columns: []
940
940
  });
941
941
  });
942
- const typeMap = {
942
+ const type_map = {
943
943
  0: "None",
944
944
  1: "Float4",
945
945
  2: "Float8",
@@ -968,36 +968,36 @@ function useShape() {
968
968
  25: "Uint",
969
969
  26: "Any"
970
970
  };
971
- const tableColumnsMap = /* @__PURE__ */ new Map();
971
+ const table_columns_map = /* @__PURE__ */ new Map();
972
972
  columns.forEach((column) => {
973
- const shapeId = column.shape_id?.valueOf();
974
- const shapeType = column.shape_type?.valueOf();
975
- const columnName = column.name?.valueOf();
976
- const typeId = column.type?.valueOf();
973
+ const shape_id = column.shape_id?.valueOf();
974
+ const shape_type = column.shape_type?.valueOf();
975
+ const column_name = column.name?.valueOf();
976
+ const type_id = column.type?.valueOf();
977
977
  const position = column.position?.valueOf();
978
- if (shapeId === void 0 || !columnName || typeId === void 0) return;
979
- if (shapeType !== 0 && shapeType !== 1) return;
980
- if (!tableColumnsMap.has(shapeId)) {
981
- tableColumnsMap.set(shapeId, []);
978
+ if (shape_id === void 0 || !column_name || type_id === void 0) return;
979
+ if (shape_type !== 0 && shape_type !== 1) return;
980
+ if (!table_columns_map.has(shape_id)) {
981
+ table_columns_map.set(shape_id, []);
982
982
  }
983
- tableColumnsMap.get(shapeId).push({
984
- name: columnName,
985
- dataType: typeMap[typeId] || `Unknown(${typeId})`,
983
+ table_columns_map.get(shape_id).push({
984
+ name: column_name,
985
+ data_type: type_map[type_id] || `Unknown(${type_id})`,
986
986
  position: position ?? 0
987
987
  });
988
988
  });
989
- tableColumnsMap.forEach((cols, shapeId) => {
990
- const tableInfo = tableInfoMap.get(shapeId);
991
- if (tableInfo) {
989
+ table_columns_map.forEach((cols, shape_id) => {
990
+ const table_info = table_info_map.get(shape_id);
991
+ if (table_info) {
992
992
  cols.sort((a, b) => a.position - b.position);
993
- tableInfo.columns = cols.map((c) => ({ name: c.name, dataType: c.dataType }));
993
+ table_info.columns = cols.map((c) => ({ name: c.name, data_type: c.data_type }));
994
994
  }
995
995
  });
996
- const shapeArray = Array.from(tableInfoMap.values()).filter((table) => table.name !== "reifydb::flows").sort((a, b) => a.name.localeCompare(b.name));
997
- setShape(shapeArray);
998
- setIsLoading(false);
999
- }, [results, isExecuting]);
1000
- return [isLoading, shape, error];
996
+ const shape_array = Array.from(table_info_map.values()).filter((table) => table.name !== "reifydb::flows").sort((a, b) => a.name.localeCompare(b.name));
997
+ set_shape(shape_array);
998
+ set_is_loading(false);
999
+ }, [results, is_executing]);
1000
+ return [is_loading, shape, error];
1001
1001
  }
1002
1002
  export {
1003
1003
  Connection,
@@ -1005,8 +1005,8 @@ export {
1005
1005
  ConnectionProvider,
1006
1006
  DEFAULT_CONFIG,
1007
1007
  DEFAULT_URL,
1008
- clearConnection,
1009
- getConnection,
1008
+ clear_connection,
1009
+ get_connection,
1010
1010
  useAdminExecutor,
1011
1011
  useAdminMany,
1012
1012
  useAdminOne,