/** * Content-addressed store for execution outputs — hash-referenced from node_outputs * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { useQuery } from '@tanstack/react-query'; import type { UseQueryOptions, UseQueryResult, QueryClient } from '@tanstack/react-query'; import { getClient } from '../client'; import { buildSelectionArgs } from '../selection'; import type { SelectionConfig } from '../selection'; import { functionGraphExecutionOutputKeys } from '../query-keys'; import type { FunctionGraphExecutionOutputSelect, FunctionGraphExecutionOutputWithRelations, } from '../../orm/input-types'; import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types'; export type { FunctionGraphExecutionOutputSelect, FunctionGraphExecutionOutputWithRelations, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const functionGraphExecutionOutputQueryKey = functionGraphExecutionOutputKeys.detail; /** * Content-addressed store for execution outputs — hash-referenced from node_outputs * * @example * ```tsx * const { data, isLoading } = useFunctionGraphExecutionOutputQuery({ * id: 'some-id', * selection: { fields: { id: true, name: true } }, * }); * ``` */ export function useFunctionGraphExecutionOutputQuery< S extends FunctionGraphExecutionOutputSelect, TData = { functionGraphExecutionOutput: InferSelectResult< FunctionGraphExecutionOutputWithRelations, S > | null; }, >( params: { id: string; selection: { fields: S; } & HookStrictSelect, FunctionGraphExecutionOutputSelect>; } & Omit< UseQueryOptions< { functionGraphExecutionOutput: InferSelectResult< FunctionGraphExecutionOutputWithRelations, S > | null; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useFunctionGraphExecutionOutputQuery( params: { id: string; selection: SelectionConfig; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildSelectionArgs(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: functionGraphExecutionOutputKeys.detail(params.id), queryFn: () => getClient() .functionGraphExecutionOutput.findOne({ id: params.id, select: args.select, }) .unwrap(), ...queryOptions, }); } /** * Content-addressed store for execution outputs — hash-referenced from node_outputs * * @example * ```ts * const data = await fetchFunctionGraphExecutionOutputQuery({ * id: 'some-id', * selection: { fields: { id: true } }, * }); * ``` */ export async function fetchFunctionGraphExecutionOutputQuery< S extends FunctionGraphExecutionOutputSelect, >(params: { id: string; selection: { fields: S; } & HookStrictSelect, FunctionGraphExecutionOutputSelect>; }): Promise<{ functionGraphExecutionOutput: InferSelectResult< FunctionGraphExecutionOutputWithRelations, S > | null; }>; export async function fetchFunctionGraphExecutionOutputQuery(params: { id: string; selection: SelectionConfig; }): Promise { const args = buildSelectionArgs(params.selection); return getClient() .functionGraphExecutionOutput.findOne({ id: params.id, select: args.select, }) .unwrap(); } /** * Content-addressed store for execution outputs — hash-referenced from node_outputs * * @example * ```ts * await prefetchFunctionGraphExecutionOutputQuery(queryClient, { id: 'some-id', selection: { fields: { id: true } } }); * ``` */ export async function prefetchFunctionGraphExecutionOutputQuery< S extends FunctionGraphExecutionOutputSelect, >( queryClient: QueryClient, params: { id: string; selection: { fields: S; } & HookStrictSelect, FunctionGraphExecutionOutputSelect>; } ): Promise; export async function prefetchFunctionGraphExecutionOutputQuery( queryClient: QueryClient, params: { id: string; selection: SelectionConfig; } ): Promise { const args = buildSelectionArgs(params.selection); await queryClient.prefetchQuery({ queryKey: functionGraphExecutionOutputKeys.detail(params.id), queryFn: () => getClient() .functionGraphExecutionOutput.findOne({ id: params.id, select: args.select, }) .unwrap(), }); }