I have a Node application where I have generated typescript types from GraphQL schema.
My service is going to receive GraphQL Object and attributes details in an API request.
The service has to form a GraphQL query string and return in the response.
For example, If the request is ‘Object.attribute = value’, then the service has to generate a query string like below:
Object(filter: {'attribute': {'val': 'value'}}){ attribute attribute1 attribute2 ... }
Please note that I need to generate the queries dynamically, I don’t want to hard code the query strings.
I have done the same using Python’s gql library. It has dsl that supports the creation of such strings.
References:
I need to do the same in the TypeScript now, but I am not able to find a library right away that can help me in doing that.
I tried generating the query strings in python.
When I tried with typescript I could not find a library that can right away help me in doing the same but, I did generate the TypeScript types, but I am not sure how to use those types OR how they can help in generating the query strings.
I expect an example library that can help me in building the graphql query strings dynamically.