File tree Expand file tree Collapse file tree 5 files changed +28
-2
lines changed Expand file tree Collapse file tree 5 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 1
1
import 'dart:async' ;
2
2
3
3
import 'package:graphql/src/utilities/response.dart' ;
4
+ import 'package:graphql_common/graphql_common.dart' ;
4
5
import 'package:meta/meta.dart' ;
5
6
import 'package:collection/collection.dart' ;
6
7
@@ -26,6 +27,7 @@ class QueryManager {
26
27
QueryManager ({
27
28
required this .link,
28
29
required this .cache,
30
+ this .tracer,
29
31
this .alwaysRebroadcast = false ,
30
32
}) {
31
33
scheduler = QueryScheduler (
@@ -50,6 +52,10 @@ class QueryManager {
50
52
/// prevents rebroadcasting for some intensive bulk operation like [refetchSafeQueries]
51
53
bool rebroadcastLocked = false ;
52
54
55
+ /// Custom Tracer specified by the user to trace the library
56
+ /// if the user need it.
57
+ final Tracer ? tracer;
58
+
53
59
ObservableQuery <TParsed > watchQuery <TParsed >(
54
60
WatchQueryOptions <TParsed > options) {
55
61
final ObservableQuery <TParsed > observableQuery = ObservableQuery <TParsed >(
Original file line number Diff line number Diff line change 1
1
import 'package:meta/meta.dart' ;
2
2
import 'dart:async' ;
3
-
4
3
import 'package:graphql/src/core/core.dart' ;
5
4
import 'package:graphql/src/cache/cache.dart' ;
6
-
7
5
import 'package:graphql/src/core/fetch_more.dart' ;
6
+ import 'package:graphql_common/graphql_common.dart' ;
8
7
9
8
/// Universal GraphQL Client with configurable caching and [link][] system.
10
9
/// modelled after the [`apollo-client`][ac] .
@@ -24,12 +23,14 @@ class GraphQLClient implements GraphQLDataProxy {
24
23
GraphQLClient ({
25
24
required this .link,
26
25
required this .cache,
26
+ this .tracer,
27
27
DefaultPolicies ? defaultPolicies,
28
28
bool alwaysRebroadcast = false ,
29
29
}) : defaultPolicies = defaultPolicies ?? DefaultPolicies (),
30
30
queryManager = QueryManager (
31
31
link: link,
32
32
cache: cache,
33
+ tracer: tracer,
33
34
alwaysRebroadcast: alwaysRebroadcast,
34
35
);
35
36
@@ -44,11 +45,16 @@ class GraphQLClient implements GraphQLDataProxy {
44
45
45
46
late final QueryManager queryManager;
46
47
48
+ /// Custom Tracer specified by the user to trace the library
49
+ /// if the user need it.
50
+ final Tracer ? tracer;
51
+
47
52
/// Create a copy of the client with the provided information.
48
53
GraphQLClient copyWith (
49
54
{Link ? link,
50
55
GraphQLCache ? cache,
51
56
DefaultPolicies ? defaultPolicies,
57
+ Tracer ? tracer,
52
58
bool ? alwaysRebroadcast}) {
53
59
return GraphQLClient (
54
60
link: link ?? this .link,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import 'package:gql_exec/gql_exec.dart';
7
7
import 'package:graphql/src/core/query_options.dart' show WithType;
8
8
import 'package:graphql/src/links/gql_links.dart' ;
9
9
import 'package:graphql/src/utilities/platform.dart' ;
10
+ import 'package:graphql_common/graphql_common.dart' ;
10
11
import 'package:meta/meta.dart' ;
11
12
import 'package:rxdart/rxdart.dart' ;
12
13
import 'package:stream_channel/stream_channel.dart' ;
@@ -48,8 +49,13 @@ class SocketClientConfig {
48
49
this .initialPayload,
49
50
this .headers,
50
51
this .connectFn,
52
+ this .tracer,
51
53
});
52
54
55
+ /// Custom Tracer specified by the user to trace the library
56
+ /// if the user need it.
57
+ final Tracer ? tracer;
58
+
53
59
/// Serializer used to serialize request
54
60
final RequestSerializer serializer;
55
61
Original file line number Diff line number Diff line change 1
1
import 'package:gql_exec/gql_exec.dart' ;
2
2
import 'package:gql_link/gql_link.dart' ;
3
+ import 'package:graphql_common/graphql_common.dart' ;
3
4
4
5
import './websocket_client.dart' ;
5
6
@@ -17,6 +18,7 @@ class WebSocketLink extends Link {
17
18
this .url, {
18
19
this .config = const SocketClientConfig (),
19
20
this .subProtocol = GraphQLProtocol .graphqlWs,
21
+ this .tracer,
20
22
});
21
23
22
24
final String url;
@@ -26,6 +28,10 @@ class WebSocketLink extends Link {
26
28
// cannot be final because we're changing the instance upon a header change.
27
29
SocketClient ? _socketClient;
28
30
31
+ /// Custom Tracer specified by the user to trace the library
32
+ /// if the user need it.
33
+ final Tracer ? tracer;
34
+
29
35
@override
30
36
Stream <Response > request (Request request, [forward]) async * {
31
37
if (_socketClient == null ) {
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ dependencies:
22
22
stream_channel : ^2.1.0
23
23
rxdart : ^0.27.1
24
24
uuid : ^3.0.1
25
+ graphql_common :
26
+ path : ../graphql_common
25
27
26
28
dev_dependencies :
27
29
async : ^2.5.0
You can’t perform that action at this time.
0 commit comments