/** * Scope-aware plaintext internal config store. No namespace_module dependency and no K8s synchronization: values are read from the database at invocation time. Configuration that must be projected into a Kubernetes ConfigMap belongs in infra_config_module. * @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 { internalConfigModuleKeys } from '../query-keys'; import type { InternalConfigModuleSelect, InternalConfigModuleWithRelations, InternalConfigModuleFilter, InternalConfigModuleOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { InternalConfigModuleSelect, InternalConfigModuleWithRelations, InternalConfigModuleFilter, InternalConfigModuleOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const internalConfigModulesQueryKey = internalConfigModuleKeys.list; /** * Scope-aware plaintext internal config store. No namespace_module dependency and no K8s synchronization: values are read from the database at invocation time. Configuration that must be projected into a Kubernetes ConfigMap belongs in infra_config_module. * * @example * ```tsx * const { data, isLoading } = useInternalConfigModulesQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function useInternalConfigModulesQuery< S extends InternalConfigModuleSelect, TData = { internalConfigModules: ConnectionResult< InferSelectResult >; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, InternalConfigModuleSelect>; } & Omit< UseQueryOptions< { internalConfigModules: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useInternalConfigModulesQuery( params: { selection: ListSelectionConfig< InternalConfigModuleSelect, InternalConfigModuleFilter, InternalConfigModuleOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< InternalConfigModuleSelect, InternalConfigModuleFilter, InternalConfigModuleOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: internalConfigModuleKeys.list(args), queryFn: () => getClient().internalConfigModule.findMany(args).unwrap(), ...queryOptions, }); } /** * Scope-aware plaintext internal config store. No namespace_module dependency and no K8s synchronization: values are read from the database at invocation time. Configuration that must be projected into a Kubernetes ConfigMap belongs in infra_config_module. * * @example * ```ts * const data = await fetchInternalConfigModulesQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchInternalConfigModulesQuery< S extends InternalConfigModuleSelect, >(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, InternalConfigModuleSelect>; }): Promise<{ internalConfigModules: ConnectionResult>; }>; export async function fetchInternalConfigModulesQuery(params: { selection: ListSelectionConfig< InternalConfigModuleSelect, InternalConfigModuleFilter, InternalConfigModuleOrderBy >; }) { const args = buildListSelectionArgs< InternalConfigModuleSelect, InternalConfigModuleFilter, InternalConfigModuleOrderBy >(params.selection); return getClient().internalConfigModule.findMany(args).unwrap(); } /** * Scope-aware plaintext internal config store. No namespace_module dependency and no K8s synchronization: values are read from the database at invocation time. Configuration that must be projected into a Kubernetes ConfigMap belongs in infra_config_module. * * @example * ```ts * await prefetchInternalConfigModulesQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchInternalConfigModulesQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, InternalConfigModuleSelect>; } ): Promise; export async function prefetchInternalConfigModulesQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< InternalConfigModuleSelect, InternalConfigModuleFilter, InternalConfigModuleOrderBy >; } ): Promise { const args = buildListSelectionArgs< InternalConfigModuleSelect, InternalConfigModuleFilter, InternalConfigModuleOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: internalConfigModuleKeys.list(args), queryFn: () => getClient().internalConfigModule.findMany(args).unwrap(), }); }