graphql 2.5.26 → 2.6.0
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/language/lexer.rb +7 -11
- data/lib/graphql/schema/build_from_definition.rb +10 -0
- data/lib/graphql/schema/resolver.rb +30 -7
- 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: 73ce16b1c358f4ab02c2d2d00e3a2a6b58a36ec2ca2d3012026ef5e346976b15
|
|
4
|
+
data.tar.gz: 8608b2cb12777e9d53c26508fb592a4c71bd733973e80608fa0010f46933d714
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee646816ac6503e2a50e601b8bcde6750409fb7bb34dd3395e7a6ba36cfc7f86ba2cd4a07b1a300b9f15d480d5a40e1e681b6a54a8355201997bff1ac3675566
|
|
7
|
+
data.tar.gz: c7f5679d27b0c4141feb01b2b15a5e04bdf5e77c3ef940d5c0cc8ecdcec995ef2e47657f8b2838ea317c639b9be628fd57c4224864b6b754207f18c4d9087b51
|
|
@@ -28,15 +28,7 @@ module GraphQL
|
|
|
28
28
|
attr_reader :pos, :tokens_count
|
|
29
29
|
|
|
30
30
|
def advance
|
|
31
|
-
|
|
32
|
-
@scanner.skip(IGNORE_REGEXP)
|
|
33
|
-
if @scanner.skip(COMMENT_REGEXP)
|
|
34
|
-
@tokens_count += 1
|
|
35
|
-
next
|
|
36
|
-
end
|
|
37
|
-
break
|
|
38
|
-
end
|
|
39
|
-
|
|
31
|
+
@scanner.skip(IGNORE_REGEXP)
|
|
40
32
|
if @scanner.eos?
|
|
41
33
|
@finished = true
|
|
42
34
|
return false
|
|
@@ -186,8 +178,12 @@ module GraphQL
|
|
|
186
178
|
raise GraphQL::ParseError.new(message, line, col, @string, filename: @filename)
|
|
187
179
|
end
|
|
188
180
|
|
|
189
|
-
IGNORE_REGEXP =
|
|
190
|
-
|
|
181
|
+
IGNORE_REGEXP = %r{
|
|
182
|
+
(?:
|
|
183
|
+
[, \c\r\n\t]+ |
|
|
184
|
+
\#.*$
|
|
185
|
+
)*
|
|
186
|
+
}x
|
|
191
187
|
IDENTIFIER_REGEXP = /[_A-Za-z][_0-9A-Za-z]*/
|
|
192
188
|
INT_REGEXP = /-?(?:[0]|[1-9][0-9]*)/
|
|
193
189
|
FLOAT_DECIMAL_REGEXP = /[.][0-9]+/
|
|
@@ -99,6 +99,16 @@ module GraphQL
|
|
|
99
99
|
# It's possible that this was already loaded by the directives
|
|
100
100
|
prev_type = types[definition.name]
|
|
101
101
|
if prev_type.nil? || prev_type.is_a?(Schema::LateBoundType)
|
|
102
|
+
if definition.is_a?(GraphQL::Language::Nodes::ObjectTypeDefinition) || definition.is_a?(Language::Nodes::InterfaceTypeDefinition)
|
|
103
|
+
interface_names = definition.interfaces.map(&:name)
|
|
104
|
+
transitive_names = interface_names.map { |n| document.definitions.find { |d| d.respond_to?(:name) && d.name == n }&.interfaces&.map(&:name) }
|
|
105
|
+
transitive_names.flatten!
|
|
106
|
+
transitive_names.compact!
|
|
107
|
+
if !(missing_transitive_interfaces = transitive_names - interface_names).empty?
|
|
108
|
+
raise GraphQL::Schema::InvalidDocumentError, "type #{definition.name} is missing one or more transitive interface names: #{missing_transitive_interfaces.join(", ")}. Add them to the type's `implements` list and try again."
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
102
112
|
types[definition.name] = build_definition_from_node(definition, type_resolver, default_resolve, base_types)
|
|
103
113
|
end
|
|
104
114
|
end
|
|
@@ -66,14 +66,31 @@ module GraphQL
|
|
|
66
66
|
q = context.query
|
|
67
67
|
trace_objs = [object]
|
|
68
68
|
q.current_trace.begin_execute_field(field, @prepared_arguments, trace_objs, q)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
new_return_value =
|
|
73
|
-
is_authed = true # the error was handled
|
|
69
|
+
is_ready = ready?(**@prepared_arguments)
|
|
70
|
+
runner = @field_resolve_step.runner
|
|
71
|
+
if runner.resolves_lazies && runner.schema.lazy?(is_ready)
|
|
72
|
+
is_ready, new_return_value = runner.schema.sync_lazy(is_ready)
|
|
74
73
|
end
|
|
75
74
|
|
|
76
|
-
if
|
|
75
|
+
if is_ready.is_a?(Array)
|
|
76
|
+
is_ready, new_return_value = is_ready
|
|
77
|
+
if is_ready != false
|
|
78
|
+
raise "Unexpected result from #ready? (expected `true`, `false` or `[false, {...}]`): [#{is_ready.inspect}, #{new_return_value.inspect}]"
|
|
79
|
+
else
|
|
80
|
+
new_return_value
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if is_ready
|
|
85
|
+
begin
|
|
86
|
+
is_authed, new_return_value = authorized?(**@prepared_arguments)
|
|
87
|
+
rescue GraphQL::UnauthorizedError => err
|
|
88
|
+
new_return_value = q.schema.unauthorized_object(err)
|
|
89
|
+
is_authed = true # the error was handled
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if runner.resolves_lazies && runner.schema.lazy?(is_authed)
|
|
77
94
|
is_authed, new_return_value = runner.schema.sync_lazy(is_authed)
|
|
78
95
|
end
|
|
79
96
|
|
|
@@ -93,7 +110,13 @@ module GraphQL
|
|
|
93
110
|
q = context.query
|
|
94
111
|
q.current_trace.end_execute_field(field, @prepared_arguments, trace_objs, q, [result])
|
|
95
112
|
exec_result[exec_index] = result
|
|
96
|
-
rescue
|
|
113
|
+
rescue GraphQL::UnauthorizedError => auth_err
|
|
114
|
+
exec_result[exec_index] = begin
|
|
115
|
+
context.schema.unauthorized_object(auth_err)
|
|
116
|
+
rescue GraphQL::ExecutionError => exec_err
|
|
117
|
+
exec_err
|
|
118
|
+
end
|
|
119
|
+
rescue GraphQL::RuntimeError => err
|
|
97
120
|
exec_result[exec_index] = err
|
|
98
121
|
rescue StandardError => stderr
|
|
99
122
|
exec_result[exec_index] = begin
|
data/lib/graphql/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graphql
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Mosolgo
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-04-
|
|
10
|
+
date: 2026-04-24 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: base64
|