/** * Append-only log of limit events for historical reporting and audit * @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 { appLimitEventKeys } from '../query-keys'; import type { AppLimitEventSelect, AppLimitEventWithRelations, AppLimitEventFilter, AppLimitEventOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { AppLimitEventSelect, AppLimitEventWithRelations, AppLimitEventFilter, AppLimitEventOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const appLimitEventsQueryKey = appLimitEventKeys.list; /** * Append-only log of limit events for historical reporting and audit * * @example * ```tsx * const { data, isLoading } = useAppLimitEventsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function useAppLimitEventsQuery< S extends AppLimitEventSelect, TData = { appLimitEvents: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, AppLimitEventSelect>; } & Omit< UseQueryOptions< { appLimitEvents: ConnectionResult>; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useAppLimitEventsQuery( params: { selection: ListSelectionConfig; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< AppLimitEventSelect, AppLimitEventFilter, AppLimitEventOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: appLimitEventKeys.list(args), queryFn: () => getClient().appLimitEvent.findMany(args).unwrap(), ...queryOptions, }); } /** * Append-only log of limit events for historical reporting and audit * * @example * ```ts * const data = await fetchAppLimitEventsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchAppLimitEventsQuery(params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, AppLimitEventSelect>; }): Promise<{ appLimitEvents: ConnectionResult>; }>; export async function fetchAppLimitEventsQuery(params: { selection: ListSelectionConfig; }) { const args = buildListSelectionArgs< AppLimitEventSelect, AppLimitEventFilter, AppLimitEventOrderBy >(params.selection); return getClient().appLimitEvent.findMany(args).unwrap(); } /** * Append-only log of limit events for historical reporting and audit * * @example * ```ts * await prefetchAppLimitEventsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchAppLimitEventsQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit, 'fields'> & HookStrictSelect, AppLimitEventSelect>; } ): Promise; export async function prefetchAppLimitEventsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig; } ): Promise { const args = buildListSelectionArgs< AppLimitEventSelect, AppLimitEventFilter, AppLimitEventOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: appLimitEventKeys.list(args), queryFn: () => getClient().appLimitEvent.findMany(args).unwrap(), }); }