BowlingX/ra-postgraphile

Unable to pass options to buildGraphQLProvider

Closed this issue · 3 comments

hjr3 commented

I want to pass the introspection option to buildGraphQLProvider but src/factory.ts does not expose a way to send arbitrary options to buildGraphQLProvider.

I have a fork where I solved my immediate case:

export const factory = (
  client: any,
  options: ProviderOptions = { queryValueToInputValueMap: {} },
  introspection?: any
) => { ... }

I can PR that, but I imagine that we will want to solve the general problem. If we can decide on the interface, then I can submit a PR.

Hi :) Thank you for reporting this!
I think the interface you posted works well (with the additional introspection parameter).

I don't see other parameters currently that would make sense. But just to be future proof, we could create another options parameter that passes everything down to the underlying buildGraphQLProvider method, what do you think?

e.g.

interface GraphqlProviderOptions { 
   introspection?: any // instead of any we could also go more into details here with types, queries etc.
}

Thank you

hjr3 commented

I like it!

Let me work on it and send up a PR. I will create a GraphqlProviderOptions type and make introspection have a more narrow type than any.

🎉 This issue has been resolved in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀