graphql-persisted_queries 1.2.1 → 1.3.0

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: 4ae3a956abf426513fde7370b4e90e4677b227a43a800a67e0094e05439a06a1
4
- data.tar.gz: 918f9fd46776d26a849cf858f4b791594ce694702cbae5f453672829c070f0fb
3
+ metadata.gz: e58f7f9d93216a84c0f80eff7216673ef7b86907f4b3001009ba4b29a043d984
4
+ data.tar.gz: 8df34c88bd32648f0ceffe576d3250f80ba96e622a5cb6e91bf4dd62667f1a05
5
5
  SHA512:
6
- metadata.gz: 69a31f10dd9e701fd7b00e28f40e4a51abc3b78d8d7a76bc0c670dd8c5a9fd4ef87b8e2df65d5128a092a636855b4c8940fbe0f8ba25d4136e8cc7c3200d7d80
7
- data.tar.gz: 11352cf7e1ec1e5d02e3445bc59598971e62bb5937964c31dc9e6d6883960f0b79c1895afbab231e7c0c61f2de211653f208326d880d07d9e5b67c7713681bbb
6
+ metadata.gz: b155dcc3bffc3c746c678b0c1c42418ab7fa63ebb35d1594aaac6b5b2befecb816a74f82de322486885448889b5249afe7cc2fb39173ef9e46d581c4d3eacb51
7
+ data.tar.gz: 2089112c8c17319121b89cb5a78db38a2b83b6b20859739189c064b24104a919f1504f465506382401740b03252aca0af9540993712f791d6dc970a6a65f25b6
@@ -18,7 +18,7 @@ jobs:
18
18
  strategy:
19
19
  fail-fast: false
20
20
  matrix:
21
- ruby: [2.3, 2.4, 2.5, 2.6, 2.7]
21
+ ruby: [2.5, 2.6, 2.7]
22
22
  gemfile: [
23
23
  "gemfiles/graphql_1_10.gemfile",
24
24
  "gemfiles/graphql_1_11.gemfile",
data/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.3.0 (2021-10-19)
6
+
7
+ - [PR#51](https://github.com/DmitryTsepelev/graphql-ruby-persisted_queries/pull/51) Drop Ruby 2.3 and 2.4 support ([@DmitryTsepelev][])
8
+
9
+ ## 1.2.4 (2021-06-07)
10
+
11
+ - [PR#50](https://github.com/DmitryTsepelev/graphql-ruby-persisted_queries/pull/50) Support empty redis_client arg on redis with locale cache ([@louim][])
12
+
13
+ ## 1.2.3 (2021-05-14)
14
+
15
+ - [PR#49](https://github.com/DmitryTsepelev/graphql-ruby-persisted_queries/pull/49) Allow nil redis_client with ENV["REDIS_URL"] ([@louim][])
16
+
17
+ ## 1.2.2 (2021-04-21)
18
+
19
+ - [PR#47](https://github.com/DmitryTsepelev/graphql-ruby-persisted_queries/pull/47) Properly initialize memory adapter inside RedisWithLocalCacheStoreAdapter ([@DmitryTsepelev][])
20
+
5
21
  ## 1.2.1 (2021-03-07)
6
22
 
7
23
  - [PR#43](https://github.com/DmitryTsepelev/graphql-ruby-persisted_queries/pull/43) Properly handle configuration when schema is inherited ([@DmitryTsepelev][])
@@ -74,3 +90,4 @@
74
90
  [@JanStevens]: https://github.com/JanStevens
75
91
  [@ogidow]: https://github.com/ogidow
76
92
  [@rbviz]: https://github.com/rbviz
93
+ [@louim]: https://github.com/louim
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # GraphQL::PersistedQueries
2
2
 
3
- `GraphQL::PersistedQueries` is the implementation of [persisted queries](https://github.com/apollographql/apollo-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.
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-link-persisted-queries](https://github.com/apollographql/apollo-link-persisted-queries) on the front–end side:
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 { createPersistedQueryLink } from "apollo-link-persisted-queries";
22
- import { createHttpLink } from "apollo-link-http";
23
- import { InMemoryCache } from "apollo-cache-inmemory";
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
- // use this with Apollo Client
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: 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/links/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!
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
- [apollo-link-persisted-queries](https://github.com/apollographql/apollo-link-persisted-queries) uses _SHA256_ for building hashes by default. Check out this [guide](docs/hash.md) if you want to override this behavior.
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
 
@@ -25,6 +25,9 @@ class GraphqlSchema < GraphQL::Schema
25
25
  use GraphQL::PersistedQueries,
26
26
  store: :redis,
27
27
  redis_client: ConnectionPool.new { Redis.new(url: "redis://127.0.0.2:2214/7") }
28
+ # or with ENV["REDIS_URL"]
29
+ use GraphQL::PersistedQueries,
30
+ store: :redis
28
31
  end
29
32
  ```
30
33
 
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.required_ruby_version = ">= 2.3"
23
+ spec.required_ruby_version = ">= 2.5"
24
24
 
25
25
  spec.add_dependency "graphql", ">= 1.10"
26
26
 
@@ -10,7 +10,7 @@ module GraphQL
10
10
  DEFAULT_EXPIRATION = 24 * 60 * 60
11
11
  DEFAULT_NAMESPACE = "graphql-persisted-query"
12
12
 
13
- def initialize(redis_client:, expiration: nil, namespace: nil)
13
+ def initialize(redis_client: {}, expiration: nil, namespace: nil)
14
14
  @redis_proc = build_redis_proc(redis_client)
15
15
  @expiration = expiration || DEFAULT_EXPIRATION
16
16
  @namespace = namespace || DEFAULT_NAMESPACE
@@ -8,7 +8,7 @@ module GraphQL
8
8
  DEFAULT_REDIS_ADAPTER_CLASS = RedisStoreAdapter
9
9
  DEFAULT_MEMORY_ADAPTER_CLASS = MemoryStoreAdapter
10
10
 
11
- def initialize(redis_client:, expiration: nil, namespace: nil, redis_adapter_class: nil,
11
+ def initialize(redis_client: {}, expiration: nil, namespace: nil, redis_adapter_class: nil,
12
12
  memory_adapter_class: nil)
13
13
  redis_adapter_class ||= DEFAULT_REDIS_ADAPTER_CLASS
14
14
  memory_adapter_class ||= DEFAULT_MEMORY_ADAPTER_CLASS
@@ -18,7 +18,7 @@ module GraphQL
18
18
  expiration: expiration,
19
19
  namespace: namespace
20
20
  )
21
- @memory_adapter = memory_adapter_class.new(nil)
21
+ @memory_adapter = memory_adapter_class.new
22
22
  @name = :redis_with_local_cache
23
23
  end
24
24
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  module PersistedQueries
5
- VERSION = "1.2.1"
5
+ VERSION = "1.3.0"
6
6
  end
7
7
  end
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.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DmitryTsepelev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-07 00:00:00.000000000 Z
11
+ date: 2021-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -180,7 +180,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
180
  requirements:
181
181
  - - ">="
182
182
  - !ruby/object:Gem::Version
183
- version: '2.3'
183
+ version: '2.5'
184
184
  required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  requirements:
186
186
  - - ">="