/** * Flow graph definitions — FBP graphs stored in the dedicated graph Merkle store * @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 { databaseFunctionGraphKeys } from '../query-keys'; import type { DatabaseFunctionGraphSelect, DatabaseFunctionGraphWithRelations, DatabaseFunctionGraphFilter, DatabaseFunctionGraphOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { DatabaseFunctionGraphSelect, DatabaseFunctionGraphWithRelations, DatabaseFunctionGraphFilter, DatabaseFunctionGraphOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const databaseFunctionGraphsQueryKey = databaseFunctionGraphKeys.list; /** * Flow graph definitions — FBP graphs stored in the dedicated graph Merkle store * * @example * ```tsx * const { data, isLoading } = useDatabaseFunctionGraphsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function useDatabaseFunctionGraphsQuery< S extends DatabaseFunctionGraphSelect, TData = { databaseFunctionGraphs: ConnectionResult< InferSelectResult >; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, DatabaseFunctionGraphSelect>; } & Omit< UseQueryOptions< { databaseFunctionGraphs: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useDatabaseFunctionGraphsQuery( params: { selection: ListSelectionConfig< DatabaseFunctionGraphSelect, DatabaseFunctionGraphFilter, DatabaseFunctionGraphOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< DatabaseFunctionGraphSelect, DatabaseFunctionGraphFilter, DatabaseFunctionGraphOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: databaseFunctionGraphKeys.list(args), queryFn: () => getClient().databaseFunctionGraph.findMany(args).unwrap(), ...queryOptions, }); } /** * Flow graph definitions — FBP graphs stored in the dedicated graph Merkle store * * @example * ```ts * const data = await fetchDatabaseFunctionGraphsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchDatabaseFunctionGraphsQuery< S extends DatabaseFunctionGraphSelect, >(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, DatabaseFunctionGraphSelect>; }): Promise<{ databaseFunctionGraphs: ConnectionResult< InferSelectResult >; }>; export async function fetchDatabaseFunctionGraphsQuery(params: { selection: ListSelectionConfig< DatabaseFunctionGraphSelect, DatabaseFunctionGraphFilter, DatabaseFunctionGraphOrderBy >; }) { const args = buildListSelectionArgs< DatabaseFunctionGraphSelect, DatabaseFunctionGraphFilter, DatabaseFunctionGraphOrderBy >(params.selection); return getClient().databaseFunctionGraph.findMany(args).unwrap(); } /** * Flow graph definitions — FBP graphs stored in the dedicated graph Merkle store * * @example * ```ts * await prefetchDatabaseFunctionGraphsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchDatabaseFunctionGraphsQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, DatabaseFunctionGraphSelect>; } ): Promise; export async function prefetchDatabaseFunctionGraphsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< DatabaseFunctionGraphSelect, DatabaseFunctionGraphFilter, DatabaseFunctionGraphOrderBy >; } ): Promise { const args = buildListSelectionArgs< DatabaseFunctionGraphSelect, DatabaseFunctionGraphFilter, DatabaseFunctionGraphOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: databaseFunctionGraphKeys.list(args), queryFn: () => getClient().databaseFunctionGraph.findMany(args).unwrap(), }); }