druxt.js
druxt.js copied to clipboard
Add support for GraphQL
Is your feature request related to a problem? Please describe. As a user I want to be able to use GraphQL endpoints because [@TODO]
Describe the solution you'd like
- [ ] Move JSON:API specific functionality to a
@druxt/client-jsonapimodule - [ ] Make client configurable.
- [ ] Add
@druxt/client-graphqlmodule - [ ] Ensure that all data consumed from client is in a standarized format so it can be consumed by Druxt / DruxtStore
- [ ] Add Normalization level?
- [ ] Ensure that queries can be altered by the existing Druxt query settings systems
- [ ] #62
Describe alternatives you've considered N/A
Additional context
-
DruxtClient
- src: https://github.com/druxt/druxt.js/blob/develop/packages/druxt/src/client.js
- docs: https://druxtjs.org/api/packages/druxt/client
-
DruxtStore
- src: https://github.com/druxt/druxt.js/blob/develop/packages/druxt/src/stores/druxt.js
- docs: https://druxtjs.org/api/packages/druxt/stores/druxt
My general idea WRT to GraphQL for the DruxtClient is to abstract the current DruxtClient, moving the current JSON:API client into a @druxt/client-jsonapi module, which would allow for a @druxt/client-graphql module.
I've also been speaking with @backlineint this morning, and he was talking about how he's been working on https://www.npmjs.com/package/@gdwc/drupal-state, and has experimented with Apollo client and transforming GraphQL to JSON:API.
There's also work done by @d34dman, the author of the https://www.npmjs.com/package/drupal-jsonapi-params module (which is a dependency of both Druxt and DrupalState) towards https://github.com/d34dman/drupal-js-sdk.
The main thing is ensuring that the data that comes back is still in JSON:API format, because the DruxtStore (Vuex state management layer) needs to consume it that way.
@jasonrgd could you provide some of the specifics about why you need GraphQL, and potentially provide repository with GraphQL configured in a realworld usecase, Drupal side as well as a demo client connection/nodejs demo of some sort? If you fork https://github.com/druxt/quickstart-druxt-site as your starting point you'll have Drupal and Nuxt already setup.
Here I am this is me ;-)