graphql-persisted_queries 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51e6b75b3baabc1ace75eab3b689bcbb6ee7082362036d6fc0dc70858f803a04
|
4
|
+
data.tar.gz: 4db1546160fd4ca16f9a67899b6e4cbd97140f75afa689e0214d3d7197ee729f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa30f3bddf9c7f933cc62d69199bceb5c55a430e8b3eca8e36c8eb9e1c78bb71f285b1f849b448e81fcb980afa9e5e2c6c4bc34e26041b6a612e830a8e4548a1
|
7
|
+
data.tar.gz: c1975bef00a57a1f18c37fde0811c5eb81d5ebfd8bd9704d02f05924e42251aa2c83f3008d7b3f2ba71face9567f39df5a3d4f2cfbbfef61be04c6a610b0942c
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.2.2 (2021-04-21)
|
6
|
+
|
7
|
+
- [PR#47](https://github.com/DmitryTsepelev/graphql-ruby-persisted_queries/pull/47) Properly initialize memory adapter inside RedisWithLocalCacheStoreAdapter ([@DmitryTsepelev][])
|
8
|
+
|
5
9
|
## 1.2.1 (2021-03-07)
|
6
10
|
|
7
11
|
- [PR#43](https://github.com/DmitryTsepelev/graphql-ruby-persisted_queries/pull/43) Properly handle configuration when schema is inherited ([@DmitryTsepelev][])
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# GraphQL::PersistedQueries
|
2
2
|
|
3
|
-
`GraphQL::PersistedQueries` is the implementation of [persisted queries](https://
|
3
|
+
`GraphQL::PersistedQueries` is the implementation of [persisted queries](https://www.apollographql.com/docs/react/api/link/persisted-queries/) for [graphql-ruby](https://github.com/rmosolgo/graphql-ruby). With this plugin your backend will cache all the queries, while frontend will send the full query only when it's not found at the backend storage.
|
4
4
|
|
5
5
|
- 🗑**Heavy query parameter will be omitted in most of cases** – network requests will become less heavy
|
6
6
|
- 🤝**Clients share cached queries** – it's enough to miss cache only once for each unique query
|
@@ -15,20 +15,18 @@
|
|
15
15
|
|
16
16
|
## Getting started
|
17
17
|
|
18
|
-
First of all, install and configure [apollo
|
18
|
+
First of all, install and configure [apollo's persisted queries](https://www.apollographql.com/docs/react/api/link/persisted-queries/) on the front–end side:
|
19
19
|
|
20
20
|
```js
|
21
|
-
import {
|
22
|
-
import {
|
23
|
-
import {
|
24
|
-
import ApolloClient from "apollo-client";
|
21
|
+
import { HttpLink, InMemoryCache, ApolloClient } from "@apollo/client";
|
22
|
+
import { createPersistedQueryLink } from "@apollo/client/link/persisted-queries";
|
23
|
+
import { sha256 } from 'crypto-hash';
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
const link = createPersistedQueryLink().concat(createHttpLink({ uri: "/graphql" }));
|
25
|
+
const httpLink = new HttpLink({ uri: "/graphql" });
|
26
|
+
const persistedQueriesLink = createPersistedQueryLink({ sha256 });
|
29
27
|
const client = new ApolloClient({
|
30
28
|
cache: new InMemoryCache(),
|
31
|
-
link:
|
29
|
+
link: persistedQueriesLink.concat(httpLink);
|
32
30
|
});
|
33
31
|
```
|
34
32
|
|
@@ -95,9 +93,9 @@ When the error occurs, the gem tries to not interrupt the regular flow of the ap
|
|
95
93
|
|
96
94
|
Since our queries are slim now, we can switch back to HTTP GET, you can find a [guide](docs/http_cache.md) here.
|
97
95
|
|
98
|
-
[batch-link](https://www.apollographql.com/docs/link/
|
96
|
+
[batch-link](https://www.apollographql.com/docs/react/api/link/apollo-link-batch-http/) allows to group queries on the client side into a single HTTP request before sending to the server. In this case you need to use `GraphqlSchema.multiplex(queries)` instead of `#execute`. The gem supports it too, no action required!
|
99
97
|
|
100
|
-
[
|
98
|
+
[persisted-queries-link](https://www.apollographql.com/docs/react/api/link/persisted-queries/) uses _SHA256_ for building hashes by default. Check out this [guide](docs/hash.md) if you want to override this behavior.
|
101
99
|
|
102
100
|
An experimental tracing feature can be enabled by setting `tracing: true` when configuring the plugin. Read more about this feature in the [Tracing guide](docs/tracing.md).
|
103
101
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-persisted_queries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DmitryTsepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|