@trustgraph/react-state 1.3.1 → 1.4.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 +1 -1
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +15 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/state/{objects-query.d.ts → rows-query.d.ts} +4 -4
- package/dist/state/rows-query.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/state/objects-query.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -156,7 +156,7 @@ const handler: NotificationHandler = {
|
|
|
156
156
|
- `useChat()` - Chat interface operations
|
|
157
157
|
- `useChatQuery()` - Chat query management
|
|
158
158
|
- `useStructuredQuery()` - Structured query operations
|
|
159
|
-
- `
|
|
159
|
+
- `useRowsQuery()` - Row queries
|
|
160
160
|
- `useNlpQuery()` - Natural language processing queries
|
|
161
161
|
|
|
162
162
|
#### Configuration
|
package/dist/index.cjs
CHANGED
|
@@ -2161,10 +2161,10 @@ const useStructuredQuery = () => {
|
|
|
2161
2161
|
|
|
2162
2162
|
// React Query hooks for data fetching and mutation management
|
|
2163
2163
|
/**
|
|
2164
|
-
* Custom hook for managing GraphQL
|
|
2165
|
-
* Provides functionality for executing GraphQL queries against structured data
|
|
2164
|
+
* Custom hook for managing GraphQL rows queries
|
|
2165
|
+
* Provides functionality for executing GraphQL queries against structured row data
|
|
2166
2166
|
*/
|
|
2167
|
-
const
|
|
2167
|
+
const useRowsQuery = () => {
|
|
2168
2168
|
// Socket connection for API calls
|
|
2169
2169
|
const socket = reactProvider.useSocket();
|
|
2170
2170
|
const connectionState = reactProvider.useConnectionState();
|
|
@@ -2177,18 +2177,18 @@ const useObjectsQuery = () => {
|
|
|
2177
2177
|
// Only enable operations when socket is connected and ready
|
|
2178
2178
|
const isSocketReady = connectionState?.status === "authenticated" ||
|
|
2179
2179
|
connectionState?.status === "unauthenticated";
|
|
2180
|
-
// Mutation for executing GraphQL
|
|
2181
|
-
const
|
|
2180
|
+
// Mutation for executing GraphQL rows queries
|
|
2181
|
+
const rowsQueryMutation = reactQuery.useMutation({
|
|
2182
2182
|
mutationFn: async ({ query, collection, variables, operationName, }) => {
|
|
2183
2183
|
if (!isSocketReady) {
|
|
2184
2184
|
throw new Error("Socket connection not ready");
|
|
2185
2185
|
}
|
|
2186
2186
|
return socket
|
|
2187
2187
|
.flow(flowId)
|
|
2188
|
-
.
|
|
2188
|
+
.rowsQuery(query, collection || settings.collection, variables, operationName);
|
|
2189
2189
|
},
|
|
2190
2190
|
onError: (err) => {
|
|
2191
|
-
console.log("
|
|
2191
|
+
console.log("Rows query error:", err);
|
|
2192
2192
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
2193
2193
|
notify.error(`GraphQL query failed: ${errorMessage}`);
|
|
2194
2194
|
},
|
|
@@ -2197,18 +2197,18 @@ const useObjectsQuery = () => {
|
|
|
2197
2197
|
},
|
|
2198
2198
|
});
|
|
2199
2199
|
// Show loading indicator for query operations
|
|
2200
|
-
useActivity(
|
|
2200
|
+
useActivity(rowsQueryMutation.isPending, "Executing GraphQL query");
|
|
2201
2201
|
// Return the public API for the hook
|
|
2202
2202
|
return {
|
|
2203
2203
|
// Query execution
|
|
2204
|
-
executeQuery:
|
|
2205
|
-
executeQueryAsync:
|
|
2204
|
+
executeQuery: rowsQueryMutation.mutate,
|
|
2205
|
+
executeQueryAsync: rowsQueryMutation.mutateAsync,
|
|
2206
2206
|
// Query state
|
|
2207
|
-
isExecuting:
|
|
2208
|
-
error:
|
|
2209
|
-
data:
|
|
2207
|
+
isExecuting: rowsQueryMutation.isPending,
|
|
2208
|
+
error: rowsQueryMutation.error,
|
|
2209
|
+
data: rowsQueryMutation.data,
|
|
2210
2210
|
// Reset function to clear previous results
|
|
2211
|
-
reset:
|
|
2211
|
+
reset: rowsQueryMutation.reset,
|
|
2212
2212
|
// Socket readiness
|
|
2213
2213
|
isReady: isSocketReady,
|
|
2214
2214
|
};
|
|
@@ -4617,12 +4617,12 @@ exports.useMcpTools = useMcpTools;
|
|
|
4617
4617
|
exports.useNlpQuery = useNlpQuery;
|
|
4618
4618
|
exports.useNodeDetails = useNodeDetails;
|
|
4619
4619
|
exports.useNotification = useNotification;
|
|
4620
|
-
exports.useObjectsQuery = useObjectsQuery;
|
|
4621
4620
|
exports.useOntologies = useOntologies;
|
|
4622
4621
|
exports.useParameterValidation = useParameterValidation;
|
|
4623
4622
|
exports.useProcessing = useProcessing;
|
|
4624
4623
|
exports.useProgressStateStore = useProgressStateStore;
|
|
4625
4624
|
exports.usePrompts = usePrompts;
|
|
4625
|
+
exports.useRowsQuery = useRowsQuery;
|
|
4626
4626
|
exports.useSchemas = useSchemas;
|
|
4627
4627
|
exports.useSearchStateStore = useSearchStateStore;
|
|
4628
4628
|
exports.useSessionStore = useSessionStore;
|