Projects

Some of the various projects I have been working on.

TypeORM GraphQL Data Loader

NPM Package VersionMonthly Package Downloads

This is a TypeScript utility package I created to help simplify resolving TypeORM entity relations in GraphQL resolvers. For a detailed explanation of the package features, please visit the package documentation website.

TypeORM providees a straightforward API for joining relations, but due to the dynamic nature of GraphQL requests, it can be hard to know ahead of time which relations will need to be loaded in order to resolve a query. This generally leads to a pattern of implementing a custom resolver function or promise-based relations to lazy load each entity relation as needed during the field resolution phase.

This package helps avoid a lot of that extra work by parsing the GraphQL query info object and dynamically building a SQL join using the TypeORM QueryBuilder API to fetch only the relations/fields needed to resolve the query.