/** * Custom query hook for signInOptions * @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 { customQueryKeys } from '../query-keys'; import type { SignInOptionsRecordSelect, SignInOptionsRecord } from '../../orm/input-types'; import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types'; export type { SignInOptionsRecordSelect } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const signInOptionsQueryKey = customQueryKeys.signInOptions; /** * Query hook for signInOptions * * @example * ```tsx * const { data, isLoading } = useSignInOptionsQuery({ selection: { fields: { id: true } } }); * * if (data?.signInOptions) { * console.log(data.signInOptions); * } * ``` */ export function useSignInOptionsQuery< S extends SignInOptionsRecordSelect, TData = { signInOptions: InferSelectResult | null; }, >( params: { selection: { fields: S & SignInOptionsRecordSelect; } & HookStrictSelect, SignInOptionsRecordSelect>; } & Omit< UseQueryOptions< { signInOptions: InferSelectResult | null; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useSignInOptionsQuery( params: { selection: SelectionConfig; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildSelectionArgs(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: signInOptionsQueryKey(), queryFn: () => getClient() .query.signInOptions({ select: args.select, }) .unwrap(), ...queryOptions, }); } /** * Fetch signInOptions without React hooks * * @example * ```ts * const data = await fetchSignInOptionsQuery({ selection: { fields: { id: true } } }); * ``` */ export async function fetchSignInOptionsQuery(params: { selection: { fields: S & SignInOptionsRecordSelect; } & HookStrictSelect, SignInOptionsRecordSelect>; }): Promise<{ signInOptions: InferSelectResult | null; }>; export async function fetchSignInOptionsQuery(params: { selection: SelectionConfig; }) { const args = buildSelectionArgs(params.selection); return getClient() .query.signInOptions({ select: args.select, }) .unwrap(); } /** * Prefetch signInOptions for SSR or cache warming * * @example * ```ts * await prefetchSignInOptionsQuery(queryClient, { selection: { fields: { id: true } } }); * ``` */ export async function prefetchSignInOptionsQuery( queryClient: QueryClient, params: { selection: { fields: S & SignInOptionsRecordSelect; } & HookStrictSelect, SignInOptionsRecordSelect>; } ): Promise; export async function prefetchSignInOptionsQuery( queryClient: QueryClient, params: { selection: SelectionConfig; } ): Promise { const args = buildSelectionArgs(params.selection); await queryClient.prefetchQuery({ queryKey: signInOptionsQueryKey(), queryFn: () => getClient() .query.signInOptions({ select: args.select, }) .unwrap(), }); }