/** * Shared system prompt templates for agent conversations * @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 { platformAgentPromptKeys } from '../query-keys'; import type { PlatformAgentPromptSelect, PlatformAgentPromptWithRelations, PlatformAgentPromptFilter, PlatformAgentPromptOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformAgentPromptSelect, PlatformAgentPromptWithRelations, PlatformAgentPromptFilter, PlatformAgentPromptOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformAgentPromptsQueryKey = platformAgentPromptKeys.list; /** * Shared system prompt templates for agent conversations * * @example * ```tsx * const { data, isLoading } = usePlatformAgentPromptsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformAgentPromptsQuery< S extends PlatformAgentPromptSelect, TData = { platformAgentPrompts: ConnectionResult>; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformAgentPromptSelect>; } & Omit< UseQueryOptions< { platformAgentPrompts: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformAgentPromptsQuery( params: { selection: ListSelectionConfig< PlatformAgentPromptSelect, PlatformAgentPromptFilter, PlatformAgentPromptOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformAgentPromptSelect, PlatformAgentPromptFilter, PlatformAgentPromptOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformAgentPromptKeys.list(args), queryFn: () => getClient().platformAgentPrompt.findMany(args).unwrap(), ...queryOptions, }); } /** * Shared system prompt templates for agent conversations * * @example * ```ts * const data = await fetchPlatformAgentPromptsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformAgentPromptsQuery(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformAgentPromptSelect>; }): Promise<{ platformAgentPrompts: ConnectionResult>; }>; export async function fetchPlatformAgentPromptsQuery(params: { selection: ListSelectionConfig< PlatformAgentPromptSelect, PlatformAgentPromptFilter, PlatformAgentPromptOrderBy >; }) { const args = buildListSelectionArgs< PlatformAgentPromptSelect, PlatformAgentPromptFilter, PlatformAgentPromptOrderBy >(params.selection); return getClient().platformAgentPrompt.findMany(args).unwrap(); } /** * Shared system prompt templates for agent conversations * * @example * ```ts * await prefetchPlatformAgentPromptsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformAgentPromptsQuery( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformAgentPromptSelect>; } ): Promise; export async function prefetchPlatformAgentPromptsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformAgentPromptSelect, PlatformAgentPromptFilter, PlatformAgentPromptOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformAgentPromptSelect, PlatformAgentPromptFilter, PlatformAgentPromptOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformAgentPromptKeys.list(args), queryFn: () => getClient().platformAgentPrompt.findMany(args).unwrap(), }); }