+6
-6
.github/CODEOWNERS
+6
-6
.github/CODEOWNERS
···
1
-
/.github/ @ryan-roemer @boygirl
2
-
/.changeset/config.json @ryan-roemer @boygirl
3
-
/scripts/actions/* @ryan-roemer @boygirl
4
-
/scripts/prepare/* @ryan-roemer @boygirl
5
-
/scripts/rollup/* @ryan-roemer @boygirl
6
-
/scripts/changesets/* @ryan-roemer @boygirl
1
+
/.github/ @urql-graphql/core
2
+
/.changeset/config.json @urql-graphql/core
3
+
/scripts/actions/* @urql-graphql/core
4
+
/scripts/prepare/* @urql-graphql/core
5
+
/scripts/rollup/* @urql-graphql/core
6
+
/scripts/changesets/* @urql-graphql/core
+2
-2
.github/ISSUE_TEMPLATE/bug_report.yaml
+2
-2
.github/ISSUE_TEMPLATE/bug_report.yaml
···
40
40
label: Validations
41
41
description: Before submitting the issue, please make sure you do the following
42
42
options:
43
-
- label: I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which [GitHub Discussions](https://github.com/FormidableLabs/urql/discussions) should be used
43
+
- label: I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which [GitHub Discussions](https://github.com/urql-graphql/urql/discussions) should be used
44
44
required: true
45
45
- label: Read the [docs](https://formidable.com/open-source/urql/docs/).
46
46
required: true
47
-
- label: Follow our [Code of Conduct](https://github.com/FormidableLabs/urql/blob/main/CODE_OF_CONDUCT.md)
47
+
- label: Follow our [Code of Conduct](https://github.com/urql-graphql/urql/blob/main/CODE_OF_CONDUCT.md)
48
48
required: true
+1
-1
.github/ISSUE_TEMPLATE/config.yml
+1
-1
.github/ISSUE_TEMPLATE/config.yml
+3
-3
CODE_OF_CONDUCT.md
+3
-3
CODE_OF_CONDUCT.md
···
57
57
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
58
reported by contacting the project team:
59
59
60
-
- lauren.eastridge@formidable.com
61
-
- phil.pluckthun@formidable.com
62
-
- Twitter DMs: @_philpl
60
+
- phil@0no.co
61
+
- grant.sander@formidable.com
62
+
- jovi@preact.dev
63
63
64
64
All complaints will be reviewed and investigated and will result in a response that
65
65
is deemed necessary and appropriate to the circumstances. The project team is
+6
-7
CONTRIBUTING.md
+6
-7
CONTRIBUTING.md
···
17
17
first. We're also happy to discuss and help you open a PR and get your changes
18
18
in!
19
19
20
-
- If you have a question, try [creating a GitHub Discussions thread.](https://github.com/FormidableLabs/urql/discussions/new)
21
-
- If you think you've found a bug, [open a new issue.](https://github.com/FormidableLabs/urql/issues/new/choose)
22
-
- or, if you found a bug you'd like to fix, [open a PR.](https://github.com/FormidableLabs/urql/compare)
23
-
- If you'd like to propose a change [open an RFC issue.](https://github.com/FormidableLabs/urql/issues/new?labels=future+%F0%9F%94%AE&template=RFC.md&title=RFC%3A+Your+Proposal) You can read more about the RFC process [below](#how-do-i-propose-changes).
20
+
- If you have a question, try [creating a GitHub Discussions thread.](https://github.com/urql-graphql/urql/discussions/new)
21
+
- If you think you've found a bug, [open a new issue.](https://github.com/urql-graphql/urql/issues/new/choose)
22
+
- or, if you found a bug you'd like to fix, [open a PR.](https://github.com/urql-graphql/urql/compare)
23
+
- If you'd like to propose a change [open an RFC issue.](https://github.com/urql-graphql/urql/issues/new?labels=future+%F0%9F%94%AE&template=RFC.md&title=RFC%3A+Your+Proposal) You can read more about the RFC process [below](#how-do-i-propose-changes).
24
24
25
25
### What are the issue conventions?
26
26
···
35
35
We follow an **RFC proposal process**. This allows anyone to propose a new feature or a change, and
36
36
allows us to communicate our current planned features or changes, so any technical discussion,
37
37
progress, or upcoming changes are always **documented transparently.** You can [find the RFC
38
-
template](https://github.com/FormidableLabs/urql/issues/new/choose) in our issue creator.
38
+
template](https://github.com/urql-graphql/urql/issues/new/choose) in our issue creator.
39
39
40
-
All RFCs are added to the [RFC Lifecycle board.](https://github.com/FormidableLabs/urql/projects/3)
40
+
All RFCs are added to the [RFC Lifecycle board.](https://github.com/urql-graphql/urql/projects/3)
41
41
This board tracks where an RFC stands and who's working on it until it's completed. Bugs and PRs may
42
42
end up on there too if no corresponding RFC exists or was necessary. RFCs are typically first added
43
43
to "In Discussion" until we believe they're ready to be worked on. This step may either be short,
···
248
248
249
249
```sh
250
250
npm access grant read-write urql:developers [package]
251
-
npm access grant read-write formidable:formidable [package]
252
251
```
+2
-1
LICENSE
+2
-1
LICENSE
···
1
1
MIT License
2
2
3
-
Copyright (c) 2018–2020 Formidable
3
+
Copyright (c) 2018–2020 Formidable,
4
+
Copyright (c) urql GraphQL Team and other contributors
4
5
5
6
Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
of this software and associated documentation files (the "Software"), to deal
+13
-12
README.md
+13
-12
README.md
···
10
10
11
11
<br />
12
12
<br />
13
-
<a href="https://circleci.com/gh/FormidableLabs/urql">
14
-
<img alt="CI Status" src="https://github.com/FormidableLabs/urql/actions/workflows/ci.yml/badge.svg?branch=main" />
15
-
</a>
16
-
<a href="https://github.com/FormidableLabs/urql#maintenance-status">
17
-
<img alt="Maintenance Status" src="https://badgen.net/badge/maintenance/active/green" />
13
+
<a href="https://github.com/urql-graphql/urql/actions/workflows/ci.yml">
14
+
<img alt="CI Status" src="https://github.com/urql-graphql/urql/actions/workflows/ci.yml/badge.svg?branch=main" />
18
15
</a>
19
16
<a href="https://www.npmjs.com/package/urql">
20
17
<img alt="Weekly downloads" src="https://badgen.net/npm/dw/urql?color=blue" />
···
22
19
<a href="https://formidable.com/open-source/urql/docs/">
23
20
<img alt="Visit docs" src="https://badgen.net/badge/docs/visit site/orange" />
24
21
</a>
25
-
<a href="https://github.com/FormidableLabs/urql/discussions">
22
+
<a href="https://github.com/urql-graphql/urql/discussions">
26
23
<img alt="GitHub Discussions: Chat With Us" src="https://badgen.net/badge/discussions/chat%20with%20us/purple" />
27
24
</a>
28
25
<br />
···
37
34
- 🌱 Normalized caching via [`@urql/exchange-graphcache`](https://formidable.com/open-source/urql/docs/graphcache)
38
35
- 🔬 Easy debugging with the [`urql` devtools browser extensions](https://formidable.com/open-source/urql/docs/advanced/debugging/)
39
36
40
-
`urql` is a GraphQL client that exposes a set of helpers for several frameworks. It's built to be highly customisable and versatile so you can take it from getting started with your first GraphQL project all the way to building complex apps and experimenting with GraphQL clients.
37
+
`urql` is a GraphQL client that exposes a set of helpers for several frameworks. It's built to be highly customisable and versatile so
38
+
you can take it from getting started with your first GraphQL project all the way to building complex apps and experimenting with GraphQL clients.
41
39
42
-
While GraphQL is an elegant protocol and schema language, client libraries today typically come with large API footprints. We aim to create something more lightweight instead.
40
+
**📃 For more information, [check out the docs](https://formidable.com/open-source/urql/docs/).**
43
41
44
42
## Installation
45
43
···
49
47
npm install --save urql graphql
50
48
```
51
49
50
+
## 🙌 Contributing
51
+
52
+
**The urql project was founded by [Formidable](https://formidable.com/) and is actively developed
53
+
by the urql GraphQL team.**
54
+
55
+
If you'd like to get involved, [check out our Contributor's guide.](https://github.com/urql-graphql/urql/blob/main/CONTRIBUTING.md)
56
+
52
57
## 📃 [Documentation](https://formidable.com/open-source/urql/docs/)
53
58
54
59
The documentation contains everything you need to know about `urql`, and contains several sections in order of importance
···
61
66
- **[API](https://formidable.com/open-source/urql/docs/api/)** — the API documentation for each individual package.
62
67
63
68
_You can find the raw markdown files inside this repository's `docs` folder._
64
-
65
-
## Maintenance Status
66
-
67
-
**Active:** Formidable is actively working on this project, and we expect to continue work on this project for the foreseeable future. Bug reports, feature requests and pull requests are welcome.
68
69
69
70
<img width="100%" src="docs/assets/urql-spoiler.png" />
+1
-1
docs/advanced/README.md
+1
-1
docs/advanced/README.md
···
15
15
Persisted Queries and File Uploads using the two respective packages.
16
16
- [**Server-side Rendering**](./server-side-rendering.md) guides us through how to set up server-side rendering and rehydration.
17
17
- [**Debugging**](./debugging.md) shows us the [`urql`
18
-
devtools](https://github.com/FormidableLabs/urql-devtools/) and how to add our own debug events
18
+
devtools](https://github.com/urql-graphql/urql-devtools/) and how to add our own debug events
19
19
for its event view.
20
20
- [**Retrying operations**](./retry-operations.md) shows the `retryExchange` which allows you to retry operations when they've failed.
21
21
- [**Authentication**](./authentication.md) describes how to implement authentication using the `authExchange`
+2
-2
docs/advanced/debugging.md
+2
-2
docs/advanced/debugging.md
···
10
10
11
11
## Devtools
12
12
13
-
It's easiest to debug `urql` with the [`urql` devtools.](https://github.com/FormidableLabs/urql-devtools/)
13
+
It's easiest to debug `urql` with the [`urql` devtools.](https://github.com/urql-graphql/urql-devtools/)
14
14
15
15
It offers tools to inspect internal ["Debug Events"](#debug-events) as they happen, to explore data
16
16
as your app is seeing it, and to quickly trigger GraphQL queries.
17
17
18
18
[For instructions on how to set up the devtools, check out `@urql/devtools`'s readme in its
19
-
repository.](https://github.com/FormidableLabs/urql-devtools)
19
+
repository.](https://github.com/urql-graphql/urql-devtools)
20
20
21
21

22
22
+1
-1
docs/api/auth-exchange.md
+1
-1
docs/api/auth-exchange.md
···
101
101
}
102
102
```
103
103
104
-
[Read more examples in the documentation given here.](https://github.com/FormidableLabs/urql/tree/main/exchanges/auth#quick-start-guide)
104
+
[Read more examples in the documentation given here.](https://github.com/urql-graphql/urql/tree/main/exchanges/auth#quick-start-guide)
+1
-1
docs/architecture.md
+1
-1
docs/architecture.md
···
150
150
- [`requestPolicyExchange`](./api/request-policy-exchange.md): Automatically upgrades `cache-only` and `cache-first` operations to `cache-and-network` after a given amount of time.
151
151
- [`refocusExchange`](./api/refocus-exchange.md): Tracks open queries and refetches them
152
152
when the window regains focus.
153
-
- `devtoolsExchange`: Provides the ability to use the [urql-devtools](https://github.com/FormidableLabs/urql-devtools)
153
+
- `devtoolsExchange`: Provides the ability to use the [urql-devtools](https://github.com/urql-graphql/urql-devtools)
154
154
155
155
We can even swap out our [document cache](./basics/document-caching.md), which is implemented by
156
156
`@urql/core`'s `cacheExchange`, with `urql`'s [normalized cache,
+5
-5
docs/basics/ui-patterns.md
+5
-5
docs/basics/ui-patterns.md
···
5
5
6
6
# UI Patterns
7
7
8
-
> This page is incomplete. You can help us expanding it by suggesting more patterns or asking us about common problems you're facing on [GitHub Discussions](https://github.com/FormidableLabs/urql/discussions).
8
+
> This page is incomplete. You can help us expanding it by suggesting more patterns or asking us about common problems you're facing on [GitHub Discussions](https://github.com/urql-graphql/urql/discussions).
9
9
10
10
Generally, `urql`'s API surface is small and compact. Some common problems that we're facing when building apps may look like they're not a built-in feature, however, there are several patterns that even a lean UI can support.
11
11
This page is a collection of common UI patterns and problems we may face with GraphQL and how we can tackle them in
···
87
87
88
88
Here we keep an array of all `variables` we've encountered and use them to render their
89
89
respective `result` page. This only rerenders the additional page rather than having a long
90
-
list that constantly changes. [You can find a full code example of this pattern in our example folder on the topic of Graphcache pagination.](https://github.com/FormidableLabs/urql/tree/main/examples/with-graphcache-pagination)
90
+
list that constantly changes. [You can find a full code example of this pattern in our example folder on the topic of Graphcache pagination.](https://github.com/urql-graphql/urql/tree/main/examples/with-graphcache-pagination)
91
91
92
-
We also do not need to use our normalized cache to achieve this. As long as we're able to split individual lists up into chunks across components, we can also solve this problem entirely in UI code. [Read our example code on how to achieve this.](https://github.com/FormidableLabs/urql/tree/main/examples/with-pagination)
92
+
We also do not need to use our normalized cache to achieve this. As long as we're able to split individual lists up into chunks across components, we can also solve this problem entirely in UI code. [Read our example code on how to achieve this.](https://github.com/urql-graphql/urql/tree/main/examples/with-pagination)
93
93
94
94
## Prefetching data
95
95
···
161
161
In urql we leverage our extensibility pattern named "Exchanges" to manipulate the way
162
162
data comes in and goes out of our client.
163
163
164
-
- [Stale time](https://github.com/FormidableLabs/urql/tree/main/exchanges/request-policy)
165
-
- [Focus](https://github.com/FormidableLabs/urql/tree/main/exchanges/refocus)
164
+
- [Stale time](https://github.com/urql-graphql/urql/tree/main/exchanges/request-policy)
165
+
- [Focus](https://github.com/urql-graphql/urql/tree/main/exchanges/refocus)
166
166
167
167
When we want to introduce one of these patterns we add the package and add it to the `exchanges`
168
168
property of our `Client`. In the case of these two we'll have to add it before the cache
+23
-34
docs/comparison.md
+23
-34
docs/comparison.md
···
35
35
36
36
### Core Features
37
37
38
-
| | urql | Apollo | Relay |
39
-
| ------------------------------------------ | ----------------------------------- | --------------------------------------------- | ------------------------------ |
40
-
| Extensible on a network level | ✅ Exchanges | ✅ Links | ✅ Network Layers |
41
-
| Extensible on a cache / control flow level | ✅ Exchanges | 🛑 | 🛑 |
42
-
| Base Bundle Size | **5.9kB** (7.1kB with bindings) | 32.9kB | 27.7kB (34.1kB with bindings) |
43
-
| Devtools | ✅ | ✅ | ✅ |
44
-
| Subscriptions | ✅ | ✅ | ✅ |
45
-
| Client-side Rehydration | ✅ | ✅ | ✅ |
46
-
| Polled Queries | 🔶 | ✅ | ✅ |
47
-
| Lazy Queries | ✅ | ✅ | ✅ |
48
-
| Stale while Revalidate / Cache and Network | ✅ | ✅ | ✅ |
49
-
| Focus Refetching | ✅ `@urql/exchange-refocus` | 🛑 | 🛑 |
50
-
| Stale Time Configuration | ✅ `@urql/exchange-request-policy` | ✅ | 🛑 |
51
-
| Persisted Queries | ✅ `@urql/exchange-persisted-fetch` | ✅ `apollo-link-persisted-queries` | ✅ |
52
-
| Batched Queries | 🛑 | ✅ `apollo-link-batch-http` | 🟡 `react-relay-network-layer` |
53
-
| Live Queries | 🛑 | 🛑 | ✅ |
54
-
| Defer & Stream Directives | ✅ | ✅ / 🛑 (`@defer` is supported in >=3.7.0, `@stream` is not yet supported) | 🟡 (unreleased) |
55
-
| Switching to `GET` method | ✅ | ✅ | 🟡 `react-relay-network-layer` |
56
-
| File Uploads | ✅ `@urql/exchange-multipart-fetch` | 🟡 `apollo-upload-client` | 🛑 |
57
-
| Retrying Failed Queries | ✅ `@urql/exchange-retry` | ✅ `apollo-link-retry` | ✅ `DefaultNetworkLayer` |
58
-
| Easy Authentication Flows | ✅ `@urql/exchange-auth` | 🛑 (no docs for refresh-based authentication) | 🟡 `react-relay-network-layer` |
59
-
| Automatic Refetch after Mutation | ✅ (with document cache) | 🛑 | ✅ |
38
+
| | urql | Apollo | Relay |
39
+
| ------------------------------------------ | ----------------------------------- | -------------------------------------------------------------------------- | ------------------------------ |
40
+
| Extensible on a network level | ✅ Exchanges | ✅ Links | ✅ Network Layers |
41
+
| Extensible on a cache / control flow level | ✅ Exchanges | 🛑 | 🛑 |
42
+
| Base Bundle Size | **5.9kB** (7.1kB with bindings) | 32.9kB | 27.7kB (34.1kB with bindings) |
43
+
| Devtools | ✅ | ✅ | ✅ |
44
+
| Subscriptions | ✅ | ✅ | ✅ |
45
+
| Client-side Rehydration | ✅ | ✅ | ✅ |
46
+
| Polled Queries | 🔶 | ✅ | ✅ |
47
+
| Lazy Queries | ✅ | ✅ | ✅ |
48
+
| Stale while Revalidate / Cache and Network | ✅ | ✅ | ✅ |
49
+
| Focus Refetching | ✅ `@urql/exchange-refocus` | 🛑 | 🛑 |
50
+
| Stale Time Configuration | ✅ `@urql/exchange-request-policy` | ✅ | 🛑 |
51
+
| Persisted Queries | ✅ `@urql/exchange-persisted-fetch` | ✅ `apollo-link-persisted-queries` | ✅ |
52
+
| Batched Queries | 🛑 | ✅ `apollo-link-batch-http` | 🟡 `react-relay-network-layer` |
53
+
| Live Queries | 🛑 | 🛑 | ✅ |
54
+
| Defer & Stream Directives | ✅ | ✅ / 🛑 (`@defer` is supported in >=3.7.0, `@stream` is not yet supported) | 🟡 (unreleased) |
55
+
| Switching to `GET` method | ✅ | ✅ | 🟡 `react-relay-network-layer` |
56
+
| File Uploads | ✅ `@urql/exchange-multipart-fetch` | 🟡 `apollo-upload-client` | 🛑 |
57
+
| Retrying Failed Queries | ✅ `@urql/exchange-retry` | ✅ `apollo-link-retry` | ✅ `DefaultNetworkLayer` |
58
+
| Easy Authentication Flows | ✅ `@urql/exchange-auth` | 🛑 (no docs for refresh-based authentication) | 🟡 `react-relay-network-layer` |
59
+
| Automatic Refetch after Mutation | ✅ (with document cache) | 🛑 | ✅ |
60
60
61
61
Typically these are all additional addon features that you may expect from a GraphQL client, no
62
62
matter which framework you use it with. It's worth mentioning that all three clients support some
···
73
73
74
74
One thing of note is our lack of support for batched queries in `urql`. We explicitly decided not to
75
75
support this in our [first-party
76
-
packages](https://github.com/FormidableLabs/urql/issues/800#issuecomment-626342821) as the benefits
76
+
packages](https://github.com/urql-graphql/urql/issues/800#issuecomment-626342821) as the benefits
77
77
are not present anymore in most cases with HTTP/2 and established patterns by Relay that recommend
78
78
hoisting all necessary data requirements to a page-wide query.
79
79
···
91
91
| Vue Bindings | ✅ | 🟡 `vue-apollo` | 🟡 `vue-relay` |
92
92
| Angular Bindings | 🛑 | 🟡 `apollo-angular` | 🟡 `relay-angular` |
93
93
| Initial Data on mount | ✅ | ✅ | ✅ |
94
-
95
-
Interestingly all three libraries heavily support React as they were all started from the React
96
-
community outwards, but Apollo and Vue benefit from community bindings for different frameworks a
97
-
lot. `urql`'s community is still growing and while that means it won't see large projects as
98
-
Apollo's `vue-apollo` in the short term, we're aiming for first-party support for these bindings.
99
-
100
-
This is a common criticism that we hear about `urql`, and it's true that our community isn't as
101
-
extensive, but we attempt to lean on good and well funded maintenance at Formidable, active
102
-
investment, and good documentation. So you may have to evaluate whether you can get any questions
103
-
answered quickly enough on [GitHub Discussions](https://github.com/FormidableLabs/urql/discussions)
104
-
for instance.
105
94
106
95
### Caching and State
107
96
+1
-1
docs/graphcache/errors.md
+1
-1
docs/graphcache/errors.md
···
370
370
warning. This may happen because you've used the default reserved names `Mutation` or `Subscription`
371
371
for entities rather than as special Operation Root Types, and haven't specified this in the schema.
372
372
Hence this issue can often be fixed by either enabling
373
-
[Schema Awareness](https://formidable.com/open-source/urql/docs/graphcache/schema-awareness/) or by
373
+
[Schema Awareness](./schema-awareness.md) or by
374
374
adding a `schema` definition to your GraphQL Schema like so:
375
375
376
376
```graphql
+3
-3
docs/graphcache/offline.md
+3
-3
docs/graphcache/offline.md
···
91
91
92
92
For React Native, we can use the async storage package `@urql/storage-rn`.
93
93
94
-
Before installing the [library](https://github.com/FormidableLabs/urql/tree/main/packages/storage-rn), ensure you have installed the necessary peer dependencies:
94
+
Before installing the [library](https://github.com/urql-graphql/urql/tree/main/packages/storage-rn), ensure you have installed the necessary peer dependencies:
95
+
95
96
- NetInfo ([RN](https://github.com/react-native-netinfo/react-native-netinfo) | [Expo](https://docs.expo.dev/versions/latest/sdk/netinfo/)) and
96
97
- AsyncStorage ([RN](https://react-native-async-storage.github.io/async-storage/docs/install) | [Expo](https://docs.expo.dev/versions/v42.0.0/sdk/async-storage/)).
97
98
···
103
104
104
105
You can then create the custom storage and use it in the offline exchange:
105
106
106
-
107
107
```js
108
108
import { makeAsyncStorage } from '@urql/storage-rn';
109
109
110
110
const storage = makeAsyncStorage({
111
111
dataKey: 'graphcache-data', // The AsyncStorage key used for the data (defaults to graphcache-data)
112
112
metadataKey: 'graphcache-metadata', // The AsyncStorage key used for the metadata (defaults to graphcache-metadata)
113
-
maxAge: 7 // How long to persist the data in storage (defaults to 7 days)
113
+
maxAge: 7, // How long to persist the data in storage (defaults to 7 days)
114
114
});
115
115
```
116
116
+12
-21
exchanges/auth/README.md
+12
-21
exchanges/auth/README.md
···
2
2
3
3
<p align="center"><strong>An exchange for managing authentication in <code>urql</code></strong></p>
4
4
5
-
`@urql/exchange-auth` is an exchange for the [`urql`](https://github.com/FormidableLabs/urql) GraphQL client which helps handle auth headers and token refresh
5
+
`@urql/exchange-auth` is an exchange for the [`urql`](https://github.com/urql-graphql/urql) GraphQL client which helps handle auth headers and token refresh
6
6
7
7
## Quick Start Guide
8
8
···
27
27
dedupExchange,
28
28
cacheExchange,
29
29
authExchange({
30
-
addAuthToOperation: ({
31
-
authState,
32
-
operation,
33
-
}) => {
30
+
addAuthToOperation: ({ authState, operation }) => {
34
31
// the token isn't in the auth state, return the operation without changes
35
32
if (!authState || !authState.token) {
36
33
return operation;
···
42
39
? operation.context.fetchOptions()
43
40
: operation.context.fetchOptions || {};
44
41
45
-
return makeOperation(
46
-
operation.kind,
47
-
operation,
48
-
{
49
-
...operation.context,
50
-
fetchOptions: {
51
-
...fetchOptions,
52
-
headers: {
53
-
...fetchOptions.headers,
54
-
"Authorization": authState.token,
55
-
},
42
+
return makeOperation(operation.kind, operation, {
43
+
...operation.context,
44
+
fetchOptions: {
45
+
...fetchOptions,
46
+
headers: {
47
+
...fetchOptions.headers,
48
+
Authorization: authState.token,
56
49
},
57
50
},
58
-
);
51
+
});
59
52
},
60
53
willAuthError: ({ authState }) => {
61
54
if (!authState) return true;
···
64
57
},
65
58
didAuthError: ({ error }) => {
66
59
// check if the error was an auth error (this can be implemented in various ways, e.g. 401 or a special error code)
67
-
return error.graphQLErrors.some(
68
-
e => e.extensions?.code === 'FORBIDDEN',
69
-
);
60
+
return error.graphQLErrors.some(e => e.extensions?.code === 'FORBIDDEN');
70
61
},
71
62
getAuth: async ({ authState, mutate }) => {
72
63
// for initial launch, fetch the auth state from storage (local storage, async storage etc)
···
112
103
return null;
113
104
},
114
105
}),
115
-
fetchExchange
106
+
fetchExchange,
116
107
],
117
108
});
118
109
```
+3
-3
exchanges/auth/package.json
+3
-3
exchanges/auth/package.json
···
4
4
"description": "An exchange for managing authentication and token refresh in urql",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "exchanges/auth"
13
13
},
14
14
"keywords": [
···
16
16
"exchange",
17
17
"auth",
18
18
"authentication",
19
-
"formidablelabs",
19
+
"graphql",
20
20
"exchanges"
21
21
],
22
22
"main": "dist/urql-exchange-auth",
+3
-3
exchanges/context/README.md
+3
-3
exchanges/context/README.md
···
2
2
3
3
<p align="center"><strong>An exchange for setting operation context in <code>urql</code></strong></p>
4
4
5
-
`@urql/exchange-context` is an exchange for the [`urql`](https://github.com/FormidableLabs/urql) GraphQL client which can set the operation context both synchronously as well as asynchronously
5
+
`@urql/exchange-context` is an exchange for the [`urql`](https://github.com/urql-graphql/urql) GraphQL client which can set the operation context both synchronously as well as asynchronously
6
6
7
7
## Quick Start Guide
8
8
···
26
26
dedupExchange,
27
27
cacheExchange,
28
28
contextExchange({
29
-
getContext: async (operation) => {
29
+
getContext: async operation => {
30
30
const token = await getToken();
31
-
return { ...operation.context, headers: { authorization: token } }
31
+
return { ...operation.context, headers: { authorization: token } };
32
32
},
33
33
}),
34
34
fetchExchange,
+3
-3
exchanges/context/package.json
+3
-3
exchanges/context/package.json
···
4
4
"description": "An exchange for setting (a)synchronous operation-context in urql",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "exchanges/context"
13
13
},
14
14
"keywords": [
15
15
"urql",
16
16
"exchange",
17
17
"context",
18
-
"formidablelabs",
18
+
"graphql",
19
19
"exchanges"
20
20
],
21
21
"main": "dist/urql-exchange-context",
+1
-1
exchanges/execute/README.md
+1
-1
exchanges/execute/README.md
···
2
2
3
3
<p align="center"><strong>An exchange for executing queries against a local schema in <code>urql</code></strong></p>
4
4
5
-
`@urql/exchange-execute` is an exchange for the [`urql`](https://github.com/FormidableLabs/urql) GraphQL client which executes queries against a local schema.
5
+
`@urql/exchange-execute` is an exchange for the [`urql`](https://github.com/urql-graphql/urql) GraphQL client which executes queries against a local schema.
6
6
This is a replacement for the default _fetchExchange_ which sends queries over HTTP/S to be executed remotely.
7
7
8
8
## Quick Start Guide
+3
-3
exchanges/execute/package.json
+3
-3
exchanges/execute/package.json
···
4
4
"description": "An exchange for executing queries against a local schema in urql",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "exchanges/execute"
13
13
},
14
14
"keywords": [
···
16
16
"exchange",
17
17
"execute",
18
18
"executable schema",
19
-
"formidablelabs",
19
+
"graphql",
20
20
"exchanges"
21
21
],
22
22
"main": "dist/urql-exchange-execute",
+3
-3
exchanges/multipart-fetch/package.json
+3
-3
exchanges/multipart-fetch/package.json
···
4
4
"description": "An exchange that allows regular fetch and will transition to multipart when files are included",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "exchanges/multipart-fetch"
13
13
},
14
14
"keywords": [
15
15
"urql",
16
-
"formidablelabs",
16
+
"graphql",
17
17
"exchanges"
18
18
],
19
19
"main": "dist/urql-exchange-multipart-fetch",
+3
-3
exchanges/persisted-fetch/package.json
+3
-3
exchanges/persisted-fetch/package.json
···
4
4
"description": "An exchange that allows for persisted queries support when fetching queries",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "exchanges/persisted-fetch"
13
13
},
14
14
"keywords": [
15
15
"urql",
16
-
"formidablelabs",
16
+
"graphql",
17
17
"persisted queries",
18
18
"exchanges"
19
19
],
+3
-3
exchanges/populate/package.json
+3
-3
exchanges/populate/package.json
···
4
4
"description": "An exchange that automaticcally populates the mutation selection body",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/advanced/auto-populate-mutations",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "exchanges/populate"
13
13
},
14
14
"keywords": [
15
15
"urql",
16
-
"formidablelabs",
16
+
"graphql",
17
17
"exchanges"
18
18
],
19
19
"main": "dist/urql-exchange-populate",
+3
-3
exchanges/refocus/package.json
+3
-3
exchanges/refocus/package.json
···
4
4
"description": "An exchange that dispatches active operations when the window regains focus",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "exchanges/refocus"
13
13
},
14
14
"keywords": [
15
15
"urql",
16
16
"graphql client",
17
-
"formidablelabs",
17
+
"graphql",
18
18
"exchanges",
19
19
"react",
20
20
"focus"
+3
-3
exchanges/request-policy/package.json
+3
-3
exchanges/request-policy/package.json
···
4
4
"description": "An exchange for operation request-policy upgrading in urql",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "exchanges/request-policy"
13
13
},
14
14
"keywords": [
15
15
"urql",
16
16
"graphql client",
17
-
"formidablelabs",
17
+
"graphql",
18
18
"exchanges",
19
19
"request-policy"
20
20
],
+3
-3
exchanges/retry/package.json
+3
-3
exchanges/retry/package.json
···
4
4
"description": "An exchange for operation retry support in urql",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "exchanges/retry"
13
13
},
14
14
"keywords": [
15
15
"urql",
16
16
"graphql client",
17
-
"formidablelabs",
17
+
"graphql",
18
18
"exchanges",
19
19
"retry"
20
20
],
+3
-3
packages/core/package.json
+3
-3
packages/core/package.json
···
4
4
"description": "The shared core for the highly customizable and versatile GraphQL client",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "packages/core"
13
13
},
14
14
"keywords": [
15
+
"graphql",
15
16
"graphql client",
16
17
"state management",
17
18
"cache",
18
-
"formidablelabs",
19
19
"exchanges"
20
20
],
21
21
"main": "dist/urql-core",
+4
-4
packages/introspection/package.json
+4
-4
packages/introspection/package.json
···
4
4
"description": "Utilities for dealing with Introspection Queries and Client Schemas",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "packages/introspection"
13
13
},
14
14
"keywords": [
15
+
"graphql",
15
16
"graphql client",
16
17
"graphql schema",
17
-
"schema",
18
-
"formidablelabs"
18
+
"schema"
19
19
],
20
20
"main": "dist/urql-introspection",
21
21
"module": "dist/urql-introspection.mjs",
+9
-9
packages/next-urql/README.md
+9
-9
packages/next-urql/README.md
···
5
5
<a href="https://npmjs.com/package/next-urql">
6
6
<img alt="NPM Version" src="https://img.shields.io/npm/v/next-urql.svg" />
7
7
</a>
8
-
<a href="https://travis-ci.com/FormidableLabs/next-urql">
9
-
<img alt="Test Status" src="https://api.travis-ci.com/FormidableLabs/next-urql.svg?branch=master" />
10
-
</a>
11
8
</div>
12
9
13
10
## `next-urql`
···
30
27
npm install --save next-urql react-is urql
31
28
```
32
29
33
-
`react-is` helps to support server-side `Suspense` with `react-ssr-prepass`. This assumes you have followed the basic installation steps for `urql` [here](https://github.com/FormidableLabs/urql#installation).
30
+
`react-is` helps to support server-side `Suspense` with `react-ssr-prepass`. This assumes you have followed the basic installation steps for `urql` [here](https://github.com/urql-graphql/urql#installation).
34
31
35
32
Note that if you are using Next before v9.4 you'll need to polyfill fetch, this can be
36
33
done through [`isomorphic-unfetch`](https://www.npmjs.com/package/isomorphic-unfetch).
···
225
222
```javascript
226
223
import { initUrqlClient } from 'next-urql';
227
224
228
-
export const getServerSideProps = async (ctx) => {
229
-
const client = initUrqlClient({
230
-
url: '/graphql',
231
-
}, false /* set to false to disable suspense */);
225
+
export const getServerSideProps = async ctx => {
226
+
const client = initUrqlClient(
227
+
{
228
+
url: '/graphql',
229
+
},
230
+
false /* set to false to disable suspense */
231
+
);
232
232
233
233
const result = await client.query(QUERY, {}).toPromise();
234
234
235
235
return {
236
-
props: { data: result.data }
236
+
props: { data: result.data },
237
237
};
238
238
};
239
239
```
+2
-2
packages/next-urql/package.json
+2
-2
packages/next-urql/package.json
···
4
4
"description": "Convenience wrappers for using urql with NextJS.",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "packages/next-urql"
13
13
},
14
14
"main": "dist/next-urql.js",
+3
-3
packages/preact-urql/package.json
+3
-3
packages/preact-urql/package.json
···
4
4
"description": "A highly customizable and versatile GraphQL client for Preact",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "packages/preact-urql"
13
13
},
14
14
"keywords": [
15
15
"graphql client",
16
16
"state management",
17
17
"cache",
18
-
"formidablelabs",
18
+
"graphql",
19
19
"exchanges",
20
20
"preact"
21
21
],
+3
-3
packages/react-urql/package.json
+3
-3
packages/react-urql/package.json
···
4
4
"description": "A highly customizable and versatile GraphQL client for React",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "packages/react-urql"
13
13
},
14
14
"keywords": [
15
15
"graphql client",
16
16
"state management",
17
17
"cache",
18
-
"formidablelabs",
18
+
"graphql",
19
19
"exchanges",
20
20
"react"
21
21
],
+2
-1
packages/site/CHANGELOG.md
+2
-1
packages/site/CHANGELOG.md
···
1
1
# urql-docs
2
2
3
3
## 1.0.0
4
+
4
5
### Major Changes
5
6
6
-
- **Goodbye IE11!** 👋 This major release removes support for IE11. All code that is shipped will be transpiled much less and will _not_ be ES5-compatible anymore, by [@kitten](https://github.com/kitten) (See [#2504](https://github.com/FormidableLabs/urql/pull/2504))
7
+
- **Goodbye IE11!** 👋 This major release removes support for IE11. All code that is shipped will be transpiled much less and will _not_ be ES5-compatible anymore, by [@kitten](https://github.com/kitten) (See [#2504](https://github.com/urql-graphql/urql/pull/2504))
+3
-3
packages/storage-rn/package.json
+3
-3
packages/storage-rn/package.json
···
4
4
"sideEffects": false,
5
5
"description": "Graphcache offline storage for React Native",
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "packages/storage-rn"
13
13
},
14
14
"keywords": [
15
15
"urql",
16
16
"graphql client",
17
-
"formidablelabs",
17
+
"graphql",
18
18
"exchanges",
19
19
"react native",
20
20
"offline",
+4
-4
packages/storybook-addon/package.json
+4
-4
packages/storybook-addon/package.json
···
3
3
"version": "2.0.1",
4
4
"description": "Make stories in Storybook with urql",
5
5
"sideEffects": false,
6
-
"homepage": "https://github.com/FormidableLabs/urql/tree/main/packages/storybook-addon",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
6
+
"homepage": "https://github.com/urql-graphql/urql/tree/main/packages/storybook-addon",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "packages/storybook-addon"
13
13
},
14
14
"keywords": [
15
15
"addon",
16
16
"storybook",
17
17
"urql",
18
-
"formidablelabs",
18
+
"graphql",
19
19
"preact",
20
20
"react",
21
21
"storybook-addon",
+3
-3
packages/svelte-urql/package.json
+3
-3
packages/svelte-urql/package.json
···
4
4
"description": "A highly customizable and versatile GraphQL client for Svelte",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "packages/svelte-urql"
13
13
},
14
14
"keywords": [
15
15
"graphql client",
16
16
"state management",
17
17
"cache",
18
-
"formidablelabs",
18
+
"graphql",
19
19
"exchanges",
20
20
"svelte"
21
21
],
+3
-3
packages/vue-urql/package.json
+3
-3
packages/vue-urql/package.json
···
4
4
"description": "A highly customizable and versatile GraphQL client for vue",
5
5
"sideEffects": false,
6
6
"homepage": "https://formidable.com/open-source/urql/docs/",
7
-
"bugs": "https://github.com/FormidableLabs/urql/issues",
7
+
"bugs": "https://github.com/urql-graphql/urql/issues",
8
8
"license": "MIT",
9
9
"repository": {
10
10
"type": "git",
11
-
"url": "https://github.com/FormidableLabs/urql.git",
11
+
"url": "https://github.com/urql-graphql/urql.git",
12
12
"directory": "packages/vue-urql"
13
13
},
14
14
"keywords": [
15
15
"graphql client",
16
16
"state management",
17
17
"cache",
18
-
"formidablelabs",
18
+
"graphql",
19
19
"exchanges",
20
20
"vue"
21
21
],