You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Example: log before and after each mutation runsmodule.exports=makeWrapResolversPlugin(context=>{if(context.scope.isRootMutation){return{scope: context.scope};}returnnull;},({ scope })=>async(resolver,user,args,context,_resolveInfo)=>{console.log(`Mutation '${scope.fieldName}' starting with arguments:`,args);constresult=awaitresolver();console.log(`Mutation '${scope.fieldName}' result:`,result);returnresult;});
In this example, the plugin adds custom logic (console logs) to every root mutation resolvers. I was wondering if there was a way to add custom logic to, let's say, every mutation creating a user, regardless of whether it's a root mutation or a nested one created through this plugin.
Has anyone tried to achieve the same behavior - or has more knowledge than me about what to look for in the resolver context to filter out the right ones ?
The text was updated successfully, but these errors were encountered:
Hello everyone, this issue is more of a call for help.
I am trying to use this core plugin https://www.graphile.org/postgraphile/make-wrap-resolvers-plugin/ in conjunction with postgraphile nested mutations.
In this example, the plugin adds custom logic (console logs) to every root mutation resolvers. I was wondering if there was a way to add custom logic to, let's say, every mutation creating a user, regardless of whether it's a root mutation or a nested one created through this plugin.
Has anyone tried to achieve the same behavior - or has more knowledge than me about what to look for in the resolver context to filter out the right ones ?
The text was updated successfully, but these errors were encountered: