Comments (12)
-
http_link
should have something like theuseGETForQueries
option as well - persisted queries were recently contributed
from gql.
@Ram231 it isn't a WIP exactly, but at the least porting the existing graphql
implementation will be necessary for graphql/client.dart
v4, which I'm actively working on.
@klavs do you think it's possible to decouple HttpLink
and FileUpload
link, or will we have to just have two different links?
Also, should I go ahead and PR my NetworkException
code into gql_http_link
's exceptions / exception handling?
from gql.
I wrote an auth link that works with the gql http link. It's similar to the one in the graphql_flutter
package has. I may contribute mine, but where to put it? It's just 21 lines...
from gql.
Hey @DoctorJohn, welcome!
A new link should go to a new package at the root of this directory.
To kickstart your PR you can start by adding it to the example directory of gql_httpl_link
so that we can discuss the design.
from gql.
Here's the basic implementation of an ErrorLink
that I'm using in case it's helpful:
import 'dart:async';
import 'package:ferry/ferry.dart';
import 'package:gql_link/gql_link.dart';
import 'package:gql_exec/gql_exec.dart';
typedef void OnError({
LinkException linkException,
List<GraphQLError> graphQLErrors,
});
class ErrorLink extends Link {
final OnError onError;
ErrorLink(this.onError);
@override
Stream<Response> request(Request request, [forward]) =>
forward(request).transform(
StreamTransformer.fromHandlers(
handleError: (error, stacktrace, sink) {
if (error is LinkException) {
onError(linkException: error);
}
sink.addError(error);
},
handleData: (data, sink) {
if (data.errors != null && data.errors.isNotEmpty) {
onError(graphQLErrors: data.errors);
}
sink.add(data);
},
),
);
}
from gql.
I think useGETForQueries
wasn't doing anything. Am I wrong?
from gql.
yeah I mean it tells the link to use GET for queries
if (operation.isQuery && config.http.useGETForQueries) {
config.options['method'] = 'GET';
}
from gql.
Is the File Upload Work in Progress? This was my first time using graphql for vue(web) and flutter(mobile). How is it going to be implemented in a way that can be used via http package?
from gql.
I'd like to propose that single file and multipart upload in a separate way that there are no type checking and it should be strongly typed. Thanks for the hard work. I hope it'll get to be flutter favorites.
from gql.
How is it going to be implemented in a way that can be used via http package?
Well that is THE question. From GraphQL's perspective a file can be a scalar type. But it should be a well-known scalar type, in the sense that links must know about it to support it.
do you think it's possible to decouple
HttpLink
andFileUpload
link, or will we have to just have two different links?
Probably we'll end up implementing file upload within HttpLink
.
Also, should I go ahead and PR my NetworkException code into gql_http_link's exceptions / exception handling?
Your NetworkException
is a specialized version of the ServerException
. (My appologies for the bad documentation comment.) In a more abstract sense, there is no network, there's only server you are trying to communicate to. This generalization will make more sense when we have a client-side resolver (client-side server) support.
from gql.
@klavs ServerException
has a @required Response parsedResponse
, which doesn't make sense when the error involves a failure on the network itself. NetworkException
would be part of gql_http_link
regardless.
Maybe the taxonomy should be
TerminatingLinkException
├── ServerException
└── NetworkException /// in `gql_http_link`
from gql.
@klavs Everything but persisted queries has been merged, and I think it's fine if APQ lives in graphql flutter or 3rd party module for now.
So, I'd say once gql_http_link: 0.3.0
is published (and maybe other recent changes) we can close this?
from gql.
Related Issues (20)
- `Visitor` and all sub class could have a `const` constructor to always subclasses to be const
- [gql_websocket_link] TransportWebSocketLink does not reconnect when graphql server disappears HOT 6
- [graphql_transport_ws] The new subprotocol doesn't auto-reconnect HOT 2
- OperationException(linkException: ResponseFormatException(originalException: type 'Null' is not a subtype of type 'String' in type cast HOT 1
- [Begging for support] Can the url be transformed? HOT 2
- [Support request] How can the client complete a subscription HOT 1
- [gql_websocket_link] Crash events on host lookup HOT 3
- LinkException as a sealed class HOT 2
- [WebSocketLink] inactivityTimeout causes a reconnect HOT 5
- More maintainers wanted
- gql_code_builder: allow adding custom builder factories for nested collections
- [gql_websocket_link] uuid package version conflict HOT 1
- [Question] Dio interceptor with retry not triggered when timeout() is invoked HOT 5
- dependencies issue HOT 1
- FR: Dynamic header HOT 1
- Issue with - distinguishing between null and absent values HOT 3
- How to make reconnect TransportWebSocketLink(TransportWsClientOptions())
- [BUG] Printer fails with string blocks HOT 5
- Type exception in gql_websocket_link with decoding incoming messages. HOT 1
- extract serializers from gql_code_builder to another package
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gql.