graphql 2.5.25 → 2.6.1
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 +11 -7
- 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: 8f525f949845c463742ad345a16e2441802ef69d89aca935fbe78dcfea419341
|
|
4
|
+
data.tar.gz: 1175b9e2ddc5cf363833b2b9ab5be79e0837d445db5e22ceb5115708c139001e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bca56323051f3df8cc6d0ce3d91ee0ba0c125cda0b2e2ddf5deab0d18131cdca646aa7a8b3a0dfee98abd5ea6be25eee358ecd3c08ab885c31c946af8033ec05
|
|
7
|
+
data.tar.gz: d4e993d8b2a3492113bb00175ddaed842ee6d10ca948d7c53ed6550007f7bd24c784214557bf4c33a35139a73909575bc9b93a2bff41d66dfdeeb235e8b4d00f
|
|
@@ -28,7 +28,15 @@ module GraphQL
|
|
|
28
28
|
attr_reader :pos, :tokens_count
|
|
29
29
|
|
|
30
30
|
def advance
|
|
31
|
-
|
|
31
|
+
loop do
|
|
32
|
+
@scanner.skip(IGNORE_REGEXP)
|
|
33
|
+
if @scanner.skip(COMMENT_REGEXP)
|
|
34
|
+
@tokens_count += 1
|
|
35
|
+
next
|
|
36
|
+
end
|
|
37
|
+
break
|
|
38
|
+
end
|
|
39
|
+
|
|
32
40
|
if @scanner.eos?
|
|
33
41
|
@finished = true
|
|
34
42
|
return false
|
|
@@ -178,12 +186,8 @@ module GraphQL
|
|
|
178
186
|
raise GraphQL::ParseError.new(message, line, col, @string, filename: @filename)
|
|
179
187
|
end
|
|
180
188
|
|
|
181
|
-
IGNORE_REGEXP =
|
|
182
|
-
|
|
183
|
-
[, \c\r\n\t]+ |
|
|
184
|
-
\#.*$
|
|
185
|
-
)*
|
|
186
|
-
}x
|
|
189
|
+
IGNORE_REGEXP = /[, \c\r\n\t]+/
|
|
190
|
+
COMMENT_REGEXP = /\#[^\n]*/
|
|
187
191
|
IDENTIFIER_REGEXP = /[_A-Za-z][_0-9A-Za-z]*/
|
|
188
192
|
INT_REGEXP = /-?(?:[0]|[1-9][0-9]*)/
|
|
189
193
|
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.1
|
|
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-27 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: base64
|