graphql 1.13.17 → 1.13.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql/execution/interpreter/runtime.rb +4 -4
- data/lib/graphql/introspection/directive_type.rb +2 -2
- data/lib/graphql/introspection/field_type.rb +1 -1
- data/lib/graphql/introspection/schema_type.rb +2 -2
- data/lib/graphql/introspection/type_type.rb +5 -5
- data/lib/graphql/schema/directive.rb +1 -1
- data/lib/graphql/schema/field.rb +28 -19
- data/lib/graphql/schema/member/base_dsl_methods.rb +1 -1
- data/lib/graphql/schema/member/has_arguments.rb +2 -2
- data/lib/graphql/schema/member/has_fields.rb +1 -1
- data/lib/graphql/schema/member/has_interfaces.rb +11 -1
- data/lib/graphql/schema/warden.rb +11 -2
- data/lib/graphql/tracing/platform_tracing.rb +1 -0
- data/lib/graphql/types/string.rb +1 -1
- data/lib/graphql/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: c21327429549138738debab2d522197133548eb4b275a5f67086154e08469149
|
4
|
+
data.tar.gz: ec61107f4f45aaf1de25c6674d7fcf3b8e19b1245fdbf2a1bd1b0f7f1dd9b0aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b56c3aaa86b6d758b53d49a7906de483375c54f40db9126b96d791f41c7bba6407d9b59205a4d47215cef1391cd5ebbc03d5eb76825747cbfc1d0f6baf1f0ef
|
7
|
+
data.tar.gz: 7f7cb3b2e4fa8c26b355ea4adf01803ab32e2d97036475469071e2cf67d06431ab0486f0daf8ab28433deb95bb8642ea0a2b52739abe6d0ad06bb22b4fdcb2cc
|
@@ -400,6 +400,7 @@ module GraphQL
|
|
400
400
|
raise "Invariant: no field for #{owner_type}.#{field_name}"
|
401
401
|
end
|
402
402
|
end
|
403
|
+
|
403
404
|
return_type = field_defn.type
|
404
405
|
|
405
406
|
next_path = path.dup
|
@@ -425,18 +426,17 @@ module GraphQL
|
|
425
426
|
total_args_count = field_defn.arguments(context).size
|
426
427
|
if total_args_count == 0
|
427
428
|
resolved_arguments = GraphQL::Execution::Interpreter::Arguments::EMPTY
|
428
|
-
evaluate_selection_with_args(resolved_arguments, field_defn, next_path, ast_node, field_ast_nodes, scoped_context, owner_type, object, is_eager_field, result_name, selections_result, parent_object)
|
429
|
+
evaluate_selection_with_args(resolved_arguments, field_defn, next_path, ast_node, field_ast_nodes, scoped_context, owner_type, object, is_eager_field, result_name, selections_result, parent_object, return_type)
|
429
430
|
else
|
430
431
|
# TODO remove all arguments(...) usages?
|
431
432
|
@query.arguments_cache.dataload_for(ast_node, field_defn, object) do |resolved_arguments|
|
432
|
-
evaluate_selection_with_args(resolved_arguments, field_defn, next_path, ast_node, field_ast_nodes, scoped_context, owner_type, object, is_eager_field, result_name, selections_result, parent_object)
|
433
|
+
evaluate_selection_with_args(resolved_arguments, field_defn, next_path, ast_node, field_ast_nodes, scoped_context, owner_type, object, is_eager_field, result_name, selections_result, parent_object, return_type)
|
433
434
|
end
|
434
435
|
end
|
435
436
|
end
|
436
437
|
|
437
|
-
def evaluate_selection_with_args(arguments, field_defn, next_path, ast_node, field_ast_nodes, scoped_context, owner_type, object, is_eager_field, result_name, selection_result, parent_object) # rubocop:disable Metrics/ParameterLists
|
438
|
+
def evaluate_selection_with_args(arguments, field_defn, next_path, ast_node, field_ast_nodes, scoped_context, owner_type, object, is_eager_field, result_name, selection_result, parent_object, return_type) # rubocop:disable Metrics/ParameterLists
|
438
439
|
context.scoped_context = scoped_context
|
439
|
-
return_type = field_defn.type
|
440
440
|
after_lazy(arguments, owner: owner_type, field: field_defn, path: next_path, ast_node: ast_node, scoped_context: context.scoped_context, owner_object: object, arguments: arguments, result_name: result_name, result: selection_result) do |resolved_arguments|
|
441
441
|
if resolved_arguments.is_a?(GraphQL::ExecutionError) || resolved_arguments.is_a?(GraphQL::UnauthorizedError)
|
442
442
|
continue_value(next_path, resolved_arguments, owner_type, field_defn, return_type.non_null?, ast_node, result_name, selection_result)
|
@@ -11,8 +11,8 @@ module GraphQL
|
|
11
11
|
"to the executor."
|
12
12
|
field :name, String, null: false, method: :graphql_name
|
13
13
|
field :description, String
|
14
|
-
field :locations, [GraphQL::Schema::LateBoundType.new("__DirectiveLocation")], null: false
|
15
|
-
field :args, [GraphQL::Schema::LateBoundType.new("__InputValue")], null: false do
|
14
|
+
field :locations, [GraphQL::Schema::LateBoundType.new("__DirectiveLocation")], null: false, scope: false
|
15
|
+
field :args, [GraphQL::Schema::LateBoundType.new("__InputValue")], null: false, scope: false do
|
16
16
|
argument :include_deprecated, Boolean, required: false, default_value: false
|
17
17
|
end
|
18
18
|
field :on_operation, Boolean, null: false, deprecation_reason: "Use `locations`.", method: :on_operation?
|
@@ -7,7 +7,7 @@ module GraphQL
|
|
7
7
|
"a name, potentially a list of arguments, and a return type."
|
8
8
|
field :name, String, null: false
|
9
9
|
field :description, String
|
10
|
-
field :args, [GraphQL::Schema::LateBoundType.new("__InputValue")], null: false do
|
10
|
+
field :args, [GraphQL::Schema::LateBoundType.new("__InputValue")], null: false, scope: false do
|
11
11
|
argument :include_deprecated, Boolean, required: false, default_value: false
|
12
12
|
end
|
13
13
|
field :type, GraphQL::Schema::LateBoundType.new("__Type"), null: false
|
@@ -8,11 +8,11 @@ module GraphQL
|
|
8
8
|
"available types and directives on the server, as well as the entry points for "\
|
9
9
|
"query, mutation, and subscription operations."
|
10
10
|
|
11
|
-
field :types, [GraphQL::Schema::LateBoundType.new("__Type")], "A list of all types supported by this server.", null: false
|
11
|
+
field :types, [GraphQL::Schema::LateBoundType.new("__Type")], "A list of all types supported by this server.", null: false, scope: false
|
12
12
|
field :query_type, GraphQL::Schema::LateBoundType.new("__Type"), "The type that query operations will be rooted at.", null: false
|
13
13
|
field :mutation_type, GraphQL::Schema::LateBoundType.new("__Type"), "If this server supports mutation, the type that mutation operations will be rooted at."
|
14
14
|
field :subscription_type, GraphQL::Schema::LateBoundType.new("__Type"), "If this server support subscription, the type that subscription operations will be rooted at."
|
15
|
-
field :directives, [GraphQL::Schema::LateBoundType.new("__Directive")], "A list of all directives supported by this server.", null: false
|
15
|
+
field :directives, [GraphQL::Schema::LateBoundType.new("__Directive")], "A list of all directives supported by this server.", null: false, scope: false
|
16
16
|
field :description, String, resolver_method: :schema_description
|
17
17
|
|
18
18
|
def schema_description
|
@@ -14,15 +14,15 @@ module GraphQL
|
|
14
14
|
field :kind, GraphQL::Schema::LateBoundType.new("__TypeKind"), null: false
|
15
15
|
field :name, String, method: :graphql_name
|
16
16
|
field :description, String
|
17
|
-
field :fields, [GraphQL::Schema::LateBoundType.new("__Field")] do
|
17
|
+
field :fields, [GraphQL::Schema::LateBoundType.new("__Field")], scope: false do
|
18
18
|
argument :include_deprecated, Boolean, required: false, default_value: false
|
19
19
|
end
|
20
|
-
field :interfaces, [GraphQL::Schema::LateBoundType.new("__Type")]
|
21
|
-
field :possible_types, [GraphQL::Schema::LateBoundType.new("__Type")]
|
22
|
-
field :enum_values, [GraphQL::Schema::LateBoundType.new("__EnumValue")] do
|
20
|
+
field :interfaces, [GraphQL::Schema::LateBoundType.new("__Type")], scope: false
|
21
|
+
field :possible_types, [GraphQL::Schema::LateBoundType.new("__Type")], scope: false
|
22
|
+
field :enum_values, [GraphQL::Schema::LateBoundType.new("__EnumValue")], scope: false do
|
23
23
|
argument :include_deprecated, Boolean, required: false, default_value: false
|
24
24
|
end
|
25
|
-
field :input_fields, [GraphQL::Schema::LateBoundType.new("__InputValue")] do
|
25
|
+
field :input_fields, [GraphQL::Schema::LateBoundType.new("__InputValue")], scope: false do
|
26
26
|
argument :include_deprecated, Boolean, required: false, default_value: false
|
27
27
|
end
|
28
28
|
field :of_type, GraphQL::Schema::LateBoundType.new("__Type")
|
data/lib/graphql/schema/field.rb
CHANGED
@@ -229,6 +229,7 @@ module GraphQL
|
|
229
229
|
end
|
230
230
|
@original_name = name
|
231
231
|
name_s = -name.to_s
|
232
|
+
|
232
233
|
@underscored_name = -Member::BuildType.underscore(name_s)
|
233
234
|
@name = -(camelize ? Member::BuildType.camelize(name_s) : name_s)
|
234
235
|
@description = description
|
@@ -258,6 +259,10 @@ module GraphQL
|
|
258
259
|
# TODO: I think non-string/symbol hash keys are wrongly normalized (eg `1` will not work)
|
259
260
|
method_name = method || hash_key || name_s
|
260
261
|
@dig_keys = dig
|
262
|
+
if hash_key
|
263
|
+
@hash_key = hash_key
|
264
|
+
end
|
265
|
+
|
261
266
|
resolver_method ||= name_s.to_sym
|
262
267
|
|
263
268
|
@method_str = -method_name.to_s
|
@@ -646,27 +651,29 @@ module GraphQL
|
|
646
651
|
arg_values = args
|
647
652
|
using_arg_values = false
|
648
653
|
end
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
if
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
application_arg_value.
|
654
|
+
if args.size > 0
|
655
|
+
args = context.warden.arguments(self)
|
656
|
+
args.each do |arg|
|
657
|
+
arg_key = arg.keyword
|
658
|
+
if arg_values.key?(arg_key)
|
659
|
+
arg_value = arg_values[arg_key]
|
660
|
+
if using_arg_values
|
661
|
+
if arg_value.default_used?
|
662
|
+
# pass -- no auth required for default used
|
663
|
+
next
|
664
|
+
else
|
665
|
+
application_arg_value = arg_value.value
|
666
|
+
if application_arg_value.is_a?(GraphQL::Execution::Interpreter::Arguments)
|
667
|
+
application_arg_value.keyword_arguments
|
668
|
+
end
|
662
669
|
end
|
670
|
+
else
|
671
|
+
application_arg_value = arg_value
|
663
672
|
end
|
664
|
-
else
|
665
|
-
application_arg_value = arg_value
|
666
|
-
end
|
667
673
|
|
668
|
-
|
669
|
-
|
674
|
+
if !arg.authorized?(object, application_arg_value, context)
|
675
|
+
return false
|
676
|
+
end
|
670
677
|
end
|
671
678
|
end
|
672
679
|
end
|
@@ -822,7 +829,7 @@ module GraphQL
|
|
822
829
|
# Find a way to resolve this field, checking:
|
823
830
|
#
|
824
831
|
# - A method on the type instance;
|
825
|
-
# - Hash keys, if the wrapped object is a hash
|
832
|
+
# - Hash keys, if the wrapped object is a hash or responds to `#[]`
|
826
833
|
# - A method on the wrapped object;
|
827
834
|
# - Or, raise not implemented.
|
828
835
|
#
|
@@ -844,6 +851,8 @@ module GraphQL
|
|
844
851
|
else
|
845
852
|
inner_object[@method_str]
|
846
853
|
end
|
854
|
+
elsif defined?(@hash_key) && obj.object.respond_to?(:[])
|
855
|
+
obj.object[@hash_key]
|
847
856
|
elsif obj.object.respond_to?(@method_sym)
|
848
857
|
method_to_call = @method_sym
|
849
858
|
method_receiver = obj.object
|
@@ -108,7 +108,7 @@ module GraphQL
|
|
108
108
|
@default_graphql_name ||= begin
|
109
109
|
raise GraphQL::RequiredImplementationMissingError, 'Anonymous class should declare a `graphql_name`' if name.nil?
|
110
110
|
|
111
|
-
name.split("::").last.sub(/Type\Z/, "")
|
111
|
+
-name.split("::").last.sub(/Type\Z/, "")
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
@@ -167,7 +167,7 @@ module GraphQL
|
|
167
167
|
# @return [Interpreter::Arguments, Execution::Lazy<Interpeter::Arguments>]
|
168
168
|
def coerce_arguments(parent_object, values, context, &block)
|
169
169
|
# Cache this hash to avoid re-merging it
|
170
|
-
arg_defns =
|
170
|
+
arg_defns = context.warden.arguments(self)
|
171
171
|
total_args_count = arg_defns.size
|
172
172
|
|
173
173
|
finished_args = nil
|
@@ -181,7 +181,7 @@ module GraphQL
|
|
181
181
|
argument_values = {}
|
182
182
|
resolved_args_count = 0
|
183
183
|
raised_error = false
|
184
|
-
arg_defns.each do |
|
184
|
+
arg_defns.each do |arg_defn|
|
185
185
|
context.dataloader.append_job do
|
186
186
|
begin
|
187
187
|
arg_defn.coerce_into_values(parent_object, values, context, argument_values)
|
@@ -134,7 +134,7 @@ module GraphQL
|
|
134
134
|
if type.respond_to?(:kind) && type.kind.interface?
|
135
135
|
implements_this_interface = false
|
136
136
|
implementation_is_visible = false
|
137
|
-
interface_type_memberships.each do |tm|
|
137
|
+
warden.interface_type_memberships(self, context).each do |tm|
|
138
138
|
if tm.abstract_type == type
|
139
139
|
implements_this_interface ||= true
|
140
140
|
if warden.visible_type_membership?(tm, context)
|
@@ -57,7 +57,17 @@ module GraphQL
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def interface_type_memberships
|
60
|
-
|
60
|
+
own_tms = own_interface_type_memberships
|
61
|
+
if (self.is_a?(Class) && superclass.respond_to?(:interface_type_memberships))
|
62
|
+
inherited_tms = superclass.interface_type_memberships
|
63
|
+
if inherited_tms.size > 0
|
64
|
+
own_tms + inherited_tms
|
65
|
+
else
|
66
|
+
own_tms
|
67
|
+
end
|
68
|
+
else
|
69
|
+
own_tms
|
70
|
+
end
|
61
71
|
end
|
62
72
|
|
63
73
|
# param context [Query::Context] If omitted, skip filtering.
|
@@ -78,6 +78,8 @@ module GraphQL
|
|
78
78
|
def visible_type?(type, ctx); type.visible?(ctx); end
|
79
79
|
def visible_enum_value?(ev, ctx); ev.visible?(ctx); end
|
80
80
|
def visible_type_membership?(tm, ctx); tm.visible?(ctx); end
|
81
|
+
def interface_type_memberships(obj_t, ctx); obj_t.interface_type_memberships; end
|
82
|
+
def arguments(owner, ctx); owner.arguments(ctx); end
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
@@ -172,8 +174,8 @@ module GraphQL
|
|
172
174
|
|
173
175
|
# @param argument_owner [GraphQL::Field, GraphQL::InputObjectType]
|
174
176
|
# @return [Array<GraphQL::Argument>] Visible arguments on `argument_owner`
|
175
|
-
def arguments(argument_owner)
|
176
|
-
@visible_arguments ||= read_through { |o| o.arguments(@context).each_value.select { |a| visible_argument?(a) } }
|
177
|
+
def arguments(argument_owner, ctx = nil)
|
178
|
+
@visible_arguments ||= read_through { |o| o.arguments(@context).each_value.select { |a| visible_argument?(a, @context) } }
|
177
179
|
@visible_arguments[argument_owner]
|
178
180
|
end
|
179
181
|
|
@@ -231,6 +233,13 @@ module GraphQL
|
|
231
233
|
visible?(type_membership)
|
232
234
|
end
|
233
235
|
|
236
|
+
def interface_type_memberships(obj_type, _ctx = nil)
|
237
|
+
@type_memberships ||= read_through do |obj_t|
|
238
|
+
obj_t.interface_type_memberships
|
239
|
+
end
|
240
|
+
@type_memberships[obj_type]
|
241
|
+
end
|
242
|
+
|
234
243
|
private
|
235
244
|
|
236
245
|
def visible_and_reachable_type?(type_defn)
|
@@ -36,6 +36,7 @@ module GraphQL
|
|
36
36
|
trace_field = true # implemented with instrumenter
|
37
37
|
else
|
38
38
|
field = data[:field]
|
39
|
+
# HERE
|
39
40
|
return_type = field.type.unwrap
|
40
41
|
trace_field = if return_type.kind.scalar? || return_type.kind.enum?
|
41
42
|
(field.trace.nil? && @trace_scalars) || field.trace
|
data/lib/graphql/types/string.rb
CHANGED
data/lib/graphql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|