feathers-plus / graphql Goto Github PK
View Code? Open in Web Editor NEWA high performance GraphQL adapter for SQL and non-SQL databases.
Home Page: https://generator.feathers-plus.com/api/#graphql
License: MIT License
A high performance GraphQL adapter for SQL and non-SQL databases.
Home Page: https://generator.feathers-plus.com/api/#graphql
License: MIT License
See #13
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.
Is there a guide or example app for this?
How do you write mutations and subscriptions using Feathers-Plus?
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 :)
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:
channel.js
file ?That's a lot of questions but I'm super excited about this project!
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.
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",
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.