/** * Spec rulebook for DB-driven resources — merkle-versioned head over the infra store; enforced by the generated admission gate via infra_utils.check_resource_admission * @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 { platformK8sSpecRuleKeys } from '../query-keys'; import type { PlatformK8sSpecRuleSelect, PlatformK8sSpecRuleWithRelations, PlatformK8sSpecRuleFilter, PlatformK8sSpecRuleOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformK8sSpecRuleSelect, PlatformK8sSpecRuleWithRelations, PlatformK8sSpecRuleFilter, PlatformK8sSpecRuleOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformK8sSpecRulesQueryKey = platformK8sSpecRuleKeys.list; /** * Spec rulebook for DB-driven resources — merkle-versioned head over the infra store; enforced by the generated admission gate via infra_utils.check_resource_admission * * @example * ```tsx * const { data, isLoading } = usePlatformK8sSpecRulesQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformK8sSpecRulesQuery< S extends PlatformK8sSpecRuleSelect, TData = { platformK8sSpecRules: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformK8sSpecRuleSelect>; } & Omit< UseQueryOptions< { platformK8sSpecRules: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformK8sSpecRulesQuery( params: { selection: ListSelectionConfig< PlatformK8sSpecRuleSelect, PlatformK8sSpecRuleFilter, PlatformK8sSpecRuleOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformK8sSpecRuleSelect, PlatformK8sSpecRuleFilter, PlatformK8sSpecRuleOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformK8sSpecRuleKeys.list(args), queryFn: () => getClient().platformK8sSpecRule.findMany(args).unwrap(), ...queryOptions, }); } /** * Spec rulebook for DB-driven resources — merkle-versioned head over the infra store; enforced by the generated admission gate via infra_utils.check_resource_admission * * @example * ```ts * const data = await fetchPlatformK8sSpecRulesQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformK8sSpecRulesQuery(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformK8sSpecRuleSelect>; }): Promise<{ platformK8sSpecRules: ConnectionResult>; }>; export async function fetchPlatformK8sSpecRulesQuery(params: { selection: ListSelectionConfig< PlatformK8sSpecRuleSelect, PlatformK8sSpecRuleFilter, PlatformK8sSpecRuleOrderBy >; }) { const args = buildListSelectionArgs< PlatformK8sSpecRuleSelect, PlatformK8sSpecRuleFilter, PlatformK8sSpecRuleOrderBy >(params.selection); return getClient().platformK8sSpecRule.findMany(args).unwrap(); } /** * Spec rulebook for DB-driven resources — merkle-versioned head over the infra store; enforced by the generated admission gate via infra_utils.check_resource_admission * * @example * ```ts * await prefetchPlatformK8sSpecRulesQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformK8sSpecRulesQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformK8sSpecRuleSelect>; } ): Promise; export async function prefetchPlatformK8sSpecRulesQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformK8sSpecRuleSelect, PlatformK8sSpecRuleFilter, PlatformK8sSpecRuleOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformK8sSpecRuleSelect, PlatformK8sSpecRuleFilter, PlatformK8sSpecRuleOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformK8sSpecRuleKeys.list(args), queryFn: () => getClient().platformK8sSpecRule.findMany(args).unwrap(), }); }