/** * Namespace-backed plaintext key-value config store (like a k8s ConfigMap); admin-only, fully CRUD-exposed * @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 { platformConfigKeys } from '../query-keys'; import type { PlatformConfigSelect, PlatformConfigWithRelations, PlatformConfigFilter, PlatformConfigOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformConfigSelect, PlatformConfigWithRelations, PlatformConfigFilter, PlatformConfigOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformConfigsQueryKey = platformConfigKeys.list; /** * Namespace-backed plaintext key-value config store (like a k8s ConfigMap); admin-only, fully CRUD-exposed * * @example * ```tsx * const { data, isLoading } = usePlatformConfigsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformConfigsQuery< S extends PlatformConfigSelect, TData = { platformConfigs: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, PlatformConfigSelect>; } & Omit< UseQueryOptions< { platformConfigs: ConnectionResult>; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformConfigsQuery( params: { selection: ListSelectionConfig< PlatformConfigSelect, PlatformConfigFilter, PlatformConfigOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformConfigSelect, PlatformConfigFilter, PlatformConfigOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformConfigKeys.list(args), queryFn: () => getClient().platformConfig.findMany(args).unwrap(), ...queryOptions, }); } /** * Namespace-backed plaintext key-value config store (like a k8s ConfigMap); admin-only, fully CRUD-exposed * * @example * ```ts * const data = await fetchPlatformConfigsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformConfigsQuery(params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, PlatformConfigSelect>; }): Promise<{ platformConfigs: ConnectionResult>; }>; export async function fetchPlatformConfigsQuery(params: { selection: ListSelectionConfig; }) { const args = buildListSelectionArgs< PlatformConfigSelect, PlatformConfigFilter, PlatformConfigOrderBy >(params.selection); return getClient().platformConfig.findMany(args).unwrap(); } /** * Namespace-backed plaintext key-value config store (like a k8s ConfigMap); admin-only, fully CRUD-exposed * * @example * ```ts * await prefetchPlatformConfigsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformConfigsQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, PlatformConfigSelect>; } ): Promise; export async function prefetchPlatformConfigsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformConfigSelect, PlatformConfigFilter, PlatformConfigOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformConfigSelect, PlatformConfigFilter, PlatformConfigOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformConfigKeys.list(args), queryFn: () => getClient().platformConfig.findMany(args).unwrap(), }); }