wesleyyoung / perch-query-builder

Dynamically build TypeORM queries based on GraphQL queries for NestJS and TypeORM
GNU General Public License v3.0
45 stars 9 forks source link

Support for projects that don't use NestJS #1

Closed hrvojepavlinovic closed 3 years ago

hrvojepavlinovic commented 3 years ago

This package is really great, but I was wondering how complicated would be to add support for projects that don't use NestJS, but only Typescript and GraphQL?

I've checked source code and found out that both @nestjs/graphql and graphql are added as dependencies in package.json.

I'm wondering what would happen if only graphql was used and imported everywhere instead of one from nestjs?

I've never used NestJS, so I'm not aware of possible issues, but I'm sure that it would expand user base by lot if this feature is added.

wesleyyoung commented 3 years ago

Not complicated at all, actually, the only part of the package that currently uses dependencies of @nestjs/graphql is the annotation for the argument types. You are right though, it should be able to support all TypeORM + GraphQL projects regardless of framework so I will focus on removing it as a dependency. Feel free to submit a PR as well if you should choose to do so

hrvojepavlinovic commented 3 years ago

@wesleyyoung that's great, thanks for quick response 😄

I'll submit PR then 👍🏽

hrvojepavlinovic commented 3 years ago

@wesleyyoung here's PR 😄 https://github.com/wesleyyoung/perch-query-builder/pull/2

wesleyyoung commented 3 years ago

I thought I wrote a reply but it looks like I forgot to hit save 😨 it looks like this PR actually removes support for NestJS rather than just adding additional support for type-graphql projects. The challenge lies in the @ObjectType annotation. I almost wonder if the object types should be their own packages/plugins so that the Perch repository can remain neutral and merely consume them as specified in the resolver.

hrvojepavlinovic commented 3 years ago

@wesleyyoung it seems like it would be simpler to fork it and create 2 separate versions, but meanwhile we made some workarounds so this isnt' necessary anymore. Thanks for assistance though 👍🏽