···11+---
22+'@urql/core': patch
33+---
44+55+Add logic for `request.extensions.persistedQuery` to `@urql/core` to omit sending `query` as needed.
+5
.changeset/strange-apples-trade.md
···11+---
22+'@urql/exchange-persisted-fetch': major
33+---
44+55+Remove `persistedFetchExchange` and instead implement `persistedExchange`. This exchange must be placed in front of a terminating exchange (such as the default `fetchExchange` or a `subscriptionExchange` that supports persisted queries), and only modifies incoming operations to contain `extensions.persistedQuery`, which is sent on via the API. If the API expects Automatic Persisted Queries, requests are retried by this exchange internally.
+5
.changeset/three-poets-think.md
···11+---
22+'@urql/exchange-persisted-fetch': major
33+---
44+55+Rename `@urql/exchange-persisted-fetch` to `@urql/exchange-persisted`
+37-69
docs/advanced/persistence-and-uploads.md
···66# Persisted Queries and Uploads
7788`urql` supports both [Automatic Persisted
99-Queries](https://www.apollographql.com/docs/apollo-server/performance/apq/) and [File
1010-Uploads](https://www.apollographql.com/docs/apollo-server/data/file-uploads/).
1111-Both of these features are implemented by enhancing or swapping out the default
1212-[`fetchExchange`](../api/core.md#fetchexchange).
99+Queries](https://www.apollographql.com/docs/apollo-server/performance/apq/), Persisted Queries, and
1010+[File Uploads](https://www.apollographql.com/docs/apollo-server/data/file-uploads/).
1111+1212+While File Uploads should work without any modifications, an additional exchange must be installed
1313+and added for Persisted Queries to work.
13141415## Automatic Persisted Queries
1516···2930requests. If we only send the persisted queries with hashes as GET requests then they become a lot
3031easier for a CDN to cache, as by default most caches would not cache POST requests automatically.
31323232-In `urql`, we may use the `@urql/exchange-persisted-fetch` package's `persistedFetchExchange` to
3333-implement Automatic Persisted Queries. This exchange works alongside other fetch exchanges and only
3434-handles `query` operations.
3333+In `urql`, we may use the `@urql/exchange-persisted` package's `persistedExchange` to
3434+implement Automatic Persisted Queries. This exchange works alongside the default `fetchExchange`
3535+and other exchanges by adding the `extensions.persistedQuery` parameters to a GraphQL request.
35363637### Installation & Setup
37383838-First install `@urql/exchange-persisted-fetch` alongside `urql`:
3939+First install `@urql/exchange-persisted` alongside `urql`:
39404041```sh
4141-yarn add @urql/exchange-persisted-fetch
4242+yarn add @urql/exchange-persisted
4243# or
4343-npm install --save @urql/exchange-persisted-fetch
4444+npm install --save @urql/exchange-persisted
4445```
45464646-You'll then need to add the `persistedFetchExchange` method, that this package exposes,
4747+You'll then need to add the `persistedExchange` function, that this package exposes,
4748to your `exchanges`.
48494950```js
5051import { createClient, dedupExchange, fetchExchange, cacheExchange } from 'urql';
5151-import { persistedFetchExchange } from '@urql/exchange-persisted-fetch';
5252+import { persistedExchange } from '@urql/exchange-persisted-fetch';
52535354const client = createClient({
5455 url: 'http://localhost:1234/graphql',
5556 exchanges: [
5657 dedupExchange,
5758 cacheExchange,
5858- persistedFetchExchange({
5959+ persistedExchange({
5960 preferGetForPersistedQueries: true,
6061 }),
6162 fetchExchange,
···65666667As we can see, typically it's recommended to set `preferGetForPersistedQueries` to `true` to force
6768all persisted queries to use GET requests instead of POST so that CDNs can do their job.
6868-We also added the `persistedFetchExchange` in front of the usual `fetchExchange`, since it only
6969-handles queries but not mutations.
6969+We also added the `persistedExchange` in front of the usual `fetchExchange`, since it has to
7070+update operations before they reach an exchange that talks to an API.
70717172The `preferGetForPersistedQueries` is similar to the [`Client`'s
7273`preferGetMethod`](../api/core.md#client) but only switches persisted queries to use GET requests
7374instead. This is preferable since sometimes the GraphQL query can grow too large for a simple GET
7474-query to handle, while the `persistedFetchExchange`'s SHA256 hashes will remain predictably small.
7575+query to handle, while the `persistedExchange`'s SHA256 hashes will remain predictably small.
75767677### Customizing Hashing
77787878-The `persistedFetchExchange` also accepts a `generateHash` option. This may be used to swap out the
7979+The `persistedExchange` also accepts a `generateHash` option. This may be used to swap out the
7980exchange's default method of generating SHA256 hashes. By default, the exchange will use the
8080-built-in [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) on the
8181-browser, which has been implemented to support IE11 as well. In Node.js it'll use the [Node
8282-Crypto Module](https://nodejs.org/api/crypto.html) instead.
8181+built-in [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) when it's
8282+available, and in Node.js it'll use the [Node Crypto Module](https://nodejs.org/api/crypto.html)
8383+instead.
83848485If you're using [the `graphql-persisted-document-loader` for
8585-Webpack](https://github.com/leoasis/graphql-persisted-document-loader) for instance, then you will
8686+Webpack](https://github.com/leoasis/graphql-persisted-document-loader), for instance, then you will
8687already have a loader generating SHA256 hashes for you at compile time. In that case we could swap
8788out the `generateHash` function with a much simpler one that uses the `generateHash` function's
8889second argument, a GraphQL `DocumentNode` object.
···9495```
95969697If you're using **React Native** then you may not have access to the Web Crypto API, which means
9797-that you have to provide your own SHA256 function to the `persistedFetchExchange`. Luckily we can do
9898+that you have to provide your own SHA256 function to the `persistedExchange`. Luckily, we can do
9899so easily by using the first argument `generateHash` receives, a GraphQL query as a string.
99100100101```js
···108109```
109110110111Additionally, if the API only expects persisted queries and not arbitrary ones and all queries are
111111-pre-registered against the API then the `persistedFetchExchange` may be put into a **non-automatic**
112112+pre-registered against the API then the `persistedExchange` may be put into a **non-automatic**
112113persisted queries mode by giving it the `enforcePersistedQueries: true` option. This disables any
113114retry logic and assumes that persisted queries will be handled like regular GraphQL requests.
114115115115-[Read more about `@urql/persisted-fetch-exchange` in our API
116116-docs.](../api/persisted-fetch-exchange.md)
117117-118116## File Uploads
119117120120-GraphQL server frameworks like [Apollo Server support an unofficial spec for file
121121-uploads.](https://www.apollographql.com/docs/apollo-server/data/file-uploads/) This allows us to
122122-define mutations on our API that accept an `Upload` input, which on the client would be a variable
123123-that we can set to a [File](https://developer.mozilla.org/en-US/docs/Web/API/File), which we'd
124124-typically retrieve via a [file input for
125125-instance](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications).
118118+Many GraphQL server frameworks and APIs support the ["GraphQL Multipart Request
119119+Spec](https://github.com/jaydenseric/graphql-multipart-request-spec) to allow files to be uploaded.
120120+Often, this is defined in schemas using a `File` or `Upload` input.
121121+This allows us to pass a `File` or `Blob` directly to our GraphQL requests as variables, and the
122122+spec requires us to perform this request as a multipart upload.
126123127127-In `urql`, we may use the `@urql/exchange-multipart-fetch` package's `multipartFetchExchange` to
128128-support file uploads, which is a drop-in replacement for the default
129129-[`fetchExchange`](../api/core.md#fetchexchange). It may also be used [alongside the
130130-`persistedFetchExchange`](#automatic-persisted-queries).
124124+Files are often handled in the browser via the [File API](https://developer.mozilla.org/en-US/docs/Web/API/File),
125125+which we may typically get to via a [file input](https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications)
126126+for example.
131127132132-It works by using the [`extract-files` package](https://www.npmjs.com/package/extract-files). When
133133-the `multipartFetchExchange` sees at least one `File` in the variables it receives for a mutation,
134134-then it will send a `multipart/form-data` POST request instead of a standard `application/json`
135135-one. This is basically the same kind of request that we'd expect to send for regular HTML forms.
136136-137137-### Installation & Setup
128128+In `urql`, these are supported natively, so as long as your JS environment supports either `File` or
129129+`Blob`s, you can pass these directly to any `urql` API via your `variables`, and the default
130130+`fetchExchange` will swich to using a multipart request instead.
138131139139-First install `@urql/exchange-multipart-fetch` alongside `urql`:
140140-141141-```sh
142142-yarn add @urql/exchange-multipart-fetch
143143-# or
144144-npm install --save @urql/exchange-multipart-fetch
145145-```
146146-147147-The `multipartFetchExchange` is a drop-in replacement for the `fetchExchange`, which should be
148148-replaced in the list of `exchanges`:
149149-150150-```js
151151-import { createClient, dedupExchange, cacheExchange } from 'urql';
152152-import { multipartFetchExchange } from '@urql/exchange-multipart-fetch';
153153-154154-const client = createClient({
155155- url: 'http://localhost:3000/graphql',
156156- exchanges: [dedupExchange, cacheExchange, multipartFetchExchange],
157157-});
158158-```
159159-160160-If you're using the `persistedFetchExchange` then put the `persistedFetchExchange` in front of the
161161-`multipartFetchExchange`, since only the latter is a full replacement for the `fetchExchange`, and
162162-the former only handled query operations.
163163-164164-[Read more about `@urql/multipart-fetch-exchange` in our API
165165-docs.](../api/multipart-fetch-exchange.md)
132132+Previously, this worked by installing the [`@urql/multipart-fetch-exchange` package](../api/multipart-fetch-exchange.md),
133133+however, this package has been deprecated and file uploads are now built into `@urql/core`.
-1
docs/api/README.md
···1919- [`@urql/exchange-retry` API docs](./retry-exchange.md)
2020- [`@urql/exchange-execute` API docs](./execute-exchange.md)
2121- [`@urql/exchange-multipart-fetch` API docs](./multipart-fetch-exchange.md)
2222-- [`@urql/exchange-persisted-fetch` API docs](./persisted-fetch-exchange.md)
2322- [`@urql/exchange-request-policy` API docs](./request-policy-exchange.md)
2423- [`@urql/exchange-auth` API docs](./auth-exchange.md)
2524- [`@urql/exchange-refocus` API docs](./refocus-exchange.md)
+1-2
docs/api/multipart-fetch-exchange.md
···1717Spec](https://github.com/jaydenseric/graphql-multipart-request-spec) which is supported by the
1818[Apollo Sever package](https://www.apollographql.com/docs/apollo-server/data/file-uploads/).
19192020-This exchange uses the same fetch logic as the [`fetchExchange`](./core.md#fetchexchange) and the
2121-[`persistedFetchExchange`](./persisted-fetch-exchange.md) by reusing logic from `@urql/core/internal`.
2020+This exchange uses the same fetch logic as the [`fetchExchange`](./core.md#fetchexchange) and by reusing logic from `@urql/core/internal`.
2221The `multipartFetchExchange` is a drop-in replacement for the default
2322[`fetchExchange`](./core.md#fetchexchange) and will act exactly like the `fetchExchange` unless the
2423`variables` that it receives for mutations contain any `File`s as detected by the `extract-files` package.
-68
docs/api/persisted-fetch-exchange.md
···11----
22-title: '@urql/exchange-persisted-fetch'
33-order: 8
44----
55-66-# Persisted Fetch Exchange
77-88-The `@urql/exchange-persisted-fetch` package contains an addon `persistedFetchExchange` for `urql`
99-that enables the use of _Automatic Persisted Queries_ with `urql`.
1010-1111-It follows the unofficial [GraphQL Persisted Queries
1212-Spec](https://github.com/apollographql/apollo-link-persisted-queries#apollo-engine) which is
1313-supported by the
1414-[Apollo Sever package](https://www.apollographql.com/docs/apollo-server/performance/apq/).
1515-1616-This exchange uses the same fetch logic as the [`fetchExchange`](./core.md#fetchexchange) and the
1717-[`multipartFetchExchange`](./multipart-fetch-exchange.md) by reusing logic from `@urql/core/internal`.
1818-The `persistedFetchExchange` will attempt to send queries with an additional SHA256 hash to the
1919-GraphQL API and will otherwise, when Automatic Persisted Queries are unsupported or when a mutation
2020-or subscription is sent, forward the operation to the next exchange. Hence it should always be added
2121-in front of another [`fetchExchange`](./core.md#fetchexchange).
2222-2323-The `persistedFetchExchange` will use the built-in [Web Crypto
2424-API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) for SHA256 hashing in the
2525-browser, which has been implemented to support IE11 as well. In Node.js it'll use the [Node
2626-Crypto Module](https://nodejs.org/api/crypto.html) instead. It's also possible to use the
2727-`generateHash` option to alter how the SHA256 hash is generated or retrieved.
2828-2929-## Installation and Setup
3030-3131-First install `@urql/exchange-persisted-fetch` alongside `urql`:
3232-3333-```sh
3434-yarn add @urql/exchange-persisted-fetch
3535-# or
3636-npm install --save @urql/exchange-persisted-fetch
3737-```
3838-3939-You'll then need to add the `persistedFetchExchange`, that this package exposes, to your
4040-`exchanges`, in front of the `fetchExchange`. If you're using the
4141-[`multipartFetchExchange`](./multipart-fetch-exchange.md) then it must be added in front of that
4242-instead:
4343-4444-```js
4545-import { createClient, dedupExchange, fetchExchange, cacheExchange } from 'urql';
4646-import { persistedFetchExchange } from '@urql/exchange-persisted-fetch';
4747-4848-const client = createClient({
4949- url: 'http://localhost:1234/graphql',
5050- exchanges: [
5151- dedupExchange,
5252- cacheExchange,
5353- persistedFetchExchange({
5454- /* optional config */
5555- }),
5656- fetchExchange,
5757- ],
5858-});
5959-```
6060-6161-## Options
6262-6363-| Option | Description |
6464-| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
6565-| `preferGetForPersistedQueries` | This is similar to [the `Client`'s `preferGetMethod` option](./core.md#client) and will cause all persisted queries to be sent using a GET request. |
6666-| `enforcePersistedQueries` | This option enforced persisted queries. Instead of allowing automatic persisted queries or triggering any retry logic when the API responds, it instead assumes that persisted queries will succeed and run like normal GraphQL API requests. |
6767-| `generateHash` | This option accepts a function that receives the `query` as a string and the raw `DocumentNode` as a second argument and must return a `Promise<string>` resolving to a SHA256 hash. This can be used to swap out the SHA256 API, e.g. for React Native, or to use pre-generated SHA256 strings from the `DocumentNode`. |
6868-| `enableForMutation` | This option allows mutations to be persisted in addition to queries. It's false by default. When a persisted mutation is requested, `preferGetForPersistedQueries` will be ignored and a POST method will always be used. |
+22-22
docs/comparison.md
···35353636### Core Features
37373838-| | urql | Apollo | Relay |
3939-| ------------------------------------------ | ----------------------------------- | -------------------------------------------------------------------------- | ------------------------------ |
4040-| Extensible on a network level | ✅ Exchanges | ✅ Links | ✅ Network Layers |
4141-| Extensible on a cache / control flow level | ✅ Exchanges | 🛑 | 🛑 |
4242-| Base Bundle Size | **5.9kB** (7.1kB with bindings) | 32.9kB | 27.7kB (34.1kB with bindings) |
4343-| Devtools | ✅ | ✅ | ✅ |
4444-| Subscriptions | ✅ | ✅ | ✅ |
4545-| Client-side Rehydration | ✅ | ✅ | ✅ |
4646-| Polled Queries | 🔶 | ✅ | ✅ |
4747-| Lazy Queries | ✅ | ✅ | ✅ |
4848-| Stale while Revalidate / Cache and Network | ✅ | ✅ | ✅ |
4949-| Focus Refetching | ✅ `@urql/exchange-refocus` | 🛑 | 🛑 |
5050-| Stale Time Configuration | ✅ `@urql/exchange-request-policy` | ✅ | 🛑 |
5151-| Persisted Queries | ✅ `@urql/exchange-persisted-fetch` | ✅ `apollo-link-persisted-queries` | ✅ |
5252-| Batched Queries | 🛑 | ✅ `apollo-link-batch-http` | 🟡 `react-relay-network-layer` |
5353-| Live Queries | 🛑 | 🛑 | ✅ |
5454-| Defer & Stream Directives | ✅ | ✅ / 🛑 (`@defer` is supported in >=3.7.0, `@stream` is not yet supported) | 🟡 (unreleased) |
5555-| Switching to `GET` method | ✅ | ✅ | 🟡 `react-relay-network-layer` |
5656-| File Uploads | ✅ | 🟡 `apollo-upload-client` | 🛑 |
5757-| Retrying Failed Queries | ✅ `@urql/exchange-retry` | ✅ `apollo-link-retry` | ✅ `DefaultNetworkLayer` |
5858-| Easy Authentication Flows | ✅ `@urql/exchange-auth` | 🛑 (no docs for refresh-based authentication) | 🟡 `react-relay-network-layer` |
5959-| Automatic Refetch after Mutation | ✅ (with document cache) | 🛑 | ✅ |
3838+| | urql | Apollo | Relay |
3939+| ------------------------------------------ | ---------------------------------- | -------------------------------------------------------------------------- | ------------------------------ |
4040+| Extensible on a network level | ✅ Exchanges | ✅ Links | ✅ Network Layers |
4141+| Extensible on a cache / control flow level | ✅ Exchanges | 🛑 | 🛑 |
4242+| Base Bundle Size | **5.9kB** (7.1kB with bindings) | 32.9kB | 27.7kB (34.1kB with bindings) |
4343+| Devtools | ✅ | ✅ | ✅ |
4444+| Subscriptions | ✅ | ✅ | ✅ |
4545+| Client-side Rehydration | ✅ | ✅ | ✅ |
4646+| Polled Queries | 🔶 | ✅ | ✅ |
4747+| Lazy Queries | ✅ | ✅ | ✅ |
4848+| Stale while Revalidate / Cache and Network | ✅ | ✅ | ✅ |
4949+| Focus Refetching | ✅ `@urql/exchange-refocus` | 🛑 | 🛑 |
5050+| Stale Time Configuration | ✅ `@urql/exchange-request-policy` | ✅ | 🛑 |
5151+| Persisted Queries | ✅ `@urql/exchange-persisted` | ✅ `apollo-link-persisted-queries` | ✅ |
5252+| Batched Queries | 🛑 | ✅ `apollo-link-batch-http` | 🟡 `react-relay-network-layer` |
5353+| Live Queries | 🛑 | 🛑 | ✅ |
5454+| Defer & Stream Directives | ✅ | ✅ / 🛑 (`@defer` is supported in >=3.7.0, `@stream` is not yet supported) | 🟡 (unreleased) |
5555+| Switching to `GET` method | ✅ | ✅ | 🟡 `react-relay-network-layer` |
5656+| File Uploads | ✅ | 🟡 `apollo-upload-client` | 🛑 |
5757+| Retrying Failed Queries | ✅ `@urql/exchange-retry` | ✅ `apollo-link-retry` | ✅ `DefaultNetworkLayer` |
5858+| Easy Authentication Flows | ✅ `@urql/exchange-auth` | 🛑 (no docs for refresh-based authentication) | 🟡 `react-relay-network-layer` |
5959+| Automatic Refetch after Mutation | ✅ (with document cache) | 🛑 | ✅ |
60606161Typically these are all additional addon features that you may expect from a GraphQL client, no
6262matter which framework you use it with. It's worth mentioning that all three clients support some
···11-# @urql/exchange-persisted-fetch
22-33-The `persistedFetchExchange` is an exchange that builds on the regular `fetchExchange`
44-but adds support for Persisted Queries.
55-66-## Quick Start Guide
77-88-First install `@urql/exchange-persisted-fetch` alongside `urql`:
99-1010-```sh
1111-yarn add @urql/exchange-persisted-fetch
1212-# or
1313-npm install --save @urql/exchange-persisted-fetch
1414-```
1515-1616-You'll then need to add the `persistedFetchExchange` method, that this package exposes,
1717-to your `exchanges`.
1818-1919-```js
2020-import { createClient, dedupExchange, fetchExchange, cacheExchange } from 'urql';
2121-import { persistedFetchExchange } from '@urql/exchange-persisted-fetch';
2222-2323-const client = createClient({
2424- url: 'http://localhost:1234/graphql',
2525- exchanges: [
2626- dedupExchange,
2727- cacheExchange,
2828- persistedFetchExchange({
2929- /* optional config */
3030- }),
3131- fetchExchange,
3232- ],
3333-});
3434-```
3535-3636-The `persistedQueryExchange` supports three configuration options:
3737-3838-- `preferGetForPersistedQueries`: Use `GET` for fetches with persisted queries
3939-- `enforcePersistedQueries`: This disables _automatic persisted queries_ and disables any retry
4040- logic for how the API responds to persisted queries. Instead it's assumed that they'll always
4141- succeed.
4242-- `generateHash`: A function that takes a GraphQL query and returns the hashed result. This defaults to the `window.crypto` API in the browser and the `crypto` module in node.
4343-4444-The `persistedFetchExchange` only handles queries, so for mutations we keep the
4545-`fetchExchange` around alongside of it.
4646-4747-## Avoid hashing during runtime
4848-4949-If you want to generate hashes at build-time you can use a [webpack-loader](https://github.com/leoasis/graphql-persisted-document-loader) to achieve this,
5050-when using this all you need to do in this exchange is the following:
5151-5252-```js
5353-import { createClient, dedupExchange, fetchExchange, cacheExchange } from 'urql';
5454-import { persistedFetchExchange } from '@urql/exchange-persisted-fetch';
5555-5656-const client = createClient({
5757- url: 'http://localhost:1234/graphql',
5858- exchanges: [
5959- dedupExchange,
6060- cacheExchange,
6161- persistedFetchExchange({
6262- generateHash: (_, document) => document.documentId,
6363- }),
6464- fetchExchange,
6565- ],
6666-});
6767-```
···11+# @urql/exchange-persisted
22+33+The `persistedExchange` is an exchange that allows other terminating exchanges to support Persisted Queries, and is as such placed in front of either the default `fetchExchange` or
44+other terminating exchanges.
55+66+## Quick Start Guide
77+88+First install `@urql/exchange-persisted` alongside `urql`:
99+1010+```sh
1111+yarn add @urql/exchange-persisted
1212+# or
1313+npm install --save @urql/exchange-persisted
1414+```
1515+1616+You'll then need to add the `persistedExchange` function, that this package exposes,
1717+to your `exchanges`.
1818+1919+```js
2020+import { createClient, dedupExchange, fetchExchange, cacheExchange } from 'urql';
2121+import { persistedExchange } from '@urql/exchange-persisted';
2222+2323+const client = createClient({
2424+ url: 'http://localhost:1234/graphql',
2525+ exchanges: [
2626+ dedupExchange,
2727+ cacheExchange,
2828+ persistedExchange({
2929+ /* optional config */
3030+ }),
3131+ fetchExchange,
3232+ ],
3333+});
3434+```
3535+3636+The `persistedExchange` supports three configuration options:
3737+3838+- `preferGetForPersistedQueries`: Enforce `GET` method to be used by the default `fetchExchange` for persisted queries
3939+- `enforcePersistedQueries`: This disables _automatic persisted queries_ and disables any retry logic for how the API responds to persisted queries. Instead it's assumed that they'll always succeed.
4040+- `generateHash`: A function that takes a GraphQL query and returns the hashed result. This defaults to the `window.crypto` API in the browser and the `crypto` module in Node.
4141+- `enableForMutation`: By default, the exchange only handles `query` operations, but enabling this allows it to handle mutations as well.
4242+4343+## Avoid hashing during runtime
4444+4545+If you want to generate hashes at build-time you can use a [webpack-loader](https://github.com/leoasis/graphql-persisted-document-loader) to achieve this,
4646+when using this all you need to do in this exchange is the following:
4747+4848+```js
4949+import { createClient, dedupExchange, fetchExchange, cacheExchange } from 'urql';
5050+import { persistedExchange } from '@urql/exchange-persisted';
5151+5252+const client = createClient({
5353+ url: 'http://localhost:1234/graphql',
5454+ exchanges: [
5555+ dedupExchange,
5656+ cacheExchange,
5757+ persistedExchange({
5858+ generateHash: (_, document) => document.documentId,
5959+ }),
6060+ fetchExchange,
6161+ ],
6262+});
6363+```
···4141 */
4242type Extensions = Record<string, any>;
43434444+/** Extensions sub-property on `persistedQuery` for Automatic Persisted Queries.
4545+ *
4646+ * @remarks
4747+ * This is part of the Automatic Persisted Query defacto standard and allows an API
4848+ * request to omit the `query`, instead sending this `sha256Hash`.
4949+ */
5050+export interface PersistedRequestExtensions {
5151+ version?: 1;
5252+ sha256Hash: string;
5353+ /** Set when a `sha256Hash` previously experienced a miss which will force `query` to be sent. */
5454+ miss?: boolean;
5555+}
5656+5757+/** Extensions which may be palced on {@link GraphQLRequest | GraphQLRequests}.
5858+ * @see {@link https://github.com/graphql/graphql-over-http/blob/1928447/spec/GraphQLOverHTTP.md#request-parameters} for the GraphQL over HTTP spec
5959+ */
6060+export interface RequestExtensions {
6161+ persistedQuery?: PersistedRequestExtensions;
6262+ [extension: string]: any;
6363+}
6464+4465/** Incremental Payloads sent as part of "Incremental Delivery" patching prior result data.
4566 *
4667 * @remarks
···253274 /** Additional metadata that a GraphQL API may accept for spec extensions.
254275 * @see {@link https://github.com/graphql/graphql-over-http/blob/1928447/spec/GraphQLOverHTTP.md#request-parameters} for the GraphQL over HTTP spec
255276 */
256256- extensions?: Record<string, any> | undefined;
277277+ extensions?: RequestExtensions | undefined;
257278}
258279259280/** Parameters from which {@link GraphQLRequest | GraphQLRequests} are created from.