apollo-federation 3.6.6 → 3.6.8

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: 8f68278723526fb35e83d13b471c1fb75461ddf8e292910acf9d864c1a4b8a6e
4
- data.tar.gz: e381e8472bfde3eedd714a66d1f10c546b871c7670c4519c692a0b59e5322e23
3
+ metadata.gz: 26437191f63f4ce0a56dff61e303ffa903ff80df46db23d5840ded158cdef18c
4
+ data.tar.gz: c19bf4aeb4d78298d0d210ad2078b08d01a8e2fd4de75f5f5d2caccadbaa315d
5
5
  SHA512:
6
- metadata.gz: 148083333795ac56d528a90a6e508095af5261b5a63621f26b6446e7d8edfc8ac2f81ce779ab913e07977681a2125e145efd86fb4cedbb030dd779a692921bab
7
- data.tar.gz: f25fd810613dd4042b39e314cf58fc1919f1065c2aacdde50a33057ba93a53f5f7ed950be800c94c2fb9e07a24ffa78399cd7951e777f6345aeb2b539a12a7cd
6
+ metadata.gz: '079095e454e865dfceacb37c16e3ce64a23d59f5d937aa8668f7264b8f89ade841df7104b547ced1e4c353f3f81457e793882087b30baaad7d82ffb7c2ce8524'
7
+ data.tar.gz: 79e15b6604c5f127e0948f4641c8530e4c538a5a587c6fb944a9b5ad874cb3564baf077dba26f1321fbe0580e61d0a157743cbbebfd1874e682c15a250e2dc8b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [3.6.8](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.7...v3.6.8) (2023-05-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * include inherited types in generated _Entity union ([#247](https://github.com/Gusto/apollo-federation-ruby/issues/247)) ([c377785](https://github.com/Gusto/apollo-federation-ruby/commit/c377785466736114d17beda8b6e27c2e0a56eb75))
7
+
8
+ ## [3.6.7](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.6...v3.6.7) (2023-05-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * 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))
14
+
1
15
  ## [3.6.6](https://github.com/Gusto/apollo-federation-ruby/compare/v3.6.5...v3.6.6) (2023-04-26)
2
16
 
3
17
 
@@ -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
@@ -77,7 +77,7 @@ module ApolloFederation
77
77
  types_schema = Class.new(self)
78
78
  # Add the original query objects to the types. We have to use orphan_types here to avoid
79
79
  # infinite recursion
80
- types_schema.orphan_types(@orig_query_object)
80
+ types_schema.orphan_types(original_query)
81
81
 
82
82
  # Walk through all of the types and determine which ones are entities (any type with a
83
83
  # "key" directive)
@@ -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.8'
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.8
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-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphql