@homebound/graphql-typescript-simple-resolvers
Advanced tools
Comparing version 1.28.0 to 1.29.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const graphql_1 = require("graphql"); | ||
const change_case_1 = require("change-case"); | ||
@@ -68,3 +69,6 @@ const upper_case_first_1 = require("upper-case-first"); | ||
export interface ${argsName} { | ||
${f.args.map(a => ts_poet_1.code `${a.name}: ${types_1.mapType(config, a.type)}; `)} | ||
${f.args.map(a => { | ||
const maybeOptional = graphql_1.isNullableType(a.type) ? "?" : ""; | ||
return ts_poet_1.code `${a.name}${maybeOptional}: ${types_1.mapType(config, a.type)}; `; | ||
})} | ||
}`); | ||
@@ -71,0 +75,0 @@ } |
@@ -5,4 +5,4 @@ import { Context, AuthorId, Popularity } from "./entities"; | ||
export interface Resolvers { | ||
Query: QueryResolvers; | ||
Author: AuthorResolvers; | ||
Query: QueryResolvers; | ||
Mutation: MutationResolvers; | ||
@@ -16,2 +16,8 @@ AuthorSummary?: AuthorSummaryResolvers; | ||
export interface QueryResolvers { | ||
authors: Resolver<{}, QueryAuthorsArgs, AuthorId[]>; | ||
authorSummaries: Resolver<{}, {}, AuthorSummary[]>; | ||
search: Resolver<{}, QuerySearchArgs, Array<AuthorId | Book>>; | ||
} | ||
export interface AuthorResolvers { | ||
@@ -27,8 +33,2 @@ name: Resolver<AuthorId, {}, string>; | ||
export interface QueryResolvers { | ||
authors: Resolver<{}, QueryAuthorsArgs, AuthorId[]>; | ||
authorSummaries: Resolver<{}, {}, AuthorSummary[]>; | ||
search: Resolver<{}, QuerySearchArgs, Array<AuthorId | Book>>; | ||
} | ||
export interface MutationResolvers { | ||
@@ -53,6 +53,6 @@ saveAuthor: Resolver<{}, MutationSaveAuthorArgs, SaveAuthorResult>; | ||
type Resolver<R, A, T> = (root: R, args: A, ctx: Context, info: GraphQLResolveInfo) => T | Promise<T>; | ||
export type Resolver<R, A, T> = (root: R, args: A, ctx: Context, info: GraphQLResolveInfo) => T | Promise<T>; | ||
export interface QueryAuthorsArgs { | ||
id: string | null | undefined; | ||
id?: string | null | undefined; | ||
} | ||
@@ -59,0 +59,0 @@ export interface QuerySearchArgs { |
{ | ||
"name": "@homebound/graphql-typescript-simple-resolvers", | ||
"version": "1.28.0", | ||
"version": "1.29.0", | ||
"main": "./build/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./build/", |
22078
383