graphql 1.12.9 → 1.12.10
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 +15 -12
- data/lib/graphql/query/null_context.rb +7 -1
- data/lib/graphql/rake_task.rb +3 -0
- data/lib/graphql/schema/argument.rb +3 -1
- data/lib/graphql/schema/loader.rb +8 -0
- data/lib/graphql/schema/resolver.rb +24 -22
- data/lib/graphql/schema/scalar.rb +3 -1
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +1 -1
- data/lib/graphql/static_validation/validator.rb +5 -0
- data/lib/graphql/subscriptions/serialize.rb +8 -1
- data/lib/graphql/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d314c3a4dbbf6bded442bea6c2fcdd68b0cd7730ebb5e807d3677ffdc838268
|
4
|
+
data.tar.gz: 60a24771181bb8a479f768a4b17f3a474ff9bbc339027b94e18bf92554df296c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25f941249c01ce4dcfe3522dfc7b045b6f2bd3888e1f21b2e25a3ae5de74f0de5f9721c998d6ddd33eb681339c3e883edcdc9d76a196c148b688a1264b1761fa
|
7
|
+
data.tar.gz: 91bde8d0102ae6874511656b6e11140b511aa1813d19b70b91a168cf58cbfc95eb83a6244137fc06abeae19f15694ca005c94c6e728085d0b8be3ad3bb964ebc
|
@@ -52,22 +52,25 @@ module GraphQL
|
|
52
52
|
set_all_interpreter_context(query.root_value, nil, nil, path)
|
53
53
|
object_proxy = authorized_new(root_type, query.root_value, context)
|
54
54
|
object_proxy = schema.sync_lazy(object_proxy)
|
55
|
+
|
55
56
|
if object_proxy.nil?
|
56
57
|
# Root .authorized? returned false.
|
57
58
|
write_in_response(path, nil)
|
58
59
|
else
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
60
|
+
resolve_with_directives(object_proxy, root_operation) do # execute query level directives
|
61
|
+
gathered_selections = gather_selections(object_proxy, root_type, root_operation.selections)
|
62
|
+
# Make the first fiber which will begin execution
|
63
|
+
@dataloader.append_job {
|
64
|
+
evaluate_selections(
|
65
|
+
path,
|
66
|
+
context.scoped_context,
|
67
|
+
object_proxy,
|
68
|
+
root_type,
|
69
|
+
root_op_type == "mutation",
|
70
|
+
gathered_selections,
|
71
|
+
)
|
72
|
+
}
|
73
|
+
end
|
71
74
|
end
|
72
75
|
delete_interpreter_context(:current_path)
|
73
76
|
delete_interpreter_context(:current_field)
|
@@ -9,10 +9,16 @@ module GraphQL
|
|
9
9
|
def visible_type?(t); true; end
|
10
10
|
end
|
11
11
|
|
12
|
+
class NullQuery
|
13
|
+
def with_error_handling
|
14
|
+
yield
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
12
18
|
attr_reader :schema, :query, :warden, :dataloader
|
13
19
|
|
14
20
|
def initialize
|
15
|
-
@query =
|
21
|
+
@query = NullQuery.new
|
16
22
|
@dataloader = GraphQL::Dataloader::NullDataloader.new
|
17
23
|
@schema = GraphQL::Schema.new
|
18
24
|
@warden = NullWarden.new(
|
data/lib/graphql/rake_task.rb
CHANGED
@@ -98,6 +98,9 @@ module GraphQL
|
|
98
98
|
result = schema.public_send(method_name, only: @only, except: @except, context: context)
|
99
99
|
dir = File.dirname(file)
|
100
100
|
FileUtils.mkdir_p(dir)
|
101
|
+
if !result.end_with?("\n")
|
102
|
+
result += "\n"
|
103
|
+
end
|
101
104
|
File.write(file, result)
|
102
105
|
end
|
103
106
|
|
@@ -266,7 +266,9 @@ module GraphQL
|
|
266
266
|
loaded_values = coerced_value.map { |val| owner.load_application_object(self, loads, val, context) }
|
267
267
|
context.schema.after_any_lazies(loaded_values) { |result| result }
|
268
268
|
else
|
269
|
-
|
269
|
+
context.query.with_error_handling do
|
270
|
+
owner.load_application_object(self, loads, coerced_value, context)
|
271
|
+
end
|
270
272
|
end
|
271
273
|
end
|
272
274
|
|
@@ -169,6 +169,12 @@ module GraphQL
|
|
169
169
|
def build_fields(type_defn, fields, type_resolver)
|
170
170
|
loader = self
|
171
171
|
fields.each do |field_hash|
|
172
|
+
unwrapped_field_hash = field_hash
|
173
|
+
while (of_type = unwrapped_field_hash["ofType"])
|
174
|
+
unwrapped_field_hash = of_type
|
175
|
+
end
|
176
|
+
type_name = unwrapped_field_hash["name"]
|
177
|
+
|
172
178
|
type_defn.field(
|
173
179
|
field_hash["name"],
|
174
180
|
type: type_resolver.call(field_hash["type"]),
|
@@ -176,6 +182,8 @@ module GraphQL
|
|
176
182
|
deprecation_reason: field_hash["deprecationReason"],
|
177
183
|
null: true,
|
178
184
|
camelize: false,
|
185
|
+
connection_extension: nil,
|
186
|
+
connection: type_name.end_with?("Connection"),
|
179
187
|
) do
|
180
188
|
if field_hash["args"].any?
|
181
189
|
loader.build_arguments(self, field_hash["args"], type_resolver)
|
@@ -333,30 +333,32 @@ module GraphQL
|
|
333
333
|
arg_defn = super(*args, from_resolver: true, **kwargs)
|
334
334
|
own_arguments_loads_as_type[arg_defn.keyword] = loads if loads
|
335
335
|
|
336
|
-
if
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
336
|
+
if !method_defined?(:"load_#{arg_defn.keyword}")
|
337
|
+
if loads && arg_defn.type.list?
|
338
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
339
|
+
def load_#{arg_defn.keyword}(values)
|
340
|
+
argument = @arguments_by_keyword[:#{arg_defn.keyword}]
|
341
|
+
lookup_as_type = @arguments_loads_as_type[:#{arg_defn.keyword}]
|
342
|
+
context.schema.after_lazy(values) do |values2|
|
343
|
+
GraphQL::Execution::Lazy.all(values2.map { |value| load_application_object(argument, lookup_as_type, value, context) })
|
344
|
+
end
|
343
345
|
end
|
346
|
+
RUBY
|
347
|
+
elsif loads
|
348
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
349
|
+
def load_#{arg_defn.keyword}(value)
|
350
|
+
argument = @arguments_by_keyword[:#{arg_defn.keyword}]
|
351
|
+
lookup_as_type = @arguments_loads_as_type[:#{arg_defn.keyword}]
|
352
|
+
load_application_object(argument, lookup_as_type, value, context)
|
353
|
+
end
|
354
|
+
RUBY
|
355
|
+
else
|
356
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
357
|
+
def load_#{arg_defn.keyword}(value)
|
358
|
+
value
|
359
|
+
end
|
360
|
+
RUBY
|
344
361
|
end
|
345
|
-
RUBY
|
346
|
-
elsif loads
|
347
|
-
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
348
|
-
def load_#{arg_defn.keyword}(value)
|
349
|
-
argument = @arguments_by_keyword[:#{arg_defn.keyword}]
|
350
|
-
lookup_as_type = @arguments_loads_as_type[:#{arg_defn.keyword}]
|
351
|
-
load_application_object(argument, lookup_as_type, value, context)
|
352
|
-
end
|
353
|
-
RUBY
|
354
|
-
else
|
355
|
-
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
356
|
-
def load_#{arg_defn.keyword}(value)
|
357
|
-
value
|
358
|
-
end
|
359
|
-
RUBY
|
360
362
|
end
|
361
363
|
|
362
364
|
arg_defn
|
@@ -44,7 +44,9 @@ module GraphQL
|
|
44
44
|
def validate_non_null_input(value, ctx)
|
45
45
|
result = Query::InputValidationResult.new
|
46
46
|
coerced_result = begin
|
47
|
-
|
47
|
+
ctx.query.with_error_handling do
|
48
|
+
coerce_input(value, ctx)
|
49
|
+
end
|
48
50
|
rescue GraphQL::CoercionError => err
|
49
51
|
err
|
50
52
|
end
|
@@ -23,7 +23,7 @@ module GraphQL
|
|
23
23
|
defn = if arg_defn && arg_defn.type.unwrap.kind.input_object?
|
24
24
|
arg_defn.type.unwrap
|
25
25
|
else
|
26
|
-
context.field_definition
|
26
|
+
context.directive_definition || context.field_definition
|
27
27
|
end
|
28
28
|
|
29
29
|
parent_type = context.warden.get_argument(defn, parent_name(parent, defn))
|
@@ -55,7 +55,14 @@ module GraphQL
|
|
55
55
|
# @return [Object] An object that load Global::Identification recursive
|
56
56
|
def load_value(value)
|
57
57
|
if value.is_a?(Array)
|
58
|
-
value.
|
58
|
+
is_gids = (v1 = value[0]).is_a?(Hash) && v1.size == 1 && v1[GLOBALID_KEY]
|
59
|
+
if is_gids
|
60
|
+
# Assume it's an array of global IDs
|
61
|
+
ids = value.map { |v| v[GLOBALID_KEY] }
|
62
|
+
GlobalID::Locator.locate_many(ids)
|
63
|
+
else
|
64
|
+
value.map { |item| load_value(item) }
|
65
|
+
end
|
59
66
|
elsif value.is_a?(Hash)
|
60
67
|
if value.size == 1
|
61
68
|
case value.keys.first # there's only 1 key
|
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.12.
|
4
|
+
version: 1.12.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -699,7 +699,7 @@ metadata:
|
|
699
699
|
source_code_uri: https://github.com/rmosolgo/graphql-ruby
|
700
700
|
bug_tracker_uri: https://github.com/rmosolgo/graphql-ruby/issues
|
701
701
|
mailing_list_uri: https://tinyletter.com/graphql-ruby
|
702
|
-
post_install_message:
|
702
|
+
post_install_message:
|
703
703
|
rdoc_options: []
|
704
704
|
require_paths:
|
705
705
|
- lib
|
@@ -714,8 +714,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
714
714
|
- !ruby/object:Gem::Version
|
715
715
|
version: '0'
|
716
716
|
requirements: []
|
717
|
-
rubygems_version: 3.
|
718
|
-
signing_key:
|
717
|
+
rubygems_version: 3.2.15
|
718
|
+
signing_key:
|
719
719
|
specification_version: 4
|
720
720
|
summary: A GraphQL language and runtime for Ruby
|
721
721
|
test_files: []
|