Skip to content

Commit

Permalink
Closer
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Nov 11, 2024
1 parent 98a60b2 commit dc0e81f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import typescript from "typescript"

import { AppContext } from "./context.js"
import { PrismaMap, prismaModeller } from "./prismaModeller.js"
import { lookAtServiceFile } from "./serviceFile.js"
import { lookAtServiceFile } from "./serviceFile2.js"
import { createSharedSchemaFiles } from "./sharedSchema.js"
import { CodeFacts, FieldFacts } from "./typeFacts.js"
import { RedwoodPaths } from "./types.js"
Expand Down
6 changes: 3 additions & 3 deletions src/serviceFile2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as graphql from "graphql"

import { AppContext } from "./context.js"
import { getCodeFactsForJSTSFileAtPath } from "./serviceFile.codefacts.js"
import { builder } from "./tsBuilder.js"
import { builder, TSBuilder } from "./tsBuilder.js"
import { CodeFacts, ModelResolverFacts, ResolverFuncFact } from "./typeFacts.js"
import { TypeMapper, typeMapper } from "./typeMap.js"
import { capitalizeFirstLetter, createAndReferOrInlineArgsForField, inlineArgsForField } from "./utils.js"
Expand Down Expand Up @@ -54,7 +54,7 @@ export const lookAtServiceFile = async (file: string, context: AppContext) => {
const isMutation = v.name in mutationType.getFields()
const parentName = isQuery ? queryType.name : isMutation ? mutationType.name : undefined
if (parentName) {
addDefinitionsForTopLevelResolvers(parentName, v)
addDefinitionsForTopLevelResolvers(parentName, v, dts)
} else {
// Add warning about unused resolver
dts.rootScope.addInterface(v.name, [], { exported: true, docs: "This resolver does not exist on Query or Mutation" })
Expand Down Expand Up @@ -138,7 +138,7 @@ export const lookAtServiceFile = async (file: string, context: AppContext) => {
context.sys.writeFile(dtsFilepath, formatted)
return dtsFilepath

function addDefinitionsForTopLevelResolvers(parentName: string, config: ResolverFuncFact) {
function addDefinitionsForTopLevelResolvers(parentName: string, config: ResolverFuncFact, dts: TSBuilder) {
const { name } = config
let field = queryType.getFields()[name]
if (!field) {
Expand Down

0 comments on commit dc0e81f

Please sign in to comment.