atulmy / gql-query-builder

🔧 Simple GraphQL Query Builder
https://npmjs.com/package/gql-query-builder
MIT License
396 stars 43 forks source link

Cannot use Utils methods in custom Adapter #88

Open yargyropoulos opened 10 months ago

yargyropoulos commented 10 months ago

If I try to create my custom Adapter as suggested in the docs , I cannot access Utils methods. For example this Adapter:

import Utils from 'gql-query-builder/build/Utils';

export default class MyQueryAdapter implements IQueryAdapter {
...
   this.variables = Utils.resolveVariables(options); ..
}

will throw an error like TypeError: Utils.resolveVariables is not a function

This happens because Utils is exported as an instantiable class with static functions, and while this works when importing it inside the gql-query-builder project itself, I cannot work in other projects that have a dependency to it.

See also :