gucheen / fetchql Goto Github PK
View Code? Open in Web Editor NEWGraphQL client with Fetch
Home Page: https://gucheen.github.io/fetchql/
License: MIT License
GraphQL client with Fetch
Home Page: https://gucheen.github.io/fetchql/
License: MIT License
I was looking for a simple graphql client library and chose this one, and tried to use it in my typescript project. But even before I was able to setup the client instance, several problems stopped me.
return Promise.reject(error)
in the requestError
does not work, even though the README
has it as an examplereueqstError
in the interceptor or rejedct
in the returned object of FetchQL instance methods (and now I realize they should return promises, I guess?)If someone else can handle this then it is fine, but maybe I can fix some of the issues if that is needed. But I'm not sure if I will understand all underlying things going on in the source code. I also suggest adding typescript as a dev dependency and then testing if the type declarations enable users to successfully compile. Should I start working on this tomorrow? (It's late at night here so I need to go to bed)
There is no reason to distribute a minified code. Furthermore, there is no reason to distribute a bundled code. All you are doing is preventing common chunk optimisation that could be achieved at the bundler level and increasing the overall script size.
Hello, I have a question I cannot find an answer for and wonder if you can help or if this library can accommodate.
The server I am sending a request to returns a response that is not a JSON object - or graphQL map.
It is actually just returns a 200/ok with a string of comma-separated values like this...
0,4,Received and queued,0,,,0,,,
Each of the values in this string represent a key or name that I need to map so the client receives a readable response. The length of the string and number of values will remain constant.
For example, in this string....
value 1 (0) = 'hostResponseCode'
value 2 (4) = 'hostDetailCode'
value 3 (Received and queued) = 'hostMessage'
value 4 (0) = 'statusCode'
value 5 () = 'statusMessage'
value 6 () = 'etc'
...
I just read in the GraphQL specs in 7.2 Response Format that:
A response to a GraphQL operation must be a map.
Am I out of luck or is there a way I can intercept this response before it is received, assign it to a json object and map these fields? Is your library only for after the response is received?
Thank you for any feedback - this one has me perplexed as I would really like to graphQL my backend....
I am getting an error like GraphQLError: Unknown operation named "..."
I've noticed the object passed to the GraphQL server consists of:
{
operationName: "...",
query: "...",
variables: { ... }
}
why operationName
is passed when it should only send query
and variables
?
My API includes mutations that don't return any data. They're effectively requests for a low-priority async operation, and they return almost immediately with no information, by just returning null
.
That's works fine and its perfectly valid GraphQL as far as I'm aware, but this library rejects these responses, due to
Lines 192 to 196 in 07d08be
In that code, a successful response that has no errors but which returns a { myOperation: null }
result will throw undefined
.
I don't think this case should throw. Even if it does, it should probably throw something clearer than undefined
.
Hello, I have a question I cannot find an answer for and wonder if you can help or if this library can accommodate.
The server I am sending a request to returns a response that is not a JSON object - or graphQL map.
It is actually just returns a 200/ok with a string of comma-separated values like this...
0,4,Received and queued,0,,,0,,,
Each of the values in this string represent a key or name that I need to map so the client receives a readable response. The length of the string and number of values will remain constant.
For example, in this string....
value 1 (0) = 'hostResponseCode'
value 2 (4) = 'hostDetailCode'
value 3 (Received and queued) = 'hostMessage'
value 4 (0) = 'statusCode'
value 5 () = 'statusMessage'
value 6 () = 'etc'
...
I just read in the GraphQL specs in 7.2 Response Format that:
A response to a GraphQL operation must be a map.
Am I out of luck or is there a way I can intercept this response before it is received, assign it to a json object and map these fields? Is your library only for after the response is received?
Thank you for any feedback - this one has me perplexed as I would really like to graphQL my backend....
Hello, sorry for the second post but your library has me hopeful for an answer after a long, hard day doing Google searches.
What I am reading is this library can handle an HTTP RPC call like this....
My published endpoint = https:mywebserver.com/process
can receive and process this actual endpoint:
https://webserver.com/service/Process.py?clientId=123456789&deviceId=001&userId=12334455&locationId=34
Is this correct? If so, can you give an example of how this looks in an code? I have to convert about 10 of these.
The docs say:
If any errors exist(from query response), will reject the promise.
The code for this is here:
Lines 184 to 199 in 07d08be
In reality, the promise is only rejected if no data is returned. If data is returned and errors exist, the promise will resolve successfully with the data, ignoring the errors.
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.