/** * Function execution logs — structured console output per invocation * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { useMutation, useQueryClient } from '@tanstack/react-query'; import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query'; import { getClient } from '../client'; import { buildSelectionArgs } from '../selection'; import type { SelectionConfig } from '../selection'; import { platformFunctionExecutionLogKeys } from '../query-keys'; import { platformFunctionExecutionLogMutationKeys } from '../mutation-keys'; import type { PlatformFunctionExecutionLogSelect, PlatformFunctionExecutionLogWithRelations, } from '../../orm/input-types'; import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types'; export type { PlatformFunctionExecutionLogSelect, PlatformFunctionExecutionLogWithRelations, } from '../../orm/input-types'; /** * Function execution logs — structured console output per invocation * * @example * ```tsx * const { mutate, isPending } = useDeletePlatformFunctionExecutionLogMutation({ * selection: { fields: { id: true } }, * }); * * mutate({ id: 'value-to-delete' }); * ``` */ export function useDeletePlatformFunctionExecutionLogMutation< S extends PlatformFunctionExecutionLogSelect, >( params: { selection: { fields: S & PlatformFunctionExecutionLogSelect; } & HookStrictSelect, PlatformFunctionExecutionLogSelect>; } & Omit< UseMutationOptions< { deletePlatformFunctionExecutionLog: { platformFunctionExecutionLog: InferSelectResult< PlatformFunctionExecutionLogWithRelations, S >; }; }, Error, { id: string; createdAt: string; } >, 'mutationFn' > ): UseMutationResult< { deletePlatformFunctionExecutionLog: { platformFunctionExecutionLog: InferSelectResult; }; }, Error, { id: string; createdAt: string; } >; export function useDeletePlatformFunctionExecutionLogMutation( params: { selection: SelectionConfig; } & Omit< UseMutationOptions< any, Error, { id: string; createdAt: string; } >, 'mutationFn' > ) { const args = buildSelectionArgs(params.selection); const { selection: _selection, ...mutationOptions } = params ?? {}; void _selection; const queryClient = useQueryClient(); return useMutation({ mutationKey: platformFunctionExecutionLogMutationKeys.all, mutationFn: ({ id, createdAt }: { id: string; createdAt: string }) => getClient() .platformFunctionExecutionLog.delete({ where: { id, createdAt, }, select: args.select, }) .unwrap(), onSuccess: (_, variables) => { queryClient.removeQueries({ queryKey: platformFunctionExecutionLogKeys.detail(variables.id), }); queryClient.invalidateQueries({ queryKey: platformFunctionExecutionLogKeys.lists(), }); }, ...mutationOptions, }); }