diff --git a/packages/nhost_dart/pubspec.yaml b/packages/nhost_dart/pubspec.yaml index f24bb69f..e4d873ce 100644 --- a/packages/nhost_dart/pubspec.yaml +++ b/packages/nhost_dart/pubspec.yaml @@ -23,7 +23,7 @@ dependencies: nhost_graphql_adapter: ^4.0.7 dev_dependencies: fake_async: ^1.3.1 - graphql: ^5.1.3 + graphql: ^5.2.0-beta.10 lints: any mockito: ^5.3.2 nock: ^1.2.1 diff --git a/packages/nhost_graphql_adapter/example/pubspec.yaml b/packages/nhost_graphql_adapter/example/pubspec.yaml index 6950bcf2..fbf0a448 100644 --- a/packages/nhost_graphql_adapter/example/pubspec.yaml +++ b/packages/nhost_graphql_adapter/example/pubspec.yaml @@ -7,7 +7,7 @@ environment: sdk: ">=2.18.0 <4.0.0" dependencies: - graphql: ^5.1.3 + graphql: ^5.2.0-beta.9 # Nhost packages nhost_dart: ^2.0.7 diff --git a/packages/nhost_graphql_adapter/lib/src/create_client.dart b/packages/nhost_graphql_adapter/lib/src/create_client.dart index 9c44521d..b8f664dd 100644 --- a/packages/nhost_graphql_adapter/lib/src/create_client.dart +++ b/packages/nhost_graphql_adapter/lib/src/create_client.dart @@ -25,11 +25,42 @@ import '../nhost_graphql_adapter.dart'; /// requests made by the Nhost APIs, which can be useful for proxy configuration /// and debugging. /// {@endtemplate} +/// +/// {@template nhost.graphqlClient.defaultPolicies} +/// [defaultPolicies] (optional) customizes the default policies used by the +/// client. This can be used to change the cache-and-network or network-only +/// behavior of the client. +/// {@endtemplate} +/// +/// {@template nhost.graphqlClient.alwaysRebroadcast} +/// [alwaysRebroadcast] (optional) if true, the client will rebroadcast watch +/// queries when the underlying cache changes. This is false by default. +/// {@endtemplate} +/// +/// {@template nhost.graphqlClient.deepEquals} +/// [deepEquals] (optional) overrides the default deep equals comparison for +/// caching. +/// {@endtemplate} +/// +/// {@template nhost.graphqlClient.deduplicatePollers} +/// [deduplicatePollers] (optional) if true, the client will deduplicate +/// duplicate pollers. This is true by default. +/// {@endtemplate} +/// +/// {@template nhost.graphqlClient.queryRequestTimeout} +/// [queryRequestTimeout] (optional) overrides the default request timeout for +/// queries. This is 10 seconds by default. +/// {@endtemplate} GraphQLClient createNhostGraphQLClient( NhostClientBase nhostClient, { GraphQLCache? gqlCache, Map? defaultHeaders, http.Client? httpClientOverride, + DefaultPolicies? defaultPolicies, + bool? alwaysRebroadcast, + DeepEqualsFn? deepEquals, + bool? deduplicatePollers, + Duration? queryRequestTimeout, }) { return createNhostGraphQLClientForAuth( nhostClient.gqlEndpointUrl, @@ -37,6 +68,11 @@ GraphQLClient createNhostGraphQLClient( gqlCache: gqlCache, defaultHeaders: defaultHeaders, httpClientOverride: httpClientOverride, + defaultPolicies: defaultPolicies, + alwaysRebroadcast: alwaysRebroadcast, + deepEquals: deepEquals, + deduplicatePollers: deduplicatePollers, + queryRequestTimeout: queryRequestTimeout, ); } @@ -52,12 +88,28 @@ GraphQLClient createNhostGraphQLClient( /// {@macro nhost.graphqlClient.defaultHeaders} /// /// {@macro nhost.graphqlClient.httpClientOverride} +/// +/// {@macro nhost.graphqlClient.defaultPolicies} +/// +/// {@macro nhost.graphqlClient.alwaysRebroadcast} +/// +/// {@macro nhost.graphqlClient.deepEquals} +/// +/// {@macro nhost.graphqlClient.deduplicatePollers} +/// +/// {@macro nhost.graphqlClient.queryRequestTimeout} +/// GraphQLClient createNhostGraphQLClientForAuth( String nhostGqlEndpointUrl, HasuraAuthClient nhostAuth, { GraphQLCache? gqlCache, Map? defaultHeaders, http.Client? httpClientOverride, + DefaultPolicies? defaultPolicies, + bool? alwaysRebroadcast, + DeepEqualsFn? deepEquals, + bool? deduplicatePollers, + Duration? queryRequestTimeout, }) { return GraphQLClient( link: combinedLinkForNhostAuth( @@ -67,5 +119,10 @@ GraphQLClient createNhostGraphQLClientForAuth( httpClientOverride: httpClientOverride, ), cache: gqlCache ?? GraphQLCache(), + defaultPolicies: defaultPolicies, + alwaysRebroadcast: alwaysRebroadcast ?? false, + deepEquals: deepEquals, + deduplicatePollers: deduplicatePollers ?? false, + queryRequestTimeout: queryRequestTimeout ?? const Duration(seconds: 5), ); } diff --git a/packages/nhost_graphql_adapter/pubspec.yaml b/packages/nhost_graphql_adapter/pubspec.yaml index b5e0b7fa..ee32a930 100644 --- a/packages/nhost_graphql_adapter/pubspec.yaml +++ b/packages/nhost_graphql_adapter/pubspec.yaml @@ -9,7 +9,7 @@ environment: sdk: ">=2.14.0 <4.0.0" dependencies: - graphql: ^5.1.3 + graphql: ^5.2.0-beta.10 http: ^1.1.0 meta: ^1.7.0 diff --git a/packages/nhost_sdk/pubspec.yaml b/packages/nhost_sdk/pubspec.yaml index 1f7967af..b0b9c7ca 100644 --- a/packages/nhost_sdk/pubspec.yaml +++ b/packages/nhost_sdk/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: dev_dependencies: fake_async: ^1.3.1 - graphql: ^5.1.3 + graphql: ^5.2.0-beta.10 lints: any mockito: ^5.3.2 nock: ^1.2.1