apollo-federation 3.6.6 → 3.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f68278723526fb35e83d13b471c1fb75461ddf8e292910acf9d864c1a4b8a6e
4
- data.tar.gz: e381e8472bfde3eedd714a66d1f10c546b871c7670c4519c692a0b59e5322e23
3
+ metadata.gz: 37bac5e46b177feadaa9327163e07d68e25789f9bccf0ba6cb112204cab77ccc
4
+ data.tar.gz: 19a02cf54f5fe7648f77631c564190951944cd68a4a8687e50ee1001559286f9
5
5
  SHA512:
6
- metadata.gz: 148083333795ac56d528a90a6e508095af5261b5a63621f26b6446e7d8edfc8ac2f81ce779ab913e07977681a2125e145efd86fb4cedbb030dd779a692921bab
7
- data.tar.gz: f25fd810613dd4042b39e314cf58fc1919f1065c2aacdde50a33057ba93a53f5f7ed950be800c94c2fb9e07a24ffa78399cd7951e777f6345aeb2b539a12a7cd
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
- chunked_references = representations.chunk { |r| r[:__typename] }
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.map do |result|
53
- context.schema.after_lazy(result) do |resolved_value|
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApolloFederation
4
- VERSION = '3.6.6'
4
+ VERSION = '3.6.7'
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.6.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-04-26 00:00:00.000000000 Z
12
+ date: 2023-05-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphql