@@ -17,6 +17,40 @@ class Query
1717 autoload :VariableValidationError , "graphql/query/variable_validation_error"
1818 autoload :ValidationPipeline , "graphql/query/validation_pipeline"
1919
20+ # Code shared with {Partial}
21+ module Runnable
22+ def after_lazy ( value , &block )
23+ if !defined? ( @runtime_instance )
24+ @runtime_instance = context . namespace ( :interpreter_runtime ) [ :runtime ]
25+ end
26+
27+ if @runtime_instance
28+ @runtime_instance . minimal_after_lazy ( value , &block )
29+ else
30+ @schema . after_lazy ( value , &block )
31+ end
32+ end
33+
34+ # Node-level cache for calculating arguments. Used during execution and query analysis.
35+ # @param ast_node [GraphQL::Language::Nodes::AbstractNode]
36+ # @param definition [GraphQL::Schema::Field]
37+ # @param parent_object [GraphQL::Schema::Object]
38+ # @return [Hash{Symbol => Object}]
39+ def arguments_for ( ast_node , definition , parent_object : nil )
40+ arguments_cache . fetch ( ast_node , definition , parent_object )
41+ end
42+
43+ def arguments_cache
44+ @arguments_cache ||= Execution ::Interpreter ::ArgumentsCache . new ( self )
45+ end
46+
47+ # @api private
48+ def handle_or_reraise ( err )
49+ @query . schema . handle_or_reraise ( context , err )
50+ end
51+ end
52+
53+ include Runnable
2054 class OperationNameMissingError < GraphQL ::ExecutionError
2155 def initialize ( name )
2256 msg = if name . nil?
@@ -291,19 +325,6 @@ def variables
291325 end
292326 end
293327
294- # Node-level cache for calculating arguments. Used during execution and query analysis.
295- # @param ast_node [GraphQL::Language::Nodes::AbstractNode]
296- # @param definition [GraphQL::Schema::Field]
297- # @param parent_object [GraphQL::Schema::Object]
298- # @return [Hash{Symbol => Object}]
299- def arguments_for ( ast_node , definition , parent_object : nil )
300- arguments_cache . fetch ( ast_node , definition , parent_object )
301- end
302-
303- def arguments_cache
304- @arguments_cache ||= Execution ::Interpreter ::ArgumentsCache . new ( self )
305- end
306-
307328 # A version of the given query string, with:
308329 # - Variables inlined to the query
309330 # - Strings replaced with `<REDACTED>`
@@ -413,23 +434,6 @@ def subscription?
413434 with_prepared_ast { @subscription }
414435 end
415436
416- # @api private
417- def handle_or_reraise ( err )
418- schema . handle_or_reraise ( context , err )
419- end
420-
421- def after_lazy ( value , &block )
422- if !defined? ( @runtime_instance )
423- @runtime_instance = context . namespace ( :interpreter_runtime ) [ :runtime ]
424- end
425-
426- if @runtime_instance
427- @runtime_instance . minimal_after_lazy ( value , &block )
428- else
429- @schema . after_lazy ( value , &block )
430- end
431- end
432-
433437 attr_reader :logger
434438
435439 private
0 commit comments