I'm currently in the process of integrating a new plugin into my ApolloServer GraphQL API that is designed to log the output of the endpoint by utilizing an argument provided as the key.
However, upon executing a query, it seems to appear as follows:
query($x: String!, $y: String!, $z: String!) {
foo(user: { a: $x, b: $y, c: $z }) {
bar
}
}
The structure of the plugin is as shown below:
{
requestDidStart() {
return {
willSendResponse({ response }: {response: GraphQLResponse }) {
console.log(`user ${ARGS.A} has made a request`);
console.log('response sent to user': response);
},
}
}
}
My attempts to access the variables from the request have been unsuccessful, mainly due to the fact that the variables can be named in any way by the client. Is there a more efficient method to access args
within the plugin?