apollo-federation 3.7.0 → 3.7.1

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: 7a3acf99a330df8e02ac0217773a9443b400d97a1ad47ed518a2f5631499711f
4
- data.tar.gz: f9482d80b73b9ba0396fc51676a1ab28a12910c6a7fc3b7666421efff705a1ef
3
+ metadata.gz: f4104a6574a535d062fe70d793bfa1b3c9099adfc8a1ecc5eeed79d296f1386b
4
+ data.tar.gz: d459803bca66e82aa00dc93c86efd63740a5e5531b33b18419bb246846d10a52
5
5
  SHA512:
6
- metadata.gz: 10f57a06a03f32dec83f3fbbd293c695a8019914b577b5ae25e6fedd86fa0d0e27be640ccc9261a5fed2f22154535e39d9d9408bfd16cce016ff2bd9cea7beda
7
- data.tar.gz: c7bc892658495ae8576159aa0c14be88837744bfde4dbcd30acb15b443eb817b17400e49f8cd46c59e161ac5975374e84f5405bb30eb8f0280fd80dc2a646f51
6
+ metadata.gz: 64ae19c9756916d3157158866f3a44cfc75644bba283aa9143237ba644c9ea2ffd6e0c91ca17dc558414a61867d04bbe8f379fee3d0a28f1f0b66298d1fb6e5d
7
+ data.tar.gz: 8c7789e315d9e68bf0c3fb1711c9a6463611bb335cfd970be5eb989a7c6ebf92c15ece86464670301e43c6978d7cb5eae3161a9841f40f0e278e0a7cba234f1f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [3.7.1](https://github.com/Gusto/apollo-federation-ruby/compare/v3.7.0...v3.7.1) (2023-06-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * handle lazy `resolve_references` return values ([#250](https://github.com/Gusto/apollo-federation-ruby/issues/250)) ([e29b155](https://github.com/Gusto/apollo-federation-ruby/commit/e29b15550d48093c6ed5b73dabb8206a3e9463b0))
7
+ * handle lazy `resolve_references` return values ([#250](https://github.com/Gusto/apollo-federation-ruby/issues/250)) ([1614440](https://github.com/Gusto/apollo-federation-ruby/commit/16144402d32de3d5016023b87fc2b949364761f5))
8
+ * handle lazy resolve_references return values ([#250](https://github.com/Gusto/apollo-federation-ruby/issues/250)) ([fa72465](https://github.com/Gusto/apollo-federation-ruby/commit/fa72465bd5f1d38f3556b748b905f16f932829ac))
9
+
1
10
  # [3.7.0](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.9...v3.7.0) (2023-05-26)
2
11
 
3
12
 
@@ -34,7 +34,7 @@ module ApolloFederation
34
34
  .with_index { |r, i| [r, i] }
35
35
  .group_by { |(r, _i)| r[:__typename] }
36
36
 
37
- grouped_references_with_indices.each do |typename, references_with_indices|
37
+ maybe_lazies = grouped_references_with_indices.map do |typename, references_with_indices|
38
38
  references = references_with_indices.map(&:first)
39
39
  indices = references_with_indices.map(&:last)
40
40
 
@@ -57,21 +57,25 @@ module ApolloFederation
57
57
  results = references
58
58
  end
59
59
 
60
- results_with_indices = results.zip(indices)
61
-
62
- results_with_indices.each do |result, i|
63
- final_result[i] = context.schema.after_lazy(result) do |resolved_value|
64
- # TODO: This isn't 100% correct: if (for some reason) 2 different resolve_reference
65
- # calls return the same object, it might not have the right type
66
- # Right now, apollo-federation just adds a __typename property to the result,
67
- # but I don't really like the idea of modifying the resolved object
68
- context[resolved_value] = type
69
- resolved_value
60
+ context.schema.after_lazy(results) do |resolved_results|
61
+ resolved_results.zip(indices).each do |result, i|
62
+ final_result[i] = context.schema.after_lazy(result) do |resolved_value|
63
+ # TODO: This isn't 100% correct: if (for some reason) 2 different resolve_reference
64
+ # calls return the same object, it might not have the right type
65
+ # Right now, apollo-federation just adds a __typename property to the result,
66
+ # but I don't really like the idea of modifying the resolved object
67
+ context[resolved_value] = type
68
+ resolved_value
69
+ end
70
70
  end
71
71
  end
72
72
  end
73
73
 
74
- final_result
74
+ # Make sure we've resolved the outer level of lazies so we can return an array with a possibly lazy
75
+ # entry for each requested entity
76
+ GraphQL::Execution::Lazy.all(maybe_lazies).then do
77
+ final_result
78
+ end
75
79
  end
76
80
 
77
81
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApolloFederation
4
- VERSION = '3.7.0'
4
+ VERSION = '3.7.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apollo-federation
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noa Elad
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-26 00:00:00.000000000 Z
12
+ date: 2023-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphql