@homebound/graphql-typescript-simple-resolvers
Advanced tools
Comparing version 1.12.0 to 1.13.0
@@ -31,6 +31,11 @@ "use strict"; | ||
const scalars = Object.values(schema.getTypeMap()).filter(types_1.isScalarType); | ||
// Make the top-level Resolvers interface | ||
generateTopLevelResolversType(chunks, typesThatMayHaveResolvers, typesThatNeedResolvers, scalars); | ||
// Make each resolver for any output type, whether its required or optional | ||
generateEachResolverType(chunks, config, allTypesWithResolvers); | ||
// For the output types with optional resolvers, make DTOs for them. Mapped types don't need DTOs. | ||
generateDtosForNonMappedTypes(chunks, config, typesThatMayHaveResolvers); | ||
// Input types | ||
generateInputTypes(chunks, config, schema); | ||
// Enums | ||
generateEnums(chunks, config, schema); | ||
@@ -40,3 +45,2 @@ const content = await ts_poet_1.code `${chunks}`.toStringWithImports(); | ||
}; | ||
// Make the top-level Resolvers interface | ||
function generateTopLevelResolversType(chunks, typesThatMayHaveResolvers, typesThatNeedResolvers, scalars) { | ||
@@ -61,3 +65,2 @@ const resolvers = ts_poet_1.code ` | ||
function generateEachResolverType(chunks, config, allTypesWithResolvers) { | ||
// Make each resolver for any output type, whether its required or optional | ||
const ctx = types_1.toImp(config.contextType); | ||
@@ -90,3 +93,2 @@ const argDefs = []; | ||
function generateDtosForNonMappedTypes(chunks, config, typesThatMayHaveResolvers) { | ||
// For the output types with optional resolvers, make DTOs for them. Mapped types don't need DTOs. | ||
typesThatMayHaveResolvers.forEach(type => { | ||
@@ -102,3 +104,2 @@ chunks.push(ts_poet_1.code ` | ||
} | ||
// Input types | ||
function generateInputTypes(chunks, config, schema) { | ||
@@ -118,3 +119,2 @@ Object.values(schema.getTypeMap()) | ||
function generateEnums(chunks, config, schema) { | ||
// Enums | ||
Object.values(schema.getTypeMap()) | ||
@@ -121,0 +121,0 @@ .filter(types_1.isEnumType) |
{ | ||
"name": "@homebound/graphql-typescript-simple-resolvers", | ||
"version": "1.12.0", | ||
"version": "1.13.0", | ||
"main": "./build/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./build/", |
14868