Object mapping GraphQL field names to QueryDefinitions (from query()).
Each key becomes the field name in the schema. Mutations are determined by { mutation: true } in the definition.
A @Resolver class suitable for initGraphQLServer.
import { QueryLibrary, query } from "naystack/graphql";
import getCurrentUser from "./resolvers/get-current-user";
import updateUser from "./resolvers/update-user";
import onboardUser from "./resolvers/onboard-user";
export const UserResolvers = QueryLibrary({
getCurrentUser, // becomes Query.getCurrentUser
updateUser, // becomes Mutation.updateUser (if mutation: true)
onboardUser, // becomes Mutation.onboardUser (if mutation: true)
});
Builds a type-graphql
@Resolverclass from a map of query/mutation definitions created with query. Each key in thequeriesobject becomes a Query or Mutation field on the GraphQL schema.Pass the returned class in the
resolversarray ofinitGraphQLServer.