/** * Append-only transcript of an agent run: one agent session entry per row, stored verbatim * @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 { buildListSelectionArgs } from '../selection'; import type { ListSelectionConfig } from '../selection'; import { agentEventKeys } from '../query-keys'; import type { AgentEventSelect, AgentEventWithRelations, AgentEventFilter, AgentEventOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { AgentEventSelect, AgentEventWithRelations, AgentEventFilter, AgentEventOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const agentEventsQueryKey = agentEventKeys.list; /** * Append-only transcript of an agent run: one agent session entry per row, stored verbatim * * @example * ```tsx * const { data, isLoading } = useAgentEventsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function useAgentEventsQuery< S extends AgentEventSelect, TData = { agentEvents: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, AgentEventSelect>; } & Omit< UseQueryOptions< { agentEvents: ConnectionResult>; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useAgentEventsQuery( params: { selection: ListSelectionConfig; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs( params.selection ); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: agentEventKeys.list(args), queryFn: () => getClient().agentEvent.findMany(args).unwrap(), ...queryOptions, }); } /** * Append-only transcript of an agent run: one agent session entry per row, stored verbatim * * @example * ```ts * const data = await fetchAgentEventsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchAgentEventsQuery(params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, AgentEventSelect>; }): Promise<{ agentEvents: ConnectionResult>; }>; export async function fetchAgentEventsQuery(params: { selection: ListSelectionConfig; }) { const args = buildListSelectionArgs( params.selection ); return getClient().agentEvent.findMany(args).unwrap(); } /** * Append-only transcript of an agent run: one agent session entry per row, stored verbatim * * @example * ```ts * await prefetchAgentEventsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchAgentEventsQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, AgentEventSelect>; } ): Promise; export async function prefetchAgentEventsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig; } ): Promise { const args = buildListSelectionArgs( params.selection ); await queryClient.prefetchQuery({ queryKey: agentEventKeys.list(args), queryFn: () => getClient().agentEvent.findMany(args).unwrap(), }); }