Skip to content
This repository was archived by the owner on Jun 23, 2026. It is now read-only.

Commit e698d12

Browse files
Refactored rows/objects (#125)
1 parent bee1a79 commit e698d12

5 files changed

Lines changed: 40 additions & 40 deletions

File tree

‎package-lock.json‎

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"@msgpack/msgpack": "^3.1.1",
2121
"@tanstack/react-query": "^5.80.3",
2222
"@tanstack/react-table": "^8.21.3",
23-
"@trustgraph/client": "^1.3.1",
23+
"@trustgraph/client": "^1.4.0",
2424
"@trustgraph/react-provider": "^1.3.0",
25-
"@trustgraph/react-state": "^1.3.1",
25+
"@trustgraph/react-state": "^1.4.0",
2626
"@types/dagre": "^0.7.53",
2727
"compute-cosine-similarity": "^1.1.0",
2828
"dagre": "^0.8.5",

‎src/components/structured-query/RunGraphQLTab.tsx‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState, useMemo } from "react";
22
import { VStack, HStack, Button, Textarea, Text, Box } from "@chakra-ui/react";
33
import { Play } from "lucide-react";
4-
import { useObjectsQuery } from "@trustgraph/react-state";
4+
import { useRowsQuery } from "@trustgraph/react-state";
55
import {
66
createColumnHelper,
77
useReactTable,
@@ -17,12 +17,12 @@ const columnHelper = createColumnHelper<GraphQLResultRow>();
1717

1818
const RunGraphQLTab: React.FC = () => {
1919
const [query, setQuery] = useState("");
20-
const objectsQuery = useObjectsQuery();
20+
const rowsQuery = useRowsQuery();
2121

2222
const handleSubmit = () => {
2323
if (!query.trim()) return;
2424

25-
objectsQuery.executeQuery({ query: query.trim() });
25+
rowsQuery.executeQuery({ query: query.trim() });
2626
};
2727

2828
const handleKeyPress = (e: React.KeyboardEvent) => {
@@ -34,20 +34,20 @@ const RunGraphQLTab: React.FC = () => {
3434

3535
// Dynamically create columns based on the first row of results
3636
const { columns, tableData } = useMemo(() => {
37-
if (!objectsQuery.data?.data) {
37+
if (!rowsQuery.data?.data) {
3838
return { columns: [], tableData: [] };
3939
}
4040

4141
// Extract the first array of results from the GraphQL response
4242
// GraphQL responses typically have structure like { data: { users: [...] } }
43-
const dataKeys = Object.keys(objectsQuery.data.data);
43+
const dataKeys = Object.keys(rowsQuery.data.data);
4444
if (dataKeys.length === 0) {
4545
return { columns: [], tableData: [] };
4646
}
4747

4848
// Get the first data collection
4949
const firstKey = dataKeys[0];
50-
const results = objectsQuery.data.data[firstKey];
50+
const results = rowsQuery.data.data[firstKey];
5151

5252
if (!Array.isArray(results) || results.length === 0) {
5353
return { columns: [], tableData: [] };
@@ -91,7 +91,7 @@ const RunGraphQLTab: React.FC = () => {
9191
columns: resultColumns,
9292
tableData: results as GraphQLResultRow[],
9393
};
94-
}, [objectsQuery.data]);
94+
}, [rowsQuery.data]);
9595

9696
// Create the table instance
9797
const table = useReactTable({
@@ -136,8 +136,8 @@ const RunGraphQLTab: React.FC = () => {
136136
onClick={handleSubmit}
137137
disabled={
138138
!query.trim() ||
139-
objectsQuery.isExecuting ||
140-
!objectsQuery.isReady
139+
rowsQuery.isExecuting ||
140+
!rowsQuery.isReady
141141
}
142142
colorPalette="primary"
143143
>
@@ -148,13 +148,13 @@ const RunGraphQLTab: React.FC = () => {
148148
</VStack>
149149

150150
{/* Error Display */}
151-
{objectsQuery.error && (
151+
{rowsQuery.error && (
152152
<Box>
153153
<Text fontWeight="medium" fontSize="lg" color="red.500" mb={2}>
154154
Query Error
155155
</Text>
156156
<Textarea
157-
value={`Error: ${objectsQuery.error.message || objectsQuery.error}`}
157+
value={`Error: ${rowsQuery.error.message || rowsQuery.error}`}
158158
readOnly
159159
rows={4}
160160
bg="red.50"
@@ -167,13 +167,13 @@ const RunGraphQLTab: React.FC = () => {
167167
)}
168168

169169
{/* GraphQL Errors Display */}
170-
{objectsQuery.data?.errors && objectsQuery.data.errors.length > 0 && (
170+
{rowsQuery.data?.errors && rowsQuery.data.errors.length > 0 && (
171171
<Box>
172172
<Text fontWeight="medium" fontSize="lg" color="orange.500" mb={2}>
173173
GraphQL Errors
174174
</Text>
175175
<Textarea
176-
value={objectsQuery.data.errors
176+
value={rowsQuery.data.errors
177177
.map(
178178
(error: Record<string, unknown>) =>
179179
(error.message as string) || JSON.stringify(error),
@@ -191,7 +191,7 @@ const RunGraphQLTab: React.FC = () => {
191191
)}
192192

193193
{/* Results Table */}
194-
{objectsQuery.data?.data && tableData.length > 0 && (
194+
{rowsQuery.data?.data && tableData.length > 0 && (
195195
<VStack gap={4} align="stretch">
196196
<HStack justify="space-between" align="center">
197197
<Text fontWeight="medium" fontSize="lg">
@@ -209,9 +209,9 @@ const RunGraphQLTab: React.FC = () => {
209209
)}
210210

211211
{/* No Results Message */}
212-
{objectsQuery.data?.data &&
212+
{rowsQuery.data?.data &&
213213
tableData.length === 0 &&
214-
!objectsQuery.error && (
214+
!rowsQuery.error && (
215215
<Box>
216216
<Text fontWeight="medium" fontSize="lg" mb={2}>
217217
Query Results

‎src/data/service-map.json‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@
5858
"description": "Text completion service",
5959
"kind": "service"
6060
},
61-
"objects-store": {
62-
"description": "Object store",
61+
"rows-store": {
62+
"description": "Row store",
6363
"kind": "service"
6464
},
65-
"objects": {
66-
"description": "Object query service",
65+
"rows": {
66+
"description": "Row query service",
6767
"kind": "service"
6868
},
6969
"nlp-query": {
@@ -94,7 +94,7 @@
9494
"graph-rag-service": { "kind": "service", "description": "Graph RAG service requests/responses" },
9595
"mcp-tool-service": { "kind": "service", "description": "MCP tool service requests/responses" },
9696
"nlp-query-service": { "kind": "service", "description": "NLP query service requests/responses" },
97-
"objects-query-service": { "kind": "service", "description": "Objects query service requests/responses" },
97+
"rows-query-service": { "kind": "service", "description": "Rows query service requests/responses" },
9898
"structured-query-service": { "kind": "service", "description": "Structured query service requests/responses" },
9999
"triples-service": { "kind": "service", "description": "Triples query service requests/responses" },
100100

@@ -105,7 +105,7 @@
105105
"graph-embeddings": { "kind": "flow", "description": "Graph embeddings storage data" },
106106
"entity-contexts": { "kind": "flow", "description": "Entity context information" },
107107
"triples": { "kind": "flow", "description": "Knowledge graph triples data" },
108-
"objects": { "kind": "flow", "description": "Extracted objects data" },
108+
"rows": { "kind": "flow", "description": "Extracted rows data" },
109109
"next-step": { "kind": "flow", "description": "Next processing step data" },
110110

111111
"text-completion-monitoring": { "kind": "passive", "description": "Passive monitoring of text completion responses" }
@@ -200,10 +200,10 @@
200200
{ "name": "prompt", "type": "prompt-service", "role": "consumes", "direction": "out" }
201201
]
202202
},
203-
"kg-extract-objects": {
203+
"kg-extract-rows": {
204204
"connections": [
205205
{ "name": "input", "type": "chunk", "role": "provides", "direction": "in" },
206-
{ "name": "output", "type": "objects", "role": "consumes", "direction": "out" },
206+
{ "name": "output", "type": "rows", "role": "consumes", "direction": "out" },
207207
{ "name": "entity-contexts", "type": "entity-contexts", "role": "consumes", "direction": "in" },
208208
{ "name": "prompt", "type": "prompt-service", "role": "consumes", "direction": "out" }
209209
]
@@ -243,14 +243,14 @@
243243
{ "name": "prompt", "type": "prompt-service", "role": "consumes", "direction": "out" }
244244
]
245245
},
246-
"objects-query": {
246+
"rows-query": {
247247
"connections": [
248-
{ "name": "service", "type": "objects-query-service", "role": "provides", "direction": "in" }
248+
{ "name": "service", "type": "rows-query-service", "role": "provides", "direction": "in" }
249249
]
250250
},
251-
"objects-write": {
251+
"rows-write": {
252252
"connections": [
253-
{ "name": "input", "type": "objects", "role": "provides", "direction": "in" }
253+
{ "name": "input", "type": "rows", "role": "provides", "direction": "in" }
254254
]
255255
},
256256
"pdf-decoder": {
@@ -275,7 +275,7 @@
275275
"connections": [
276276
{ "name": "service", "type": "structured-query-service", "role": "provides", "direction": "in" },
277277
{ "name": "nlp-query", "type": "nlp-query-service", "role": "consumes", "direction": "out" },
278-
{ "name": "objects-query", "type": "objects-query-service", "role": "consumes", "direction": "out" }
278+
{ "name": "rows-query", "type": "rows-query-service", "role": "consumes", "direction": "out" }
279279
]
280280
},
281281
"text-completion": {

‎src/test/test-utils.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const mockSocket = {
2020
triplesQuery: () => Promise.resolve([]),
2121
graphEmbeddingsQuery: () => Promise.resolve([]),
2222
nlpQuery: () => Promise.resolve({ graphql_query: "" }),
23-
objectsQuery: () => Promise.resolve({}),
23+
rowsQuery: () => Promise.resolve({}),
2424
embeddings: () => Promise.resolve([]),
2525
}),
2626
flows: () => ({

0 commit comments

Comments
 (0)