@homebound/graphql-typescript-simple-resolvers
Advanced tools
Comparing version 1.29.0 to 1.30.0
@@ -31,3 +31,4 @@ "use strict"; | ||
// For the output types with optional resolvers, make DTOs for them. Mapped types don't need DTOs. | ||
generateDtosForNonMappedTypes(chunks, config, typesThatMayHaveResolvers); | ||
const interfaceTypes = Object.values(schema.getTypeMap()).filter(graphql_1.isInterfaceType); | ||
generateDtosForNonMappedTypes(chunks, config, [...typesThatMayHaveResolvers, ...interfaceTypes]); | ||
// Input types | ||
@@ -88,4 +89,4 @@ generateInputTypes(chunks, config, schema); | ||
} | ||
function generateDtosForNonMappedTypes(chunks, config, typesThatMayHaveResolvers) { | ||
typesThatMayHaveResolvers.forEach(type => { | ||
function generateDtosForNonMappedTypes(chunks, config, types) { | ||
types.forEach(type => { | ||
chunks.push(ts_poet_1.code ` | ||
@@ -92,0 +93,0 @@ export interface ${type.name} { |
@@ -29,2 +29,5 @@ "use strict"; | ||
} | ||
else if (type instanceof graphql_1.GraphQLInterfaceType) { | ||
return mapInterfaceType(config, type); | ||
} | ||
else if (type instanceof graphql_1.GraphQLScalarType) { | ||
@@ -56,2 +59,6 @@ return mapScalarType(config, type); | ||
exports.mapObjectType = mapObjectType; | ||
function mapInterfaceType(config, type) { | ||
return type.name; | ||
} | ||
exports.mapInterfaceType = mapInterfaceType; | ||
function mapEnumType(config, type) { | ||
@@ -58,0 +65,0 @@ return toImp(config.enumValues[type.name]) || type.name; |
@@ -11,2 +11,3 @@ import { Context, AuthorId, Popularity } from "./entities"; | ||
SaveAuthorResult?: SaveAuthorResultResolvers; | ||
Container?: ContainerResolvers; | ||
Date: GraphQLScalarType; | ||
@@ -51,2 +52,9 @@ DateTime: GraphQLScalarType; | ||
export interface ContainerResolvers { | ||
thingOptional: Resolver<Container, {}, HasName | null | undefined>; | ||
thingRequired: Resolver<Container, {}, HasName>; | ||
thingsOptional: Resolver<Container, {}, HasName[] | null | undefined>; | ||
thingsRequired: Resolver<Container, {}, HasName[]>; | ||
} | ||
export type Resolver<R, A, T> = (root: R, args: A, ctx: Context, info: GraphQLResolveInfo) => T | Promise<T>; | ||
@@ -78,2 +86,13 @@ | ||
export interface Container { | ||
thingOptional: HasName | null | undefined; | ||
thingRequired: HasName; | ||
thingsOptional: HasName[] | null | undefined; | ||
thingsRequired: HasName[]; | ||
} | ||
export interface HasName { | ||
name: string; | ||
} | ||
export interface AuthorInput { | ||
@@ -80,0 +99,0 @@ name?: string | null | undefined; |
{ | ||
"name": "@homebound/graphql-typescript-simple-resolvers", | ||
"version": "1.29.0", | ||
"version": "1.30.0", | ||
"main": "./build/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./build/", |
Sorry, the diff of this file is not supported yet
23217
407