/** * Function definitions — registered cloud functions with routing, queue, and retry configuration * @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 { platformFunctionDefinitionKeys } from '../query-keys'; import type { PlatformFunctionDefinitionSelect, PlatformFunctionDefinitionWithRelations, PlatformFunctionDefinitionFilter, PlatformFunctionDefinitionOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformFunctionDefinitionSelect, PlatformFunctionDefinitionWithRelations, PlatformFunctionDefinitionFilter, PlatformFunctionDefinitionOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformFunctionDefinitionsQueryKey = platformFunctionDefinitionKeys.list; /** * Function definitions — registered cloud functions with routing, queue, and retry configuration * * @example * ```tsx * const { data, isLoading } = usePlatformFunctionDefinitionsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformFunctionDefinitionsQuery< S extends PlatformFunctionDefinitionSelect, TData = { platformFunctionDefinitions: ConnectionResult< InferSelectResult >; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformFunctionDefinitionSelect>; } & Omit< UseQueryOptions< { platformFunctionDefinitions: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformFunctionDefinitionsQuery( params: { selection: ListSelectionConfig< PlatformFunctionDefinitionSelect, PlatformFunctionDefinitionFilter, PlatformFunctionDefinitionOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformFunctionDefinitionSelect, PlatformFunctionDefinitionFilter, PlatformFunctionDefinitionOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformFunctionDefinitionKeys.list(args), queryFn: () => getClient().platformFunctionDefinition.findMany(args).unwrap(), ...queryOptions, }); } /** * Function definitions — registered cloud functions with routing, queue, and retry configuration * * @example * ```ts * const data = await fetchPlatformFunctionDefinitionsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformFunctionDefinitionsQuery< S extends PlatformFunctionDefinitionSelect, >(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformFunctionDefinitionSelect>; }): Promise<{ platformFunctionDefinitions: ConnectionResult< InferSelectResult >; }>; export async function fetchPlatformFunctionDefinitionsQuery(params: { selection: ListSelectionConfig< PlatformFunctionDefinitionSelect, PlatformFunctionDefinitionFilter, PlatformFunctionDefinitionOrderBy >; }) { const args = buildListSelectionArgs< PlatformFunctionDefinitionSelect, PlatformFunctionDefinitionFilter, PlatformFunctionDefinitionOrderBy >(params.selection); return getClient().platformFunctionDefinition.findMany(args).unwrap(); } /** * Function definitions — registered cloud functions with routing, queue, and retry configuration * * @example * ```ts * await prefetchPlatformFunctionDefinitionsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformFunctionDefinitionsQuery< S extends PlatformFunctionDefinitionSelect, >( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformFunctionDefinitionSelect>; } ): Promise; export async function prefetchPlatformFunctionDefinitionsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformFunctionDefinitionSelect, PlatformFunctionDefinitionFilter, PlatformFunctionDefinitionOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformFunctionDefinitionSelect, PlatformFunctionDefinitionFilter, PlatformFunctionDefinitionOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformFunctionDefinitionKeys.list(args), queryFn: () => getClient().platformFunctionDefinition.findMany(args).unwrap(), }); }