graphql 2.6.1 → 2.6.2

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/graphql/dataloader.rb +1 -1
  3. data/lib/graphql/execution/field_resolve_step.rb +165 -65
  4. data/lib/graphql/execution/finalize.rb +18 -7
  5. data/lib/graphql/execution/input_values.rb +110 -38
  6. data/lib/graphql/execution/interpreter/runtime.rb +36 -15
  7. data/lib/graphql/execution/load_argument_step.rb +35 -3
  8. data/lib/graphql/execution/next.rb +20 -12
  9. data/lib/graphql/execution/prepare_object_step.rb +18 -5
  10. data/lib/graphql/execution/resolve_type_step.rb +27 -0
  11. data/lib/graphql/execution/runner.rb +64 -29
  12. data/lib/graphql/execution/selections_step.rb +1 -1
  13. data/lib/graphql/execution.rb +8 -1
  14. data/lib/graphql/execution_error.rb +6 -12
  15. data/lib/graphql/introspection/entry_points.rb +2 -2
  16. data/lib/graphql/introspection/schema_type.rb +6 -2
  17. data/lib/graphql/language/lexer.rb +1 -1
  18. data/lib/graphql/language/parser.rb +1 -1
  19. data/lib/graphql/pagination/connections.rb +1 -3
  20. data/lib/graphql/query.rb +2 -2
  21. data/lib/graphql/schema/argument.rb +2 -2
  22. data/lib/graphql/schema/directive/feature.rb +4 -0
  23. data/lib/graphql/schema/directive/transform.rb +20 -0
  24. data/lib/graphql/schema/has_single_input_argument.rb +24 -13
  25. data/lib/graphql/schema/input_object.rb +4 -0
  26. data/lib/graphql/schema/ractor_shareable.rb +1 -0
  27. data/lib/graphql/schema/relay_classic_mutation.rb +16 -2
  28. data/lib/graphql/schema/resolver.rb +0 -7
  29. data/lib/graphql/schema/subscription.rb +53 -8
  30. data/lib/graphql/schema/timeout.rb +2 -2
  31. data/lib/graphql/schema/visibility/visit.rb +1 -1
  32. data/lib/graphql/schema.rb +30 -9
  33. data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +6 -0
  34. data/lib/graphql/subscriptions/event.rb +0 -1
  35. data/lib/graphql/tracing/perfetto_trace.rb +5 -3
  36. data/lib/graphql/version.rb +1 -1
  37. metadata +3 -2
@@ -1150,17 +1150,14 @@ module GraphQL
1150
1150
  attr_accessor :using_backtrace
1151
1151
 
1152
1152
  # @api private
1153
- def handle_or_reraise(context, err)
1153
+ def handle_or_reraise(context, err, object: context[:current_object], arguments: context[:current_arguments], field: context[:current_field])
1154
1154
  handler = Execution::Errors.find_handler_for(self, err.class)
1155
1155
  if handler
1156
- obj = context[:current_object]
1157
- args = context[:current_arguments]
1158
- args = args && args.respond_to?(:keyword_arguments) ? args.keyword_arguments : nil
1159
- field = context[:current_field]
1160
- if obj.is_a?(GraphQL::Schema::Object)
1161
- obj = obj.object
1156
+ arguments = arguments.respond_to?(:keyword_arguments) ? arguments.keyword_arguments : arguments
1157
+ if object.is_a?(GraphQL::Schema::Object)
1158
+ object = object.object
1162
1159
  end
1163
- handler[:handler].call(err, obj, args, context, field)
1160
+ handler[:handler].call(err, object, arguments, context, field)
1164
1161
  else
1165
1162
  if (context[:backtrace] || using_backtrace) && !err.is_a?(GraphQL::ExecutionError)
1166
1163
  err = GraphQL::Backtrace::TracedError.new(err, context)
@@ -1587,6 +1584,14 @@ module GraphQL
1587
1584
  # @see {Query#initialize} for arguments.
1588
1585
  # @return [GraphQL::Query::Result] query result, ready to be serialized as JSON
1589
1586
  def execute(query_str = nil, **kwargs)
1587
+ if default_execution_next
1588
+ execute_next(query_str, **kwargs)
1589
+ else
1590
+ execute_legacy(query_str, **kwargs)
1591
+ end
1592
+ end
1593
+
1594
+ def execute_legacy(query_str = nil, **kwargs)
1590
1595
  if query_str
1591
1596
  kwargs[:query] = query_str
1592
1597
  end
@@ -1628,7 +1633,23 @@ module GraphQL
1628
1633
  # @option kwargs [nil, Integer] :max_complexity (nil)
1629
1634
  # @return [Array<GraphQL::Query::Result>] One result for each query in the input
1630
1635
  def multiplex(queries, **kwargs)
1631
- GraphQL::Execution::Interpreter.run_all(self, queries, **kwargs)
1636
+ if @default_execution_next
1637
+ multiplex_next(queries, **kwargs)
1638
+ else
1639
+ GraphQL::Execution::Interpreter.run_all(self, queries, **kwargs)
1640
+ end
1641
+ end
1642
+
1643
+ def default_execution_next(new_value = NOT_CONFIGURED)
1644
+ if !NOT_CONFIGURED.equal?(new_value)
1645
+ @default_execution_next = new_value
1646
+ elsif instance_variable_defined?(:@default_execution_next)
1647
+ @default_execution_next
1648
+ elsif superclass.respond_to?(:default_execution_next)
1649
+ superclass.default_execution_next
1650
+ else
1651
+ false
1652
+ end
1632
1653
  end
1633
1654
 
1634
1655
  def instrumenters
@@ -54,6 +54,12 @@ module GraphQL
54
54
  events << subscription_instance.event
55
55
  end
56
56
  value
57
+ elsif (exec_next_update_event = context.namespace(:subscriptions)[:update_event])
58
+ if context.query.subscription_topic == exec_next_update_event.topic
59
+ value
60
+ else
61
+ context.skip
62
+ end
57
63
  elsif (events = context.namespace(:subscriptions)[:events])
58
64
  # This is the first execution, so gather an Event
59
65
  # for the backend to register:
@@ -104,7 +104,6 @@ module GraphQL
104
104
 
105
105
  def stringify_args(arg_owner, args, context)
106
106
  arg_owner = arg_owner.respond_to?(:unwrap) ? arg_owner.unwrap : arg_owner # remove list and non-null wrappers
107
-
108
107
  case args
109
108
  when Hash
110
109
  next_args = {}
@@ -67,6 +67,8 @@ module GraphQL
67
67
  DA_FETCH_KEYS_IID => "fetch keys",
68
68
  }
69
69
 
70
+ ANON_CLASS_NAME = "(anonymous)"
71
+
70
72
  DEBUG_INSPECT_CATEGORY_IIDS = [15]
71
73
  DA_DEBUG_INSPECT_CLASS_IID = 16
72
74
  DEBUG_INSPECT_EVENT_NAME_IID = 17
@@ -118,7 +120,7 @@ module GraphQL
118
120
  }
119
121
 
120
122
  @source_name_iids = Hash.new do |h, source_class|
121
- h[source_class] = @interned_event_name_iids[source_class.name]
123
+ h[source_class] = @interned_event_name_iids[source_class.name || ANON_CLASS_NAME]
122
124
  end.compare_by_identity
123
125
 
124
126
  @auth_name_iids = Hash.new do |h, graphql_type|
@@ -144,7 +146,7 @@ module GraphQL
144
146
  end
145
147
 
146
148
  @class_name_iids = Hash.new do |h, k|
147
- h[k] = @interned_da_string_values[k.name]
149
+ h[k] = @interned_da_string_values[k.name || ANON_CLASS_NAME]
148
150
  end.compare_by_identity
149
151
 
150
152
  @starting_objects = GC.stat(:total_allocated_objects)
@@ -682,7 +684,7 @@ module GraphQL
682
684
  when GraphQL::Schema::InputObject
683
685
  payload_to_debug(k, v.to_h, iid: iid, intern_value: intern_value)
684
686
  else
685
- class_name_iid = @interned_da_string_values[(v.class.name || "(anonymous)")]
687
+ class_name_iid = @interned_da_string_values[(v.class.name || ANON_CLASS_NAME)]
686
688
  da = [
687
689
  debug_annotation(DA_DEBUG_INSPECT_CLASS_IID, :string_value_iid, class_name_iid),
688
690
  ]
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.6.1"
3
+ VERSION = "2.6.2"
4
4
  end
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.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-04-27 00:00:00.000000000 Z
10
+ date: 2026-05-12 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: base64
@@ -512,6 +512,7 @@ files:
512
512
  - lib/graphql/execution/multiplex.rb
513
513
  - lib/graphql/execution/next.rb
514
514
  - lib/graphql/execution/prepare_object_step.rb
515
+ - lib/graphql/execution/resolve_type_step.rb
515
516
  - lib/graphql/execution/runner.rb
516
517
  - lib/graphql/execution/selections_step.rb
517
518
  - lib/graphql/execution_error.rb