graphql-stitching 1.7.1 → 1.7.2
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 +4 -4
- data/lib/graphql/stitching/executor/root_source.rb +1 -1
- data/lib/graphql/stitching/executor/shaper.rb +1 -1
- data/lib/graphql/stitching/executor/type_resolver_source.rb +1 -1
- data/lib/graphql/stitching/planner.rb +2 -2
- data/lib/graphql/stitching/request.rb +5 -0
- data/lib/graphql/stitching/supergraph/from_definition.rb +3 -6
- data/lib/graphql/stitching/supergraph.rb +3 -3
- data/lib/graphql/stitching/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: 10934c3d783de823cba55bfe33b361f7ffb6ead4a113a415199f660db97790be
|
4
|
+
data.tar.gz: b310d93e9493319363924fd4eaca3a828e110479a91906394b35df5cb2b7d2d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d998d78a25d271bd41b70df55f6d9e5442e2a5ce38c05c30ed281cc34a28e88aa41a0f923f07e306e1c472143e4a164ad109f1297a8b0af0c621769e38b92f30
|
7
|
+
data.tar.gz: 9aee659c12c236428062e2621d189b6a79518e31ed8fed60c995a27fb18fe746479c554edcb0bc9e091ed39e412185c63da0223d7acee21b304bd6707c630298
|
@@ -16,7 +16,7 @@ module GraphQL::Stitching
|
|
16
16
|
@executor.request.operation_name,
|
17
17
|
@executor.request.operation_directives,
|
18
18
|
)
|
19
|
-
query_variables = @executor.request.variables.slice(*op.variables.
|
19
|
+
query_variables = @executor.request.variables.slice(*op.variables.each_key)
|
20
20
|
result = @executor.request.supergraph.execute_at_location(op.location, query_document, query_variables, @executor.request)
|
21
21
|
@executor.query_count += 1
|
22
22
|
|
@@ -32,7 +32,7 @@ module GraphQL::Stitching
|
|
32
32
|
field_name = node.alias || node.name
|
33
33
|
|
34
34
|
if @request.query.get_field(parent_type, node.name).introspection?
|
35
|
-
if node.name == TYPENAME && parent_type == @root_type
|
35
|
+
if node.name == TYPENAME && parent_type == @root_type && node != TypeResolver::TYPENAME_EXPORT_NODE
|
36
36
|
raw_object[field_name] = @root_type.graphql_name
|
37
37
|
end
|
38
38
|
next
|
@@ -165,7 +165,7 @@ module GraphQL::Stitching
|
|
165
165
|
if pathed_errors_by_op_index_and_object_id.any?
|
166
166
|
pathed_errors_by_op_index_and_object_id.each do |op_index, pathed_errors_by_object_id|
|
167
167
|
repath_errors!(pathed_errors_by_object_id, ops.dig(op_index, "path"))
|
168
|
-
errors_result.
|
168
|
+
errors_result.push(*pathed_errors_by_object_id.each_value)
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
@@ -213,7 +213,7 @@ module GraphQL
|
|
213
213
|
input_selections.each do |node|
|
214
214
|
case node
|
215
215
|
when GraphQL::Language::Nodes::Field
|
216
|
-
if node.alias&.start_with?(TypeResolver::EXPORT_PREFIX)
|
216
|
+
if node.alias&.start_with?(TypeResolver::EXPORT_PREFIX) && node != TypeResolver::TYPENAME_EXPORT_NODE
|
217
217
|
raise StitchingError, %(Alias "#{node.alias}" is not allowed because "#{TypeResolver::EXPORT_PREFIX}" is a reserved prefix.)
|
218
218
|
elsif node.name == TYPENAME
|
219
219
|
locale_selections << node
|
@@ -284,7 +284,7 @@ module GraphQL
|
|
284
284
|
remote_selections_by_location = delegate_remote_selections(parent_type, remote_selections)
|
285
285
|
|
286
286
|
# D) Create paths routing to new entrypoint locations via resolver queries.
|
287
|
-
routes = @supergraph.route_type_to_locations(parent_type.graphql_name, current_location, remote_selections_by_location.
|
287
|
+
routes = @supergraph.route_type_to_locations(parent_type.graphql_name, current_location, remote_selections_by_location.each_key)
|
288
288
|
|
289
289
|
# E) Translate resolver pathways into new entrypoints.
|
290
290
|
routes.each_value do |route|
|
@@ -147,6 +147,11 @@ module GraphQL
|
|
147
147
|
@query.static_errors
|
148
148
|
end
|
149
149
|
|
150
|
+
# @return [Boolean] is the request valid?
|
151
|
+
def valid?
|
152
|
+
validate.empty?
|
153
|
+
end
|
154
|
+
|
150
155
|
# Gets and sets the query plan for the request. Assigned query plans may pull from a cache,
|
151
156
|
# which is useful for redundant GraphQL documents (commonly sent by frontend clients).
|
152
157
|
# ```ruby
|
@@ -21,11 +21,8 @@ module GraphQL::Stitching
|
|
21
21
|
field_map = {}
|
22
22
|
resolver_map = {}
|
23
23
|
possible_locations = {}
|
24
|
-
|
25
|
-
|
26
|
-
else
|
27
|
-
[]
|
28
|
-
end
|
24
|
+
visibility_definition = schema.directives[GraphQL::Stitching.visibility_directive]
|
25
|
+
visibility_profiles = visibility_definition&.get_argument("profiles")&.default_value || EMPTY_ARRAY
|
29
26
|
|
30
27
|
schema.types.each do |type_name, type|
|
31
28
|
next if type.introspection?
|
@@ -75,7 +72,7 @@ module GraphQL::Stitching
|
|
75
72
|
end
|
76
73
|
end
|
77
74
|
|
78
|
-
executables = possible_locations.
|
75
|
+
executables = possible_locations.each_key.each_with_object({}) do |location, memo|
|
79
76
|
executable = executables[location] || executables[location.to_sym]
|
80
77
|
if validate_executable!(location, executable)
|
81
78
|
memo[location] = executable
|
@@ -38,7 +38,7 @@ module GraphQL
|
|
38
38
|
@locations_by_type_and_field = @memoized_introspection_types.each_with_object(fields) do |(type_name, type), memo|
|
39
39
|
next unless type.kind.fields?
|
40
40
|
|
41
|
-
memo[type_name] = type.fields.
|
41
|
+
memo[type_name] = type.fields.each_key.each_with_object({}) do |field_name, m|
|
42
42
|
m[field_name] = [SUPERGRAPH_LOCATION]
|
43
43
|
end
|
44
44
|
end.freeze
|
@@ -75,7 +75,7 @@ module GraphQL
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def locations
|
78
|
-
@executables.
|
78
|
+
@executables.each_key.reject { _1 == SUPERGRAPH_LOCATION }
|
79
79
|
end
|
80
80
|
|
81
81
|
def memoized_schema_fields(type_name)
|
@@ -130,7 +130,7 @@ module GraphQL
|
|
130
130
|
# "Type" => ["location1", "location2", ...]
|
131
131
|
def locations_by_type
|
132
132
|
@locations_by_type ||= @locations_by_type_and_field.each_with_object({}) do |(type_name, fields), memo|
|
133
|
-
memo[type_name] = fields.values.flatten.uniq
|
133
|
+
memo[type_name] = fields.values.tap(&:flatten!).tap(&:uniq!)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-stitching
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg MacWilliam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|