apollo-federation 3.6.6 → 3.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/apollo-federation/entities_field.rb +16 -4
- data/lib/apollo-federation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37bac5e46b177feadaa9327163e07d68e25789f9bccf0ba6cb112204cab77ccc
|
4
|
+
data.tar.gz: 19a02cf54f5fe7648f77631c564190951944cd68a4a8687e50ee1001559286f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe67ad551e2af8730ed54f7eda506f3d6d3af0b66ca7f1ec3de48a9ddb5c6809b7483b5144511cd62f4ee1c2e788a3e360c1a2d58bf83e38f1e613a581b341ec
|
7
|
+
data.tar.gz: f73c5f3551333026d1ede990f2800a0e406d5b21f23b59d91f06ddc1227ba8ef6ba7db4008f1173a0d46aef8df77c079970c29f3f3446ff49b9eb11f26c4f5ff
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [3.6.7](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.6...v3.6.7) (2023-05-18)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* call `resolve_references` once per `__typename` ([#244](https://github.com/Gusto/apollo-federation-ruby/issues/244)) ([c21715d](https://github.com/Gusto/apollo-federation-ruby/commit/c21715d28b67764a078b4daefdfe490f50171817))
|
7
|
+
|
1
8
|
## [3.6.6](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.5...v3.6.6) (2023-04-26)
|
2
9
|
|
3
10
|
|
@@ -27,9 +27,17 @@ module ApolloFederation
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def _entities(representations:)
|
30
|
-
|
30
|
+
final_result = Array.new(representations.size)
|
31
|
+
grouped_references_with_indices =
|
32
|
+
representations
|
33
|
+
.map
|
34
|
+
.with_index { |r, i| [r, i] }
|
35
|
+
.group_by { |(r, _i)| r[:__typename] }
|
36
|
+
|
37
|
+
grouped_references_with_indices.each do |typename, references_with_indices|
|
38
|
+
references = references_with_indices.map(&:first)
|
39
|
+
indices = references_with_indices.map(&:last)
|
31
40
|
|
32
|
-
chunked_references.flat_map do |typename, references|
|
33
41
|
# TODO: Use warden or schema?
|
34
42
|
type = context.warden.get_type(typename)
|
35
43
|
if type.nil? || type.kind != GraphQL::TypeKinds::OBJECT
|
@@ -49,8 +57,10 @@ module ApolloFederation
|
|
49
57
|
results = references
|
50
58
|
end
|
51
59
|
|
52
|
-
results.
|
53
|
-
|
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|
|
54
64
|
# TODO: This isn't 100% correct: if (for some reason) 2 different resolve_reference
|
55
65
|
# calls return the same object, it might not have the right type
|
56
66
|
# Right now, apollo-federation just adds a __typename property to the result,
|
@@ -60,6 +70,8 @@ module ApolloFederation
|
|
60
70
|
end
|
61
71
|
end
|
62
72
|
end
|
73
|
+
|
74
|
+
final_result
|
63
75
|
end
|
64
76
|
|
65
77
|
private
|
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.6.
|
4
|
+
version: 3.6.7
|
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-
|
12
|
+
date: 2023-05-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: graphql
|