Skip to content

Instantly share code, notes, and snippets.

@colinhacks
Created January 28, 2019 22:03
Show Gist options
  • Save colinhacks/ee04fe66f8f209698e98878e3fbd6786 to your computer and use it in GitHub Desktop.
Save colinhacks/ee04fe66f8f209698e98878e3fbd6786 to your computer and use it in GitHub Desktop.
import { typeDefs as prismaSchema } from './client/prisma-schema';
const prismaAST = gql`
${prismaSchema}
`;
/*
remove the built-in Mutation and Query objects
from the Prisma Client schema
*/
const modifiedAST: DocumentNode = {
kind: 'Document',
definitions: prismaAST.definitions.filter(
def =>
def.kind !== 'ObjectTypeDefinition' || // keep all other definitions (Inputs, Enums, etc)
!['Query', 'Mutation'].includes(
(def as ObjectTypeDefinitionNode).name.value
) // keep if name of type is NOT "Query" or "Mutation"
),
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment