Separate system operations from core objects in GraphQL endpoints (#12977)

Moves system-level operations (auth, billing, admin) to use the
/metadata endpoint instead of /graphql.

This cleans up the endpoint separation so /graphql is purely for core
objects (Company, People, etc.) and /metadata handles all system
operations.

Part of prep work for webhook/API key core migration.
This commit is contained in:
nitin
2025-07-01 21:59:32 +05:30
committed by GitHub
parent 76c517aa29
commit d2ddd6f473
229 changed files with 9425 additions and 8804 deletions
@@ -1,24 +1,25 @@
import { useApolloClient, useMutation } from '@apollo/client';
import { useMutation } from '@apollo/client';
import { triggerUpdateRecordOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerUpdateRecordOptimisticEffect';
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { modifyRecordFromCache } from '@/object-record/cache/utils/modifyRecordFromCache';
import { DEACTIVATE_WORKFLOW_VERSION } from '@/workflow/graphql/mutations/deactivateWorkflowVersion';
import { WorkflowVersion } from '@/workflow/types/Workflow';
import { isDefined } from 'twenty-shared/utils';
import {
DeactivateWorkflowVersionMutation,
DeactivateWorkflowVersionMutationVariables,
} from '~/generated/graphql';
import { isDefined } from 'twenty-shared/utils';
} from '~/generated-metadata/graphql';
export const useDeactivateWorkflowVersion = () => {
const apolloClient = useApolloClient();
const apolloCoreClient = useApolloCoreClient();
const [mutate] = useMutation<
DeactivateWorkflowVersionMutation,
DeactivateWorkflowVersionMutationVariables
>(DEACTIVATE_WORKFLOW_VERSION, {
client: apolloClient,
client: apolloCoreClient,
});
const { objectMetadataItem: objectMetadataItemWorkflowVersion } =
@@ -37,7 +38,7 @@ export const useDeactivateWorkflowVersion = () => {
},
update: () => {
modifyRecordFromCache({
cache: apolloClient.cache,
cache: apolloCoreClient.cache,
recordId: workflowVersionId,
objectMetadataItem: objectMetadataItemWorkflowVersion,
fieldModifiers: {
@@ -45,7 +46,7 @@ export const useDeactivateWorkflowVersion = () => {
},
});
const cacheSnapshot = apolloClient.cache.extract();
const cacheSnapshot = apolloCoreClient.cache.extract();
const workflowVersion: WorkflowVersion | undefined = Object.values(
cacheSnapshot,
).find(
@@ -59,7 +60,7 @@ export const useDeactivateWorkflowVersion = () => {
}
triggerUpdateRecordOptimisticEffect({
cache: apolloClient.cache,
cache: apolloCoreClient.cache,
objectMetadataItem: objectMetadataItemWorkflowVersion,
currentRecord: workflowVersion,
updatedRecord: {