/** * 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 { buildSelectionArgs } from '../selection'; import type { SelectionConfig } from '../selection'; import { platformFunctionInvocationKeys } from '../query-keys'; import type { PlatformFunctionInvocationSelect, PlatformFunctionInvocationWithRelations, } from '../../orm/input-types'; import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types'; export type { PlatformFunctionInvocationSelect, PlatformFunctionInvocationWithRelations, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformFunctionInvocationQueryKey = platformFunctionInvocationKeys.detail; /** * 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 } = usePlatformFunctionInvocationQuery({ * id: 'some-id', * selection: { fields: { id: true, name: true } }, * }); * ``` */ export function usePlatformFunctionInvocationQuery< S extends PlatformFunctionInvocationSelect, TData = { platformFunctionInvocation: InferSelectResult< PlatformFunctionInvocationWithRelations, S > | null; }, >( params: { id: string; selection: { fields: S; } & HookStrictSelect, PlatformFunctionInvocationSelect>; } & Omit< UseQueryOptions< { platformFunctionInvocation: InferSelectResult< PlatformFunctionInvocationWithRelations, S > | null; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformFunctionInvocationQuery( params: { id: string; selection: SelectionConfig; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildSelectionArgs(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformFunctionInvocationKeys.detail(params.id), queryFn: () => getClient() .platformFunctionInvocation.findOne({ id: params.id, select: args.select, }) .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 fetchPlatformFunctionInvocationQuery({ * id: 'some-id', * selection: { fields: { id: true } }, * }); * ``` */ export async function fetchPlatformFunctionInvocationQuery< S extends PlatformFunctionInvocationSelect, >(params: { id: string; selection: { fields: S; } & HookStrictSelect, PlatformFunctionInvocationSelect>; }): Promise<{ platformFunctionInvocation: InferSelectResult | null; }>; export async function fetchPlatformFunctionInvocationQuery(params: { id: string; selection: SelectionConfig; }): Promise { const args = buildSelectionArgs(params.selection); return getClient() .platformFunctionInvocation.findOne({ id: params.id, select: args.select, }) .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 prefetchPlatformFunctionInvocationQuery(queryClient, { id: 'some-id', selection: { fields: { id: true } } }); * ``` */ export async function prefetchPlatformFunctionInvocationQuery< S extends PlatformFunctionInvocationSelect, >( queryClient: QueryClient, params: { id: string; selection: { fields: S; } & HookStrictSelect, PlatformFunctionInvocationSelect>; } ): Promise; export async function prefetchPlatformFunctionInvocationQuery( queryClient: QueryClient, params: { id: string; selection: SelectionConfig; } ): Promise { const args = buildSelectionArgs(params.selection); await queryClient.prefetchQuery({ queryKey: platformFunctionInvocationKeys.detail(params.id), queryFn: () => getClient() .platformFunctionInvocation.findOne({ id: params.id, select: args.select, }) .unwrap(), }); }