Description
Describe the bug
The command mesh build
is unable to generate a type definition file index.d.ts
when the transform @graphql-mesh/transform-filter-schema
is used to filter queries or mutations generated by the source Open API, Mongoose, and possibly other source handlers. Although, I've noticed that queries or mutations generated via additionalTypeDefs
option can be filtered without issues. The bug can be seen when the following transform is added:
transforms:
- filterSchema:
mode: bare
filters:
- Query.!{getMediaMathFormulaHash}
getMediaMathFormulaHash
comes from the Open API source handler. However, that query is not specifically causing the issue, nor the Open API source handler. I've tried a number of combinations of queries and source handlers, and they all seem to experience the same bug. I have also tried with wrap
mode and the same issue persists.
To Reproduce
Here is a repository with the minimum setup to reproduce the bug https://github.com/leonsomed/graphql-mesh-transform-types-bug.
- Checkout environment details below to replicate exact conditions (optional)
- Clone the repo
- Install dependencies
yarn install
- Build the project
yarn build
- Notice the generated directory
.mesh
does not contain a type definition fileindex.d.ts
(This is the reported bug) - Remove or comment the transform
filterSchema
from.meshrc.yaml
- Build the project again
yarn build
- Notice the type definition file
index.d.ts
is correctly created in directory.mesh
Expected behavior
A type definition file index.d.ts
should be generated when running mesh build
regardless of the transforms or source handlers used.
Environment:
- OS: macOS Catalina 10.15.4
- NodeJS: 14.17.0
- yarn: 1.22.13
- npm dependencies in
package.json
Additional context
Since this bug prevents the types from being generated, it is impossible to use the Resolvers
type when working with typescript and using the additionalResolvers
option.