- improvements on serverless function behavior (autosave performances, deploy on execution only) - add versioning to serverless functions - add a publish endpoint to create a new version of a serverless function - add deploy and reset to lastVersion button in the settings section: <img width="736" alt="image" src="https://github.com/user-attachments/assets/2001f8d2-07a4-4f79-84dd-ec74b6f301d3">
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
|
import { ApolloClient, useMutation } from '@apollo/client';
|
|
import { getOperationName } from '@apollo/client/utilities';
|
|
import { DELETE_ONE_SERVERLESS_FUNCTION } from '@/settings/serverless-functions/graphql/mutations/deleteOneServerlessFunction';
|
|
import {
|
|
DeleteServerlessFunctionInput,
|
|
DeleteOneServerlessFunctionMutation,
|
|
DeleteOneServerlessFunctionMutationVariables,
|
|
} from '~/generated-metadata/graphql';
|
|
import { FIND_ONE_SERVERLESS_FUNCTION_SOURCE_CODE } from '@/settings/serverless-functions/graphql/queries/findOneServerlessFunctionSourceCode';
|
|
|
|
export const useDeleteOneServerlessFunction = () => {
|
|
const apolloMetadataClient = useApolloMetadataClient();
|
|
const [mutate] = useMutation<
|
|
DeleteOneServerlessFunctionMutation,
|
|
DeleteOneServerlessFunctionMutationVariables
|
|
>(DELETE_ONE_SERVERLESS_FUNCTION, {
|
|
client: apolloMetadataClient ?? ({} as ApolloClient<any>),
|
|
});
|
|
|
|
const deleteOneServerlessFunction = async (
|
|
input: DeleteServerlessFunctionInput,
|
|
) => {
|
|
return await mutate({
|
|
variables: {
|
|
input,
|
|
},
|
|
awaitRefetchQueries: true,
|
|
refetchQueries: [
|
|
getOperationName(FIND_ONE_SERVERLESS_FUNCTION_SOURCE_CODE) ?? '',
|
|
],
|
|
});
|
|
};
|
|
|
|
return { deleteOneServerlessFunction };
|
|
};
|