/** * Commit history — each commit snapshots a tree root for a store * @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 { functionGraphCommitKeys } from '../query-keys'; import type { FunctionGraphCommitSelect, FunctionGraphCommitWithRelations, FunctionGraphCommitFilter, FunctionGraphCommitOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { FunctionGraphCommitSelect, FunctionGraphCommitWithRelations, FunctionGraphCommitFilter, FunctionGraphCommitOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const functionGraphCommitsQueryKey = functionGraphCommitKeys.list; /** * Commit history — each commit snapshots a tree root for a store * * @example * ```tsx * const { data, isLoading } = useFunctionGraphCommitsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function useFunctionGraphCommitsQuery< S extends FunctionGraphCommitSelect, TData = { functionGraphCommits: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, FunctionGraphCommitSelect>; } & Omit< UseQueryOptions< { functionGraphCommits: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function useFunctionGraphCommitsQuery( params: { selection: ListSelectionConfig< FunctionGraphCommitSelect, FunctionGraphCommitFilter, FunctionGraphCommitOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< FunctionGraphCommitSelect, FunctionGraphCommitFilter, FunctionGraphCommitOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: functionGraphCommitKeys.list(args), queryFn: () => getClient().functionGraphCommit.findMany(args).unwrap(), ...queryOptions, }); } /** * Commit history — each commit snapshots a tree root for a store * * @example * ```ts * const data = await fetchFunctionGraphCommitsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchFunctionGraphCommitsQuery(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, FunctionGraphCommitSelect>; }): Promise<{ functionGraphCommits: ConnectionResult>; }>; export async function fetchFunctionGraphCommitsQuery(params: { selection: ListSelectionConfig< FunctionGraphCommitSelect, FunctionGraphCommitFilter, FunctionGraphCommitOrderBy >; }) { const args = buildListSelectionArgs< FunctionGraphCommitSelect, FunctionGraphCommitFilter, FunctionGraphCommitOrderBy >(params.selection); return getClient().functionGraphCommit.findMany(args).unwrap(); } /** * Commit history — each commit snapshots a tree root for a store * * @example * ```ts * await prefetchFunctionGraphCommitsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchFunctionGraphCommitsQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, FunctionGraphCommitSelect>; } ): Promise; export async function prefetchFunctionGraphCommitsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< FunctionGraphCommitSelect, FunctionGraphCommitFilter, FunctionGraphCommitOrderBy >; } ): Promise { const args = buildListSelectionArgs< FunctionGraphCommitSelect, FunctionGraphCommitFilter, FunctionGraphCommitOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: functionGraphCommitKeys.list(args), queryFn: () => getClient().functionGraphCommit.findMany(args).unwrap(), }); }