/** * Durable webhook acceptance log — one row per accepted delivery, deduplicated on (endpoint_id, external_event_id), linked to the pending function invocation it enqueued * @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 { platformWebhookEventKeys } from '../query-keys'; import { platformWebhookEventMutationKeys } from '../mutation-keys'; import type { PlatformWebhookEventSelect, PlatformWebhookEventWithRelations, PlatformWebhookEventPatch, } from '../../orm/input-types'; import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types'; export type { PlatformWebhookEventSelect, PlatformWebhookEventWithRelations, PlatformWebhookEventPatch, } from '../../orm/input-types'; /** * Durable webhook acceptance log — one row per accepted delivery, deduplicated on (endpoint_id, external_event_id), linked to the pending function invocation it enqueued * * @example * ```tsx * const { mutate, isPending } = useUpdatePlatformWebhookEventMutation({ * selection: { fields: { id: true, name: true } }, * }); * * mutate({ id: 'value-here', platformWebhookEventPatch: { name: 'Updated' } }); * ``` */ export function useUpdatePlatformWebhookEventMutation( params: { selection: { fields: S & PlatformWebhookEventSelect; } & HookStrictSelect, PlatformWebhookEventSelect>; } & Omit< UseMutationOptions< { updatePlatformWebhookEvent: { platformWebhookEvent: InferSelectResult; }; }, Error, { id: string; platformWebhookEventPatch: PlatformWebhookEventPatch; } >, 'mutationFn' > ): UseMutationResult< { updatePlatformWebhookEvent: { platformWebhookEvent: InferSelectResult; }; }, Error, { id: string; platformWebhookEventPatch: PlatformWebhookEventPatch; } >; export function useUpdatePlatformWebhookEventMutation( params: { selection: SelectionConfig; } & Omit< UseMutationOptions< any, Error, { id: string; platformWebhookEventPatch: PlatformWebhookEventPatch; } >, 'mutationFn' > ) { const args = buildSelectionArgs(params.selection); const { selection: _selection, ...mutationOptions } = params ?? {}; void _selection; const queryClient = useQueryClient(); return useMutation({ mutationKey: platformWebhookEventMutationKeys.all, mutationFn: ({ id, platformWebhookEventPatch, }: { id: string; platformWebhookEventPatch: PlatformWebhookEventPatch; }) => getClient() .platformWebhookEvent.update({ where: { id, }, data: platformWebhookEventPatch, select: args.select, }) .unwrap(), onSuccess: (_, variables) => { queryClient.invalidateQueries({ queryKey: platformWebhookEventKeys.detail(variables.id), }); queryClient.invalidateQueries({ queryKey: platformWebhookEventKeys.lists(), }); }, ...mutationOptions, }); }