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