@elqnt/kg 2.1.1 → 3.0.0
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/README.md +357 -39
- package/dist/api/index.d.mts +250 -3
- package/dist/api/index.d.ts +250 -3
- package/dist/api/index.js +2 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/api/server.d.mts +219 -0
- package/dist/api/server.d.ts +219 -0
- package/dist/api/server.js +442 -0
- package/dist/api/server.js.map +1 -0
- package/dist/api/server.mjs +442 -0
- package/dist/api/server.mjs.map +1 -0
- package/dist/{chunk-4XIW5GLO.js → chunk-2TJCYLTP.js} +63 -68
- package/dist/chunk-2TJCYLTP.js.map +1 -0
- package/dist/chunk-67SUELDR.js.map +1 -1
- package/dist/chunk-7RW5MHP5.js +497 -0
- package/dist/chunk-7RW5MHP5.js.map +1 -0
- package/dist/chunk-ADIKUMMI.js +238 -0
- package/dist/chunk-ADIKUMMI.js.map +1 -0
- package/dist/chunk-CAXPQTKI.mjs +238 -0
- package/dist/chunk-CAXPQTKI.mjs.map +1 -0
- package/dist/{chunk-3AS6C7FW.mjs → chunk-HCDFJCQL.mjs} +62 -67
- package/dist/chunk-HCDFJCQL.mjs.map +1 -0
- package/dist/chunk-JZ7UXVRW.mjs +497 -0
- package/dist/chunk-JZ7UXVRW.mjs.map +1 -0
- package/dist/chunk-UCKE66GB.js.map +1 -1
- package/dist/chunk-W4XVBGE7.js.map +1 -1
- package/dist/hooks/index.d.mts +109 -4
- package/dist/hooks/index.d.ts +109 -4
- package/dist/hooks/index.js +9 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +10 -4
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -4
- package/dist/index.mjs.map +1 -1
- package/dist/models/index.js.map +1 -1
- package/dist/models/kg-designer.js.map +1 -1
- package/dist/models/kg.js.map +1 -1
- package/dist/utils/index.d.mts +277 -0
- package/dist/utils/index.d.ts +277 -0
- package/dist/utils/index.js +44 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +44 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +24 -16
- package/dist/chunk-3AS6C7FW.mjs.map +0 -1
- package/dist/chunk-4XIW5GLO.js.map +0 -1
- package/dist/chunk-7HNJUCVW.js +0 -577
- package/dist/chunk-7HNJUCVW.js.map +0 -1
- package/dist/chunk-EW3NQGUZ.mjs +0 -577
- package/dist/chunk-EW3NQGUZ.mjs.map +0 -1
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cancelCrawlJobApi,
|
|
4
|
+
createDesignerEdgeApi,
|
|
5
|
+
createDesignerNodeApi,
|
|
6
|
+
createGraphApi,
|
|
7
|
+
deleteDesignerEdgeApi,
|
|
8
|
+
deleteDesignerNodeApi,
|
|
9
|
+
deleteGraphApi,
|
|
10
|
+
getCrawlJobStatusApi,
|
|
11
|
+
getCrawledPagesApi,
|
|
12
|
+
getDesignerNodeApi,
|
|
13
|
+
getGraphApi,
|
|
14
|
+
getGraphLabelsApi,
|
|
15
|
+
getKGNodeApi,
|
|
16
|
+
ingestKGNodeApi,
|
|
17
|
+
listCrawlJobsApi,
|
|
18
|
+
listDesignerEdgesApi,
|
|
19
|
+
listDesignerNodesApi,
|
|
20
|
+
listGraphsApi,
|
|
21
|
+
queryGraphApi,
|
|
22
|
+
startCrawlJobApi,
|
|
23
|
+
updateDesignerEdgeApi,
|
|
24
|
+
updateDesignerNodeApi,
|
|
25
|
+
updateGraphApi,
|
|
26
|
+
updateKGNodeApi
|
|
27
|
+
} from "./chunk-HCDFJCQL.mjs";
|
|
28
|
+
|
|
29
|
+
// hooks/index.ts
|
|
30
|
+
import { useCallback as useCallback2, useMemo } from "react";
|
|
31
|
+
|
|
32
|
+
// hooks/use-async.ts
|
|
33
|
+
import { useState, useCallback, useRef } from "react";
|
|
34
|
+
function extractFromResponse(response, extractor, defaultValue) {
|
|
35
|
+
if (response.error) {
|
|
36
|
+
return [defaultValue, response.error];
|
|
37
|
+
}
|
|
38
|
+
if (!response.data) {
|
|
39
|
+
return [defaultValue, null];
|
|
40
|
+
}
|
|
41
|
+
return [extractor(response.data), null];
|
|
42
|
+
}
|
|
43
|
+
function useAsync(asyncFn, options) {
|
|
44
|
+
const [loading, setLoading] = useState(false);
|
|
45
|
+
const [error, setError] = useState(null);
|
|
46
|
+
const requestCount = useRef(0);
|
|
47
|
+
const execute = useCallback(
|
|
48
|
+
async (...args) => {
|
|
49
|
+
requestCount.current += 1;
|
|
50
|
+
setLoading(true);
|
|
51
|
+
setError(null);
|
|
52
|
+
try {
|
|
53
|
+
const result = await asyncFn(...args);
|
|
54
|
+
return result;
|
|
55
|
+
} catch (err) {
|
|
56
|
+
const message = err instanceof Error ? err.message : "An error occurred";
|
|
57
|
+
setError(message);
|
|
58
|
+
options?.onError?.(message);
|
|
59
|
+
throw err;
|
|
60
|
+
} finally {
|
|
61
|
+
requestCount.current -= 1;
|
|
62
|
+
if (requestCount.current === 0) {
|
|
63
|
+
setLoading(false);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
[asyncFn, options]
|
|
68
|
+
);
|
|
69
|
+
const clearError = useCallback(() => {
|
|
70
|
+
setError(null);
|
|
71
|
+
}, []);
|
|
72
|
+
return { execute, loading, error, clearError };
|
|
73
|
+
}
|
|
74
|
+
function useApiAsync(asyncFn, extractor, defaultValue, options) {
|
|
75
|
+
const [loading, setLoading] = useState(false);
|
|
76
|
+
const [error, setError] = useState(null);
|
|
77
|
+
const requestCount = useRef(0);
|
|
78
|
+
const execute = useCallback(
|
|
79
|
+
async (...args) => {
|
|
80
|
+
requestCount.current += 1;
|
|
81
|
+
setLoading(true);
|
|
82
|
+
setError(null);
|
|
83
|
+
try {
|
|
84
|
+
const response = await asyncFn(...args);
|
|
85
|
+
const [result, errorMessage] = extractFromResponse(response, extractor, defaultValue);
|
|
86
|
+
if (errorMessage) {
|
|
87
|
+
setError(errorMessage);
|
|
88
|
+
options?.onError?.(errorMessage);
|
|
89
|
+
return defaultValue;
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
} catch (err) {
|
|
93
|
+
const message = err instanceof Error ? err.message : "An error occurred";
|
|
94
|
+
setError(message);
|
|
95
|
+
options?.onError?.(message);
|
|
96
|
+
return defaultValue;
|
|
97
|
+
} finally {
|
|
98
|
+
requestCount.current -= 1;
|
|
99
|
+
if (requestCount.current === 0) {
|
|
100
|
+
setLoading(false);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
[asyncFn, extractor, defaultValue, options]
|
|
105
|
+
);
|
|
106
|
+
const clearError = useCallback(() => {
|
|
107
|
+
setError(null);
|
|
108
|
+
}, []);
|
|
109
|
+
return { execute, loading, error, clearError };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// hooks/use-options-ref.ts
|
|
113
|
+
import { useRef as useRef2, useEffect } from "react";
|
|
114
|
+
function useOptionsRef(options) {
|
|
115
|
+
const ref = useRef2(options);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
ref.current = options;
|
|
118
|
+
}, [options]);
|
|
119
|
+
return ref;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// hooks/index.ts
|
|
123
|
+
function useGraphs(options) {
|
|
124
|
+
const optionsRef = useOptionsRef(options);
|
|
125
|
+
const {
|
|
126
|
+
execute: listGraphs,
|
|
127
|
+
loading: listLoading,
|
|
128
|
+
error: listError
|
|
129
|
+
} = useApiAsync(
|
|
130
|
+
() => listGraphsApi(optionsRef.current),
|
|
131
|
+
(data) => data.graphs || [],
|
|
132
|
+
[]
|
|
133
|
+
);
|
|
134
|
+
const {
|
|
135
|
+
execute: getGraphInternal,
|
|
136
|
+
loading: getLoading,
|
|
137
|
+
error: getError
|
|
138
|
+
} = useApiAsync(
|
|
139
|
+
(graphId) => getGraphApi(graphId, optionsRef.current),
|
|
140
|
+
(data) => data.graph || null,
|
|
141
|
+
null
|
|
142
|
+
);
|
|
143
|
+
const getGraph = useCallback2((graphId) => getGraphInternal(graphId), [getGraphInternal]);
|
|
144
|
+
const {
|
|
145
|
+
execute: createGraphInternal,
|
|
146
|
+
loading: createLoading,
|
|
147
|
+
error: createError
|
|
148
|
+
} = useApiAsync(
|
|
149
|
+
(graph) => createGraphApi(graph, optionsRef.current),
|
|
150
|
+
(data) => data.graph || null,
|
|
151
|
+
null
|
|
152
|
+
);
|
|
153
|
+
const createGraph = useCallback2(
|
|
154
|
+
(graph) => createGraphInternal(graph),
|
|
155
|
+
[createGraphInternal]
|
|
156
|
+
);
|
|
157
|
+
const {
|
|
158
|
+
execute: updateGraphInternal,
|
|
159
|
+
loading: updateLoading,
|
|
160
|
+
error: updateError
|
|
161
|
+
} = useApiAsync(
|
|
162
|
+
(graphId, updates) => updateGraphApi(graphId, updates, optionsRef.current),
|
|
163
|
+
(data) => data.graph || null,
|
|
164
|
+
null
|
|
165
|
+
);
|
|
166
|
+
const updateGraph = useCallback2(
|
|
167
|
+
(graphId, updates) => updateGraphInternal(graphId, updates),
|
|
168
|
+
[updateGraphInternal]
|
|
169
|
+
);
|
|
170
|
+
const {
|
|
171
|
+
execute: deleteGraphInternal,
|
|
172
|
+
loading: deleteLoading,
|
|
173
|
+
error: deleteError
|
|
174
|
+
} = useApiAsync(
|
|
175
|
+
(graphId) => deleteGraphApi(graphId, optionsRef.current),
|
|
176
|
+
(data) => data.success ?? true,
|
|
177
|
+
false
|
|
178
|
+
);
|
|
179
|
+
const deleteGraph = useCallback2(
|
|
180
|
+
(graphId) => deleteGraphInternal(graphId),
|
|
181
|
+
[deleteGraphInternal]
|
|
182
|
+
);
|
|
183
|
+
const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading;
|
|
184
|
+
const error = listError || getError || createError || updateError || deleteError;
|
|
185
|
+
return useMemo(
|
|
186
|
+
() => ({
|
|
187
|
+
loading,
|
|
188
|
+
error,
|
|
189
|
+
listGraphs,
|
|
190
|
+
getGraph,
|
|
191
|
+
createGraph,
|
|
192
|
+
updateGraph,
|
|
193
|
+
deleteGraph
|
|
194
|
+
}),
|
|
195
|
+
[loading, error, listGraphs, getGraph, createGraph, updateGraph, deleteGraph]
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
function useKGQuery(options) {
|
|
199
|
+
const optionsRef = useOptionsRef(options);
|
|
200
|
+
const {
|
|
201
|
+
execute: queryInternal,
|
|
202
|
+
loading: queryLoading,
|
|
203
|
+
error: queryError
|
|
204
|
+
} = useApiAsync(
|
|
205
|
+
(queryParams) => queryGraphApi(queryParams, optionsRef.current),
|
|
206
|
+
(data) => data,
|
|
207
|
+
null
|
|
208
|
+
);
|
|
209
|
+
const query = useCallback2(
|
|
210
|
+
(queryParams) => queryInternal(queryParams),
|
|
211
|
+
[queryInternal]
|
|
212
|
+
);
|
|
213
|
+
const {
|
|
214
|
+
execute: getLabels,
|
|
215
|
+
loading: labelsLoading,
|
|
216
|
+
error: labelsError
|
|
217
|
+
} = useApiAsync(
|
|
218
|
+
() => getGraphLabelsApi(optionsRef.current),
|
|
219
|
+
(data) => data.labels || [],
|
|
220
|
+
[]
|
|
221
|
+
);
|
|
222
|
+
const {
|
|
223
|
+
execute: getNodeInternal,
|
|
224
|
+
loading: nodeLoading,
|
|
225
|
+
error: nodeError
|
|
226
|
+
} = useApiAsync(
|
|
227
|
+
(nodeId) => getKGNodeApi(nodeId, optionsRef.current),
|
|
228
|
+
(data) => data.node || null,
|
|
229
|
+
null
|
|
230
|
+
);
|
|
231
|
+
const getNode = useCallback2((nodeId) => getNodeInternal(nodeId), [getNodeInternal]);
|
|
232
|
+
const {
|
|
233
|
+
execute: ingestNodeInternal,
|
|
234
|
+
loading: ingestLoading,
|
|
235
|
+
error: ingestError
|
|
236
|
+
} = useApiAsync(
|
|
237
|
+
(node) => ingestKGNodeApi(node, optionsRef.current),
|
|
238
|
+
(data) => data.nodeId || null,
|
|
239
|
+
null
|
|
240
|
+
);
|
|
241
|
+
const ingestNode = useCallback2(
|
|
242
|
+
(node) => ingestNodeInternal(node),
|
|
243
|
+
[ingestNodeInternal]
|
|
244
|
+
);
|
|
245
|
+
const {
|
|
246
|
+
execute: updateNodeInternal,
|
|
247
|
+
loading: updateLoading,
|
|
248
|
+
error: updateError
|
|
249
|
+
} = useApiAsync(
|
|
250
|
+
(nodeId, updates) => updateKGNodeApi(nodeId, updates, optionsRef.current),
|
|
251
|
+
(data) => data.success ?? true,
|
|
252
|
+
false
|
|
253
|
+
);
|
|
254
|
+
const updateNode = useCallback2(
|
|
255
|
+
(nodeId, updates) => updateNodeInternal(nodeId, updates),
|
|
256
|
+
[updateNodeInternal]
|
|
257
|
+
);
|
|
258
|
+
const loading = queryLoading || labelsLoading || nodeLoading || ingestLoading || updateLoading;
|
|
259
|
+
const error = queryError || labelsError || nodeError || ingestError || updateError;
|
|
260
|
+
return useMemo(
|
|
261
|
+
() => ({
|
|
262
|
+
loading,
|
|
263
|
+
error,
|
|
264
|
+
query,
|
|
265
|
+
getLabels,
|
|
266
|
+
getNode,
|
|
267
|
+
ingestNode,
|
|
268
|
+
updateNode
|
|
269
|
+
}),
|
|
270
|
+
[loading, error, query, getLabels, getNode, ingestNode, updateNode]
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
function useKGDesigner(options) {
|
|
274
|
+
const optionsRef = useOptionsRef(options);
|
|
275
|
+
const {
|
|
276
|
+
execute: listNodes,
|
|
277
|
+
loading: listNodesLoading,
|
|
278
|
+
error: listNodesError
|
|
279
|
+
} = useApiAsync(
|
|
280
|
+
() => listDesignerNodesApi(optionsRef.current),
|
|
281
|
+
(data) => data.nodes || [],
|
|
282
|
+
[]
|
|
283
|
+
);
|
|
284
|
+
const {
|
|
285
|
+
execute: getNodeInternal,
|
|
286
|
+
loading: getNodeLoading,
|
|
287
|
+
error: getNodeError
|
|
288
|
+
} = useApiAsync(
|
|
289
|
+
(label) => getDesignerNodeApi(label, optionsRef.current),
|
|
290
|
+
(data) => data.node || null,
|
|
291
|
+
null
|
|
292
|
+
);
|
|
293
|
+
const getNode = useCallback2((label) => getNodeInternal(label), [getNodeInternal]);
|
|
294
|
+
const {
|
|
295
|
+
execute: createNodeInternal,
|
|
296
|
+
loading: createNodeLoading,
|
|
297
|
+
error: createNodeError
|
|
298
|
+
} = useApiAsync(
|
|
299
|
+
(node) => createDesignerNodeApi(node, optionsRef.current),
|
|
300
|
+
(data) => data.node || null,
|
|
301
|
+
null
|
|
302
|
+
);
|
|
303
|
+
const createNode = useCallback2(
|
|
304
|
+
(node) => createNodeInternal(node),
|
|
305
|
+
[createNodeInternal]
|
|
306
|
+
);
|
|
307
|
+
const {
|
|
308
|
+
execute: updateNodeInternal,
|
|
309
|
+
loading: updateNodeLoading,
|
|
310
|
+
error: updateNodeError
|
|
311
|
+
} = useApiAsync(
|
|
312
|
+
(label, updates) => updateDesignerNodeApi(label, updates, optionsRef.current),
|
|
313
|
+
(data) => data.node || null,
|
|
314
|
+
null
|
|
315
|
+
);
|
|
316
|
+
const updateNode = useCallback2(
|
|
317
|
+
(label, updates) => updateNodeInternal(label, updates),
|
|
318
|
+
[updateNodeInternal]
|
|
319
|
+
);
|
|
320
|
+
const {
|
|
321
|
+
execute: deleteNodeInternal,
|
|
322
|
+
loading: deleteNodeLoading,
|
|
323
|
+
error: deleteNodeError
|
|
324
|
+
} = useApiAsync(
|
|
325
|
+
(label) => deleteDesignerNodeApi(label, optionsRef.current),
|
|
326
|
+
(data) => data.success ?? true,
|
|
327
|
+
false
|
|
328
|
+
);
|
|
329
|
+
const deleteNode = useCallback2((label) => deleteNodeInternal(label), [deleteNodeInternal]);
|
|
330
|
+
const {
|
|
331
|
+
execute: listEdges,
|
|
332
|
+
loading: listEdgesLoading,
|
|
333
|
+
error: listEdgesError
|
|
334
|
+
} = useApiAsync(
|
|
335
|
+
() => listDesignerEdgesApi(optionsRef.current),
|
|
336
|
+
(data) => data.edges || [],
|
|
337
|
+
[]
|
|
338
|
+
);
|
|
339
|
+
const {
|
|
340
|
+
execute: createEdgeInternal,
|
|
341
|
+
loading: createEdgeLoading,
|
|
342
|
+
error: createEdgeError
|
|
343
|
+
} = useApiAsync(
|
|
344
|
+
(edge) => createDesignerEdgeApi(edge, optionsRef.current),
|
|
345
|
+
(data) => data.edge || null,
|
|
346
|
+
null
|
|
347
|
+
);
|
|
348
|
+
const createEdge = useCallback2(
|
|
349
|
+
(edge) => createEdgeInternal(edge),
|
|
350
|
+
[createEdgeInternal]
|
|
351
|
+
);
|
|
352
|
+
const {
|
|
353
|
+
execute: updateEdgeInternal,
|
|
354
|
+
loading: updateEdgeLoading,
|
|
355
|
+
error: updateEdgeError
|
|
356
|
+
} = useApiAsync(
|
|
357
|
+
(label, updates) => updateDesignerEdgeApi(label, updates, optionsRef.current),
|
|
358
|
+
(data) => data.edge || null,
|
|
359
|
+
null
|
|
360
|
+
);
|
|
361
|
+
const updateEdge = useCallback2(
|
|
362
|
+
(label, updates) => updateEdgeInternal(label, updates),
|
|
363
|
+
[updateEdgeInternal]
|
|
364
|
+
);
|
|
365
|
+
const {
|
|
366
|
+
execute: deleteEdgeInternal,
|
|
367
|
+
loading: deleteEdgeLoading,
|
|
368
|
+
error: deleteEdgeError
|
|
369
|
+
} = useApiAsync(
|
|
370
|
+
(label) => deleteDesignerEdgeApi(label, optionsRef.current),
|
|
371
|
+
(data) => data.success ?? true,
|
|
372
|
+
false
|
|
373
|
+
);
|
|
374
|
+
const deleteEdge = useCallback2((label) => deleteEdgeInternal(label), [deleteEdgeInternal]);
|
|
375
|
+
const loading = listNodesLoading || getNodeLoading || createNodeLoading || updateNodeLoading || deleteNodeLoading || listEdgesLoading || createEdgeLoading || updateEdgeLoading || deleteEdgeLoading;
|
|
376
|
+
const error = listNodesError || getNodeError || createNodeError || updateNodeError || deleteNodeError || listEdgesError || createEdgeError || updateEdgeError || deleteEdgeError;
|
|
377
|
+
return useMemo(
|
|
378
|
+
() => ({
|
|
379
|
+
loading,
|
|
380
|
+
error,
|
|
381
|
+
// Nodes
|
|
382
|
+
listNodes,
|
|
383
|
+
getNode,
|
|
384
|
+
createNode,
|
|
385
|
+
updateNode,
|
|
386
|
+
deleteNode,
|
|
387
|
+
// Edges
|
|
388
|
+
listEdges,
|
|
389
|
+
createEdge,
|
|
390
|
+
updateEdge,
|
|
391
|
+
deleteEdge
|
|
392
|
+
}),
|
|
393
|
+
[
|
|
394
|
+
loading,
|
|
395
|
+
error,
|
|
396
|
+
listNodes,
|
|
397
|
+
getNode,
|
|
398
|
+
createNode,
|
|
399
|
+
updateNode,
|
|
400
|
+
deleteNode,
|
|
401
|
+
listEdges,
|
|
402
|
+
createEdge,
|
|
403
|
+
updateEdge,
|
|
404
|
+
deleteEdge
|
|
405
|
+
]
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
function useCrawlJobs(options) {
|
|
409
|
+
const optionsRef = useOptionsRef(options);
|
|
410
|
+
const {
|
|
411
|
+
execute: listJobsInternal,
|
|
412
|
+
loading: listLoading,
|
|
413
|
+
error: listError
|
|
414
|
+
} = useApiAsync(
|
|
415
|
+
(params) => listCrawlJobsApi({ ...optionsRef.current, ...params }),
|
|
416
|
+
(data) => ({ jobs: data.jobs || [], total: data.total || 0 }),
|
|
417
|
+
{ jobs: [], total: 0 }
|
|
418
|
+
);
|
|
419
|
+
const listJobs = useCallback2(
|
|
420
|
+
(params) => listJobsInternal(params),
|
|
421
|
+
[listJobsInternal]
|
|
422
|
+
);
|
|
423
|
+
const {
|
|
424
|
+
execute: startJobInternal,
|
|
425
|
+
loading: startLoading,
|
|
426
|
+
error: startError
|
|
427
|
+
} = useApiAsync(
|
|
428
|
+
(params) => startCrawlJobApi(params, optionsRef.current),
|
|
429
|
+
(data) => data.jobId || null,
|
|
430
|
+
null
|
|
431
|
+
);
|
|
432
|
+
const startJob = useCallback2(
|
|
433
|
+
(params) => startJobInternal(params),
|
|
434
|
+
[startJobInternal]
|
|
435
|
+
);
|
|
436
|
+
const {
|
|
437
|
+
execute: getJobStatusInternal,
|
|
438
|
+
loading: statusLoading,
|
|
439
|
+
error: statusError
|
|
440
|
+
} = useApiAsync(
|
|
441
|
+
(jobId) => getCrawlJobStatusApi(jobId, optionsRef.current),
|
|
442
|
+
(data) => data.job || null,
|
|
443
|
+
null
|
|
444
|
+
);
|
|
445
|
+
const getJobStatus = useCallback2(
|
|
446
|
+
(jobId) => getJobStatusInternal(jobId),
|
|
447
|
+
[getJobStatusInternal]
|
|
448
|
+
);
|
|
449
|
+
const {
|
|
450
|
+
execute: cancelJobInternal,
|
|
451
|
+
loading: cancelLoading,
|
|
452
|
+
error: cancelError
|
|
453
|
+
} = useApiAsync(
|
|
454
|
+
(jobId) => cancelCrawlJobApi(jobId, optionsRef.current),
|
|
455
|
+
(data) => data.success ?? true,
|
|
456
|
+
false
|
|
457
|
+
);
|
|
458
|
+
const cancelJob = useCallback2((jobId) => cancelJobInternal(jobId), [cancelJobInternal]);
|
|
459
|
+
const {
|
|
460
|
+
execute: getCrawledPagesInternal,
|
|
461
|
+
loading: pagesLoading,
|
|
462
|
+
error: pagesError
|
|
463
|
+
} = useApiAsync(
|
|
464
|
+
(jobId) => getCrawledPagesApi(jobId, optionsRef.current),
|
|
465
|
+
(data) => data.pages || [],
|
|
466
|
+
[]
|
|
467
|
+
);
|
|
468
|
+
const getCrawledPages = useCallback2(
|
|
469
|
+
(jobId) => getCrawledPagesInternal(jobId),
|
|
470
|
+
[getCrawledPagesInternal]
|
|
471
|
+
);
|
|
472
|
+
const loading = listLoading || startLoading || statusLoading || cancelLoading || pagesLoading;
|
|
473
|
+
const error = listError || startError || statusError || cancelError || pagesError;
|
|
474
|
+
return useMemo(
|
|
475
|
+
() => ({
|
|
476
|
+
loading,
|
|
477
|
+
error,
|
|
478
|
+
listJobs,
|
|
479
|
+
startJob,
|
|
480
|
+
getJobStatus,
|
|
481
|
+
cancelJob,
|
|
482
|
+
getCrawledPages
|
|
483
|
+
}),
|
|
484
|
+
[loading, error, listJobs, startJob, getJobStatus, cancelJob, getCrawledPages]
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export {
|
|
489
|
+
useAsync,
|
|
490
|
+
useApiAsync,
|
|
491
|
+
useOptionsRef,
|
|
492
|
+
useGraphs,
|
|
493
|
+
useKGQuery,
|
|
494
|
+
useKGDesigner,
|
|
495
|
+
useCrawlJobs
|
|
496
|
+
};
|
|
497
|
+
//# sourceMappingURL=chunk-JZ7UXVRW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../hooks/index.ts","../hooks/use-async.ts","../hooks/use-options-ref.ts"],"sourcesContent":["\"use client\";\n\n/**\n * Knowledge Graph React Hooks\n *\n * Provides React hooks for KG operations with loading/error states.\n * All hooks use the useOptionsRef pattern to always access the latest options.\n *\n * @packageDocumentation\n */\n\nimport { useCallback, useMemo } from \"react\";\nimport type { ApiClientOptions } from \"@elqnt/api-client\";\nimport type {\n Graph,\n CreateGraphRequest,\n KGNode,\n KGQuery,\n KGQueryResult,\n KGLabelInfo,\n KGNodeIngestRequest,\n GraphNodeDefinition,\n GraphEdgeDefinition,\n} from \"../models\";\nimport {\n listGraphsApi,\n getGraphApi,\n createGraphApi,\n updateGraphApi,\n deleteGraphApi,\n queryGraphApi,\n getGraphLabelsApi,\n getKGNodeApi,\n ingestKGNodeApi,\n updateKGNodeApi,\n listDesignerNodesApi,\n getDesignerNodeApi,\n createDesignerNodeApi,\n updateDesignerNodeApi,\n deleteDesignerNodeApi,\n listDesignerEdgesApi,\n createDesignerEdgeApi,\n updateDesignerEdgeApi,\n deleteDesignerEdgeApi,\n listCrawlJobsApi,\n startCrawlJobApi,\n getCrawlJobStatusApi,\n cancelCrawlJobApi,\n getCrawledPagesApi,\n type KGApiOptions,\n type CrawlJob,\n} from \"../api\";\nimport { useApiAsync } from \"./use-async\";\nimport { useOptionsRef } from \"./use-options-ref\";\n\n// Re-export utilities for external use\nexport { useApiAsync, useAsync } from \"./use-async\";\nexport type { UseAsyncOptions, UseAsyncReturn } from \"./use-async\";\nexport { useOptionsRef } from \"./use-options-ref\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\n/** Options for KG hooks that require a graph ID */\nexport type UseKGOptions = ApiClientOptions & { graphId?: string };\n\n// =============================================================================\n// USE GRAPHS HOOK\n// =============================================================================\n\n/**\n * Hook for knowledge graph CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, listGraphs, createGraph } = useGraphs({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * });\n *\n * const graphs = await listGraphs();\n * ```\n */\nexport function useGraphs(options: ApiClientOptions) {\n const optionsRef = useOptionsRef(options);\n\n const {\n execute: listGraphs,\n loading: listLoading,\n error: listError,\n } = useApiAsync(\n () => listGraphsApi(optionsRef.current),\n (data) => data.graphs || [],\n []\n );\n\n const {\n execute: getGraphInternal,\n loading: getLoading,\n error: getError,\n } = useApiAsync(\n (graphId: string) => getGraphApi(graphId, optionsRef.current),\n (data) => data.graph || null,\n null\n );\n const getGraph = useCallback((graphId: string) => getGraphInternal(graphId), [getGraphInternal]);\n\n const {\n execute: createGraphInternal,\n loading: createLoading,\n error: createError,\n } = useApiAsync(\n (graph: CreateGraphRequest) => createGraphApi(graph, optionsRef.current),\n (data) => data.graph || null,\n null\n );\n const createGraph = useCallback(\n (graph: CreateGraphRequest) => createGraphInternal(graph),\n [createGraphInternal]\n );\n\n const {\n execute: updateGraphInternal,\n loading: updateLoading,\n error: updateError,\n } = useApiAsync(\n (graphId: string, updates: Partial<Graph>) => updateGraphApi(graphId, updates, optionsRef.current),\n (data) => data.graph || null,\n null\n );\n const updateGraph = useCallback(\n (graphId: string, updates: Partial<Graph>) => updateGraphInternal(graphId, updates),\n [updateGraphInternal]\n );\n\n const {\n execute: deleteGraphInternal,\n loading: deleteLoading,\n error: deleteError,\n } = useApiAsync(\n (graphId: string) => deleteGraphApi(graphId, optionsRef.current),\n (data) => data.success ?? true,\n false\n );\n const deleteGraph = useCallback(\n (graphId: string) => deleteGraphInternal(graphId),\n [deleteGraphInternal]\n );\n\n // Combine loading and error states\n const loading = listLoading || getLoading || createLoading || updateLoading || deleteLoading;\n const error = listError || getError || createError || updateError || deleteError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listGraphs,\n getGraph,\n createGraph,\n updateGraph,\n deleteGraph,\n }),\n [loading, error, listGraphs, getGraph, createGraph, updateGraph, deleteGraph]\n );\n}\n\n// =============================================================================\n// USE KG QUERY HOOK\n// =============================================================================\n\n/**\n * Hook for querying knowledge graph nodes\n *\n * @example\n * ```tsx\n * const { query, getLabels, loading, error } = useKGQuery({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * graphId: selectedGraphId,\n * });\n *\n * const result = await query({ label: \"Person\", fields: [], limit: 10 });\n * ```\n */\nexport function useKGQuery(options: UseKGOptions) {\n const optionsRef = useOptionsRef(options);\n\n const {\n execute: queryInternal,\n loading: queryLoading,\n error: queryError,\n } = useApiAsync(\n (queryParams: KGQuery) => queryGraphApi(queryParams, optionsRef.current),\n (data) => data,\n null\n );\n const query = useCallback(\n (queryParams: KGQuery): Promise<KGQueryResult | null> => queryInternal(queryParams),\n [queryInternal]\n );\n\n const {\n execute: getLabels,\n loading: labelsLoading,\n error: labelsError,\n } = useApiAsync(\n () => getGraphLabelsApi(optionsRef.current),\n (data) => data.labels || [],\n []\n );\n\n const {\n execute: getNodeInternal,\n loading: nodeLoading,\n error: nodeError,\n } = useApiAsync(\n (nodeId: string) => getKGNodeApi(nodeId, optionsRef.current),\n (data) => data.node || null,\n null\n );\n const getNode = useCallback((nodeId: string) => getNodeInternal(nodeId), [getNodeInternal]);\n\n const {\n execute: ingestNodeInternal,\n loading: ingestLoading,\n error: ingestError,\n } = useApiAsync(\n (node: KGNodeIngestRequest) => ingestKGNodeApi(node, optionsRef.current),\n (data) => data.nodeId || null,\n null\n );\n const ingestNode = useCallback(\n (node: KGNodeIngestRequest) => ingestNodeInternal(node),\n [ingestNodeInternal]\n );\n\n const {\n execute: updateNodeInternal,\n loading: updateLoading,\n error: updateError,\n } = useApiAsync(\n (nodeId: string, updates: Partial<KGNode>) => updateKGNodeApi(nodeId, updates, optionsRef.current),\n (data) => data.success ?? true,\n false\n );\n const updateNode = useCallback(\n (nodeId: string, updates: Partial<KGNode>) => updateNodeInternal(nodeId, updates),\n [updateNodeInternal]\n );\n\n const loading = queryLoading || labelsLoading || nodeLoading || ingestLoading || updateLoading;\n const error = queryError || labelsError || nodeError || ingestError || updateError;\n\n return useMemo(\n () => ({\n loading,\n error,\n query,\n getLabels,\n getNode,\n ingestNode,\n updateNode,\n }),\n [loading, error, query, getLabels, getNode, ingestNode, updateNode]\n );\n}\n\n// =============================================================================\n// USE KG DESIGNER HOOK\n// =============================================================================\n\n/**\n * Hook for KG designer operations (node and edge definitions)\n *\n * @example\n * ```tsx\n * const { listNodes, createNode, listEdges, createEdge } = useKGDesigner({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * graphId: selectedGraphId,\n * });\n *\n * const nodes = await listNodes();\n * ```\n */\nexport function useKGDesigner(options: UseKGOptions) {\n const optionsRef = useOptionsRef(options);\n\n // Node operations\n const {\n execute: listNodes,\n loading: listNodesLoading,\n error: listNodesError,\n } = useApiAsync(\n () => listDesignerNodesApi(optionsRef.current),\n (data) => data.nodes || [],\n []\n );\n\n const {\n execute: getNodeInternal,\n loading: getNodeLoading,\n error: getNodeError,\n } = useApiAsync(\n (label: string) => getDesignerNodeApi(label, optionsRef.current),\n (data) => data.node || null,\n null\n );\n const getNode = useCallback((label: string) => getNodeInternal(label), [getNodeInternal]);\n\n const {\n execute: createNodeInternal,\n loading: createNodeLoading,\n error: createNodeError,\n } = useApiAsync(\n (node: Omit<GraphNodeDefinition, \"createdAt\" | \"updatedAt\">) =>\n createDesignerNodeApi(node, optionsRef.current),\n (data) => data.node || null,\n null\n );\n const createNode = useCallback(\n (node: Omit<GraphNodeDefinition, \"createdAt\" | \"updatedAt\">) => createNodeInternal(node),\n [createNodeInternal]\n );\n\n const {\n execute: updateNodeInternal,\n loading: updateNodeLoading,\n error: updateNodeError,\n } = useApiAsync(\n (label: string, updates: Partial<GraphNodeDefinition>) =>\n updateDesignerNodeApi(label, updates, optionsRef.current),\n (data) => data.node || null,\n null\n );\n const updateNode = useCallback(\n (label: string, updates: Partial<GraphNodeDefinition>) => updateNodeInternal(label, updates),\n [updateNodeInternal]\n );\n\n const {\n execute: deleteNodeInternal,\n loading: deleteNodeLoading,\n error: deleteNodeError,\n } = useApiAsync(\n (label: string) => deleteDesignerNodeApi(label, optionsRef.current),\n (data) => data.success ?? true,\n false\n );\n const deleteNode = useCallback((label: string) => deleteNodeInternal(label), [deleteNodeInternal]);\n\n // Edge operations\n const {\n execute: listEdges,\n loading: listEdgesLoading,\n error: listEdgesError,\n } = useApiAsync(\n () => listDesignerEdgesApi(optionsRef.current),\n (data) => data.edges || [],\n []\n );\n\n const {\n execute: createEdgeInternal,\n loading: createEdgeLoading,\n error: createEdgeError,\n } = useApiAsync(\n (edge: Omit<GraphEdgeDefinition, \"createdAt\" | \"updatedAt\">) =>\n createDesignerEdgeApi(edge, optionsRef.current),\n (data) => data.edge || null,\n null\n );\n const createEdge = useCallback(\n (edge: Omit<GraphEdgeDefinition, \"createdAt\" | \"updatedAt\">) => createEdgeInternal(edge),\n [createEdgeInternal]\n );\n\n const {\n execute: updateEdgeInternal,\n loading: updateEdgeLoading,\n error: updateEdgeError,\n } = useApiAsync(\n (label: string, updates: Partial<GraphEdgeDefinition>) =>\n updateDesignerEdgeApi(label, updates, optionsRef.current),\n (data) => data.edge || null,\n null\n );\n const updateEdge = useCallback(\n (label: string, updates: Partial<GraphEdgeDefinition>) => updateEdgeInternal(label, updates),\n [updateEdgeInternal]\n );\n\n const {\n execute: deleteEdgeInternal,\n loading: deleteEdgeLoading,\n error: deleteEdgeError,\n } = useApiAsync(\n (label: string) => deleteDesignerEdgeApi(label, optionsRef.current),\n (data) => data.success ?? true,\n false\n );\n const deleteEdge = useCallback((label: string) => deleteEdgeInternal(label), [deleteEdgeInternal]);\n\n const loading =\n listNodesLoading ||\n getNodeLoading ||\n createNodeLoading ||\n updateNodeLoading ||\n deleteNodeLoading ||\n listEdgesLoading ||\n createEdgeLoading ||\n updateEdgeLoading ||\n deleteEdgeLoading;\n\n const error =\n listNodesError ||\n getNodeError ||\n createNodeError ||\n updateNodeError ||\n deleteNodeError ||\n listEdgesError ||\n createEdgeError ||\n updateEdgeError ||\n deleteEdgeError;\n\n return useMemo(\n () => ({\n loading,\n error,\n // Nodes\n listNodes,\n getNode,\n createNode,\n updateNode,\n deleteNode,\n // Edges\n listEdges,\n createEdge,\n updateEdge,\n deleteEdge,\n }),\n [\n loading,\n error,\n listNodes,\n getNode,\n createNode,\n updateNode,\n deleteNode,\n listEdges,\n createEdge,\n updateEdge,\n deleteEdge,\n ]\n );\n}\n\n// =============================================================================\n// USE CRAWL JOBS HOOK\n// =============================================================================\n\n/**\n * Hook for web crawl job operations\n *\n * @example\n * ```tsx\n * const { listJobs, startJob, getJobStatus } = useCrawlJobs({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * graphId: selectedGraphId,\n * });\n *\n * const jobId = await startJob({ baseUrl: \"https://example.com\", depth: 2, maxPages: 100 });\n * ```\n */\nexport function useCrawlJobs(options: UseKGOptions) {\n const optionsRef = useOptionsRef(options);\n\n const {\n execute: listJobsInternal,\n loading: listLoading,\n error: listError,\n } = useApiAsync(\n (params?: { limit?: number; offset?: number; status?: string }) =>\n listCrawlJobsApi({ ...optionsRef.current, ...params }),\n (data) => ({ jobs: data.jobs || [], total: data.total || 0 }),\n { jobs: [], total: 0 }\n );\n const listJobs = useCallback(\n (params?: { limit?: number; offset?: number; status?: string }) => listJobsInternal(params),\n [listJobsInternal]\n );\n\n const {\n execute: startJobInternal,\n loading: startLoading,\n error: startError,\n } = useApiAsync(\n (params: { baseUrl: string; depth: number; maxPages: number }) =>\n startCrawlJobApi(params, optionsRef.current),\n (data) => data.jobId || null,\n null\n );\n const startJob = useCallback(\n (params: { baseUrl: string; depth: number; maxPages: number }) => startJobInternal(params),\n [startJobInternal]\n );\n\n const {\n execute: getJobStatusInternal,\n loading: statusLoading,\n error: statusError,\n } = useApiAsync(\n (jobId: string) => getCrawlJobStatusApi(jobId, optionsRef.current),\n (data) => data.job || null,\n null\n );\n const getJobStatus = useCallback(\n (jobId: string): Promise<CrawlJob | null> => getJobStatusInternal(jobId),\n [getJobStatusInternal]\n );\n\n const {\n execute: cancelJobInternal,\n loading: cancelLoading,\n error: cancelError,\n } = useApiAsync(\n (jobId: string) => cancelCrawlJobApi(jobId, optionsRef.current),\n (data) => data.success ?? true,\n false\n );\n const cancelJob = useCallback((jobId: string) => cancelJobInternal(jobId), [cancelJobInternal]);\n\n const {\n execute: getCrawledPagesInternal,\n loading: pagesLoading,\n error: pagesError,\n } = useApiAsync(\n (jobId: string) => getCrawledPagesApi(jobId, optionsRef.current),\n (data) => data.pages || [],\n []\n );\n const getCrawledPages = useCallback(\n (jobId: string) => getCrawledPagesInternal(jobId),\n [getCrawledPagesInternal]\n );\n\n const loading = listLoading || startLoading || statusLoading || cancelLoading || pagesLoading;\n const error = listError || startError || statusError || cancelError || pagesError;\n\n return useMemo(\n () => ({\n loading,\n error,\n listJobs,\n startJob,\n getJobStatus,\n cancelJob,\n getCrawledPages,\n }),\n [loading, error, listJobs, startJob, getJobStatus, cancelJob, getCrawledPages]\n );\n}\n","\"use client\";\n\n/**\n * Generic async operation hook with loading/error state management\n *\n * Reduces boilerplate for async operations by handling:\n * - Loading state with request counter (handles concurrent calls correctly)\n * - Error state management\n * - Automatic error extraction from ApiResponse or Error objects\n */\n\nimport { useState, useCallback, useRef } from \"react\";\nimport type { ApiResponse } from \"@elqnt/api-client\";\n\nexport interface UseAsyncOptions {\n /** Custom error handler - called in addition to setting error state */\n onError?: (error: string) => void;\n}\n\nexport interface UseAsyncReturn<TResult, TArgs extends unknown[]> {\n /** Execute the async function */\n execute: (...args: TArgs) => Promise<TResult>;\n /** Whether any request is currently in flight */\n loading: boolean;\n /** Last error message, or null if no error */\n error: string | null;\n /** Clear the current error */\n clearError: () => void;\n}\n\n/**\n * Extract data from an ApiResponse, handling errors\n * @returns [data, errorMessage]\n */\nfunction extractFromResponse<T, TResult>(\n response: ApiResponse<T>,\n extractor: (data: T) => TResult,\n defaultValue: TResult\n): [TResult, string | null] {\n if (response.error) {\n return [defaultValue, response.error];\n }\n if (!response.data) {\n return [defaultValue, null];\n }\n return [extractor(response.data), null];\n}\n\n/**\n * Create an async operation handler with loading and error states\n *\n * This hook wraps async functions to automatically manage:\n * - Loading state (using request counter for concurrent calls)\n * - Error state (extracted from ApiResponse or Error)\n *\n * @example\n * ```tsx\n * const { execute: fetchGraphs, loading, error } = useAsync(\n * async () => {\n * const response = await listGraphsApi(options);\n * if (response.error) throw new Error(response.error);\n * return response.data?.graphs || [];\n * }\n * );\n * ```\n */\nexport function useAsync<TResult, TArgs extends unknown[] = []>(\n asyncFn: (...args: TArgs) => Promise<TResult>,\n options?: UseAsyncOptions\n): UseAsyncReturn<TResult, TArgs> {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const requestCount = useRef(0);\n\n const execute = useCallback(\n async (...args: TArgs): Promise<TResult> => {\n requestCount.current += 1;\n setLoading(true);\n setError(null);\n\n try {\n const result = await asyncFn(...args);\n return result;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"An error occurred\";\n setError(message);\n options?.onError?.(message);\n throw err;\n } finally {\n requestCount.current -= 1;\n if (requestCount.current === 0) {\n setLoading(false);\n }\n }\n },\n [asyncFn, options]\n );\n\n const clearError = useCallback(() => {\n setError(null);\n }, []);\n\n return { execute, loading, error, clearError };\n}\n\n/**\n * Create an async operation handler specifically for ApiResponse-returning functions\n *\n * Unlike useAsync, this handles the ApiResponse unwrapping automatically:\n * - Extracts data using the provided extractor\n * - Sets error state from response.error\n * - Returns default value on error\n *\n * @example\n * ```tsx\n * const { execute: fetchGraphs, loading, error } = useApiAsync(\n * () => listGraphsApi(optionsRef.current),\n * (data) => data.graphs || [],\n * []\n * );\n * ```\n */\nexport function useApiAsync<TResponse, TResult, TArgs extends unknown[] = []>(\n asyncFn: (...args: TArgs) => Promise<ApiResponse<TResponse>>,\n extractor: (data: TResponse) => TResult,\n defaultValue: TResult,\n options?: UseAsyncOptions\n): UseAsyncReturn<TResult, TArgs> {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const requestCount = useRef(0);\n\n const execute = useCallback(\n async (...args: TArgs): Promise<TResult> => {\n requestCount.current += 1;\n setLoading(true);\n setError(null);\n\n try {\n const response = await asyncFn(...args);\n const [result, errorMessage] = extractFromResponse(response, extractor, defaultValue);\n\n if (errorMessage) {\n setError(errorMessage);\n options?.onError?.(errorMessage);\n return defaultValue;\n }\n\n return result;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"An error occurred\";\n setError(message);\n options?.onError?.(message);\n return defaultValue;\n } finally {\n requestCount.current -= 1;\n if (requestCount.current === 0) {\n setLoading(false);\n }\n }\n },\n [asyncFn, extractor, defaultValue, options]\n );\n\n const clearError = useCallback(() => {\n setError(null);\n }, []);\n\n return { execute, loading, error, clearError };\n}\n","\"use client\";\n\n/**\n * Hook to keep a mutable ref of options in sync\n *\n * This pattern allows callbacks created with useCallback to always access\n * the latest options without needing to re-create the callback when options change.\n *\n * This is useful for API hooks where:\n * - Options (baseUrl, orgId, graphId) may change over time\n * - Callbacks are memoized and shouldn't be recreated on every options change\n * - The callback should always use the current options when called\n */\n\nimport { useRef, useEffect } from \"react\";\n\n/**\n * Keep a mutable ref synchronized with the latest value\n *\n * @example\n * ```tsx\n * function useGraphs(options: ApiClientOptions) {\n * const optionsRef = useOptionsRef(options);\n *\n * const listGraphs = useCallback(async () => {\n * // Always uses latest options\n * return listGraphsApi(optionsRef.current);\n * }, []); // No dependency on options - callback never changes\n *\n * return { listGraphs };\n * }\n * ```\n */\nexport function useOptionsRef<T>(options: T): React.MutableRefObject<T> {\n const ref = useRef(options);\n\n useEffect(() => {\n ref.current = options;\n }, [options]);\n\n return ref;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAS,eAAAA,cAAa,eAAe;;;ACArC,SAAS,UAAU,aAAa,cAAc;AAuB9C,SAAS,oBACP,UACA,WACA,cAC0B;AAC1B,MAAI,SAAS,OAAO;AAClB,WAAO,CAAC,cAAc,SAAS,KAAK;AAAA,EACtC;AACA,MAAI,CAAC,SAAS,MAAM;AAClB,WAAO,CAAC,cAAc,IAAI;AAAA,EAC5B;AACA,SAAO,CAAC,UAAU,SAAS,IAAI,GAAG,IAAI;AACxC;AAoBO,SAAS,SACd,SACA,SACgC;AAChC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AACtD,QAAM,eAAe,OAAO,CAAC;AAE7B,QAAM,UAAU;AAAA,IACd,UAAU,SAAkC;AAC1C,mBAAa,WAAW;AACxB,iBAAW,IAAI;AACf,eAAS,IAAI;AAEb,UAAI;AACF,cAAM,SAAS,MAAM,QAAQ,GAAG,IAAI;AACpC,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,cAAM,UAAU,eAAe,QAAQ,IAAI,UAAU;AACrD,iBAAS,OAAO;AAChB,iBAAS,UAAU,OAAO;AAC1B,cAAM;AAAA,MACR,UAAE;AACA,qBAAa,WAAW;AACxB,YAAI,aAAa,YAAY,GAAG;AAC9B,qBAAW,KAAK;AAAA,QAClB;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS,OAAO;AAAA,EACnB;AAEA,QAAM,aAAa,YAAY,MAAM;AACnC,aAAS,IAAI;AAAA,EACf,GAAG,CAAC,CAAC;AAEL,SAAO,EAAE,SAAS,SAAS,OAAO,WAAW;AAC/C;AAmBO,SAAS,YACd,SACA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AC;AAE9F,QAAM;AAAA,IACJ,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,EACT,IAAI;AAAA,IACF,CAAC,UAAkB,mBAAmB,OAAO,WAAW,OAAO;AAAA,IAC/D,CAAC,SAAS,KAAK,SAAS,CAAC;AAAA,IACzB,CAAC;AAAA,EACH;AACA,QAAM,kBAAkBA;AAAA,IACtB,CAAC,UAAkB,wBAAwB,KAAK;AAAA,IAChD,CAAC,uBAAuB;AAAA,EAC1B;AAEA,QAAM,UAAU,eAAe,gBAAgB,iBAAiB,iBAAiB;AACjF,QAAM,QAAQ,aAAa,cAAc,eAAe,eAAe;AAEvE,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,SAAS,OAAO,UAAU,UAAU,cAAc,WAAW,eAAe;AAAA,EAC/E;AACF;","names":["useCallback","useRef","useCallback"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/chunk-UCKE66GB.js","../models/kg.ts"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACA;ACiGO,IAAM,wBAAA,EAA2C,kBAAA;AACjD,IAAM,sBAAA,EAAyC,QAAA;AAC/C,IAAM,uBAAA,EAA0C,SAAA;AAChD,IAAM,oBAAA,EAAuC,MAAA;AAC7C,IAAM,sBAAA,EAAyC,QAAA;AAiC/C,IAAM,0BAAA,EAAkD,IAAA;AACxD,IAAM,6BAAA,EAAqD,KAAA;AAC3D,IAAM,4BAAA,EAAoD,IAAA;AAC1D,IAAM,yBAAA,EAAiD,IAAA;AACvD,IAAM,mCAAA,EAA2D,KAAA;AACjE,IAAM,gCAAA,EAAwD,KAAA;AAC9D,IAAM,yBAAA,EAAiD,MAAA;AACvD,IAAM,4BAAA,EAAoD,SAAA;AAK1D,IAAM,uBAAA,EAA+C,IAAA;AACrD,IAAM,kCAAA,EAA0D,eAAA;AAEhE,IAAM,gCAAA,EAA2D,UAAA;AACjE,IAAM,gCAAA,EAA2D,UAAA;ADpIxE;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,klCAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/chunk-UCKE66GB.js","sourcesContent":[null,"// Code generated by tygo. DO NOT EDIT.\nimport { ResponseMetadata } from \"@elqnt/types\";\n\n//////////\n// source: kg-models.go\n\n/**\n * Graph represents a knowledge graph within an organization\n */\nexport interface Graph {\n id: string;\n name: string;\n description: string;\n isDefault: boolean;\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n}\n/**\n * CreateGraphRequest is the request to create a new graph\n */\nexport interface CreateGraphRequest {\n id?: string; // Optional: if provided, use as graph ID (must be valid UUID)\n name: string;\n description: string;\n}\n/**\n * CreateGraphResult is the response for creating a graph\n */\nexport interface CreateGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * GetGraphResult is the response for getting a single graph\n */\nexport interface GetGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * ListGraphsResult is the response for listing graphs\n */\nexport interface ListGraphsResult {\n graphs?: Graph[];\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * UpdateGraphResult is the response for updating a graph\n */\nexport interface UpdateGraphResult {\n graph?: Graph;\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\n/**\n * DeleteGraphResult is the response for deleting a graph\n */\nexport interface DeleteGraphResult {\n success: boolean;\n error?: string;\n metadata?: ResponseMetadata;\n}\nexport interface KGNode {\n id: string;\n label: string;\n fields: { [key: string]: any};\n relationships?: KGEdge[];\n score?: number /* float64 */;\n}\nexport interface KGEdge {\n id: string;\n label: string;\n fields: { [key: string]: any};\n from: string;\n to: string;\n}\n/**\n * KGNodeIngestRequest represents a request to ingest a node into the knowledge graph.\n * Note: graphId should be passed via NATS header, not in the body.\n */\nexport interface KGNodeIngestRequest {\n label: string;\n keyField?: string;\n reverseEdgeLabel?: string;\n fields: { [key: string]: any};\n edges?: KGEdgeIngestRequest[];\n duplicatePolicy?: DuplicatePolicy;\n generateEmbeddings?: boolean;\n embeddingsSource?: string;\n embeddingsFields?: string[];\n}\nexport type DuplicatePolicy = string;\nexport const DuplicatePolicyCreateIf: DuplicatePolicy = \"createIfNotExist\";\nexport const DuplicatePolicyIgnore: DuplicatePolicy = \"ignore\";\nexport const DuplicatePolicyReplace: DuplicatePolicy = \"replace\";\nexport const DuplicatePolicyFail: DuplicatePolicy = \"fail\";\nexport const DuplicatePolicyCreate: DuplicatePolicy = \"create\";\nexport interface KGEdgeIngestRequest {\n label: string;\n fields: { [key: string]: any};\n toLabel: string;\n toFieldKey: string;\n toFieldValue: any;\n createReciprocal: boolean;\n reciprocalLabel: string;\n allowEmbeddingsSearch?: boolean;\n}\n/**\n * KGQuery represents a query to the knowledge graph.\n * Note: graphId should be passed via NATS header, not in the body.\n */\nexport interface KGQuery {\n label: string;\n fields: KGFieldQuery[];\n limit: number /* int */;\n depth: number /* int */;\n sortBy: string;\n sortOrder: string;\n edges?: KGEdgeQuery[];\n embeddingsSource?: string;\n skipEmbedding?: boolean;\n summaryOnly?: boolean; // Filter out heavy fields (text, embeddings, etc.) for UI performance\n}\nexport interface KGFieldQuery {\n name: string;\n value: any;\n operator: KGFieldQueryOperator;\n}\nexport type KGFieldQueryOperator = string;\nexport const KGFieldQueryOperatorEqual: KGFieldQueryOperator = \"eq\";\nexport const KGFieldQueryOperatorNotEqual: KGFieldQueryOperator = \"neq\";\nexport const KGFieldQueryOperatorGreater: KGFieldQueryOperator = \"gt\";\nexport const KGFieldQueryOperatorLess: KGFieldQueryOperator = \"lt\";\nexport const KGFieldQueryOperatorGreaterOrEqual: KGFieldQueryOperator = \"gte\";\nexport const KGFieldQueryOperatorLessOrEqual: KGFieldQueryOperator = \"lte\";\nexport const KGFieldQueryOperatorLike: KGFieldQueryOperator = \"like\";\nexport const KGFieldQueryOperatorSimilar: KGFieldQueryOperator = \"similar\";\n/**\n * KGFieldQueryOperatorGreaterOrEqual KGFieldQueryOperator = \"gte\"\n * KGFieldQueryOperatorLessOrEqual KGFieldQueryOperator = \"lte\"\n */\nexport const KGFieldQueryOperatorIn: KGFieldQueryOperator = \"in\";\nexport const KGFieldQueryOperatorArrayContains: KGFieldQueryOperator = \"arrayContains\";\nexport type KGRelationshipDirection = string;\nexport const KGRelationshipDirectionIncoming: KGRelationshipDirection = \"incoming\";\nexport const KGRelationshipDirectionOutgoing: KGRelationshipDirection = \"outgoing\";\nexport interface KGEdgeQuery {\n label: string;\n direction: 'incoming' | 'outgoing';\n fields?: { [key: string]: any};\n /**\n * FromLabel string `json:\"fromLabel\"`\n * FromFieldKey string `json:\"fromFieldKey\"`\n * FromValue interface{} `json:\"fromValue\"`\n */\n toLabel: string;\n toFieldKey: string;\n toFieldValue: any;\n}\nexport interface KGQueryResult {\n nodes: KGNode[];\n edges: KGEdge[];\n}\nexport interface KGLabelInfo {\n label: string;\n count: number /* uint64 */;\n}\nexport interface KGPropertyInfo {\n property: string;\n count: number /* uint64 */;\n}\nexport interface KGPLabelSchema {\n label: string;\n keys: string[];\n}\nexport interface KGArticle {\n id: string;\n title: string;\n content: string;\n lang?: string;\n docUrl?: string;\n paragraphs?: string;\n}\nexport interface KGPropertyFilter {\n property: string;\n value: string;\n}\nexport interface KGPropertyFilterRequest {\n label: string;\n filters: KGPropertyFilter[];\n}\nexport interface DeleteDocumentRequest {\n documentId: string;\n}\nexport interface DeleteDocumentResponse {\n success: boolean;\n deletedNodes: { [key: string]: number /* int */};\n totalDeleted: number /* int */;\n error?: string;\n}\n/**\n * KGSyncJob represents a sync job record in the database\n */\nexport interface KGSyncJob {\n id: string;\n title: string;\n stats: { [key: string]: any};\n startTime: string;\n endTime: string;\n updatedAt?: string;\n}\n/**\n * KGSyncJobUpdateRequest is used to insert or update a sync job\n */\nexport interface KGSyncJobUpdateRequest {\n id: string;\n title: string;\n stats: { [key: string]: any};\n startTime: string;\n endTime: string;\n}\nexport interface KGSyncJobUpdateResponse {\n jobId: string;\n metadata: ResponseMetadata;\n}\nexport interface KGSyncJobListResponse {\n jobs: KGSyncJob[];\n metadata: ResponseMetadata;\n}\n/**\n * KGSyncJobListRequest is used to list sync jobs with filters\n */\nexport interface KGSyncJobListRequest {\n limit?: number /* int */;\n offset?: number /* int */;\n startFrom?: string;\n endTo?: string;\n}\n/**\n * KGSyncIngestResponse is the response for synchronous single node ingestion\n */\nexport interface KGSyncIngestResponse {\n success: boolean;\n nodeId?: string;\n error?: string;\n metadata: ResponseMetadata;\n}\n/**\n * KGBatchSyncIngestResponse is the response for synchronous batch node ingestion\n */\nexport interface KGBatchSyncIngestResponse {\n success: boolean;\n ingestedCount: number /* int */;\n nodeIds?: string[];\n errors?: string[];\n metadata: ResponseMetadata;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/chunk-W4XVBGE7.js"],"names":[],"mappings":"AAAA,yBAAY","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/kg/dist/chunk-W4XVBGE7.js"}
|