@reifydb/react 0.0.1-alpha.6
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.mts +2 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +318 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +0 -0
- package/license.md +21 -0
- package/package.json +51 -0
- package/readme.md +1 -0
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Column, SchemaNode, InferSchema } from '@reifydb/core';
|
|
2
|
+
export * from '@reifydb/core';
|
|
3
|
+
import { WsClientOptions, WsClient } from '@reifydb/client';
|
|
4
|
+
export * from '@reifydb/client';
|
|
5
|
+
|
|
6
|
+
interface ConnectionState {
|
|
7
|
+
client: WsClient | null;
|
|
8
|
+
isConnected: boolean;
|
|
9
|
+
isConnecting: boolean;
|
|
10
|
+
connectionError: string | null;
|
|
11
|
+
listeners: Set<(state: ConnectionState) => void>;
|
|
12
|
+
}
|
|
13
|
+
interface ConnectionConfig {
|
|
14
|
+
url?: string;
|
|
15
|
+
options?: Omit<WsClientOptions, 'url'>;
|
|
16
|
+
}
|
|
17
|
+
declare class Connection {
|
|
18
|
+
private static instance;
|
|
19
|
+
private state;
|
|
20
|
+
private config;
|
|
21
|
+
private constructor();
|
|
22
|
+
static getInstance(): Connection;
|
|
23
|
+
setConfig(config: ConnectionConfig): void;
|
|
24
|
+
getConfig(): ConnectionConfig;
|
|
25
|
+
connect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void>;
|
|
26
|
+
disconnect(): void;
|
|
27
|
+
reconnect(url?: string, options?: Omit<WsClientOptions, 'url'>): Promise<void>;
|
|
28
|
+
getClient(): WsClient | null;
|
|
29
|
+
isConnected(): boolean;
|
|
30
|
+
isConnecting(): boolean;
|
|
31
|
+
getConnectionError(): string | null;
|
|
32
|
+
getState(): Omit<ConnectionState, 'listeners'>;
|
|
33
|
+
subscribe(listener: (state: ConnectionState) => void): () => void;
|
|
34
|
+
private updateState;
|
|
35
|
+
}
|
|
36
|
+
declare const connection: Connection;
|
|
37
|
+
|
|
38
|
+
declare function useConnection(): {
|
|
39
|
+
connect: () => Promise<void>;
|
|
40
|
+
disconnect: () => void;
|
|
41
|
+
reconnect: () => Promise<void>;
|
|
42
|
+
client: WsClient | null;
|
|
43
|
+
isConnected: boolean;
|
|
44
|
+
isConnecting: boolean;
|
|
45
|
+
connectionError: string | null;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
interface QueryResult<T = any> {
|
|
49
|
+
columns: Column[];
|
|
50
|
+
rows: T[];
|
|
51
|
+
executionTimeMs: number;
|
|
52
|
+
rowsAffected?: number;
|
|
53
|
+
}
|
|
54
|
+
interface QueryState<T = any> {
|
|
55
|
+
isExecuting: boolean;
|
|
56
|
+
results: QueryResult<T>[] | undefined;
|
|
57
|
+
error: string | undefined;
|
|
58
|
+
executionTime: number | undefined;
|
|
59
|
+
}
|
|
60
|
+
declare function useQueryExecutor<T = any>(): {
|
|
61
|
+
isExecuting: boolean;
|
|
62
|
+
results: QueryResult<T>[] | undefined;
|
|
63
|
+
error: string | undefined;
|
|
64
|
+
executionTime: number | undefined;
|
|
65
|
+
query: (statements: string | string[], params?: any, schemas?: readonly SchemaNode[]) => void;
|
|
66
|
+
cancelQuery: () => void;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
declare function useQueryOne<S extends SchemaNode = any>(rql: string, params?: any, schema?: S): {
|
|
70
|
+
isExecuting: boolean;
|
|
71
|
+
result: QueryResult<S extends SchemaNode ? InferSchema<S> : any> | undefined;
|
|
72
|
+
error: string | undefined;
|
|
73
|
+
};
|
|
74
|
+
declare function useQueryMany<S extends readonly SchemaNode[] = readonly SchemaNode[]>(statements: string | string[], params?: any, schemas?: S): {
|
|
75
|
+
isExecuting: boolean;
|
|
76
|
+
results: QueryResult<S extends readonly SchemaNode[] ? InferSchema<S[number]> : any>[] | undefined;
|
|
77
|
+
error: string | undefined;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export { Connection, type ConnectionConfig, type QueryResult, type QueryState, connection, useConnection, useQueryExecutor, useQueryMany, useQueryOne };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
export * from "@reifydb/core";
|
|
3
|
+
export * from "@reifydb/client";
|
|
4
|
+
|
|
5
|
+
// src/connection/connection.ts
|
|
6
|
+
import { Client } from "@reifydb/client";
|
|
7
|
+
var DEFAULT_CONFIG = {
|
|
8
|
+
url: "ws://127.0.0.1:8090",
|
|
9
|
+
options: {
|
|
10
|
+
timeoutMs: 1e3
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var Connection = class _Connection {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.state = {
|
|
16
|
+
client: null,
|
|
17
|
+
isConnected: false,
|
|
18
|
+
isConnecting: false,
|
|
19
|
+
connectionError: null,
|
|
20
|
+
listeners: /* @__PURE__ */ new Set()
|
|
21
|
+
};
|
|
22
|
+
this.config = DEFAULT_CONFIG;
|
|
23
|
+
}
|
|
24
|
+
static getInstance() {
|
|
25
|
+
if (!_Connection.instance) {
|
|
26
|
+
_Connection.instance = new _Connection();
|
|
27
|
+
}
|
|
28
|
+
return _Connection.instance;
|
|
29
|
+
}
|
|
30
|
+
setConfig(config) {
|
|
31
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
32
|
+
}
|
|
33
|
+
getConfig() {
|
|
34
|
+
return this.config;
|
|
35
|
+
}
|
|
36
|
+
async connect(url, options) {
|
|
37
|
+
if (this.state.isConnected || this.state.isConnecting) {
|
|
38
|
+
console.debug("[Connection] Already connected or connecting, skipping wsConnection attempt");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const connectUrl = url || this.config.url || DEFAULT_CONFIG.url;
|
|
42
|
+
const connectOptions = { ...this.config.options, ...options };
|
|
43
|
+
console.debug("[Connection] Attempting to connect to:", connectUrl);
|
|
44
|
+
this.updateState({
|
|
45
|
+
isConnecting: true,
|
|
46
|
+
connectionError: null
|
|
47
|
+
});
|
|
48
|
+
try {
|
|
49
|
+
const client = await Client.connect_ws(connectUrl, connectOptions);
|
|
50
|
+
console.debug("[Connection] Successfully connected to WebSocket");
|
|
51
|
+
this.updateState({
|
|
52
|
+
client,
|
|
53
|
+
isConnected: true,
|
|
54
|
+
isConnecting: false,
|
|
55
|
+
connectionError: null
|
|
56
|
+
});
|
|
57
|
+
} catch (err) {
|
|
58
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to connect to ReifyDB";
|
|
59
|
+
console.error("[Connection] Connection failed:", errorMessage, err);
|
|
60
|
+
this.updateState({
|
|
61
|
+
client: null,
|
|
62
|
+
isConnected: false,
|
|
63
|
+
isConnecting: false,
|
|
64
|
+
connectionError: errorMessage
|
|
65
|
+
});
|
|
66
|
+
throw err;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
disconnect() {
|
|
70
|
+
if (this.state.client) {
|
|
71
|
+
try {
|
|
72
|
+
this.state.client.disconnect();
|
|
73
|
+
} catch (err) {
|
|
74
|
+
console.error("Error disconnecting:", err);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
this.updateState({
|
|
78
|
+
client: null,
|
|
79
|
+
isConnected: false,
|
|
80
|
+
isConnecting: false,
|
|
81
|
+
connectionError: null
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async reconnect(url, options) {
|
|
85
|
+
this.disconnect();
|
|
86
|
+
await this.connect(url, options);
|
|
87
|
+
}
|
|
88
|
+
getClient() {
|
|
89
|
+
return this.state.client;
|
|
90
|
+
}
|
|
91
|
+
isConnected() {
|
|
92
|
+
return this.state.isConnected;
|
|
93
|
+
}
|
|
94
|
+
isConnecting() {
|
|
95
|
+
return this.state.isConnecting;
|
|
96
|
+
}
|
|
97
|
+
getConnectionError() {
|
|
98
|
+
return this.state.connectionError;
|
|
99
|
+
}
|
|
100
|
+
getState() {
|
|
101
|
+
const { listeners, ...state } = this.state;
|
|
102
|
+
return state;
|
|
103
|
+
}
|
|
104
|
+
// Subscribe to state changes
|
|
105
|
+
subscribe(listener) {
|
|
106
|
+
this.state.listeners.add(listener);
|
|
107
|
+
return () => {
|
|
108
|
+
this.state.listeners.delete(listener);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
updateState(updates) {
|
|
112
|
+
this.state = {
|
|
113
|
+
...this.state,
|
|
114
|
+
...updates
|
|
115
|
+
};
|
|
116
|
+
this.state.listeners.forEach((listener) => {
|
|
117
|
+
listener(this.state);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var connection = Connection.getInstance();
|
|
122
|
+
|
|
123
|
+
// src/hooks/use-connection.ts
|
|
124
|
+
import { useEffect, useState } from "react";
|
|
125
|
+
function useConnection() {
|
|
126
|
+
const [state, setState] = useState(() => connection.getState());
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
const unsubscribe = connection.subscribe((newState) => {
|
|
129
|
+
console.log("[useConnection] State update:", {
|
|
130
|
+
isConnected: newState.isConnected,
|
|
131
|
+
isConnecting: newState.isConnecting,
|
|
132
|
+
connectionError: newState.connectionError
|
|
133
|
+
});
|
|
134
|
+
setState({
|
|
135
|
+
client: newState.client,
|
|
136
|
+
isConnected: newState.isConnected,
|
|
137
|
+
isConnecting: newState.isConnecting,
|
|
138
|
+
connectionError: newState.connectionError
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
if (!connection.isConnected() && !connection.isConnecting()) {
|
|
142
|
+
console.log("[useConnection] Initiating auto-connect...");
|
|
143
|
+
connection.connect().catch((err) => {
|
|
144
|
+
console.error("[useConnection] Failed to connect:", err);
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
console.log("[useConnection] Skipping auto-connect, current state:", {
|
|
148
|
+
isConnected: connection.isConnected(),
|
|
149
|
+
isConnecting: connection.isConnecting()
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return unsubscribe;
|
|
153
|
+
}, []);
|
|
154
|
+
return {
|
|
155
|
+
...state,
|
|
156
|
+
connect: () => connection.connect(),
|
|
157
|
+
disconnect: () => connection.disconnect(),
|
|
158
|
+
reconnect: () => connection.reconnect()
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/hooks/use-query-executor.ts
|
|
163
|
+
import { useState as useState2, useCallback, useRef } from "react";
|
|
164
|
+
function useQueryExecutor() {
|
|
165
|
+
const { client } = useConnection();
|
|
166
|
+
const [state, setState] = useState2({
|
|
167
|
+
isExecuting: false,
|
|
168
|
+
results: void 0,
|
|
169
|
+
error: void 0,
|
|
170
|
+
executionTime: void 0
|
|
171
|
+
});
|
|
172
|
+
const abortControllerRef = useRef(null);
|
|
173
|
+
const query = useCallback(
|
|
174
|
+
(statements, params, schemas) => {
|
|
175
|
+
console.log("[useQuery] Executing query:", statements);
|
|
176
|
+
console.log("[useQuery] Client available:", !!client);
|
|
177
|
+
if (abortControllerRef.current) {
|
|
178
|
+
abortControllerRef.current.abort();
|
|
179
|
+
}
|
|
180
|
+
abortControllerRef.current = new AbortController();
|
|
181
|
+
setState({
|
|
182
|
+
isExecuting: true,
|
|
183
|
+
results: void 0,
|
|
184
|
+
error: void 0,
|
|
185
|
+
executionTime: void 0
|
|
186
|
+
});
|
|
187
|
+
const startTime = Date.now();
|
|
188
|
+
(async () => {
|
|
189
|
+
try {
|
|
190
|
+
const frameResults = await client?.query(statements, params || null, schemas || []) || [];
|
|
191
|
+
console.debug("frameResults", frameResults);
|
|
192
|
+
const executionTime = Date.now() - startTime;
|
|
193
|
+
const results = frameResults.map((frame) => {
|
|
194
|
+
if (Array.isArray(frame) && frame.length > 0) {
|
|
195
|
+
const firstRow = frame[0];
|
|
196
|
+
let columns = [];
|
|
197
|
+
const hasValueObjects = firstRow && typeof firstRow === "object" && Object.values(firstRow).some((v) => v && typeof v === "object" && "type" in v);
|
|
198
|
+
if (hasValueObjects) {
|
|
199
|
+
columns = Object.keys(firstRow).map((key) => {
|
|
200
|
+
const value = firstRow[key];
|
|
201
|
+
const dataType = value?.type || "Utf8";
|
|
202
|
+
return {
|
|
203
|
+
name: key,
|
|
204
|
+
type: dataType,
|
|
205
|
+
data: []
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
} else {
|
|
209
|
+
columns = Object.keys(firstRow).map((key) => ({
|
|
210
|
+
name: key,
|
|
211
|
+
type: "Utf8",
|
|
212
|
+
// Default type for plain objects
|
|
213
|
+
data: []
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
columns,
|
|
218
|
+
rows: frame,
|
|
219
|
+
executionTimeMs: executionTime
|
|
220
|
+
};
|
|
221
|
+
} else {
|
|
222
|
+
return {
|
|
223
|
+
columns: [],
|
|
224
|
+
rows: [],
|
|
225
|
+
executionTimeMs: executionTime
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
setState({
|
|
230
|
+
isExecuting: false,
|
|
231
|
+
results,
|
|
232
|
+
error: void 0,
|
|
233
|
+
executionTime
|
|
234
|
+
});
|
|
235
|
+
} catch (err) {
|
|
236
|
+
const executionTime = Date.now() - startTime;
|
|
237
|
+
let errorMessage = "Query execution failed";
|
|
238
|
+
if (err instanceof Error) {
|
|
239
|
+
errorMessage = err.message;
|
|
240
|
+
} else if (typeof err === "string") {
|
|
241
|
+
errorMessage = err;
|
|
242
|
+
} else if (err && typeof err === "object" && "message" in err) {
|
|
243
|
+
errorMessage = err.message;
|
|
244
|
+
}
|
|
245
|
+
setState({
|
|
246
|
+
isExecuting: false,
|
|
247
|
+
results: void 0,
|
|
248
|
+
error: errorMessage,
|
|
249
|
+
executionTime
|
|
250
|
+
});
|
|
251
|
+
} finally {
|
|
252
|
+
abortControllerRef.current = null;
|
|
253
|
+
}
|
|
254
|
+
})();
|
|
255
|
+
},
|
|
256
|
+
[client]
|
|
257
|
+
);
|
|
258
|
+
const cancelQuery = useCallback(() => {
|
|
259
|
+
if (abortControllerRef.current) {
|
|
260
|
+
abortControllerRef.current.abort();
|
|
261
|
+
setState((prev) => ({
|
|
262
|
+
...prev,
|
|
263
|
+
isExecuting: false,
|
|
264
|
+
error: "Query cancelled"
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
}, []);
|
|
268
|
+
return {
|
|
269
|
+
// State
|
|
270
|
+
isExecuting: state.isExecuting,
|
|
271
|
+
results: state.results,
|
|
272
|
+
error: state.error,
|
|
273
|
+
executionTime: state.executionTime,
|
|
274
|
+
// Actions
|
|
275
|
+
query,
|
|
276
|
+
cancelQuery
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// src/hooks/use-query.ts
|
|
281
|
+
import { useEffect as useEffect2, useMemo } from "react";
|
|
282
|
+
function useQueryOne(rql, params, schema) {
|
|
283
|
+
const {
|
|
284
|
+
isExecuting,
|
|
285
|
+
results,
|
|
286
|
+
error,
|
|
287
|
+
query
|
|
288
|
+
} = useQueryExecutor();
|
|
289
|
+
useEffect2(() => {
|
|
290
|
+
const schemas = schema ? [schema] : void 0;
|
|
291
|
+
query(rql, params, schemas);
|
|
292
|
+
}, [rql, params, query]);
|
|
293
|
+
const result = useMemo(() => {
|
|
294
|
+
return results && results.length > 0 ? results[0] : void 0;
|
|
295
|
+
}, [results]);
|
|
296
|
+
return { isExecuting, result, error };
|
|
297
|
+
}
|
|
298
|
+
function useQueryMany(statements, params, schemas) {
|
|
299
|
+
const {
|
|
300
|
+
isExecuting,
|
|
301
|
+
results,
|
|
302
|
+
error,
|
|
303
|
+
query
|
|
304
|
+
} = useQueryExecutor();
|
|
305
|
+
useEffect2(() => {
|
|
306
|
+
query(statements, params, schemas);
|
|
307
|
+
}, [statements, params, query]);
|
|
308
|
+
return { isExecuting, results, error };
|
|
309
|
+
}
|
|
310
|
+
export {
|
|
311
|
+
Connection,
|
|
312
|
+
connection,
|
|
313
|
+
useConnection,
|
|
314
|
+
useQueryExecutor,
|
|
315
|
+
useQueryMany,
|
|
316
|
+
useQueryOne
|
|
317
|
+
};
|
|
318
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,WAAW,oBAAI,IAAI;AAAA,IACvB;AACA,SAAQ,SAA2B;AAAA,EAGnC;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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"]}
|
package/dist/index.mjs
ADDED
|
File without changes
|
package/license.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 The ReifyDB Developers <license@reifydb.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reifydb/react",
|
|
3
|
+
"version": "0.0.1-alpha.6",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@reifydb/client": "0.0.1-alpha.6",
|
|
9
|
+
"@reifydb/core": "0.0.1-alpha.6"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"react": ">=16.8.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@testing-library/react": "^16.3.0",
|
|
16
|
+
"@types/react": "^19.1.12",
|
|
17
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
18
|
+
"happy-dom": "^18.0.1",
|
|
19
|
+
"react": "^19.1.1",
|
|
20
|
+
"tsup": "^8.5.0",
|
|
21
|
+
"typescript": "^5.9.2",
|
|
22
|
+
"vitest": "^3.2.4"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=16.0.0"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"reifydb"
|
|
29
|
+
],
|
|
30
|
+
"files": [
|
|
31
|
+
"dist/",
|
|
32
|
+
"package.json",
|
|
33
|
+
"readme.md",
|
|
34
|
+
"license.md"
|
|
35
|
+
],
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup src/index.ts --dts --format esm --sourcemap",
|
|
42
|
+
"dev": "tsc --watch",
|
|
43
|
+
"test": "pnpm test:integration",
|
|
44
|
+
"test:integration": "vitest run --config vitest.config.ts",
|
|
45
|
+
"test:integration:watch": "vitest --config vitest.config.ts",
|
|
46
|
+
"test:integration:coverage": "vitest run --coverage --config vitest.config.ts",
|
|
47
|
+
"test:coverage": "pnpm test:integration:coverage",
|
|
48
|
+
"pretest:integration": "pnpm build",
|
|
49
|
+
"publish:npm": "pnpm publish --access public"
|
|
50
|
+
}
|
|
51
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# ReifyDB React
|