graphql 1.12.4 → 1.12.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/graphql/install_generator.rb +2 -1
- data/lib/generators/graphql/loader_generator.rb +1 -0
- data/lib/generators/graphql/mutation_generator.rb +1 -0
- data/lib/generators/graphql/relay_generator.rb +1 -0
- data/lib/generators/graphql/templates/graphql_controller.erb +2 -2
- data/lib/generators/graphql/type_generator.rb +1 -0
- data/lib/graphql.rb +13 -11
- data/lib/graphql/backtrace/tracer.rb +2 -2
- data/lib/graphql/dataloader.rb +45 -14
- data/lib/graphql/execution/errors.rb +109 -11
- data/lib/graphql/execution/interpreter.rb +1 -1
- data/lib/graphql/execution/interpreter/runtime.rb +17 -24
- data/lib/graphql/introspection.rb +1 -1
- data/lib/graphql/introspection/directive_type.rb +7 -3
- data/lib/graphql/language.rb +1 -0
- data/lib/graphql/language/cache.rb +37 -0
- data/lib/graphql/language/parser.rb +15 -5
- data/lib/graphql/language/parser.y +15 -5
- data/lib/graphql/pagination/active_record_relation_connection.rb +7 -0
- data/lib/graphql/pagination/connection.rb +15 -1
- data/lib/graphql/pagination/connections.rb +2 -1
- data/lib/graphql/pagination/relation_connection.rb +12 -1
- data/lib/graphql/query.rb +1 -3
- data/lib/graphql/query/validation_pipeline.rb +1 -1
- data/lib/graphql/railtie.rb +9 -1
- data/lib/graphql/relay/range_add.rb +10 -5
- data/lib/graphql/schema.rb +32 -45
- data/lib/graphql/schema/field/connection_extension.rb +1 -0
- data/lib/graphql/schema/input_object.rb +2 -2
- data/lib/graphql/schema/member/base_dsl_methods.rb +3 -15
- data/lib/graphql/schema/object.rb +19 -5
- data/lib/graphql/schema/resolver.rb +28 -1
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +3 -1
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb +6 -2
- data/lib/graphql/static_validation/rules/arguments_are_defined.rb +2 -1
- data/lib/graphql/static_validation/rules/arguments_are_defined_error.rb +4 -2
- data/lib/graphql/static_validation/rules/directives_are_defined.rb +1 -1
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +17 -8
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +2 -2
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +4 -3
- data/lib/graphql/subscriptions/broadcast_analyzer.rb +0 -3
- data/lib/graphql/subscriptions/serialize.rb +3 -0
- data/lib/graphql/tracing/active_support_notifications_tracing.rb +2 -1
- data/lib/graphql/types/relay/base_connection.rb +4 -0
- data/lib/graphql/types/relay/connection_behaviors.rb +38 -5
- data/lib/graphql/types/relay/edge_behaviors.rb +12 -1
- data/lib/graphql/version.rb +1 -1
- data/readme.md +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcd53f90295f4a4444841bee25b0329ba993ea2ae3d10bb9ba807f262b9354ca
|
4
|
+
data.tar.gz: af7807ae411d7f50252758b64c2248fc3c640cc2930c22c0740bae25d567e7ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 770c7bde4c17619f645d77829bb9ca78bed5f944a7609a31095d9e8e859adbf0728988a640ad98a3a10fbccc73f658a0906296d1d6bed5f0f6d77b53a9bf9c79
|
7
|
+
data.tar.gz: 9fee4b7cb3e63c07a702462c1b6ebc0a0bd2d1342a4d22803839b63a03d8a910ebd6189a748695ba75e2732e1af30e9a6b9587d72be602eee6b1db43822bb779
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require 'rails/generators'
|
2
3
|
require 'rails/generators/base'
|
3
4
|
require_relative 'core'
|
4
5
|
require_relative 'relay'
|
@@ -121,7 +122,7 @@ module Graphql
|
|
121
122
|
if options.api?
|
122
123
|
say("Skipped graphiql, as this rails project is API only")
|
123
124
|
say(" You may wish to use GraphiQL.app for development: https://github.com/skevy/graphiql-app")
|
124
|
-
elsif !options[:skip_graphiql]
|
125
|
+
elsif !options[:skip_graphiql] && !File.read(Rails.root.join("Gemfile")).include?("graphiql-rails")
|
125
126
|
gem("graphiql-rails", group: :development)
|
126
127
|
|
127
128
|
# This is a little cheat just to get cleaner shell output:
|
@@ -15,9 +15,9 @@ class GraphqlController < ApplicationController
|
|
15
15
|
}
|
16
16
|
result = <%= schema_name %>.execute(query, variables: variables, context: context, operation_name: operation_name)
|
17
17
|
render json: result
|
18
|
-
rescue => e
|
18
|
+
rescue StandardError => e
|
19
19
|
raise e unless Rails.env.development?
|
20
|
-
handle_error_in_development
|
20
|
+
handle_error_in_development(e)
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
data/lib/graphql.rb
CHANGED
@@ -4,7 +4,6 @@ require "json"
|
|
4
4
|
require "set"
|
5
5
|
require "singleton"
|
6
6
|
require "forwardable"
|
7
|
-
require_relative "./graphql/railtie" if defined? Rails::Railtie
|
8
7
|
|
9
8
|
module GraphQL
|
10
9
|
# forwards-compat for argument handling
|
@@ -82,10 +81,19 @@ end
|
|
82
81
|
# Order matters for these:
|
83
82
|
|
84
83
|
require "graphql/execution_error"
|
84
|
+
require "graphql/runtime_type_error"
|
85
|
+
require "graphql/unresolved_type_error"
|
86
|
+
require "graphql/invalid_null_error"
|
87
|
+
require "graphql/analysis_error"
|
88
|
+
require "graphql/coercion_error"
|
89
|
+
require "graphql/invalid_name_error"
|
90
|
+
require "graphql/integer_decoding_error"
|
91
|
+
require "graphql/integer_encoding_error"
|
92
|
+
require "graphql/string_encoding_error"
|
93
|
+
|
85
94
|
require "graphql/define"
|
86
95
|
require "graphql/base_type"
|
87
96
|
require "graphql/object_type"
|
88
|
-
|
89
97
|
require "graphql/enum_type"
|
90
98
|
require "graphql/input_object_type"
|
91
99
|
require "graphql/interface_type"
|
@@ -103,13 +111,13 @@ require "graphql/scalar_type"
|
|
103
111
|
require "graphql/name_validator"
|
104
112
|
|
105
113
|
require "graphql/language"
|
114
|
+
|
115
|
+
require_relative "./graphql/railtie" if defined? Rails::Railtie
|
116
|
+
|
106
117
|
require "graphql/analysis"
|
107
118
|
require "graphql/tracing"
|
108
119
|
require "graphql/dig"
|
109
120
|
require "graphql/execution"
|
110
|
-
require "graphql/runtime_type_error"
|
111
|
-
require "graphql/unresolved_type_error"
|
112
|
-
require "graphql/invalid_null_error"
|
113
121
|
require "graphql/pagination"
|
114
122
|
require "graphql/schema"
|
115
123
|
require "graphql/query"
|
@@ -131,12 +139,6 @@ require "graphql/static_validation"
|
|
131
139
|
require "graphql/dataloader"
|
132
140
|
require "graphql/introspection"
|
133
141
|
|
134
|
-
require "graphql/analysis_error"
|
135
|
-
require "graphql/coercion_error"
|
136
|
-
require "graphql/invalid_name_error"
|
137
|
-
require "graphql/integer_decoding_error"
|
138
|
-
require "graphql/integer_encoding_error"
|
139
|
-
require "graphql/string_encoding_error"
|
140
142
|
require "graphql/version"
|
141
143
|
require "graphql/compatibility"
|
142
144
|
require "graphql/function"
|
@@ -44,13 +44,13 @@ module GraphQL
|
|
44
44
|
end
|
45
45
|
|
46
46
|
if push_data && multiplex
|
47
|
-
multiplex.context[:graphql_backtrace_contexts]
|
47
|
+
push_storage = multiplex.context[:graphql_backtrace_contexts] ||= {}
|
48
|
+
push_storage[push_key] = push_data
|
48
49
|
multiplex.context[:last_graphql_backtrace_context] = push_data
|
49
50
|
end
|
50
51
|
|
51
52
|
if key == "execute_multiplex"
|
52
53
|
multiplex_context = metadata[:multiplex].context
|
53
|
-
multiplex_context[:graphql_backtrace_contexts] = {}
|
54
54
|
begin
|
55
55
|
yield
|
56
56
|
rescue StandardError => err
|
data/lib/graphql/dataloader.rb
CHANGED
@@ -29,7 +29,12 @@ module GraphQL
|
|
29
29
|
|
30
30
|
def initialize
|
31
31
|
@source_cache = Hash.new { |h, source_class| h[source_class] = Hash.new { |h2, batch_parameters|
|
32
|
-
source =
|
32
|
+
source = if RUBY_VERSION < "3"
|
33
|
+
source_class.new(*batch_parameters)
|
34
|
+
else
|
35
|
+
batch_args, batch_kwargs = batch_parameters
|
36
|
+
source_class.new(*batch_args, **batch_kwargs)
|
37
|
+
end
|
33
38
|
source.setup(self)
|
34
39
|
h2[batch_parameters] = source
|
35
40
|
}
|
@@ -43,8 +48,15 @@ module GraphQL
|
|
43
48
|
# @param batch_parameters [Array<Object>]
|
44
49
|
# @return [GraphQL::Dataloader::Source] An instance of {source_class}, initialized with `self, *batch_parameters`,
|
45
50
|
# and cached for the lifetime of this {Multiplex}.
|
46
|
-
|
47
|
-
|
51
|
+
if RUBY_VERSION < "3"
|
52
|
+
def with(source_class, *batch_parameters)
|
53
|
+
@source_cache[source_class][batch_parameters]
|
54
|
+
end
|
55
|
+
else
|
56
|
+
def with(source_class, *batch_args, **batch_kwargs)
|
57
|
+
batch_parameters = [batch_args, batch_kwargs]
|
58
|
+
@source_cache[source_class][batch_parameters]
|
59
|
+
end
|
48
60
|
end
|
49
61
|
|
50
62
|
# Tell the dataloader that this fiber is waiting for data.
|
@@ -95,7 +107,7 @@ module GraphQL
|
|
95
107
|
else
|
96
108
|
# These fibers were previously waiting for sources to load data,
|
97
109
|
# resume them. (They might wait again, in which case, re-enqueue them.)
|
98
|
-
f
|
110
|
+
resume(f)
|
99
111
|
if f.alive?
|
100
112
|
next_fibers << f
|
101
113
|
end
|
@@ -104,15 +116,12 @@ module GraphQL
|
|
104
116
|
while @pending_jobs.any?
|
105
117
|
# Create a Fiber to consume jobs until one of the jobs yields
|
106
118
|
# or jobs run out
|
107
|
-
f =
|
119
|
+
f = spawn_fiber {
|
108
120
|
while (job = @pending_jobs.shift)
|
109
121
|
job.call
|
110
122
|
end
|
111
123
|
}
|
112
|
-
|
113
|
-
if result.is_a?(StandardError)
|
114
|
-
raise result
|
115
|
-
end
|
124
|
+
resume(f)
|
116
125
|
# In this case, the job yielded. Queue it up to run again after
|
117
126
|
# we load whatever it's waiting for.
|
118
127
|
if f.alive?
|
@@ -138,10 +147,7 @@ module GraphQL
|
|
138
147
|
# that newly-pending source will run _before_ the one that depends on it.
|
139
148
|
# (See below where the old fiber is pushed to the stack, then the new fiber is pushed on the stack.)
|
140
149
|
while (outer_source_fiber = source_fiber_stack.pop)
|
141
|
-
|
142
|
-
if result.is_a?(StandardError)
|
143
|
-
raise result
|
144
|
-
end
|
150
|
+
resume(outer_source_fiber)
|
145
151
|
|
146
152
|
if outer_source_fiber.alive?
|
147
153
|
source_fiber_stack << outer_source_fiber
|
@@ -197,12 +203,37 @@ module GraphQL
|
|
197
203
|
#
|
198
204
|
# This design could probably be improved by maintaining a `@pending_sources` queue which is shared by the fibers,
|
199
205
|
# similar to `@pending_jobs`. That way, when a fiber is resumed, it would never pick up work that was finished by a different fiber.
|
200
|
-
source_fiber =
|
206
|
+
source_fiber = spawn_fiber do
|
201
207
|
pending_sources.each(&:run_pending_keys)
|
202
208
|
end
|
203
209
|
end
|
204
210
|
|
205
211
|
source_fiber
|
206
212
|
end
|
213
|
+
|
214
|
+
def resume(fiber)
|
215
|
+
fiber.resume
|
216
|
+
rescue UncaughtThrowError => e
|
217
|
+
throw e.tag, e.value
|
218
|
+
end
|
219
|
+
|
220
|
+
# Copies the thread local vars into the fiber thread local vars. Many
|
221
|
+
# gems (such as RequestStore, MiniRacer, etc.) rely on thread local vars
|
222
|
+
# to keep track of execution context, and without this they do not
|
223
|
+
# behave as expected.
|
224
|
+
#
|
225
|
+
# @see https://github.com/rmosolgo/graphql-ruby/issues/3449
|
226
|
+
def spawn_fiber
|
227
|
+
fiber_locals = {}
|
228
|
+
|
229
|
+
Thread.current.keys.each do |fiber_var_key|
|
230
|
+
fiber_locals[fiber_var_key] = Thread.current[fiber_var_key]
|
231
|
+
end
|
232
|
+
|
233
|
+
Fiber.new do
|
234
|
+
fiber_locals.each { |k, v| Thread.current[k] = v }
|
235
|
+
yield
|
236
|
+
end
|
237
|
+
end
|
207
238
|
end
|
208
239
|
end
|
@@ -18,21 +18,83 @@ module GraphQL
|
|
18
18
|
#
|
19
19
|
class Errors
|
20
20
|
def self.use(schema)
|
21
|
-
|
22
|
-
|
23
|
-
GraphQL::Deprecation.warn("GraphQL::Execution::Errors is now installed by default, remove `use GraphQL::Execution::Errors` from #{definition_line}")
|
24
|
-
end
|
25
|
-
schema.error_handler = self.new(schema)
|
21
|
+
definition_line = caller(2, 1).first
|
22
|
+
GraphQL::Deprecation.warn("GraphQL::Execution::Errors is now installed by default, remove `use GraphQL::Execution::Errors` from #{definition_line}")
|
26
23
|
end
|
27
24
|
|
25
|
+
NEW_HANDLER_HASH = ->(h, k) {
|
26
|
+
h[k] = {
|
27
|
+
class: k,
|
28
|
+
handler: nil,
|
29
|
+
subclass_handlers: Hash.new(&NEW_HANDLER_HASH),
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
28
33
|
def initialize(schema)
|
29
34
|
@schema = schema
|
35
|
+
@handlers = {
|
36
|
+
class: nil,
|
37
|
+
handler: nil,
|
38
|
+
subclass_handlers: Hash.new(&NEW_HANDLER_HASH),
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# @api private
|
43
|
+
def each_rescue
|
44
|
+
handlers = @handlers.values
|
45
|
+
while (handler = handlers.shift) do
|
46
|
+
yield(handler[:class], handler[:handler])
|
47
|
+
handlers.concat(handler[:subclass_handlers].values)
|
48
|
+
end
|
30
49
|
end
|
31
50
|
|
32
|
-
|
33
|
-
|
34
|
-
|
51
|
+
# Register this handler, updating the
|
52
|
+
# internal handler index to maintain least-to-most specific.
|
53
|
+
#
|
54
|
+
# @param error_class [Class<Exception>]
|
55
|
+
# @param error_handler [Proc]
|
56
|
+
# @return [void]
|
57
|
+
def rescue_from(error_class, error_handler)
|
58
|
+
subclasses_handlers = {}
|
59
|
+
this_level_subclasses = []
|
60
|
+
# During this traversal, do two things:
|
61
|
+
# - Identify any already-registered subclasses of this error class
|
62
|
+
# and gather them up to be inserted _under_ this class
|
63
|
+
# - Find the point in the index where this handler should be inserted
|
64
|
+
# (That is, _under_ any superclasses, or at top-level, if there are no superclasses registered)
|
65
|
+
handlers = @handlers[:subclass_handlers]
|
66
|
+
while (handlers) do
|
67
|
+
this_level_subclasses.clear
|
68
|
+
# First, identify already-loaded handlers that belong
|
69
|
+
# _under_ this one. (That is, they're handlers
|
70
|
+
# for subclasses of `error_class`.)
|
71
|
+
handlers.each do |err_class, handler|
|
72
|
+
if err_class < error_class
|
73
|
+
subclasses_handlers[err_class] = handler
|
74
|
+
this_level_subclasses << err_class
|
75
|
+
end
|
76
|
+
end
|
77
|
+
# Any handlers that we'll be moving, delete them from this point in the index
|
78
|
+
this_level_subclasses.each do |err_class|
|
79
|
+
handlers.delete(err_class)
|
80
|
+
end
|
81
|
+
|
82
|
+
# See if any keys in this hash are superclasses of this new class:
|
83
|
+
next_index_point = handlers.find { |err_class, handler| error_class < err_class }
|
84
|
+
if next_index_point
|
85
|
+
handlers = next_index_point[1][:subclass_handlers]
|
86
|
+
else
|
87
|
+
# this new handler doesn't belong to any sub-handlers,
|
88
|
+
# so insert it in the current set of `handlers`
|
89
|
+
break
|
90
|
+
end
|
35
91
|
end
|
92
|
+
# Having found the point at which to insert this handler,
|
93
|
+
# register it and merge any subclass handlers back in at this point.
|
94
|
+
this_class_handlers = handlers[error_class]
|
95
|
+
this_class_handlers[:handler] = error_handler
|
96
|
+
this_class_handlers[:subclass_handlers].merge!(subclasses_handlers)
|
97
|
+
nil
|
36
98
|
end
|
37
99
|
|
38
100
|
# Call the given block with the schema's configured error handlers.
|
@@ -44,8 +106,7 @@ module GraphQL
|
|
44
106
|
def with_error_handling(ctx)
|
45
107
|
yield
|
46
108
|
rescue StandardError => err
|
47
|
-
|
48
|
-
_err_class, handler = rescues.find { |err_class, handler| err.is_a?(err_class) }
|
109
|
+
handler = find_handler_for(err.class)
|
49
110
|
if handler
|
50
111
|
runtime_info = ctx.namespace(:interpreter) || {}
|
51
112
|
obj = runtime_info[:current_object]
|
@@ -54,11 +115,48 @@ module GraphQL
|
|
54
115
|
if obj.is_a?(GraphQL::Schema::Object)
|
55
116
|
obj = obj.object
|
56
117
|
end
|
57
|
-
handler.call(err, obj, args, ctx, field)
|
118
|
+
handler[:handler].call(err, obj, args, ctx, field)
|
58
119
|
else
|
59
120
|
raise err
|
60
121
|
end
|
61
122
|
end
|
123
|
+
|
124
|
+
# @return [Proc, nil] The handler for `error_class`, if one was registered on this schema or inherited
|
125
|
+
def find_handler_for(error_class)
|
126
|
+
handlers = @handlers[:subclass_handlers]
|
127
|
+
handler = nil
|
128
|
+
while (handlers) do
|
129
|
+
_err_class, next_handler = handlers.find { |err_class, handler| error_class <= err_class }
|
130
|
+
if next_handler
|
131
|
+
handlers = next_handler[:subclass_handlers]
|
132
|
+
handler = next_handler
|
133
|
+
else
|
134
|
+
# Don't reassign `handler` --
|
135
|
+
# let the previous assignment carry over outside this block.
|
136
|
+
break
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# check for a handler from a parent class:
|
141
|
+
if @schema.superclass.respond_to?(:error_handler) && (parent_errors = @schema.superclass.error_handler)
|
142
|
+
parent_handler = parent_errors.find_handler_for(error_class)
|
143
|
+
end
|
144
|
+
|
145
|
+
# If the inherited handler is more specific than the one defined here,
|
146
|
+
# use it.
|
147
|
+
# If it's a tie (or there is no parent handler), use the one defined here.
|
148
|
+
# If there's an inherited one, but not one defined here, use the inherited one.
|
149
|
+
# Otherwise, there's no handler for this error, return `nil`.
|
150
|
+
if parent_handler && handler && parent_handler[:class] < handler[:class]
|
151
|
+
parent_handler
|
152
|
+
elsif handler
|
153
|
+
handler
|
154
|
+
elsif parent_handler
|
155
|
+
parent_handler
|
156
|
+
else
|
157
|
+
nil
|
158
|
+
end
|
159
|
+
end
|
62
160
|
end
|
63
161
|
end
|
64
162
|
end
|
@@ -113,7 +113,7 @@ module GraphQL
|
|
113
113
|
def initialize(value:, path:, field:)
|
114
114
|
message = "Failed to build a GraphQL list result for field `#{field.path}` at path `#{path.join(".")}`.\n".dup
|
115
115
|
|
116
|
-
message << "Expected `#{value.inspect}` to implement `.each` to satisfy the GraphQL return type `#{field.type.to_type_signature}`.\n"
|
116
|
+
message << "Expected `#{value.inspect}` (#{value.class}) to implement `.each` to satisfy the GraphQL return type `#{field.type.to_type_signature}`.\n"
|
117
117
|
|
118
118
|
if field.connection?
|
119
119
|
message << "\nThis field was treated as a Relay-style connection; add `connection: false` to the `field(...)` to disable this behavior."
|
@@ -50,7 +50,7 @@ module GraphQL
|
|
50
50
|
root_type = schema.root_type_for_operation(root_op_type)
|
51
51
|
path = []
|
52
52
|
set_all_interpreter_context(query.root_value, nil, nil, path)
|
53
|
-
object_proxy = authorized_new(root_type, query.root_value, context
|
53
|
+
object_proxy = authorized_new(root_type, query.root_value, context)
|
54
54
|
object_proxy = schema.sync_lazy(object_proxy)
|
55
55
|
if object_proxy.nil?
|
56
56
|
# Root .authorized? returned false.
|
@@ -193,7 +193,7 @@ module GraphQL
|
|
193
193
|
object = owner_object
|
194
194
|
|
195
195
|
if is_introspection
|
196
|
-
object = authorized_new(field_defn.owner, object, context
|
196
|
+
object = authorized_new(field_defn.owner, object, context)
|
197
197
|
end
|
198
198
|
|
199
199
|
total_args_count = field_defn.arguments.size
|
@@ -246,11 +246,17 @@ module GraphQL
|
|
246
246
|
# Use this flag to tell Interpreter::Arguments to add itself
|
247
247
|
# to the keyword args hash _before_ freezing everything.
|
248
248
|
extra_args[:argument_details] = :__arguments_add_self
|
249
|
+
when :irep_node
|
250
|
+
# This is used by `__typename` in order to support the legacy runtime,
|
251
|
+
# but it has no use here (and it's always `nil`).
|
252
|
+
# Stop adding it here to avoid the overhead of `.merge_extras` below.
|
249
253
|
else
|
250
254
|
extra_args[extra] = field_defn.fetch_extra(extra, context)
|
251
255
|
end
|
252
256
|
end
|
253
|
-
|
257
|
+
if extra_args.any?
|
258
|
+
resolved_arguments = resolved_arguments.merge_extras(extra_args)
|
259
|
+
end
|
254
260
|
resolved_arguments.keyword_arguments
|
255
261
|
end
|
256
262
|
|
@@ -277,10 +283,7 @@ module GraphQL
|
|
277
283
|
end
|
278
284
|
after_lazy(app_result, owner: owner_type, field: field_defn, path: next_path, ast_node: ast_node, scoped_context: context.scoped_context, owner_object: object, arguments: kwarg_arguments) do |inner_result|
|
279
285
|
continue_value = continue_value(next_path, inner_result, owner_type, field_defn, return_type.non_null?, ast_node)
|
280
|
-
if
|
281
|
-
# Write raw value directly to the response without resolving nested objects
|
282
|
-
write_in_response(next_path, continue_value.resolve)
|
283
|
-
elsif HALT != continue_value
|
286
|
+
if HALT != continue_value
|
284
287
|
continue_field(next_path, continue_value, owner_type, field_defn, return_type, ast_node, next_selections, false, object, kwarg_arguments)
|
285
288
|
end
|
286
289
|
end
|
@@ -332,6 +335,10 @@ module GraphQL
|
|
332
335
|
continue_value(path, next_value, parent_type, field, is_non_null, ast_node)
|
333
336
|
elsif GraphQL::Execution::Execute::SKIP == value
|
334
337
|
HALT
|
338
|
+
elsif value.is_a?(GraphQL::Execution::Interpreter::RawValue)
|
339
|
+
# Write raw value directly to the response without resolving nested objects
|
340
|
+
write_in_response(path, value.resolve)
|
341
|
+
HALT
|
335
342
|
else
|
336
343
|
value
|
337
344
|
end
|
@@ -371,7 +378,7 @@ module GraphQL
|
|
371
378
|
end
|
372
379
|
when "OBJECT"
|
373
380
|
object_proxy = begin
|
374
|
-
authorized_new(current_type, value, context
|
381
|
+
authorized_new(current_type, value, context)
|
375
382
|
rescue GraphQL::ExecutionError => err
|
376
383
|
err
|
377
384
|
end
|
@@ -634,22 +641,8 @@ module GraphQL
|
|
634
641
|
end
|
635
642
|
end
|
636
643
|
|
637
|
-
def authorized_new(type, value, context
|
638
|
-
|
639
|
-
|
640
|
-
auth_val = context.query.trace("authorized", trace_payload) do
|
641
|
-
type.authorized_new(value, context)
|
642
|
-
end
|
643
|
-
|
644
|
-
if context.schema.lazy?(auth_val)
|
645
|
-
GraphQL::Execution::Lazy.new do
|
646
|
-
context.query.trace("authorized_lazy", trace_payload) do
|
647
|
-
context.schema.sync_lazy(auth_val)
|
648
|
-
end
|
649
|
-
end
|
650
|
-
else
|
651
|
-
auth_val
|
652
|
-
end
|
644
|
+
def authorized_new(type, value, context)
|
645
|
+
type.authorized_new(value, context)
|
653
646
|
end
|
654
647
|
end
|
655
648
|
end
|