GithubHelp home page GithubHelp logo

feathers-plus / graphql Goto Github PK

View Code? Open in Web Editor NEW
76.0 76.0 9.0 268 KB

A high performance GraphQL adapter for SQL and non-SQL databases.

Home Page: https://generator.feathers-plus.com/api/#graphql

License: MIT License

JavaScript 100.00%

graphql's People

Contributors

daffl avatar eddyystop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphql's Issues

Cannot get convertArgsToFeathers to pass arguments correctly

I'm trying to pass in a header (x-api-key) into a place where graphql can add it to the query.

FIrst, I've got middleware attaching the headers to the feathers headers.
req.feathers.headers = req.headers;

Second, I've got a hook that finds and attaches the organization (like a user) and the appropriate key to the hook.params object.

 // app.hooks.js
   before: {
    all: [
      authenticateOrg()
    ],

For feathers REST calls, it works fine. For graphql calls, it does not. For example, when running a simple graphql query:

{
  findUser(query: { }) {
   id
  }
}

where the additional fields have been added into the serviceResolvers(app, options) function like this: const convertArgs = convertArgsToFeathers(['headers','org','key']) I can't find any of those parameters in the library. I'm not sure where they are getting dropped or what the original intent of that function was. I added console log into the @feathers-plus/graphql/lib/index.js, and still can't get the arguments to be accessible. Here's the modified graphql index chunk

 // @feathers-plus/graphql/lib/index.js
  find (params) {
    if (!params.query || !params.query.query || typeof params.query.query !== 'string') {
      throw new BadRequest('A GraphQL query requires a "params.query.query" property. (@feathers-plus/graphql)');
    }

    const content = {
      app: this._app,
      batchLoaders: {}, // where batchloaders are stored for this request
      cache: {}, // where tables used with a .filter() are cached
      provider: params.provider,
      user: params.user,
      authenticated: params.authenticated,
    }
    console.log(' in graphql-index-Service-find\n', params) //<--- ADDED
    console.log(this._options.extraAuthProps)  //<--- ADDED

But that yields

in graphql-index-Service-find  
{ query: 
   { query: '{\n  findUser(query: { }) {\n    mtc_id\n  }\n}\n',
     variables: 'null' },
  route: {},
  provider: 'rest',
  headers: 
   { 'content-type': 'application/json',
     'user-agent': 'graphiql-app',
     'x-api-key': '5384760e-1ddd-4d04-b0d5-baa12e96014c',
     host: 'localhost:3030',
     connection: 'close' },
  key: 
   { id: 1,
     key: '5384760e-1ddd-4d04-b0d5-baa12e96014c',
     org_id: 1,
     createdAt: 2018-09-24T19:22:07.736Z,
     updatedAt: 2018-09-24T19:22:07.736Z },
  org: 
   { id: 1,
     mtc_id: 'c75d598a-b244-4dbc-9ae2-b223001b8ab2',
     name: 'Herzog - Haley',
     createdAt: 2018-09-24T19:22:07.757Z,
     updatedAt: 2018-09-24T19:22:07.757Z } }

undefined

Any help with passing extra params in, or a good example would be appreciated! Happy to write up some extra documentation if someone can just point me to the problem.

Guide?

Is there a guide or example app for this?

Does this work with feathers v4?

Contemplating moving to graphql queries for our feathers 4 app...wanted to find out if this would work with the latest version before getting too far in?

Thanks for any feedback :)

is this module ready?

Hello !

First of all, I wanted you to know that a module to bring graphql to Feathers is one of the best idea of the moment!

Nevertheless, this module lacks some information, I have listed some elements:

  • Is this module ready to be used in production ?
  • Will it support graphql subscriptions with the channel.js file ?
  • No implementation examples were given
  • When do you think you'll be able to put it on NPM ?
  • Will it support authentication? (in particular oauth2)

That's a lot of questions but I'm super excited about this project!

Problem using along with CASL

Hello :

I added CASL and configured abilities and is working fine but on graphql service.
The service is setting the user in the underneath calls to services but the headers are lost and the authorize hook that manages the CASL capabilities can't get the abilities from the payload.

How can I do to set the payload to the service's calls made from graphql?.

Thanks.

[email protected]

npm WARN [email protected] requires a peer of graphql-tools@^0.4.0 but none is installed. You must install peer dependencies yourself.

package.json sets:

  "dependencies": {
    "graphql-tools": "2.0.0",
    "join-monster-graphql-tools-adapter": "0.0.2",

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.