/** * Function invocation log — INSERT to call a function (business-layer, metered). Linked to definitions via function_definition_id FK, with task_identifier as the denormalized routing/audit slug. * @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 { functionInvocationKeys } from '../query-keys'; import type { FunctionInvocationSelect, FunctionInvocationWithRelations, FunctionInvocationFilter, FunctionInvocationOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { FunctionInvocationSelect, FunctionInvocationWithRelations, FunctionInvocationFilter, FunctionInvocationOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const functionInvocationsQueryKey = functionInvocationKeys.list; /** * Function invocation log — INSERT to call a function (business-layer, metered). Linked to definitions via function_definition_id FK, with task_identifier as the denormalized routing/audit slug. * * @example * ```tsx * const { data, isLoading } = useFunctionInvocationsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function useFunctionInvocationsQuery< S extends FunctionInvocationSelect, TData = { functionInvocations: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, FunctionInvocationSelect>; } & Omit< UseQueryOptions< { functionInvocations: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useFunctionInvocationsQuery( params: { selection: ListSelectionConfig< FunctionInvocationSelect, FunctionInvocationFilter, FunctionInvocationOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< FunctionInvocationSelect, FunctionInvocationFilter, FunctionInvocationOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: functionInvocationKeys.list(args), queryFn: () => getClient().functionInvocation.findMany(args).unwrap(), ...queryOptions, }); } /** * Function invocation log — INSERT to call a function (business-layer, metered). Linked to definitions via function_definition_id FK, with task_identifier as the denormalized routing/audit slug. * * @example * ```ts * const data = await fetchFunctionInvocationsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchFunctionInvocationsQuery(params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, FunctionInvocationSelect>; }): Promise<{ functionInvocations: ConnectionResult>; }>; export async function fetchFunctionInvocationsQuery(params: { selection: ListSelectionConfig< FunctionInvocationSelect, FunctionInvocationFilter, FunctionInvocationOrderBy >; }) { const args = buildListSelectionArgs< FunctionInvocationSelect, FunctionInvocationFilter, FunctionInvocationOrderBy >(params.selection); return getClient().functionInvocation.findMany(args).unwrap(); } /** * Function invocation log — INSERT to call a function (business-layer, metered). Linked to definitions via function_definition_id FK, with task_identifier as the denormalized routing/audit slug. * * @example * ```ts * await prefetchFunctionInvocationsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchFunctionInvocationsQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, FunctionInvocationSelect>; } ): Promise; export async function prefetchFunctionInvocationsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< FunctionInvocationSelect, FunctionInvocationFilter, FunctionInvocationOrderBy >; } ): Promise { const args = buildListSelectionArgs< FunctionInvocationSelect, FunctionInvocationFilter, FunctionInvocationOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: functionInvocationKeys.list(args), queryFn: () => getClient().functionInvocation.findMany(args).unwrap(), }); }