/** * Function schedules — user-facing cron schedules synced into the worker scheduler (app_jobs.scheduled_jobs) * @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 { platformFunctionScheduleKeys } from '../query-keys'; import type { PlatformFunctionScheduleSelect, PlatformFunctionScheduleWithRelations, PlatformFunctionScheduleFilter, PlatformFunctionScheduleOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformFunctionScheduleSelect, PlatformFunctionScheduleWithRelations, PlatformFunctionScheduleFilter, PlatformFunctionScheduleOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformFunctionSchedulesQueryKey = platformFunctionScheduleKeys.list; /** * Function schedules — user-facing cron schedules synced into the worker scheduler (app_jobs.scheduled_jobs) * * @example * ```tsx * const { data, isLoading } = usePlatformFunctionSchedulesQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformFunctionSchedulesQuery< S extends PlatformFunctionScheduleSelect, TData = { platformFunctionSchedules: ConnectionResult< InferSelectResult >; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformFunctionScheduleSelect>; } & Omit< UseQueryOptions< { platformFunctionSchedules: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformFunctionSchedulesQuery( params: { selection: ListSelectionConfig< PlatformFunctionScheduleSelect, PlatformFunctionScheduleFilter, PlatformFunctionScheduleOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformFunctionScheduleSelect, PlatformFunctionScheduleFilter, PlatformFunctionScheduleOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformFunctionScheduleKeys.list(args), queryFn: () => getClient().platformFunctionSchedule.findMany(args).unwrap(), ...queryOptions, }); } /** * Function schedules — user-facing cron schedules synced into the worker scheduler (app_jobs.scheduled_jobs) * * @example * ```ts * const data = await fetchPlatformFunctionSchedulesQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformFunctionSchedulesQuery< S extends PlatformFunctionScheduleSelect, >(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformFunctionScheduleSelect>; }): Promise<{ platformFunctionSchedules: ConnectionResult< InferSelectResult >; }>; export async function fetchPlatformFunctionSchedulesQuery(params: { selection: ListSelectionConfig< PlatformFunctionScheduleSelect, PlatformFunctionScheduleFilter, PlatformFunctionScheduleOrderBy >; }) { const args = buildListSelectionArgs< PlatformFunctionScheduleSelect, PlatformFunctionScheduleFilter, PlatformFunctionScheduleOrderBy >(params.selection); return getClient().platformFunctionSchedule.findMany(args).unwrap(); } /** * Function schedules — user-facing cron schedules synced into the worker scheduler (app_jobs.scheduled_jobs) * * @example * ```ts * await prefetchPlatformFunctionSchedulesQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformFunctionSchedulesQuery< S extends PlatformFunctionScheduleSelect, >( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformFunctionScheduleSelect>; } ): Promise; export async function prefetchPlatformFunctionSchedulesQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformFunctionScheduleSelect, PlatformFunctionScheduleFilter, PlatformFunctionScheduleOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformFunctionScheduleSelect, PlatformFunctionScheduleFilter, PlatformFunctionScheduleOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformFunctionScheduleKeys.list(args), queryFn: () => getClient().platformFunctionSchedule.findMany(args).unwrap(), }); }