+
+
+
+
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+655
+656
+657
+658
+659
+660
+661
+662
+663
+664
+665
+666
+667
+668
+669
+670
+671
+672
+673
+674
+675
+676
+677
+678
+679
+680
+681
+682
+683
+684
+685
+686
+687
+688
+689
+690
+691
+692
+ |
+
+ # File 'lib/graphql/execution/interpreter/runtime.rb', line 554
+
+def continue_field(value, owner_type, field, current_type, ast_node, next_selections, is_non_null, owner_object, arguments, result_name, selection_result, was_scoped, runtime_state) if current_type.non_null?
+ current_type = current_type.of_type
+ is_non_null = true
+ end
+
+ case current_type.kind.name
+ when "SCALAR", "ENUM"
+ r = begin
+ current_type.coerce_result(value, context)
+ rescue StandardError => err
+ schema.handle_or_reraise(context, err)
+ end
+ set_result(selection_result, result_name, r, false, is_non_null)
+ r
+ when "UNION", "INTERFACE"
+ resolved_type_or_lazy = resolve_type(current_type, value)
+ after_lazy(resolved_type_or_lazy, ast_node: ast_node, field: field, owner_object: owner_object, arguments: arguments, trace: false, result_name: result_name, result: selection_result, runtime_state: runtime_state) do |resolved_type_result, runtime_state|
+ if resolved_type_result.is_a?(Array) && resolved_type_result.length == 2
+ resolved_type, resolved_value = resolved_type_result
+ else
+ resolved_type = resolved_type_result
+ resolved_value = value
+ end
+
+ possible_types = query.possible_types(current_type)
+ if !possible_types.include?(resolved_type)
+ parent_type = field.owner_type
+ err_class = current_type::UnresolvedTypeError
+ type_error = err_class.new(resolved_value, field, parent_type, resolved_type, possible_types)
+ schema.type_error(type_error, context)
+ set_result(selection_result, result_name, nil, false, is_non_null)
+ nil
+ else
+ continue_field(resolved_value, owner_type, field, resolved_type, ast_node, next_selections, is_non_null, owner_object, arguments, result_name, selection_result, was_scoped, runtime_state)
+ end
+ end
+ when "OBJECT"
+ object_proxy = begin
+ was_scoped ? current_type.wrap_scoped(value, context) : current_type.wrap(value, context)
+ rescue GraphQL::ExecutionError => err
+ err
+ end
+ after_lazy(object_proxy, ast_node: ast_node, field: field, owner_object: owner_object, arguments: arguments, trace: false, result_name: result_name, result: selection_result, runtime_state: runtime_state) do |inner_object, runtime_state|
+ continue_value = continue_value(inner_object, owner_type, field, is_non_null, ast_node, result_name, selection_result)
+ if HALT != continue_value
+ response_hash = GraphQLResultHash.new(result_name, selection_result, is_non_null)
+ set_result(selection_result, result_name, response_hash, true, is_non_null)
+
+ gathered_selections = gather_selections(continue_value, current_type, next_selections)
+ tap_or_each(gathered_selections) do |selections, is_selection_array|
+ if is_selection_array
+ this_result = GraphQLResultHash.new(result_name, selection_result, is_non_null)
+ final_result = response_hash
+ else
+ this_result = response_hash
+ final_result = nil
+ end
+ runtime_state.current_object = continue_value
+ runtime_state.current_result_name = nil
+ runtime_state.current_result = this_result
+ if (directives = selections[:graphql_directives])
+ selections.delete(:graphql_directives)
+ end
+ call_method_on_directives(:resolve, continue_value, directives) do
+ evaluate_selections(
+ continue_value,
+ current_type,
+ false,
+ selections,
+ this_result,
+ final_result,
+ owner_object.object,
+ runtime_state,
+ )
+ this_result
+ end
+ end
+ end
+ end
+ when "LIST"
+ inner_type = current_type.of_type
+ use_dataloader_job = !inner_type.unwrap.kind.input?
+ inner_type_non_null = inner_type.non_null?
+ response_list = GraphQLResultArray.new(result_name, selection_result, is_non_null)
+ set_result(selection_result, result_name, response_list, true, is_non_null)
+ idx = nil
+ list_value = begin
+ value.each do |inner_value|
+ idx ||= 0
+ this_idx = idx
+ idx += 1
+ if use_dataloader_job
+ @dataloader.append_job do
+ resolve_list_item(inner_value, inner_type, inner_type_non_null, ast_node, field, owner_object, arguments, this_idx, response_list, next_selections, owner_type, was_scoped, runtime_state)
+ end
+ else
+ resolve_list_item(inner_value, inner_type, inner_type_non_null, ast_node, field, owner_object, arguments, this_idx, response_list, next_selections, owner_type, was_scoped, runtime_state)
+ end
+ end
+
+ response_list
+ rescue NoMethodError => err
+ if err.name == :each && (err.respond_to?(:receiver) ? err.receiver == value : true)
+ raise ListResultFailedError.new(value: value, field: field, path: current_path)
+ else
+ raise
+ end
+ rescue GraphQL::ExecutionError, GraphQL::UnauthorizedError => ex_err
+ ex_err
+ rescue StandardError => err
+ begin
+ query.handle_or_reraise(err)
+ rescue GraphQL::ExecutionError => ex_err
+ ex_err
+ end
+ end
+ error_is_non_null = idx.nil? ? is_non_null : inner_type.non_null?
+ continue_value(list_value, owner_type, field, error_is_non_null, ast_node, result_name, selection_result)
+ else
+ raise "Invariant: Unhandled type kind #{current_type.kind} (#{current_type})"
+ end
+end
+ |
+
+