@reifydb/react 0.0.1-alpha.6 → 0.0.1-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +78 -11
- package/dist/index.js +243 -33
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Column, SchemaNode, InferSchema } from '@reifydb/core';
|
|
|
2
2
|
export * from '@reifydb/core';
|
|
3
3
|
import { WsClientOptions, WsClient } from '@reifydb/client';
|
|
4
4
|
export * from '@reifydb/client';
|
|
5
|
+
import React, { ReactNode } from 'react';
|
|
5
6
|
|
|
6
7
|
interface ConnectionState {
|
|
7
8
|
client: WsClient | null;
|
|
@@ -14,16 +15,15 @@ interface ConnectionConfig {
|
|
|
14
15
|
url?: string;
|
|
15
16
|
options?: Omit<WsClientOptions, 'url'>;
|
|
16
17
|
}
|
|
18
|
+
declare const DEFAULT_CONFIG: ConnectionConfig;
|
|
17
19
|
declare class Connection {
|
|
18
|
-
private static instance;
|
|
19
20
|
private state;
|
|
20
21
|
private config;
|
|
21
|
-
|
|
22
|
-
static getInstance(): Connection;
|
|
22
|
+
constructor(config?: ConnectionConfig);
|
|
23
23
|
setConfig(config: ConnectionConfig): void;
|
|
24
24
|
getConfig(): ConnectionConfig;
|
|
25
25
|
connect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void>;
|
|
26
|
-
disconnect(): void
|
|
26
|
+
disconnect(): Promise<void>;
|
|
27
27
|
reconnect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void>;
|
|
28
28
|
getClient(): WsClient | null;
|
|
29
29
|
isConnected(): boolean;
|
|
@@ -33,11 +33,34 @@ declare class Connection {
|
|
|
33
33
|
subscribe(listener: (state: ConnectionState) => void): () => void;
|
|
34
34
|
private updateState;
|
|
35
35
|
}
|
|
36
|
-
declare const connection: Connection;
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Get or create a connection for the given configuration.
|
|
39
|
+
* If a connection with the same config already exists, it will be reused.
|
|
40
|
+
* @param config - Optional connection configuration
|
|
41
|
+
* @returns Connection instance for the given configuration
|
|
42
|
+
*/
|
|
43
|
+
declare function getConnection(config?: ConnectionConfig): Connection;
|
|
44
|
+
/**
|
|
45
|
+
* Clear a specific connection from the cache
|
|
46
|
+
* @param config - Configuration of the connection to clear
|
|
47
|
+
*/
|
|
48
|
+
declare function clearConnection(config?: ConnectionConfig): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Clear all cached connections
|
|
51
|
+
*/
|
|
52
|
+
declare function clearAllConnections(): Promise<void>;
|
|
53
|
+
|
|
54
|
+
declare const ConnectionContext: React.Context<Connection | null>;
|
|
55
|
+
interface ConnectionProviderProps {
|
|
56
|
+
config?: ConnectionConfig;
|
|
57
|
+
children: ReactNode;
|
|
58
|
+
}
|
|
59
|
+
declare function ConnectionProvider({ config, children }: ConnectionProviderProps): React.JSX.Element;
|
|
60
|
+
|
|
61
|
+
declare function useConnection(overrideConfig?: ConnectionConfig): {
|
|
39
62
|
connect: () => Promise<void>;
|
|
40
|
-
disconnect: () => void
|
|
63
|
+
disconnect: () => Promise<void>;
|
|
41
64
|
reconnect: () => Promise<void>;
|
|
42
65
|
client: WsClient | null;
|
|
43
66
|
isConnected: boolean;
|
|
@@ -57,7 +80,10 @@ interface QueryState<T = any> {
|
|
|
57
80
|
error: string | undefined;
|
|
58
81
|
executionTime: number | undefined;
|
|
59
82
|
}
|
|
60
|
-
|
|
83
|
+
interface QueryExecutorOptions {
|
|
84
|
+
connectionConfig?: ConnectionConfig;
|
|
85
|
+
}
|
|
86
|
+
declare function useQueryExecutor<T = any>(options?: QueryExecutorOptions): {
|
|
61
87
|
isExecuting: boolean;
|
|
62
88
|
results: QueryResult<T>[] | undefined;
|
|
63
89
|
error: string | undefined;
|
|
@@ -66,15 +92,56 @@ declare function useQueryExecutor<T = any>(): {
|
|
|
66
92
|
cancelQuery: () => void;
|
|
67
93
|
};
|
|
68
94
|
|
|
69
|
-
|
|
95
|
+
interface QueryOptions extends QueryExecutorOptions {
|
|
96
|
+
connectionConfig?: ConnectionConfig;
|
|
97
|
+
}
|
|
98
|
+
declare function useQueryOne<S extends SchemaNode = any>(rql: string, params?: any, schema?: S, options?: QueryOptions): {
|
|
70
99
|
isExecuting: boolean;
|
|
71
100
|
result: QueryResult<S extends SchemaNode ? InferSchema<S> : any> | undefined;
|
|
72
101
|
error: string | undefined;
|
|
73
102
|
};
|
|
74
|
-
declare function useQueryMany<S extends readonly SchemaNode[] = readonly SchemaNode[]>(statements: string | string[], params?: any, schemas?: S): {
|
|
103
|
+
declare function useQueryMany<S extends readonly SchemaNode[] = readonly SchemaNode[]>(statements: string | string[], params?: any, schemas?: S, options?: QueryOptions): {
|
|
75
104
|
isExecuting: boolean;
|
|
76
105
|
results: QueryResult<S extends readonly SchemaNode[] ? InferSchema<S[number]> : any>[] | undefined;
|
|
77
106
|
error: string | undefined;
|
|
78
107
|
};
|
|
79
108
|
|
|
80
|
-
|
|
109
|
+
interface CommandResult<T = any> {
|
|
110
|
+
columns: Column[];
|
|
111
|
+
rows: T[];
|
|
112
|
+
executionTimeMs: number;
|
|
113
|
+
rowsAffected?: number;
|
|
114
|
+
}
|
|
115
|
+
interface CommandState<T = any> {
|
|
116
|
+
isExecuting: boolean;
|
|
117
|
+
results: CommandResult<T>[] | undefined;
|
|
118
|
+
error: string | undefined;
|
|
119
|
+
executionTime: number | undefined;
|
|
120
|
+
}
|
|
121
|
+
interface CommandExecutorOptions {
|
|
122
|
+
connectionConfig?: ConnectionConfig;
|
|
123
|
+
}
|
|
124
|
+
declare function useCommandExecutor<T = any>(options?: CommandExecutorOptions): {
|
|
125
|
+
isExecuting: boolean;
|
|
126
|
+
results: CommandResult<T>[] | undefined;
|
|
127
|
+
error: string | undefined;
|
|
128
|
+
executionTime: number | undefined;
|
|
129
|
+
command: (statements: string | string[], params?: any, schemas?: readonly SchemaNode[]) => void;
|
|
130
|
+
cancelCommand: () => void;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
interface CommandOptions extends CommandExecutorOptions {
|
|
134
|
+
connectionConfig?: ConnectionConfig;
|
|
135
|
+
}
|
|
136
|
+
declare function useCommandOne<S extends SchemaNode = any>(statement: string, params?: any, schema?: S, options?: CommandOptions): {
|
|
137
|
+
isExecuting: boolean;
|
|
138
|
+
result: CommandResult<S extends SchemaNode ? InferSchema<S> : any> | undefined;
|
|
139
|
+
error: string | undefined;
|
|
140
|
+
};
|
|
141
|
+
declare function useCommandMany<S extends readonly SchemaNode[] = readonly SchemaNode[]>(statements: string | string[], params?: any, schemas?: S, options?: CommandOptions): {
|
|
142
|
+
isExecuting: boolean;
|
|
143
|
+
results: CommandResult<S extends readonly SchemaNode[] ? InferSchema<S[number]> : any>[] | undefined;
|
|
144
|
+
error: string | undefined;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export { type CommandExecutorOptions, type CommandOptions, type CommandResult, type CommandState, Connection, type ConnectionConfig, ConnectionContext, ConnectionProvider, type ConnectionProviderProps, DEFAULT_CONFIG, type QueryExecutorOptions, type QueryOptions, type QueryResult, type QueryState, clearAllConnections, clearConnection, getConnection, useCommandExecutor, useCommandMany, useCommandOne, useConnection, useQueryExecutor, useQueryMany, useQueryOne };
|
package/dist/index.js
CHANGED
|
@@ -10,8 +10,8 @@ var DEFAULT_CONFIG = {
|
|
|
10
10
|
timeoutMs: 1e3
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
var Connection = class
|
|
14
|
-
constructor() {
|
|
13
|
+
var Connection = class {
|
|
14
|
+
constructor(config) {
|
|
15
15
|
this.state = {
|
|
16
16
|
client: null,
|
|
17
17
|
isConnected: false,
|
|
@@ -19,13 +19,7 @@ var Connection = class _Connection {
|
|
|
19
19
|
connectionError: null,
|
|
20
20
|
listeners: /* @__PURE__ */ new Set()
|
|
21
21
|
};
|
|
22
|
-
this.config = DEFAULT_CONFIG;
|
|
23
|
-
}
|
|
24
|
-
static getInstance() {
|
|
25
|
-
if (!_Connection.instance) {
|
|
26
|
-
_Connection.instance = new _Connection();
|
|
27
|
-
}
|
|
28
|
-
return _Connection.instance;
|
|
22
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
29
23
|
}
|
|
30
24
|
setConfig(config) {
|
|
31
25
|
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
@@ -66,10 +60,11 @@ var Connection = class _Connection {
|
|
|
66
60
|
throw err;
|
|
67
61
|
}
|
|
68
62
|
}
|
|
69
|
-
disconnect() {
|
|
63
|
+
async disconnect() {
|
|
70
64
|
if (this.state.client) {
|
|
71
65
|
try {
|
|
72
66
|
this.state.client.disconnect();
|
|
67
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
73
68
|
} catch (err) {
|
|
74
69
|
console.error("Error disconnecting:", err);
|
|
75
70
|
}
|
|
@@ -82,7 +77,7 @@ var Connection = class _Connection {
|
|
|
82
77
|
});
|
|
83
78
|
}
|
|
84
79
|
async reconnect(url, options) {
|
|
85
|
-
this.disconnect();
|
|
80
|
+
await this.disconnect();
|
|
86
81
|
await this.connect(url, options);
|
|
87
82
|
}
|
|
88
83
|
getClient() {
|
|
@@ -118,13 +113,70 @@ var Connection = class _Connection {
|
|
|
118
113
|
});
|
|
119
114
|
}
|
|
120
115
|
};
|
|
121
|
-
|
|
116
|
+
|
|
117
|
+
// src/connection/connection-pool.ts
|
|
118
|
+
var connectionCache = /* @__PURE__ */ new Map();
|
|
119
|
+
function getConnection(config) {
|
|
120
|
+
const effectiveConfig = config ? { ...DEFAULT_CONFIG, ...config } : DEFAULT_CONFIG;
|
|
121
|
+
const key = JSON.stringify(effectiveConfig);
|
|
122
|
+
if (!connectionCache.has(key)) {
|
|
123
|
+
connectionCache.set(key, new Connection(effectiveConfig));
|
|
124
|
+
}
|
|
125
|
+
return connectionCache.get(key);
|
|
126
|
+
}
|
|
127
|
+
async function clearConnection(config) {
|
|
128
|
+
const effectiveConfig = config ? { ...DEFAULT_CONFIG, ...config } : DEFAULT_CONFIG;
|
|
129
|
+
const key = JSON.stringify(effectiveConfig);
|
|
130
|
+
const connection = connectionCache.get(key);
|
|
131
|
+
if (connection) {
|
|
132
|
+
await connection.disconnect();
|
|
133
|
+
connectionCache.delete(key);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async function clearAllConnections() {
|
|
137
|
+
const disconnectPromises = [];
|
|
138
|
+
for (const connection of connectionCache.values()) {
|
|
139
|
+
disconnectPromises.push(connection.disconnect());
|
|
140
|
+
}
|
|
141
|
+
await Promise.all(disconnectPromises);
|
|
142
|
+
connectionCache.clear();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/connection/connection-context.tsx
|
|
146
|
+
import React, { createContext, useEffect, useMemo } from "react";
|
|
147
|
+
var ConnectionContext = createContext(null);
|
|
148
|
+
function ConnectionProvider({ config, children }) {
|
|
149
|
+
const connection = useMemo(() => getConnection(config), [JSON.stringify(config)]);
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
if (!connection.isConnected() && !connection.isConnecting()) {
|
|
152
|
+
console.log("[ConnectionProvider] Initiating auto-connect...");
|
|
153
|
+
connection.connect().catch((err) => {
|
|
154
|
+
console.error("[ConnectionProvider] Failed to connect:", err);
|
|
155
|
+
});
|
|
156
|
+
} else {
|
|
157
|
+
console.log("[ConnectionProvider] Skipping auto-connect, current state:", {
|
|
158
|
+
isConnected: connection.isConnected(),
|
|
159
|
+
isConnecting: connection.isConnecting()
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}, [connection]);
|
|
163
|
+
return /* @__PURE__ */ React.createElement(ConnectionContext.Provider, { value: connection }, children);
|
|
164
|
+
}
|
|
122
165
|
|
|
123
166
|
// src/hooks/use-connection.ts
|
|
124
|
-
import { useEffect, useState } from "react";
|
|
125
|
-
function useConnection() {
|
|
167
|
+
import { useContext, useEffect as useEffect2, useState } from "react";
|
|
168
|
+
function useConnection(overrideConfig) {
|
|
169
|
+
const contextConnection = useContext(ConnectionContext);
|
|
170
|
+
const [connection] = useState(() => {
|
|
171
|
+
if (overrideConfig) {
|
|
172
|
+
return getConnection(overrideConfig);
|
|
173
|
+
}
|
|
174
|
+
return contextConnection || getConnection();
|
|
175
|
+
});
|
|
126
176
|
const [state, setState] = useState(() => connection.getState());
|
|
127
|
-
|
|
177
|
+
useEffect2(() => {
|
|
178
|
+
const currentState = connection.getState();
|
|
179
|
+
setState(currentState);
|
|
128
180
|
const unsubscribe = connection.subscribe((newState) => {
|
|
129
181
|
console.log("[useConnection] State update:", {
|
|
130
182
|
isConnected: newState.isConnected,
|
|
@@ -138,19 +190,19 @@ function useConnection() {
|
|
|
138
190
|
connectionError: newState.connectionError
|
|
139
191
|
});
|
|
140
192
|
});
|
|
141
|
-
if (!connection.isConnected() && !connection.isConnecting()) {
|
|
142
|
-
console.log("[useConnection] Initiating auto-connect...");
|
|
193
|
+
if (overrideConfig && !connection.isConnected() && !connection.isConnecting()) {
|
|
194
|
+
console.log("[useConnection] Initiating auto-connect for override config...");
|
|
143
195
|
connection.connect().catch((err) => {
|
|
144
196
|
console.error("[useConnection] Failed to connect:", err);
|
|
145
197
|
});
|
|
146
|
-
} else {
|
|
147
|
-
console.log("[useConnection]
|
|
148
|
-
|
|
149
|
-
|
|
198
|
+
} else if (!contextConnection && !overrideConfig && !connection.isConnected() && !connection.isConnecting()) {
|
|
199
|
+
console.log("[useConnection] Initiating auto-connect for default connection...");
|
|
200
|
+
connection.connect().catch((err) => {
|
|
201
|
+
console.error("[useConnection] Failed to connect:", err);
|
|
150
202
|
});
|
|
151
203
|
}
|
|
152
204
|
return unsubscribe;
|
|
153
|
-
}, []);
|
|
205
|
+
}, [connection, overrideConfig, contextConnection]);
|
|
154
206
|
return {
|
|
155
207
|
...state,
|
|
156
208
|
connect: () => connection.connect(),
|
|
@@ -161,8 +213,8 @@ function useConnection() {
|
|
|
161
213
|
|
|
162
214
|
// src/hooks/use-query-executor.ts
|
|
163
215
|
import { useState as useState2, useCallback, useRef } from "react";
|
|
164
|
-
function useQueryExecutor() {
|
|
165
|
-
const { client } = useConnection();
|
|
216
|
+
function useQueryExecutor(options) {
|
|
217
|
+
const { client } = useConnection(options?.connectionConfig);
|
|
166
218
|
const [state, setState] = useState2({
|
|
167
219
|
isExecuting: false,
|
|
168
220
|
results: void 0,
|
|
@@ -278,38 +330,196 @@ function useQueryExecutor() {
|
|
|
278
330
|
}
|
|
279
331
|
|
|
280
332
|
// src/hooks/use-query.ts
|
|
281
|
-
import { useEffect as
|
|
282
|
-
function useQueryOne(rql, params, schema) {
|
|
333
|
+
import { useEffect as useEffect3, useMemo as useMemo2 } from "react";
|
|
334
|
+
function useQueryOne(rql, params, schema, options) {
|
|
283
335
|
const {
|
|
284
336
|
isExecuting,
|
|
285
337
|
results,
|
|
286
338
|
error,
|
|
287
339
|
query
|
|
288
|
-
} = useQueryExecutor();
|
|
289
|
-
|
|
340
|
+
} = useQueryExecutor(options);
|
|
341
|
+
useEffect3(() => {
|
|
290
342
|
const schemas = schema ? [schema] : void 0;
|
|
291
343
|
query(rql, params, schemas);
|
|
292
344
|
}, [rql, params, query]);
|
|
293
|
-
const result =
|
|
345
|
+
const result = useMemo2(() => {
|
|
294
346
|
return results && results.length > 0 ? results[0] : void 0;
|
|
295
347
|
}, [results]);
|
|
296
348
|
return { isExecuting, result, error };
|
|
297
349
|
}
|
|
298
|
-
function useQueryMany(statements, params, schemas) {
|
|
350
|
+
function useQueryMany(statements, params, schemas, options) {
|
|
299
351
|
const {
|
|
300
352
|
isExecuting,
|
|
301
353
|
results,
|
|
302
354
|
error,
|
|
303
355
|
query
|
|
304
|
-
} = useQueryExecutor();
|
|
305
|
-
|
|
356
|
+
} = useQueryExecutor(options);
|
|
357
|
+
useEffect3(() => {
|
|
306
358
|
query(statements, params, schemas);
|
|
307
359
|
}, [statements, params, query]);
|
|
308
360
|
return { isExecuting, results, error };
|
|
309
361
|
}
|
|
362
|
+
|
|
363
|
+
// src/hooks/use-command-executor.ts
|
|
364
|
+
import { useState as useState3, useCallback as useCallback2, useRef as useRef2 } from "react";
|
|
365
|
+
function useCommandExecutor(options) {
|
|
366
|
+
const { client } = useConnection(options?.connectionConfig);
|
|
367
|
+
const [state, setState] = useState3({
|
|
368
|
+
isExecuting: false,
|
|
369
|
+
results: void 0,
|
|
370
|
+
error: void 0,
|
|
371
|
+
executionTime: void 0
|
|
372
|
+
});
|
|
373
|
+
const abortControllerRef = useRef2(null);
|
|
374
|
+
const command = useCallback2(
|
|
375
|
+
(statements, params, schemas) => {
|
|
376
|
+
console.log("[useCommand] Executing command:", statements);
|
|
377
|
+
console.log("[useCommand] Client available:", !!client);
|
|
378
|
+
if (abortControllerRef.current) {
|
|
379
|
+
abortControllerRef.current.abort();
|
|
380
|
+
}
|
|
381
|
+
abortControllerRef.current = new AbortController();
|
|
382
|
+
setState({
|
|
383
|
+
isExecuting: true,
|
|
384
|
+
results: void 0,
|
|
385
|
+
error: void 0,
|
|
386
|
+
executionTime: void 0
|
|
387
|
+
});
|
|
388
|
+
const startTime = Date.now();
|
|
389
|
+
(async () => {
|
|
390
|
+
try {
|
|
391
|
+
const frameResults = await client?.command(statements, params || null, schemas || []) || [];
|
|
392
|
+
console.debug("frameResults", frameResults);
|
|
393
|
+
const executionTime = Date.now() - startTime;
|
|
394
|
+
const results = frameResults.map((frame) => {
|
|
395
|
+
if (Array.isArray(frame) && frame.length > 0) {
|
|
396
|
+
const firstRow = frame[0];
|
|
397
|
+
let columns = [];
|
|
398
|
+
const hasValueObjects = firstRow && typeof firstRow === "object" && Object.values(firstRow).some((v) => v && typeof v === "object" && "type" in v);
|
|
399
|
+
if (hasValueObjects) {
|
|
400
|
+
columns = Object.keys(firstRow).map((key) => {
|
|
401
|
+
const value = firstRow[key];
|
|
402
|
+
const dataType = value?.type || "Utf8";
|
|
403
|
+
return {
|
|
404
|
+
name: key,
|
|
405
|
+
type: dataType,
|
|
406
|
+
data: []
|
|
407
|
+
};
|
|
408
|
+
});
|
|
409
|
+
} else {
|
|
410
|
+
columns = Object.keys(firstRow).map((key) => ({
|
|
411
|
+
name: key,
|
|
412
|
+
type: "Utf8",
|
|
413
|
+
// Default type for plain objects
|
|
414
|
+
data: []
|
|
415
|
+
}));
|
|
416
|
+
}
|
|
417
|
+
return {
|
|
418
|
+
columns,
|
|
419
|
+
rows: frame,
|
|
420
|
+
executionTimeMs: executionTime
|
|
421
|
+
};
|
|
422
|
+
} else {
|
|
423
|
+
return {
|
|
424
|
+
columns: [],
|
|
425
|
+
rows: [],
|
|
426
|
+
executionTimeMs: executionTime,
|
|
427
|
+
rowsAffected: typeof frame === "number" ? frame : void 0
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
setState({
|
|
432
|
+
isExecuting: false,
|
|
433
|
+
results,
|
|
434
|
+
error: void 0,
|
|
435
|
+
executionTime
|
|
436
|
+
});
|
|
437
|
+
} catch (err) {
|
|
438
|
+
const executionTime = Date.now() - startTime;
|
|
439
|
+
let errorMessage = "Command execution failed";
|
|
440
|
+
if (err instanceof Error) {
|
|
441
|
+
errorMessage = err.message;
|
|
442
|
+
} else if (typeof err === "string") {
|
|
443
|
+
errorMessage = err;
|
|
444
|
+
} else if (err && typeof err === "object" && "message" in err) {
|
|
445
|
+
errorMessage = err.message;
|
|
446
|
+
}
|
|
447
|
+
setState({
|
|
448
|
+
isExecuting: false,
|
|
449
|
+
results: void 0,
|
|
450
|
+
error: errorMessage,
|
|
451
|
+
executionTime
|
|
452
|
+
});
|
|
453
|
+
} finally {
|
|
454
|
+
abortControllerRef.current = null;
|
|
455
|
+
}
|
|
456
|
+
})();
|
|
457
|
+
},
|
|
458
|
+
[client]
|
|
459
|
+
);
|
|
460
|
+
const cancelCommand = useCallback2(() => {
|
|
461
|
+
if (abortControllerRef.current) {
|
|
462
|
+
abortControllerRef.current.abort();
|
|
463
|
+
setState((prev) => ({
|
|
464
|
+
...prev,
|
|
465
|
+
isExecuting: false,
|
|
466
|
+
error: "Command cancelled"
|
|
467
|
+
}));
|
|
468
|
+
}
|
|
469
|
+
}, []);
|
|
470
|
+
return {
|
|
471
|
+
// State
|
|
472
|
+
isExecuting: state.isExecuting,
|
|
473
|
+
results: state.results,
|
|
474
|
+
error: state.error,
|
|
475
|
+
executionTime: state.executionTime,
|
|
476
|
+
// Actions
|
|
477
|
+
command,
|
|
478
|
+
cancelCommand
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// src/hooks/use-command.ts
|
|
483
|
+
import { useEffect as useEffect4, useMemo as useMemo3 } from "react";
|
|
484
|
+
function useCommandOne(statement, params, schema, options) {
|
|
485
|
+
const {
|
|
486
|
+
isExecuting,
|
|
487
|
+
results,
|
|
488
|
+
error,
|
|
489
|
+
command
|
|
490
|
+
} = useCommandExecutor(options);
|
|
491
|
+
useEffect4(() => {
|
|
492
|
+
const schemas = schema ? [schema] : void 0;
|
|
493
|
+
command(statement, params, schemas);
|
|
494
|
+
}, [statement, params, command]);
|
|
495
|
+
const result = useMemo3(() => {
|
|
496
|
+
return results && results.length > 0 ? results[0] : void 0;
|
|
497
|
+
}, [results]);
|
|
498
|
+
return { isExecuting, result, error };
|
|
499
|
+
}
|
|
500
|
+
function useCommandMany(statements, params, schemas, options) {
|
|
501
|
+
const {
|
|
502
|
+
isExecuting,
|
|
503
|
+
results,
|
|
504
|
+
error,
|
|
505
|
+
command
|
|
506
|
+
} = useCommandExecutor(options);
|
|
507
|
+
useEffect4(() => {
|
|
508
|
+
command(statements, params, schemas);
|
|
509
|
+
}, [statements, params, command]);
|
|
510
|
+
return { isExecuting, results, error };
|
|
511
|
+
}
|
|
310
512
|
export {
|
|
311
513
|
Connection,
|
|
312
|
-
|
|
514
|
+
ConnectionContext,
|
|
515
|
+
ConnectionProvider,
|
|
516
|
+
DEFAULT_CONFIG,
|
|
517
|
+
clearAllConnections,
|
|
518
|
+
clearConnection,
|
|
519
|
+
getConnection,
|
|
520
|
+
useCommandExecutor,
|
|
521
|
+
useCommandMany,
|
|
522
|
+
useCommandOne,
|
|
313
523
|
useConnection,
|
|
314
524
|
useQueryExecutor,
|
|
315
525
|
useQueryMany,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/connection/connection.ts","../src/hooks/use-connection.ts","../src/hooks/use-query-executor.ts","../src/hooks/use-query.ts"],"sourcesContent":["export * from '@reifydb/core';\nexport * from '@reifydb/client';\n\n// Export connection utilities\nexport {Connection, connection, type ConnectionConfig} from './connection/connection';\n\n// Export React hooks\nexport {useConnection} from './hooks/use-connection';\nexport {useQueryExecutor, type QueryResult, type QueryState} from './hooks/use-query-executor';\nexport {useQueryOne, useQueryMany} from './hooks/use-query';","import {Client, WsClient, type WsClientOptions} from '@reifydb/client';\n\ninterface ConnectionState {\n client: WsClient | null;\n isConnected: boolean;\n isConnecting: boolean;\n connectionError: string | null;\n listeners: Set<(state: ConnectionState) => void>;\n}\n\nexport interface ConnectionConfig {\n url?: string;\n options?: Omit<WsClientOptions, 'url'>;\n}\n\nconst DEFAULT_CONFIG: ConnectionConfig = {\n url: 'ws://127.0.0.1:8090',\n options: {\n timeoutMs: 1000,\n }\n};\n\nexport class Connection {\n private static instance: Connection;\n private state: ConnectionState = {\n client: null,\n isConnected: false,\n isConnecting: false,\n connectionError: null,\n listeners: new Set(),\n };\n private config: ConnectionConfig = DEFAULT_CONFIG;\n\n private constructor() {\n }\n\n static getInstance(): Connection {\n if (!Connection.instance) {\n Connection.instance = new Connection();\n }\n return Connection.instance;\n }\n\n setConfig(config: ConnectionConfig): void {\n this.config = {...DEFAULT_CONFIG, ...config};\n }\n\n getConfig(): ConnectionConfig {\n return this.config;\n }\n\n async connect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void> {\n // Don't connect if already connected or connecting\n if (this.state.isConnected || this.state.isConnecting) {\n console.debug('[Connection] Already connected or connecting, skipping wsConnection attempt');\n return;\n }\n\n const connectUrl = url || this.config.url || DEFAULT_CONFIG.url!;\n const connectOptions = {...this.config.options, ...options};\n\n console.debug('[Connection] Attempting to connect to:', connectUrl);\n this.updateState({\n isConnecting: true,\n connectionError: null,\n });\n\n try {\n const client = await Client.connect_ws(connectUrl, connectOptions);\n\n console.debug('[Connection] Successfully connected to WebSocket');\n this.updateState({\n client,\n isConnected: true,\n isConnecting: false,\n connectionError: null,\n });\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Failed to connect to ReifyDB';\n console.error('[Connection] Connection failed:', errorMessage, err);\n this.updateState({\n client: null,\n isConnected: false,\n isConnecting: false,\n connectionError: errorMessage,\n });\n throw err;\n }\n }\n\n disconnect(): void {\n if (this.state.client) {\n try {\n this.state.client.disconnect();\n } catch (err) {\n console.error('Error disconnecting:', err);\n }\n }\n\n this.updateState({\n client: null,\n isConnected: false,\n isConnecting: false,\n connectionError: null,\n });\n }\n\n async reconnect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void> {\n this.disconnect();\n await this.connect(url, options);\n }\n\n getClient(): WsClient | null {\n return this.state.client;\n }\n\n isConnected(): boolean {\n return this.state.isConnected;\n }\n\n isConnecting(): boolean {\n return this.state.isConnecting;\n }\n\n getConnectionError(): string | null {\n return this.state.connectionError;\n }\n\n getState(): Omit<ConnectionState, 'listeners'> {\n const {listeners, ...state} = this.state;\n return state;\n }\n\n // Subscribe to state changes\n subscribe(listener: (state: ConnectionState) => void): () => void {\n this.state.listeners.add(listener);\n // Return unsubscribe function\n return () => {\n this.state.listeners.delete(listener);\n };\n }\n\n private updateState(updates: Partial<ConnectionState>): void {\n this.state = {\n ...this.state,\n ...updates,\n };\n\n // Notify all listeners\n this.state.listeners.forEach(listener => {\n listener(this.state);\n });\n }\n}\n\n// Export singleton instance\nexport const connection = Connection.getInstance();","import { useEffect, useState } from 'react';\nimport { connection } from '../connection/connection';\nimport { WsClient } from '@reifydb/client';\n\ninterface ConnectionState {\n client: WsClient | null;\n isConnected: boolean;\n isConnecting: boolean;\n connectionError: string | null;\n}\n\nexport function useConnection() {\n const [state, setState] = useState<ConnectionState>(() => connection.getState());\n\n useEffect(() => {\n // Subscribe to wsConnection state changes\n const unsubscribe = connection.subscribe((newState) => {\n console.log('[useConnection] State update:', {\n isConnected: newState.isConnected,\n isConnecting: newState.isConnecting,\n connectionError: newState.connectionError,\n });\n setState({\n client: newState.client,\n isConnected: newState.isConnected,\n isConnecting: newState.isConnecting,\n connectionError: newState.connectionError,\n });\n });\n\n // Auto-connect if not connected\n if (!connection.isConnected() && !connection.isConnecting()) {\n console.log('[useConnection] Initiating auto-connect...');\n connection.connect().catch(err => {\n console.error('[useConnection] Failed to connect:', err);\n });\n } else {\n console.log('[useConnection] Skipping auto-connect, current state:', {\n isConnected: connection.isConnected(),\n isConnecting: connection.isConnecting()\n });\n }\n\n return unsubscribe;\n }, []);\n\n return {\n ...state,\n connect: () => connection.connect(),\n disconnect: () => connection.disconnect(),\n reconnect: () => connection.reconnect(),\n };\n}","import {useState, useCallback, useRef} from 'react';\nimport {Column, SchemaNode} from '@reifydb/core';\nimport {useConnection} from './use-connection';\n\nexport interface QueryResult<T = any> {\n columns: Column[];\n rows: T[];\n executionTimeMs: number;\n rowsAffected?: number;\n}\n\nexport interface QueryState<T = any> {\n isExecuting: boolean;\n results: QueryResult<T>[] | undefined;\n error: string | undefined;\n executionTime: number | undefined;\n}\n\nexport function useQueryExecutor<T = any>() {\n const {client} = useConnection();\n\n const [state, setState] = useState<QueryState<T>>({\n isExecuting: false,\n results: undefined,\n error: undefined,\n executionTime: undefined,\n });\n\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const query = useCallback(\n (statements: string | string[], params?: any, schemas?: readonly SchemaNode[]): void => {\n console.log('[useQuery] Executing query:', statements);\n console.log('[useQuery] Client available:', !!client);\n\n // Cancel any ongoing query for THIS instance only\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n abortControllerRef.current = new AbortController();\n\n setState({\n isExecuting: true,\n results: undefined,\n error: undefined,\n executionTime: undefined,\n });\n\n const startTime = Date.now();\n\n (async () => {\n try {\n // Call client.query which returns FrameResults (array of frames)\n const frameResults = await client?.query(statements, params || null, schemas || []) || [];\n\n console.debug(\"frameResults\", frameResults);\n\n const executionTime = Date.now() - startTime;\n \n // Process each frame into a QueryResult\n const results: QueryResult<T>[] = frameResults.map((frame: any) => {\n if (Array.isArray(frame) && frame.length > 0) {\n const firstRow = frame[0];\n let columns: Column[] = [];\n \n // Check if we have Value objects or plain objects\n const hasValueObjects = firstRow && typeof firstRow === 'object' && \n Object.values(firstRow).some(v => v && typeof v === 'object' && 'type' in v);\n \n if (hasValueObjects) {\n // We have Value objects - extract type info\n columns = Object.keys(firstRow).map((key) => {\n const value = firstRow[key];\n const dataType = value?.type || 'Utf8';\n return {\n name: key,\n type: dataType,\n data: [],\n };\n });\n } else {\n // Plain objects from schema conversion\n columns = Object.keys(firstRow).map((key) => ({\n name: key,\n type: 'Utf8', // Default type for plain objects\n data: [],\n }));\n }\n \n return {\n columns,\n rows: frame as T[],\n executionTimeMs: executionTime,\n };\n } else {\n // Empty result\n return {\n columns: [],\n rows: [],\n executionTimeMs: executionTime,\n };\n }\n });\n\n setState({\n isExecuting: false,\n results,\n error: undefined,\n executionTime,\n });\n } catch (err) {\n const executionTime = Date.now() - startTime;\n let errorMessage = 'Query execution failed';\n\n if (err instanceof Error) {\n errorMessage = err.message;\n } else if (typeof err === 'string') {\n errorMessage = err;\n } else if (err && typeof err === 'object' && 'message' in err) {\n errorMessage = (err as { message: string }).message;\n }\n\n setState({\n isExecuting: false,\n results: undefined,\n error: errorMessage,\n executionTime,\n });\n } finally {\n abortControllerRef.current = null;\n }\n })();\n },\n [client]\n );\n\n const cancelQuery = useCallback(() => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n setState((prev) => ({\n ...prev,\n isExecuting: false,\n error: 'Query cancelled',\n }));\n }\n }, []);\n\n return {\n // State\n isExecuting: state.isExecuting,\n results: state.results,\n error: state.error,\n executionTime: state.executionTime,\n\n // Actions\n query,\n cancelQuery,\n };\n}","import {useEffect, useMemo} from 'react';\nimport {SchemaNode, InferSchema} from '@reifydb/core';\nimport {useQueryExecutor, type QueryResult} from './use-query-executor';\n\n// Single query hook - returns a single result\nexport function useQueryOne<S extends SchemaNode = any>(\n rql: string,\n params?: any,\n schema?: S\n): {\n isExecuting: boolean;\n result: QueryResult<S extends SchemaNode ? InferSchema<S> : any> | undefined;\n error: string | undefined;\n} {\n const {\n isExecuting,\n results,\n error,\n query\n } = useQueryExecutor<S extends SchemaNode ? InferSchema<S> : any>();\n\n useEffect(() => {\n // Pass schema as array for the executor\n const schemas = schema ? [schema] : undefined;\n query(rql, params, schemas);\n }, [rql, params, query]);\n\n // Extract first result for single query convenience\n const result = useMemo(() => {\n return results && results.length > 0 ? results[0] : undefined;\n }, [results]);\n\n return {isExecuting, result, error};\n}\n\n// Multiple query hook - returns multiple results\nexport function useQueryMany<S extends readonly SchemaNode[] = readonly SchemaNode[]>(\n statements: string | string[],\n params?: any,\n schemas?: S\n): {\n isExecuting: boolean;\n results: QueryResult<S extends readonly SchemaNode[] ? InferSchema<S[number]> : any>[] | undefined;\n error: string | undefined;\n} {\n const {\n isExecuting,\n results,\n error,\n query\n } = useQueryExecutor<S extends readonly SchemaNode[] ? InferSchema<S[number]> : any>();\n\n useEffect(() => {\n query(statements, params, schemas);\n }, [statements, params, query]);\n\n return {isExecuting, results, error};\n}"],"mappings":";AAAA,cAAc;AACd,cAAc;;;ACDd,SAAQ,cAA6C;AAerD,IAAM,iBAAmC;AAAA,EACrC,KAAK;AAAA,EACL,SAAS;AAAA,IACL,WAAW;AAAA,EACf;AACJ;AAEO,IAAM,aAAN,MAAM,YAAW;AAAA,EAWZ,cAAc;AATtB,SAAQ,QAAyB;AAAA,MAC7B,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,cAAc;AAAA,MACd,iBAAiB;AAAA,MACjB,WA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AS,QAAQ,MAAM;AACzB,WAAO,WAAW,QAAQ,SAAS,IAAI,QAAQ,CAAC,IAAI;AAAA,EACxD,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,EAAC,aAAa,QAAQ,MAAK;AACtC;AAGO,SAAS,aACZ,YACA,QACA,SAKF;AACE,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,IAAI,iBAAiF;AAErF,EAAAA,WAAU,MAAM;AACZ,UAAM,YAAY,QAAQ,OAAO;AAAA,EACrC,GAAG,CAAC,YAAY,QAAQ,KAAK,CAAC;AAE9B,SAAO,EAAC,aAAa,SAAS,MAAK;AACvC;","names":["useState","useState","useEffect","useEffect"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/connection/connection.ts","../src/connection/connection-pool.ts","../src/connection/connection-context.tsx","../src/hooks/use-connection.ts","../src/hooks/use-query-executor.ts","../src/hooks/use-query.ts","../src/hooks/use-command-executor.ts","../src/hooks/use-command.ts"],"sourcesContent":["export * from '@reifydb/core';\nexport * from '@reifydb/client';\n\n// Export connection utilities\nexport {Connection, type ConnectionConfig, DEFAULT_CONFIG} from './connection/connection';\nexport {getConnection, clearConnection, clearAllConnections} from './connection/connection-pool';\nexport {ConnectionProvider, ConnectionContext, type ConnectionProviderProps} from './connection/connection-context';\n\n// Export React hooks\nexport {useConnection} from './hooks/use-connection';\nexport {useQueryExecutor, type QueryResult, type QueryState, type QueryExecutorOptions} from './hooks/use-query-executor';\nexport {useQueryOne, useQueryMany, type QueryOptions} from './hooks/use-query';\nexport {useCommandExecutor, type CommandResult, type CommandState, type CommandExecutorOptions} from './hooks/use-command-executor';\nexport {useCommandOne, useCommandMany, type CommandOptions} from './hooks/use-command';","import {Client, WsClient, type WsClientOptions} from '@reifydb/client';\n\ninterface ConnectionState {\n client: WsClient | null;\n isConnected: boolean;\n isConnecting: boolean;\n connectionError: string | null;\n listeners: Set<(state: ConnectionState) => void>;\n}\n\nexport interface ConnectionConfig {\n url?: string;\n options?: Omit<WsClientOptions, 'url'>;\n}\n\nexport const DEFAULT_CONFIG: ConnectionConfig = {\n url: 'ws://127.0.0.1:8090',\n options: {\n timeoutMs: 1000,\n }\n};\n\nexport class Connection {\n private state: ConnectionState = {\n client: null,\n isConnected: false,\n isConnecting: false,\n connectionError: null,\n listeners: new Set(),\n };\n private config: ConnectionConfig;\n\n constructor(config?: ConnectionConfig) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n }\n\n setConfig(config: ConnectionConfig): void {\n this.config = {...DEFAULT_CONFIG, ...config};\n }\n\n getConfig(): ConnectionConfig {\n return this.config;\n }\n\n async connect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void> {\n // Don't connect if already connected or connecting\n if (this.state.isConnected || this.state.isConnecting) {\n console.debug('[Connection] Already connected or connecting, skipping wsConnection attempt');\n return;\n }\n\n const connectUrl = url || this.config.url || DEFAULT_CONFIG.url!;\n const connectOptions = {...this.config.options, ...options};\n\n console.debug('[Connection] Attempting to connect to:', connectUrl);\n this.updateState({\n isConnecting: true,\n connectionError: null,\n });\n\n try {\n const client = await Client.connect_ws(connectUrl, connectOptions);\n\n console.debug('[Connection] Successfully connected to WebSocket');\n this.updateState({\n client,\n isConnected: true,\n isConnecting: false,\n connectionError: null,\n });\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Failed to connect to ReifyDB';\n console.error('[Connection] Connection failed:', errorMessage, err);\n this.updateState({\n client: null,\n isConnected: false,\n isConnecting: false,\n connectionError: errorMessage,\n });\n throw err;\n }\n }\n\n async disconnect(): Promise<void> {\n if (this.state.client) {\n try {\n this.state.client.disconnect();\n // Small delay to ensure WebSocket closes cleanly\n await new Promise(resolve => setTimeout(resolve, 10));\n } catch (err) {\n console.error('Error disconnecting:', err);\n }\n }\n\n this.updateState({\n client: null,\n isConnected: false,\n isConnecting: false,\n connectionError: null,\n });\n }\n\n async reconnect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void> {\n await this.disconnect();\n await this.connect(url, options);\n }\n\n getClient(): WsClient | null {\n return this.state.client;\n }\n\n isConnected(): boolean {\n return this.state.isConnected;\n }\n\n isConnecting(): boolean {\n return this.state.isConnecting;\n }\n\n getConnectionError(): string | null {\n return this.state.connectionError;\n }\n\n getState(): Omit<ConnectionState, 'listeners'> {\n const {listeners, ...state} = this.state;\n return state;\n }\n\n // Subscribe to state changes\n subscribe(listener: (state: ConnectionState) => void): () => void {\n this.state.listeners.add(listener);\n // Return unsubscribe function\n return () => {\n this.state.listeners.delete(listener);\n };\n }\n\n private updateState(updates: Partial<ConnectionState>): void {\n this.state = {\n ...this.state,\n ...updates,\n };\n\n // Notify all listeners\n this.state.listeners.forEach(listener => {\n listener(this.state);\n });\n }\n}\n\n","import { Connection, ConnectionConfig, DEFAULT_CONFIG } from './connection';\n\n/**\n * Connection cache that stores connections by their configuration.\n * This ensures that connections with the same configuration share the same instance.\n */\nconst connectionCache = new Map<string, Connection>();\n\n/**\n * Get or create a connection for the given configuration.\n * If a connection with the same config already exists, it will be reused.\n * @param config - Optional connection configuration\n * @returns Connection instance for the given configuration\n */\nexport function getConnection(config?: ConnectionConfig): Connection {\n const effectiveConfig = config ? { ...DEFAULT_CONFIG, ...config } : DEFAULT_CONFIG;\n const key = JSON.stringify(effectiveConfig);\n \n if (!connectionCache.has(key)) {\n connectionCache.set(key, new Connection(effectiveConfig));\n }\n \n return connectionCache.get(key)!;\n}\n\n/**\n * Clear a specific connection from the cache\n * @param config - Configuration of the connection to clear\n */\nexport async function clearConnection(config?: ConnectionConfig): Promise<void> {\n const effectiveConfig = config ? { ...DEFAULT_CONFIG, ...config } : DEFAULT_CONFIG;\n const key = JSON.stringify(effectiveConfig);\n \n const connection = connectionCache.get(key);\n if (connection) {\n await connection.disconnect();\n connectionCache.delete(key);\n }\n}\n\n/**\n * Clear all cached connections\n */\nexport async function clearAllConnections(): Promise<void> {\n const disconnectPromises = [];\n for (const connection of connectionCache.values()) {\n disconnectPromises.push(connection.disconnect());\n }\n await Promise.all(disconnectPromises);\n connectionCache.clear();\n}","import React, { createContext, useEffect, useMemo, ReactNode } from 'react';\nimport { Connection, ConnectionConfig } from './connection';\nimport { getConnection } from './connection-pool';\n\nexport const ConnectionContext = createContext<Connection | null>(null);\n\nexport interface ConnectionProviderProps {\n config?: ConnectionConfig;\n children: ReactNode;\n}\n\nexport function ConnectionProvider({ config, children }: ConnectionProviderProps) {\n const connection = useMemo(() => getConnection(config), [JSON.stringify(config)]);\n \n useEffect(() => {\n // Auto-connect if not connected\n if (!connection.isConnected() && !connection.isConnecting()) {\n console.log('[ConnectionProvider] Initiating auto-connect...');\n connection.connect().catch(err => {\n console.error('[ConnectionProvider] Failed to connect:', err);\n });\n } else {\n console.log('[ConnectionProvider] Skipping auto-connect, current state:', {\n isConnected: connection.isConnected(),\n isConnecting: connection.isConnecting()\n });\n }\n }, [connection]);\n \n return (\n <ConnectionContext.Provider value={connection}>\n {children}\n </ConnectionContext.Provider>\n );\n}","import {useContext, useEffect, useState} from 'react';\nimport {ConnectionConfig} from '../connection/connection';\nimport {getConnection} from '../connection/connection-pool';\nimport {ConnectionContext} from '../connection/connection-context';\nimport {WsClient} from '@reifydb/client';\n\ninterface ConnectionState {\n client: WsClient | null;\n isConnected: boolean;\n isConnecting: boolean;\n connectionError: string | null;\n}\n\nexport function useConnection(overrideConfig?: ConnectionConfig) {\n const contextConnection = useContext(ConnectionContext);\n\n // Use override config if provided, otherwise use context, otherwise get default\n const [connection] = useState(() => {\n if (overrideConfig) {\n return getConnection(overrideConfig);\n }\n return contextConnection || getConnection();\n });\n\n const [state, setState] = useState<ConnectionState>(() => connection.getState());\n\n useEffect(() => {\n // Get initial state immediately\n const currentState = connection.getState();\n setState(currentState);\n \n // Subscribe to connection state changes\n const unsubscribe = connection.subscribe((newState) => {\n console.log('[useConnection] State update:', {\n isConnected: newState.isConnected,\n isConnecting: newState.isConnecting,\n connectionError: newState.connectionError,\n });\n setState({\n client: newState.client,\n isConnected: newState.isConnected,\n isConnecting: newState.isConnecting,\n connectionError: newState.connectionError,\n });\n });\n\n // Auto-connect if not connected (only for override configs, context handles its own)\n if (overrideConfig && !connection.isConnected() && !connection.isConnecting()) {\n console.log('[useConnection] Initiating auto-connect for override config...');\n connection.connect().catch(err => {\n console.error('[useConnection] Failed to connect:', err);\n });\n } else if (!contextConnection && !overrideConfig && !connection.isConnected() && !connection.isConnecting()) {\n // Auto-connect for default connection when no context provider\n console.log('[useConnection] Initiating auto-connect for default connection...');\n connection.connect().catch(err => {\n console.error('[useConnection] Failed to connect:', err);\n });\n }\n\n return unsubscribe;\n }, [connection, overrideConfig, contextConnection]);\n\n return {\n ...state,\n connect: () => connection.connect(),\n disconnect: () => connection.disconnect(),\n reconnect: () => connection.reconnect(),\n };\n}","import {useState, useCallback, useRef} from 'react';\nimport {Column, SchemaNode} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useConnection} from './use-connection';\n\nexport interface QueryResult<T = any> {\n columns: Column[];\n rows: T[];\n executionTimeMs: number;\n rowsAffected?: number;\n}\n\nexport interface QueryState<T = any> {\n isExecuting: boolean;\n results: QueryResult<T>[] | undefined;\n error: string | undefined;\n executionTime: number | undefined;\n}\n\nexport interface QueryExecutorOptions {\n connectionConfig?: ConnectionConfig;\n}\n\nexport function useQueryExecutor<T = any>(options?: QueryExecutorOptions) {\n const {client} = useConnection(options?.connectionConfig);\n\n const [state, setState] = useState<QueryState<T>>({\n isExecuting: false,\n results: undefined,\n error: undefined,\n executionTime: undefined,\n });\n\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const query = useCallback(\n (statements: string | string[], params?: any, schemas?: readonly SchemaNode[]): void => {\n console.log('[useQuery] Executing query:', statements);\n console.log('[useQuery] Client available:', !!client);\n\n // Cancel any ongoing query for THIS instance only\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n abortControllerRef.current = new AbortController();\n\n setState({\n isExecuting: true,\n results: undefined,\n error: undefined,\n executionTime: undefined,\n });\n\n const startTime = Date.now();\n\n (async () => {\n try {\n // Call client.query which returns FrameResults (array of frames)\n const frameResults = await client?.query(statements, params || null, schemas || []) || [];\n\n console.debug(\"frameResults\", frameResults);\n\n const executionTime = Date.now() - startTime;\n \n // Process each frame into a QueryResult\n const results: QueryResult<T>[] = frameResults.map((frame: any) => {\n if (Array.isArray(frame) && frame.length > 0) {\n const firstRow = frame[0];\n let columns: Column[] = [];\n \n // Check if we have Value objects or plain objects\n const hasValueObjects = firstRow && typeof firstRow === 'object' && \n Object.values(firstRow).some(v => v && typeof v === 'object' && 'type' in v);\n \n if (hasValueObjects) {\n // We have Value objects - extract type info\n columns = Object.keys(firstRow).map((key) => {\n const value = firstRow[key];\n const dataType = value?.type || 'Utf8';\n return {\n name: key,\n type: dataType,\n data: [],\n };\n });\n } else {\n // Plain objects from schema conversion\n columns = Object.keys(firstRow).map((key) => ({\n name: key,\n type: 'Utf8', // Default type for plain objects\n data: [],\n }));\n }\n \n return {\n columns,\n rows: frame as T[],\n executionTimeMs: executionTime,\n };\n } else {\n // Empty result\n return {\n columns: [],\n rows: [],\n executionTimeMs: executionTime,\n };\n }\n });\n\n setState({\n isExecuting: false,\n results,\n error: undefined,\n executionTime,\n });\n } catch (err) {\n const executionTime = Date.now() - startTime;\n let errorMessage = 'Query execution failed';\n\n if (err instanceof Error) {\n errorMessage = err.message;\n } else if (typeof err === 'string') {\n errorMessage = err;\n } else if (err && typeof err === 'object' && 'message' in err) {\n errorMessage = (err as { message: string }).message;\n }\n\n setState({\n isExecuting: false,\n results: undefined,\n error: errorMessage,\n executionTime,\n });\n } finally {\n abortControllerRef.current = null;\n }\n })();\n },\n [client]\n );\n\n const cancelQuery = useCallback(() => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n setState((prev) => ({\n ...prev,\n isExecuting: false,\n error: 'Query cancelled',\n }));\n }\n }, []);\n\n return {\n // State\n isExecuting: state.isExecuting,\n results: state.results,\n error: state.error,\n executionTime: state.executionTime,\n\n // Actions\n query,\n cancelQuery,\n };\n}","import {useEffect, useMemo} from 'react';\nimport {SchemaNode, InferSchema} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useQueryExecutor, type QueryResult, type QueryExecutorOptions} from './use-query-executor';\n\nexport interface QueryOptions extends QueryExecutorOptions {\n connectionConfig?: ConnectionConfig;\n}\n\n// Single query hook - returns a single result\nexport function useQueryOne<S extends SchemaNode = any>(\n rql: string,\n params?: any,\n schema?: S,\n options?: QueryOptions\n): {\n isExecuting: boolean;\n result: QueryResult<S extends SchemaNode ? InferSchema<S> : any> | undefined;\n error: string | undefined;\n} {\n const {\n isExecuting,\n results,\n error,\n query\n } = useQueryExecutor<S extends SchemaNode ? InferSchema<S> : any>(options);\n\n useEffect(() => {\n // Pass schema as array for the executor\n const schemas = schema ? [schema] : undefined;\n query(rql, params, schemas);\n }, [rql, params, query]);\n\n // Extract first result for single query convenience\n const result = useMemo(() => {\n return results && results.length > 0 ? results[0] : undefined;\n }, [results]);\n\n return {isExecuting, result, error};\n}\n\n// Multiple query hook - returns multiple results\nexport function useQueryMany<S extends readonly SchemaNode[] = readonly SchemaNode[]>(\n statements: string | string[],\n params?: any,\n schemas?: S,\n options?: QueryOptions\n): {\n isExecuting: boolean;\n results: QueryResult<S extends readonly SchemaNode[] ? InferSchema<S[number]> : any>[] | undefined;\n error: string | undefined;\n} {\n const {\n isExecuting,\n results,\n error,\n query\n } = useQueryExecutor<S extends readonly SchemaNode[] ? InferSchema<S[number]> : any>(options);\n\n useEffect(() => {\n query(statements, params, schemas);\n }, [statements, params, query]);\n\n return {isExecuting, results, error};\n}","import {useState, useCallback, useRef} from 'react';\nimport {Column, SchemaNode} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useConnection} from './use-connection';\n\nexport interface CommandResult<T = any> {\n columns: Column[];\n rows: T[];\n executionTimeMs: number;\n rowsAffected?: number;\n}\n\nexport interface CommandState<T = any> {\n isExecuting: boolean;\n results: CommandResult<T>[] | undefined;\n error: string | undefined;\n executionTime: number | undefined;\n}\n\nexport interface CommandExecutorOptions {\n connectionConfig?: ConnectionConfig;\n}\n\nexport function useCommandExecutor<T = any>(options?: CommandExecutorOptions) {\n const {client} = useConnection(options?.connectionConfig);\n\n const [state, setState] = useState<CommandState<T>>({\n isExecuting: false,\n results: undefined,\n error: undefined,\n executionTime: undefined,\n });\n\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const command = useCallback(\n (statements: string | string[], params?: any, schemas?: readonly SchemaNode[]): void => {\n console.log('[useCommand] Executing command:', statements);\n console.log('[useCommand] Client available:', !!client);\n\n // Cancel any ongoing command for THIS instance only\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n abortControllerRef.current = new AbortController();\n\n setState({\n isExecuting: true,\n results: undefined,\n error: undefined,\n executionTime: undefined,\n });\n\n const startTime = Date.now();\n\n (async () => {\n try {\n // Call client.command which returns FrameResults (array of frames)\n // Commands and queries both use the same command method\n const frameResults = await client?.command(statements, params || null, schemas || []) || [];\n\n console.debug(\"frameResults\", frameResults);\n\n const executionTime = Date.now() - startTime;\n \n // Process each frame into a CommandResult\n const results: CommandResult<T>[] = frameResults.map((frame: any) => {\n if (Array.isArray(frame) && frame.length > 0) {\n const firstRow = frame[0];\n let columns: Column[] = [];\n \n // Check if we have Value objects or plain objects\n const hasValueObjects = firstRow && typeof firstRow === 'object' && \n Object.values(firstRow).some(v => v && typeof v === 'object' && 'type' in v);\n \n if (hasValueObjects) {\n // We have Value objects - extract type info\n columns = Object.keys(firstRow).map((key) => {\n const value = firstRow[key];\n const dataType = value?.type || 'Utf8';\n return {\n name: key,\n type: dataType,\n data: [],\n };\n });\n } else {\n // Plain objects from schema conversion\n columns = Object.keys(firstRow).map((key) => ({\n name: key,\n type: 'Utf8', // Default type for plain objects\n data: [],\n }));\n }\n \n return {\n columns,\n rows: frame as T[],\n executionTimeMs: executionTime,\n };\n } else {\n // Empty result or rows affected\n return {\n columns: [],\n rows: [],\n executionTimeMs: executionTime,\n rowsAffected: typeof frame === 'number' ? frame : undefined,\n };\n }\n });\n\n setState({\n isExecuting: false,\n results,\n error: undefined,\n executionTime,\n });\n } catch (err) {\n const executionTime = Date.now() - startTime;\n let errorMessage = 'Command execution failed';\n\n if (err instanceof Error) {\n errorMessage = err.message;\n } else if (typeof err === 'string') {\n errorMessage = err;\n } else if (err && typeof err === 'object' && 'message' in err) {\n errorMessage = (err as { message: string }).message;\n }\n\n setState({\n isExecuting: false,\n results: undefined,\n error: errorMessage,\n executionTime,\n });\n } finally {\n abortControllerRef.current = null;\n }\n })();\n },\n [client]\n );\n\n const cancelCommand = useCallback(() => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n setState((prev) => ({\n ...prev,\n isExecuting: false,\n error: 'Command cancelled',\n }));\n }\n }, []);\n\n return {\n // State\n isExecuting: state.isExecuting,\n results: state.results,\n error: state.error,\n executionTime: state.executionTime,\n\n // Actions\n command,\n cancelCommand,\n };\n}","import {useEffect, useMemo} from 'react';\nimport {SchemaNode, InferSchema} from '@reifydb/core';\nimport {ConnectionConfig} from '../connection/connection';\nimport {useCommandExecutor, type CommandResult, type CommandExecutorOptions} from './use-command-executor';\n\nexport interface CommandOptions extends CommandExecutorOptions {\n connectionConfig?: ConnectionConfig;\n}\n\n// Single command hook - returns a single result\nexport function useCommandOne<S extends SchemaNode = any>(\n statement: string,\n params?: any,\n schema?: S,\n options?: CommandOptions\n): {\n isExecuting: boolean;\n result: CommandResult<S extends SchemaNode ? InferSchema<S> : any> | undefined;\n error: string | undefined;\n} {\n const {\n isExecuting,\n results,\n error,\n command\n } = useCommandExecutor<S extends SchemaNode ? InferSchema<S> : any>(options);\n\n useEffect(() => {\n // Pass schema as array for the executor\n const schemas = schema ? [schema] : undefined;\n command(statement, params, schemas);\n }, [statement, params, command]);\n\n // Extract first result for single command convenience\n const result = useMemo(() => {\n return results && results.length > 0 ? results[0] : undefined;\n }, [results]);\n\n return {isExecuting, result, error};\n}\n\n// Multiple command hook - returns multiple results\nexport function useCommandMany<S extends readonly SchemaNode[] = readonly SchemaNode[]>(\n statements: string | string[],\n params?: any,\n schemas?: S,\n options?: CommandOptions\n): {\n isExecuting: boolean;\n results: CommandResult<S extends readonly SchemaNode[] ? InferSchema<S[number]> : any>[] | undefined;\n error: string | undefined;\n} {\n const {\n isExecuting,\n results,\n error,\n command\n } = useCommandExecutor<S extends readonly SchemaNode[] ? InferSchema<S[number]> : any>(options);\n\n useEffect(() => {\n command(statements, params, schemas);\n }, [statements, params, command]);\n\n return {isExecuting, results, error};\n}"],"mappings":";AAAA,cAAc;AACd,cAAc;;;ACDd,SAAQ,cAA6C;AAe9C,IAAM,iBAAmC;AAAA,EAC5C,KAAK;AAAA,EACL,SAAS;AAAA,IACL,WAAW;AAAA,EACf;AACJ;AAEO,IAAM,aAAN,MAAiB;AAAA,EAUpB,YAAY,QAA2B;AATvC,SAAQ,QAAyB;AAAA,MAC7B,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,cAAc;AAAA,MACd,iBAAiB;AAAA,MACjB,WAAW,oBAAI,IAAI;AAAA,IACvB;AAII,SAAK,SAAS,EAAE,GAAG,gBAAgB,GAAG,OAAO;AAAA,EACjD;AAAA,EAEA,UAAU,QAAgC;AACtC,SAAK,SAAS,EAAC,GAAG,gBAAgB,GAAG,OAAM;AAAA,EAC/C;AAAA,EAEA,YAA8B;AAC1B,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,MAAM,QAAQ,KAAc,SAAuD;AAE/E,QAAI,KAAK,MAAM,eAAe,KAAK,MAAM,cAAc;AACnD,cAAQ,MAAM,6EAA6E;AAC3F;AAAA,IACJ;AAEA,UAAM,aAAa,OAAO,KAAK,OAAO,OAAO,eAAe;AAC5D,UAAM,iBAAiB,EAAC,GAAG,KAAK,OAAO,SAAS,GAAG,QAAO;AAE1D,YAAQ,MAAM,0CAA0C,UAAU;AAClE,SAAK,YAAY;AAAA,MACb,cAAc;AAAA,MACd,iBAAiB;AAAA,IACrB,CAAC;AAED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F;AACE,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,IAAI,mBAAmF,OAAO;AAE9F,EAAAD,WAAU,MAAM;AACZ,YAAQ,YAAY,QAAQ,OAAO;AAAA,EACvC,GAAG,CAAC,YAAY,QAAQ,OAAO,CAAC;AAEhC,SAAO,EAAC,aAAa,SAAS,MAAK;AACvC;","names":["useEffect","useEffect","useState","useState","useEffect","useMemo","useEffect","useMemo","useState","useCallback","useRef","useState","useRef","useCallback","useEffect","useMemo","useEffect","useMemo"]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reifydb/react",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@reifydb/
|
|
9
|
-
"@reifydb/
|
|
8
|
+
"@reifydb/core": "0.0.1-alpha.8",
|
|
9
|
+
"@reifydb/client": "0.0.1-alpha.8"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
12
12
|
"react": ">=16.8.0"
|
package/dist/index.d.mts
DELETED
package/dist/index.mjs
DELETED
|
File without changes
|