graphql-fragment_cache 1.18.1 → 1.19.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: da685d54588830a63cc96b79d9348f496c3d9e114b8bbd39353d89bbf734a2be
4
- data.tar.gz: e97d85a3bb1b1ef33b50f9b784f14d5cf0662a220cb46b3e0195422775ca230a
3
+ metadata.gz: d4dd3472ddcbe18e4c306b81770b5a9fa2dbe306968d1e16f2d98e81630bfec8
4
+ data.tar.gz: 96c8cd920f0e46041c803527bbe3679841daa169aae82db6d627747eaf4632b9
5
5
  SHA512:
6
- metadata.gz: 435e71e009c537926c19b2089815b8633a91f0f30caf49fbc45c71d227ff9923867a52c01ed9a0e0e8eff4c51bfa7887371af5ce51281c74bc0be7fcd9566f82
7
- data.tar.gz: 87eadfeba581e7ad08a492ae9c82c6a40406def445b1284943dfa55c320426d7135401761561e3fd7ad1c7c99a987b0a52ec1fc6c5c3a229b8ce5ee5a77e3bc6
6
+ metadata.gz: c308ffcdfdb6fc7529ec3d094109cf7d21db8380b598435d6274e5b1f89a14110ece6fda565d9bc6429ae907066795597c8815f3e745c9a646033d246b2d1f2d
7
+ data.tar.gz: 806ef15a72ca9eec45e4cde2e35ba43ceb29194c9ed23d77aa776bd3721a77f4d1b04ae8dc3d189e285be12a3cacd5dd1415faba7f57c745c55cb505eca6322e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.19.0 (2023-11-03)
6
+
7
+ - [PR#104](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache/pull/104) Support graphql-ruby 2.1.4 ([@DmitryTsepelev][])
8
+
9
+ ## 1.18.2 (2023-02-21)
10
+
11
+ - [PR#100](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache/pull/100) Fix an error when `path_cache_key` is nil ([@rince][])
12
+
5
13
  ## 1.18.1 (2023-01-06)
6
14
 
7
15
  - [PR#96](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache/pull/96) Properly pass arguments to `write_multi` ([@DmitryTsepelev][])
@@ -172,3 +180,4 @@
172
180
  [@daukadolt]: https://github.com/daukadolt
173
181
  [@frostmark]: https://github.com/frostmark
174
182
  [@KTSCode]: https://github.com/KTSCode
183
+ [@rince]: https://github.com/rince
data/README.md CHANGED
@@ -469,7 +469,7 @@ def cached_author_inside_batch
469
469
  end
470
470
  ```
471
471
 
472
- 2. Caching does not work for Union types, because of the `Lookahead` implementation: it requires the exact type to be passed to the `selection` method (you can find the [discussion](https://github.com/rmosolgo/graphql-ruby/pull/3007) here). This method is used for cache key building, and I haven't found a workaround yet ([PR in progress](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache/pull/30)). If you get `Failed to look ahead the field` error — please pass `query_cache_key` explicitly:
472
+ 2. Caching does not work for Union types, because of the `Lookahead` implementation: it requires the exact type to be passed to the `selection` method (you can find the [discussion](https://github.com/rmosolgo/graphql-ruby/pull/3007) here). This method is used for cache key building, and I haven't found a workaround yet ([PR in progress](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache/pull/30)). If you get `Failed to look ahead the field` error — please pass `path_cache_key` explicitly:
473
473
 
474
474
  ```ruby
475
475
  field :cached_avatar_url, String, null: false
@@ -177,6 +177,8 @@ module GraphQL
177
177
  end
178
178
 
179
179
  def simple_path_cache_key
180
+ return if path_cache_key.nil?
181
+
180
182
  path_cache_key.split("(").first
181
183
  end
182
184
 
@@ -177,6 +177,8 @@ module GraphQL
177
177
  end
178
178
 
179
179
  def simple_path_cache_key
180
+ return if path_cache_key.nil?
181
+
180
182
  path_cache_key.split("(").first
181
183
  end
182
184
 
@@ -76,7 +76,7 @@ module GraphQL
76
76
  arguments = arguments.is_a?(::GraphQL::Execution::Interpreter::Arguments) ? arguments.keyword_arguments : arguments
77
77
  @ast_nodes.each do |ast_node|
78
78
  ast_node.selections.each do |selection|
79
- if GraphQL::FragmentCache.graphql_ruby_after_2_0_13?
79
+ if GraphQL::FragmentCache.graphql_ruby_after_2_0_13? && GraphQL::FragmentCache.graphql_ruby_before_2_1_4?
80
80
  find_selected_nodes(selection, next_field_defn, arguments: arguments, matches: next_nodes)
81
81
  else
82
82
  find_selected_nodes(selection, next_field_name, next_field_defn, arguments: arguments, matches: next_nodes)
@@ -177,6 +177,8 @@ module GraphQL
177
177
  end
178
178
 
179
179
  def simple_path_cache_key
180
+ return if path_cache_key.nil?
181
+
180
182
  path_cache_key.split("(").first
181
183
  end
182
184
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  module FragmentCache
5
- VERSION = "1.18.1"
5
+ VERSION = "1.19.0"
6
6
  end
7
7
  end
@@ -65,6 +65,10 @@ module GraphQL
65
65
  check_graphql_version "> 2.0.13"
66
66
  end
67
67
 
68
+ def graphql_ruby_before_2_1_4?
69
+ check_graphql_version "< 2.1.4"
70
+ end
71
+
68
72
  private
69
73
 
70
74
  def check_graphql_version(predicate)
@@ -78,7 +82,6 @@ module GraphQL
78
82
  "GraphQL::Execution::Interpreter should be enabled for fragment caching"
79
83
  end
80
84
 
81
- puts "schema_defn.analysis_engine #{schema_defn.analysis_engine}"
82
85
  unless schema_defn.analysis_engine == GraphQL::Analysis::AST
83
86
  raise StandardError,
84
87
  "GraphQL::Analysis::AST should be enabled for fragment caching"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-fragment_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.1
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DmitryTsepelev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-05 00:00:00.000000000 Z
11
+ date: 2023-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -235,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
237
  requirements: []
238
- rubygems_version: 3.4.1
238
+ rubygems_version: 3.4.6
239
239
  signing_key:
240
240
  specification_version: 4
241
241
  summary: Fragment cache for graphql-ruby