/** * Config row for the session_secrets_module, which provisions a DB-private, session-scoped ephemeral key-value store for challenges, nonces, and one-time tokens that must never be readable by end users. * @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 { sessionSecretsModuleKeys } from '../query-keys'; import type { SessionSecretsModuleSelect, SessionSecretsModuleWithRelations, SessionSecretsModuleFilter, SessionSecretsModuleOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { SessionSecretsModuleSelect, SessionSecretsModuleWithRelations, SessionSecretsModuleFilter, SessionSecretsModuleOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const sessionSecretsModulesQueryKey = sessionSecretsModuleKeys.list; /** * Config row for the session_secrets_module, which provisions a DB-private, session-scoped ephemeral key-value store for challenges, nonces, and one-time tokens that must never be readable by end users. * * @example * ```tsx * const { data, isLoading } = useSessionSecretsModulesQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function useSessionSecretsModulesQuery< S extends SessionSecretsModuleSelect, TData = { sessionSecretsModules: ConnectionResult< InferSelectResult >; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, SessionSecretsModuleSelect>; } & Omit< UseQueryOptions< { sessionSecretsModules: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useSessionSecretsModulesQuery( params: { selection: ListSelectionConfig< SessionSecretsModuleSelect, SessionSecretsModuleFilter, SessionSecretsModuleOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< SessionSecretsModuleSelect, SessionSecretsModuleFilter, SessionSecretsModuleOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: sessionSecretsModuleKeys.list(args), queryFn: () => getClient().sessionSecretsModule.findMany(args).unwrap(), ...queryOptions, }); } /** * Config row for the session_secrets_module, which provisions a DB-private, session-scoped ephemeral key-value store for challenges, nonces, and one-time tokens that must never be readable by end users. * * @example * ```ts * const data = await fetchSessionSecretsModulesQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchSessionSecretsModulesQuery< S extends SessionSecretsModuleSelect, >(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, SessionSecretsModuleSelect>; }): Promise<{ sessionSecretsModules: ConnectionResult>; }>; export async function fetchSessionSecretsModulesQuery(params: { selection: ListSelectionConfig< SessionSecretsModuleSelect, SessionSecretsModuleFilter, SessionSecretsModuleOrderBy >; }) { const args = buildListSelectionArgs< SessionSecretsModuleSelect, SessionSecretsModuleFilter, SessionSecretsModuleOrderBy >(params.selection); return getClient().sessionSecretsModule.findMany(args).unwrap(); } /** * Config row for the session_secrets_module, which provisions a DB-private, session-scoped ephemeral key-value store for challenges, nonces, and one-time tokens that must never be readable by end users. * * @example * ```ts * await prefetchSessionSecretsModulesQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchSessionSecretsModulesQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, SessionSecretsModuleSelect>; } ): Promise; export async function prefetchSessionSecretsModulesQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< SessionSecretsModuleSelect, SessionSecretsModuleFilter, SessionSecretsModuleOrderBy >; } ): Promise { const args = buildListSelectionArgs< SessionSecretsModuleSelect, SessionSecretsModuleFilter, SessionSecretsModuleOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: sessionSecretsModuleKeys.list(args), queryFn: () => getClient().sessionSecretsModule.findMany(args).unwrap(), }); }