import { configureWunderGraphHooksWithClient } from "./generated/wundergraph.hooks.configuration" ; const superAdmins = [ "jens@wundergraph.com" , ] ; const wunderGraphHooks = configureWunderGraphHooksWithClient ( client => ( { authentication : { postAuthentication : async ( user ) => { if ( user . email ) { try { await client . mutations . SetLastLogin ( { email : user . email } ) ; } catch ( e ) { console . log ( e ) ; } } } , mutatingPostAuthentication : async ( user ) => { if ( ! user . email ) { return { status : "deny" } ; } if ( superAdmins . find ( s => s === user . email ) !== undefined ) { return { status : "ok" , user : { ... user , roles : [ "user" , "superadmin" ] } } ; } return { status : "ok" , user : { ... user , roles : [ "user" ] } } ; } } , queries : { MockQuery : { mockResolve : async ( ) => { return { data : { findFirstusers : { id : 1 , email : "jens@wundergraph.com" , name : "Jens" } } } ; } } } , mutations : { } , } ) ) ; export default wunderGraphHooks ;