naystack - v1.5.10
    Preparing search index...

    Function QueryLibrary

    • Builds a type-graphql @Resolver class from a map of query/mutation definitions created with query. Each key in the queries object becomes a Query or Mutation field on the GraphQL schema.

      Pass the returned class in the resolvers array of initGraphQLServer.

      Parameters

      • queries: T

        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.

      Returns typeof GeneratedResolver

      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)
      });