Created
January 28, 2019 22:03
-
-
Save colinhacks/ee04fe66f8f209698e98878e3fbd6786 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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