Skip to content
This repository was archived by the owner on Jun 23, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"@msgpack/msgpack": "^3.1.1",
"@tanstack/react-query": "^5.80.3",
"@tanstack/react-table": "^8.21.3",
"@trustgraph/client": "^1.3.1",
"@trustgraph/client": "^1.4.0",
"@trustgraph/react-provider": "^1.3.0",
"@trustgraph/react-state": "^1.3.1",
"@trustgraph/react-state": "^1.4.0",
"@types/dagre": "^0.7.53",
"compute-cosine-similarity": "^1.1.0",
"dagre": "^0.8.5",
Expand Down
32 changes: 16 additions & 16 deletions src/components/structured-query/RunGraphQLTab.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useMemo } from "react";
import { VStack, HStack, Button, Textarea, Text, Box } from "@chakra-ui/react";
import { Play } from "lucide-react";
import { useObjectsQuery } from "@trustgraph/react-state";
import { useRowsQuery } from "@trustgraph/react-state";
import {
createColumnHelper,
useReactTable,
Expand All @@ -17,12 +17,12 @@ const columnHelper = createColumnHelper<GraphQLResultRow>();

const RunGraphQLTab: React.FC = () => {
const [query, setQuery] = useState("");
const objectsQuery = useObjectsQuery();
const rowsQuery = useRowsQuery();

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

objectsQuery.executeQuery({ query: query.trim() });
rowsQuery.executeQuery({ query: query.trim() });
};

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

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

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

// Get the first data collection
const firstKey = dataKeys[0];
const results = objectsQuery.data.data[firstKey];
const results = rowsQuery.data.data[firstKey];

if (!Array.isArray(results) || results.length === 0) {
return { columns: [], tableData: [] };
Expand Down Expand Up @@ -91,7 +91,7 @@ const RunGraphQLTab: React.FC = () => {
columns: resultColumns,
tableData: results as GraphQLResultRow[],
};
}, [objectsQuery.data]);
}, [rowsQuery.data]);

// Create the table instance
const table = useReactTable({
Expand Down Expand Up @@ -136,8 +136,8 @@ const RunGraphQLTab: React.FC = () => {
onClick={handleSubmit}
disabled={
!query.trim() ||
objectsQuery.isExecuting ||
!objectsQuery.isReady
rowsQuery.isExecuting ||
!rowsQuery.isReady
}
colorPalette="primary"
>
Expand All @@ -148,13 +148,13 @@ const RunGraphQLTab: React.FC = () => {
</VStack>

{/* Error Display */}
{objectsQuery.error && (
{rowsQuery.error && (
<Box>
<Text fontWeight="medium" fontSize="lg" color="red.500" mb={2}>
Query Error
</Text>
<Textarea
value={`Error: ${objectsQuery.error.message || objectsQuery.error}`}
value={`Error: ${rowsQuery.error.message || rowsQuery.error}`}
readOnly
rows={4}
bg="red.50"
Expand All @@ -167,13 +167,13 @@ const RunGraphQLTab: React.FC = () => {
)}

{/* GraphQL Errors Display */}
{objectsQuery.data?.errors && objectsQuery.data.errors.length > 0 && (
{rowsQuery.data?.errors && rowsQuery.data.errors.length > 0 && (
<Box>
<Text fontWeight="medium" fontSize="lg" color="orange.500" mb={2}>
GraphQL Errors
</Text>
<Textarea
value={objectsQuery.data.errors
value={rowsQuery.data.errors
.map(
(error: Record<string, unknown>) =>
(error.message as string) || JSON.stringify(error),
Expand All @@ -191,7 +191,7 @@ const RunGraphQLTab: React.FC = () => {
)}

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

{/* No Results Message */}
{objectsQuery.data?.data &&
{rowsQuery.data?.data &&
tableData.length === 0 &&
!objectsQuery.error && (
!rowsQuery.error && (
<Box>
<Text fontWeight="medium" fontSize="lg" mb={2}>
Query Results
Expand Down
26 changes: 13 additions & 13 deletions src/data/service-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
"description": "Text completion service",
"kind": "service"
},
"objects-store": {
"description": "Object store",
"rows-store": {
"description": "Row store",
"kind": "service"
},
"objects": {
"description": "Object query service",
"rows": {
"description": "Row query service",
"kind": "service"
},
"nlp-query": {
Expand Down Expand Up @@ -94,7 +94,7 @@
"graph-rag-service": { "kind": "service", "description": "Graph RAG service requests/responses" },
"mcp-tool-service": { "kind": "service", "description": "MCP tool service requests/responses" },
"nlp-query-service": { "kind": "service", "description": "NLP query service requests/responses" },
"objects-query-service": { "kind": "service", "description": "Objects query service requests/responses" },
"rows-query-service": { "kind": "service", "description": "Rows query service requests/responses" },
"structured-query-service": { "kind": "service", "description": "Structured query service requests/responses" },
"triples-service": { "kind": "service", "description": "Triples query service requests/responses" },

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

"text-completion-monitoring": { "kind": "passive", "description": "Passive monitoring of text completion responses" }
Expand Down Expand Up @@ -200,10 +200,10 @@
{ "name": "prompt", "type": "prompt-service", "role": "consumes", "direction": "out" }
]
},
"kg-extract-objects": {
"kg-extract-rows": {
"connections": [
{ "name": "input", "type": "chunk", "role": "provides", "direction": "in" },
{ "name": "output", "type": "objects", "role": "consumes", "direction": "out" },
{ "name": "output", "type": "rows", "role": "consumes", "direction": "out" },
{ "name": "entity-contexts", "type": "entity-contexts", "role": "consumes", "direction": "in" },
{ "name": "prompt", "type": "prompt-service", "role": "consumes", "direction": "out" }
]
Expand Down Expand Up @@ -243,14 +243,14 @@
{ "name": "prompt", "type": "prompt-service", "role": "consumes", "direction": "out" }
]
},
"objects-query": {
"rows-query": {
"connections": [
{ "name": "service", "type": "objects-query-service", "role": "provides", "direction": "in" }
{ "name": "service", "type": "rows-query-service", "role": "provides", "direction": "in" }
]
},
"objects-write": {
"rows-write": {
"connections": [
{ "name": "input", "type": "objects", "role": "provides", "direction": "in" }
{ "name": "input", "type": "rows", "role": "provides", "direction": "in" }
]
},
"pdf-decoder": {
Expand All @@ -275,7 +275,7 @@
"connections": [
{ "name": "service", "type": "structured-query-service", "role": "provides", "direction": "in" },
{ "name": "nlp-query", "type": "nlp-query-service", "role": "consumes", "direction": "out" },
{ "name": "objects-query", "type": "objects-query-service", "role": "consumes", "direction": "out" }
{ "name": "rows-query", "type": "rows-query-service", "role": "consumes", "direction": "out" }
]
},
"text-completion": {
Expand Down
2 changes: 1 addition & 1 deletion src/test/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const mockSocket = {
triplesQuery: () => Promise.resolve([]),
graphEmbeddingsQuery: () => Promise.resolve([]),
nlpQuery: () => Promise.resolve({ graphql_query: "" }),
objectsQuery: () => Promise.resolve({}),
rowsQuery: () => Promise.resolve({}),
embeddings: () => Promise.resolve([]),
}),
flows: () => ({
Expand Down