You can add your own GraphQL queries and mutations to Payload, making use of all the types that Payload has defined for you.
To do so, add your queries and mutations to the main Payload config as follows:
|Function that returns an object containing keys to custom GraphQL queries|
|Function that returns an object containing keys to custom GraphQL mutations|
The above properties each receive a function that is defined with the following arguments:
This is Payload's GraphQL dependency. You should not install your own copy of GraphQL as a dependency due to underlying restrictions based on how GraphQL works. Instead, you can use the Payload-provided copy via this argument.
This is a copy of the currently running Payload instance, which provides you with existing GraphQL types for all of your Collections and Globals - among other things.
graphQL.mutations functions should return an object with properties equal to your newly written GraphQL queries and mutations.