[GH-ISSUE #88] Cannot use Utils methods in custom Adapter #56

Open
opened 2026-03-03 00:03:01 +03:00 by kerem · 0 comments
Owner

Originally created by @yargyropoulos on GitHub (Dec 7, 2023).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/88

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 :

Originally created by @yargyropoulos on GitHub (Dec 7, 2023). Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/88 If I try to create my custom Adapter as suggested in the [docs](https://www.npmjs.com/package/gql-query-builder#mutation-with-operation-name) , 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 : - https://stackoverflow.com/questions/54165012/how-to-call-a-method-of-a-class-without-instantiating-it/54168245#54168245
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gql-query-builder#56
No description provided.