@apollo/client@4.0.0-alpha.22
Pre-releaseMajor Changes
-
#12673
cee90ab
Thanks @phryneas! - TheincludeExtensions
option ofHttpLink
andBatchHttpLink
now defaults
totrue
.If
includeExtensions
istrue
, butextensions
is not set or empty, extensions
will not be included in outgoing requests. -
#12673
cee90ab
Thanks @phryneas! - TheApolloClient
constructor optionsname
andversion
that are used to
configure the client awareness feature have moved onto aclientAwareness
key.const client = new ApolloClient({ // .. - name: "my-app", - version: "1.0.0", + clientAwareness: { + name: "my-app", + version: "1.0.0", + }, });
-
#12690
5812759
Thanks @phryneas! - Aliasing any other field to__typename
is now forbidden. -
#12690
5812759
Thanks @phryneas! - Aliasing a field to an alias beginning with__ac_
is now forbidden - this namespace is now reserved for internal use. -
#12673
cee90ab
Thanks @phryneas! - Adds enhanced client awareness to the client.HttpLink
andBatchHttpLink
will now per default send information about the
client library you are using inextensions
.This could look like this:
{ "query": "query GetUser($id: ID!) { user(id: $id) { __typename id name } }", "variables": { "id": 5 }, "extensions": { "clientLibrary": { "name": "@apollo/client", "version": "4.0.0" } } }
This feature can be disabled by passing
enhancedClientAwareness: { transport: false }
to your
ApolloClient
,HttpLink
orBatchHttpLink
constructor options.
Minor Changes
-
#12698
be77d1a
Thanks @phryneas! - Adjusted the accept header for multipart requests according to the new GraphQL over HTTP spec with these changes:-multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json +multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/graphql-response+json,application/json;q=0.9
-multipart/mixed;deferSpec=20220824,application/json +multipart/mixed;deferSpec=20220824,application/graphql-response+json,application/json;q=0.9
-
#12673
cee90ab
Thanks @phryneas! - Add the newClientAwarenessLink
.This link is already included in
HttpLink
andBatchHttpLink
to enable the
"client awareness" and "enhanced client awareness" features, but you can also use
ClientAwarenessLink
directly in your link chain to combine it with other
terminating links.If you want to save the bundle size that
ClientAwarenessLink
adds toHttpLink
andBatchHttpLink
, you can useBaseHttpLink
orBaseBatchHttpLink
instead.
These links come without theClientAwarenessLink
included.For example:
import { ApolloClient, - HttpLink, } from "@apollo/client"; +import { BaseHttpLink } from "@apollo/client/link/http"; const client = new ApolloClient({ - link: new HttpLink({ + link: new BaseHttpLink({ uri, }), cache: new InMemoryCache(), });
-
#12698
be77d1a
Thanks @phryneas! - Adds anaccept
option toHttpOptions
that allows to add additionalAccept
headers to be merged in without overriding user-specified or default accept headers.