/** * Custom mutation hook for setAndCommit * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { useMutation } 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 { customMutationKeys } from '../mutation-keys'; import type { SetAndCommitVariables } from '../../orm/mutation'; import type { SetAndCommitPayloadSelect, SetAndCommitPayload } from '../../orm/input-types'; import type { InferSelectResult, HookStrictSelect, StrictSelect } from '../../orm/select-types'; export type { SetAndCommitVariables } from '../../orm/mutation'; export type { SetAndCommitPayloadSelect } from '../../orm/input-types'; export function useSetAndCommitMutation( params: { selection: { fields: S & SetAndCommitPayloadSelect; } & HookStrictSelect, SetAndCommitPayloadSelect>; } & Omit< UseMutationOptions< { setAndCommit: InferSelectResult | null; }, Error, SetAndCommitVariables >, 'mutationFn' > ): UseMutationResult< { setAndCommit: InferSelectResult | null; }, Error, SetAndCommitVariables > { const args = buildSelectionArgs(params.selection); const { selection: _selection, ...mutationOptions } = params ?? {}; void _selection; return useMutation({ mutationKey: customMutationKeys.setAndCommit(), mutationFn: (variables: SetAndCommitVariables) => getClient() .mutation.setAndCommit(variables, { select: args.select, } as { select: S; } & StrictSelect) .unwrap(), ...mutationOptions, }); }