lynxtaa / awesome-graphql-client Goto Github PK
View Code? Open in Web Editor NEWGraphQL Client with file upload support for NodeJS and browser
Home Page: https://npm.im/awesome-graphql-client
License: MIT License
GraphQL Client with file upload support for NodeJS and browser
Home Page: https://npm.im/awesome-graphql-client
License: MIT License
OperationName is useful for logging purposes, frameworks like HotChocolate have a built-in field to handle it
Describe the solution you'd like
Pass operationName in the request payload
Describe alternatives you've considered
using a customFetch operation and extracting the operationName from the queries sent in
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
Is it planned to add subscriptions support?
Describe the solution you'd like
Would like to use graphql subscriptions
Describe alternatives you've considered
N/A
Additional context
N/A
Hello, would be cool to have a Next.js example in README showing how to combine clientside and server side fetching
Is your feature request related to a problem? Please describe.
Would be nice if you can setFetchOptions() (or only headers) per request.
Describe the solution you'd like
Setting some default headers in initial setup
const graphQlClient = new AwesomeGraphQLClient({
endpoint: GRAPHQL_ENDPOINT,
fetchOptions: {
headers: {
...some default headers
}
}
});
// request with default headers/fetchOptions
graphQlClient.request(document, variables)
if some requests need an additional header
graphQlClient
.setFetchOptions({
headers: {
...additional headers
}
})
.request(document, variables)
or only headers
graphQlClient
.setHeaders({
...additional headers
})
.request(document, variables)
Describe alternatives you've considered
N/A
Additional context
N/A
Describe the bug
Sending query by GET
fails when endpoint starts with /
.
To Reproduce
import { AwesomeGraphQLClient } from 'awesome-graphql-client'
const client = new AwesomeGraphQLClient({ endpoint: '/graphql' })
await client.request(SomeQuery, variables, {method: "GET"})
This code shows an error: TypeError: Failed to construct 'URL': Invalid URL
Expected behavior
The client should accept a relative path as an endpoint.
Additional context
It looks caused by this function:
awesome-graphql-client/src/util/formatGetRequestUrl.ts
Lines 5 to 15 in 32ffb82
URL
constructor requires an absolute url or a relative path with a base url. See https://developer.mozilla.org/en-US/docs/Web/API/URL/URL
Is your feature request related to a problem? Please describe.
When using this package in a typescript project I receive following error:
/path-to-project/node_modules/awesome-graphql-client/dist/index.modern.mjs' implicitly has an 'any' type.
There are types at '/path-to-project/node_modules/awesome-graphql-client/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'awesome-graphql-client' library may need to update its package.json or typings.
NOTE: This problem is produced by vscode.
Describe the solution you'd like
I prefer to have a complete typing when using project or there should be a package like @types/awesome-graphql-client
to add necessary typings.
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
Is your feature request related to a problem? Please describe.
Would be helpful if we can set the endpoint like the fetchOptions.
Describe the solution you'd like
add the possibility to set the endpoint like this client.setEndpoint(string)
.
Describe alternatives you've considered
NA
Additional context
NA
Is your feature request related to a problem? Please describe.
It would be great if this library support persisted queries, which means the server already knows the query the client is sending, and the client merely passes an "id" in the query string (GET) or "id" in the body (POST) rather than a query
in the body
Describe the solution you'd like
A way for graphClient.request
to pass an id
corresponding to a query, or an alternative graphClient.requestId()
where the first arg is an ID rather than the query itself
Describe alternatives you've considered
Alternatively, the library could provide a way to customize how operations are serialized, instead of just a hard-coded JSON.stringify(...)
Is your feature request related to a problem? Please describe.
It is common to have some authenticated urls which requires a token in header to give you access to the desired resource.
Unfortunately I didn't see any way to set my preferred header variable for authorization.
Describe the solution you'd like
Provide a method to give user ability to set necessary headers. For example:
client.setHeader({
variable: value
})
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.