/** * Provisions the platform-managed Kubernetes admission catalogs: a kinds table and a spec-rules table, Merkle-versioned through the referenced merkle_store_module, whose rows the generated admission gate on resources/resource_definitions reads. Writes are platform-admin and human-only; every scope reads the one catalog. * @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 { k8sAdmissionModuleKeys } from '../query-keys'; import { k8sAdmissionModuleMutationKeys } from '../mutation-keys'; import type { K8sAdmissionModuleSelect, K8sAdmissionModuleWithRelations, } from '../../orm/input-types'; import type { InferSelectResult, HookStrictSelect } from '../../orm/select-types'; export type { K8sAdmissionModuleSelect, K8sAdmissionModuleWithRelations, } from '../../orm/input-types'; /** * Provisions the platform-managed Kubernetes admission catalogs: a kinds table and a spec-rules table, Merkle-versioned through the referenced merkle_store_module, whose rows the generated admission gate on resources/resource_definitions reads. Writes are platform-admin and human-only; every scope reads the one catalog. * * @example * ```tsx * const { mutate, isPending } = useDeleteK8sAdmissionModuleMutation({ * selection: { fields: { id: true } }, * }); * * mutate({ id: 'value-to-delete' }); * ``` */ export function useDeleteK8sAdmissionModuleMutation( params: { selection: { fields: S & K8sAdmissionModuleSelect; } & HookStrictSelect, K8sAdmissionModuleSelect>; } & Omit< UseMutationOptions< { deleteK8sAdmissionModule: { k8sAdmissionModule: InferSelectResult; }; }, Error, { id: string; } >, 'mutationFn' > ): UseMutationResult< { deleteK8sAdmissionModule: { k8sAdmissionModule: InferSelectResult; }; }, Error, { id: string; } >; export function useDeleteK8sAdmissionModuleMutation( params: { selection: SelectionConfig; } & Omit< UseMutationOptions< any, Error, { id: string; } >, 'mutationFn' > ) { const args = buildSelectionArgs(params.selection); const { selection: _selection, ...mutationOptions } = params ?? {}; void _selection; const queryClient = useQueryClient(); return useMutation({ mutationKey: k8sAdmissionModuleMutationKeys.all, mutationFn: ({ id }: { id: string }) => getClient() .k8sAdmissionModule.delete({ where: { id, }, select: args.select, }) .unwrap(), onSuccess: (_, variables) => { queryClient.removeQueries({ queryKey: k8sAdmissionModuleKeys.detail(variables.id), }); queryClient.invalidateQueries({ queryKey: k8sAdmissionModuleKeys.lists(), }); }, ...mutationOptions, }); }