graphql 2.0.21 → 2.0.32

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/graphql/mutation_delete_generator.rb +1 -1
  3. data/lib/generators/graphql/mutation_update_generator.rb +1 -1
  4. data/lib/generators/graphql/relay.rb +18 -1
  5. data/lib/graphql/backtrace.rb +0 -4
  6. data/lib/graphql/dataloader/source.rb +69 -45
  7. data/lib/graphql/dataloader.rb +4 -4
  8. data/lib/graphql/execution/interpreter/arguments_cache.rb +31 -30
  9. data/lib/graphql/execution/interpreter/runtime.rb +122 -101
  10. data/lib/graphql/execution/interpreter.rb +1 -2
  11. data/lib/graphql/execution/lookahead.rb +1 -1
  12. data/lib/graphql/filter.rb +2 -1
  13. data/lib/graphql/introspection/entry_points.rb +1 -1
  14. data/lib/graphql/language/document_from_schema_definition.rb +16 -9
  15. data/lib/graphql/language/lexer.rb +89 -57
  16. data/lib/graphql/language/nodes.rb +3 -0
  17. data/lib/graphql/language/parser.rb +706 -691
  18. data/lib/graphql/language/parser.y +1 -0
  19. data/lib/graphql/language/printer.rb +28 -14
  20. data/lib/graphql/language/visitor.rb +64 -61
  21. data/lib/graphql/query/context.rb +16 -7
  22. data/lib/graphql/query/null_context.rb +8 -18
  23. data/lib/graphql/query/validation_pipeline.rb +2 -1
  24. data/lib/graphql/query.rb +37 -12
  25. data/lib/graphql/schema/addition.rb +38 -12
  26. data/lib/graphql/schema/always_visible.rb +10 -0
  27. data/lib/graphql/schema/argument.rb +8 -10
  28. data/lib/graphql/schema/build_from_definition.rb +8 -7
  29. data/lib/graphql/schema/directive.rb +1 -1
  30. data/lib/graphql/schema/enum_value.rb +2 -2
  31. data/lib/graphql/schema/field/connection_extension.rb +1 -1
  32. data/lib/graphql/schema/field.rb +26 -15
  33. data/lib/graphql/schema/input_object.rb +9 -7
  34. data/lib/graphql/schema/interface.rb +5 -1
  35. data/lib/graphql/schema/introspection_system.rb +1 -1
  36. data/lib/graphql/schema/member/build_type.rb +10 -2
  37. data/lib/graphql/schema/member/has_arguments.rb +9 -7
  38. data/lib/graphql/schema/member/has_directives.rb +1 -1
  39. data/lib/graphql/schema/member/has_fields.rb +1 -1
  40. data/lib/graphql/schema/member/has_interfaces.rb +1 -1
  41. data/lib/graphql/schema/member/type_system_helpers.rb +1 -1
  42. data/lib/graphql/schema/object.rb +6 -1
  43. data/lib/graphql/schema/printer.rb +3 -1
  44. data/lib/graphql/schema/relay_classic_mutation.rb +1 -1
  45. data/lib/graphql/schema/resolver.rb +12 -10
  46. data/lib/graphql/schema/timeout.rb +1 -1
  47. data/lib/graphql/schema/validator.rb +1 -1
  48. data/lib/graphql/schema/warden.rb +37 -4
  49. data/lib/graphql/schema.rb +92 -23
  50. data/lib/graphql/tracing/appoptics_trace.rb +35 -11
  51. data/lib/graphql/tracing/appsignal_trace.rb +4 -0
  52. data/lib/graphql/tracing/data_dog_trace.rb +89 -50
  53. data/lib/graphql/tracing/data_dog_tracing.rb +7 -21
  54. data/lib/graphql/tracing/legacy_trace.rb +5 -1
  55. data/lib/graphql/tracing/notifications_trace.rb +7 -0
  56. data/lib/graphql/tracing/platform_trace.rb +26 -12
  57. data/lib/graphql/tracing/prometheus_trace.rb +4 -0
  58. data/lib/graphql/tracing/scout_trace.rb +3 -0
  59. data/lib/graphql/tracing/statsd_trace.rb +4 -0
  60. data/lib/graphql/tracing.rb +1 -0
  61. data/lib/graphql/types/relay/connection_behaviors.rb +1 -1
  62. data/lib/graphql/types/relay/edge_behaviors.rb +1 -1
  63. data/lib/graphql/version.rb +1 -1
  64. data/readme.md +1 -1
  65. metadata +36 -24
@@ -5,12 +5,22 @@ module GraphQL
5
5
  module PlatformTrace
6
6
  def initialize(trace_scalars: false, **_options)
7
7
  @trace_scalars = trace_scalars
8
- @platform_field_key_cache = Hash.new { |h, k| h[k] = platform_field_key(k) }
9
- @platform_authorized_key_cache = Hash.new { |h, k| h[k] = platform_authorized_key(k) }
10
- @platform_resolve_type_key_cache = Hash.new { |h, k| h[k] = platform_resolve_type_key(k) }
8
+
9
+ @platform_key_cache = Hash.new { |h, mod| h[mod] = mod::KeyCache.new }
11
10
  super
12
11
  end
13
12
 
13
+ module BaseKeyCache
14
+ def initialize
15
+ @platform_field_key_cache = Hash.new { |h, k| h[k] = platform_field_key(k) }
16
+ @platform_authorized_key_cache = Hash.new { |h, k| h[k] = platform_authorized_key(k) }
17
+ @platform_resolve_type_key_cache = Hash.new { |h, k| h[k] = platform_resolve_type_key(k) }
18
+ end
19
+
20
+ attr_reader :platform_field_key_cache, :platform_authorized_key_cache, :platform_resolve_type_key_cache
21
+ end
22
+
23
+
14
24
  def platform_execute_field_lazy(*args, &block)
15
25
  platform_execute_field(*args, &block)
16
26
  end
@@ -24,9 +34,13 @@ module GraphQL
24
34
  end
25
35
 
26
36
  def self.included(child_class)
27
- # Don't gather this unless necessary
28
- pass_data_to_execute_field = child_class.method_defined?(:platform_execute_field) &&
29
- child_class.instance_method(:platform_execute_field).arity != 1
37
+ key_methods_class = Class.new {
38
+ include(child_class)
39
+ include(BaseKeyCache)
40
+ }
41
+ child_class.const_set(:KeyCache, key_methods_class)
42
+
43
+ # rubocop:disable Development/NoEvalCop This eval takes static inputs at load-time
30
44
 
31
45
  [:execute_field, :execute_field_lazy].each do |field_trace_method|
32
46
  if !child_class.method_defined?(field_trace_method)
@@ -39,12 +53,12 @@ module GraphQL
39
53
  true
40
54
  end
41
55
  platform_key = if trace_field
42
- @platform_field_key_cache[field]
56
+ @platform_key_cache[#{child_class}].platform_field_key_cache[field]
43
57
  else
44
58
  nil
45
59
  end
46
60
  if platform_key && trace_field
47
- platform_#{field_trace_method}(platform_key#{pass_data_to_execute_field ? ", { query: query, field: field, ast_node: ast_node, arguments: arguments, object: object }" : ""}) do
61
+ platform_#{field_trace_method}(platform_key) do
48
62
  super
49
63
  end
50
64
  else
@@ -60,7 +74,7 @@ module GraphQL
60
74
  if !child_class.method_defined?(auth_trace_method)
61
75
  child_class.module_eval <<-RUBY, __FILE__, __LINE__
62
76
  def #{auth_trace_method}(type:, query:, object:)
63
- platform_key = @platform_authorized_key_cache[type]
77
+ platform_key = @platform_key_cache[#{child_class}].platform_authorized_key_cache[type]
64
78
  platform_#{auth_trace_method}(platform_key) do
65
79
  super
66
80
  end
@@ -73,18 +87,18 @@ module GraphQL
73
87
  if !child_class.method_defined?(rt_trace_method)
74
88
  child_class.module_eval <<-RUBY, __FILE__, __LINE__
75
89
  def #{rt_trace_method}(query:, type:, object:)
76
- platform_key = @platform_resolve_type_key_cache[type]
90
+ platform_key = @platform_key_cache[#{child_class}].platform_resolve_type_key_cache[type]
77
91
  platform_#{rt_trace_method}(platform_key) do
78
92
  super
79
93
  end
80
94
  end
81
95
  RUBY
82
96
  end
97
+
98
+ # rubocop:enable Development/NoEvalCop
83
99
  end
84
100
  end
85
101
 
86
-
87
-
88
102
  private
89
103
 
90
104
  # Get the transaction name based on the operation type and name if possible, or fall back to a user provided
@@ -13,6 +13,8 @@ module GraphQL
13
13
  super(**rest)
14
14
  end
15
15
 
16
+ # rubocop:disable Development/NoEvalCop This eval takes static inputs at load-time
17
+
16
18
  {
17
19
  'lex' => "graphql.lex",
18
20
  'parse' => "graphql.parse",
@@ -30,6 +32,8 @@ module GraphQL
30
32
  RUBY
31
33
  end
32
34
 
35
+ # rubocop:enable Development/NoEvalCop
36
+
33
37
  def platform_execute_field(platform_key, &block)
34
38
  instrument_execution(platform_key, "execute_field", &block)
35
39
  end
@@ -16,6 +16,8 @@ module GraphQL
16
16
  super
17
17
  end
18
18
 
19
+ # rubocop:disable Development/NoEvalCop This eval takes static inputs at load-time
20
+
19
21
  {
20
22
  "lex" => "lex.graphql",
21
23
  "parse" => "parse.graphql",
@@ -45,6 +47,7 @@ module GraphQL
45
47
  end
46
48
  RUBY
47
49
  end
50
+ # rubocop:enable Development/NoEvalCop
48
51
 
49
52
  def platform_execute_field(platform_key, &block)
50
53
  self.class.instrument("GraphQL", platform_key, INSTRUMENT_OPTS, &block)
@@ -11,6 +11,8 @@ module GraphQL
11
11
  super(**rest)
12
12
  end
13
13
 
14
+ # rubocop:disable Development/NoEvalCop This eval takes static inputs at load-time
15
+
14
16
  {
15
17
  'lex' => "graphql.lex",
16
18
  'parse' => "graphql.parse",
@@ -30,6 +32,8 @@ module GraphQL
30
32
  RUBY
31
33
  end
32
34
 
35
+ # rubocop:enable Development/NoEvalCop
36
+
33
37
  def platform_execute_field(platform_key, &block)
34
38
  @statsd.time(platform_key, &block)
35
39
  end
@@ -14,6 +14,7 @@ require "graphql/tracing/statsd_tracing"
14
14
  require "graphql/tracing/prometheus_tracing"
15
15
 
16
16
  # New Tracing:
17
+ require "graphql/tracing/active_support_notifications_trace"
17
18
  require "graphql/tracing/platform_trace"
18
19
  require "graphql/tracing/appoptics_trace"
19
20
  require "graphql/tracing/appsignal_trace"
@@ -13,7 +13,7 @@ module GraphQL
13
13
  child_class.node_nullable(true)
14
14
  child_class.edges_nullable(true)
15
15
  child_class.edge_nullable(true)
16
- child_class.module_eval {
16
+ child_class.module_exec {
17
17
  self.edge_type = nil
18
18
  self.node_type = nil
19
19
  self.edge_class = nil
@@ -8,7 +8,7 @@ module GraphQL
8
8
  child_class.description("An edge in a connection.")
9
9
  child_class.field(:cursor, String, null: false, description: "A cursor for use in pagination.")
10
10
  child_class.extend(ClassMethods)
11
- child_class.class_eval { self.node_type = nil }
11
+ child_class.class_exec { self.node_type = nil }
12
12
  child_class.node_nullable(true)
13
13
  end
14
14
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.0.21"
3
+ VERSION = "2.0.32"
4
4
  end
data/readme.md CHANGED
@@ -44,6 +44,6 @@ I also sell [GraphQL::Pro](https://graphql.pro) which provides several features
44
44
 
45
45
  ## Getting Involved
46
46
 
47
- - __Say hi & ask questions__ in the #graphql-ruby channel on [Discord](https://discord.com/invite/xud7bH9) or [on Twitter](https://twitter.com/rmosolgo)!
47
+ - __Say hi & ask questions__ in the #graphql-ruby channel on [Discord](https://discord.com/invite/xud7bH9).
48
48
  - __Report bugs__ by posting a description, full stack trace, and all relevant code in a [GitHub issue](https://github.com/rmosolgo/graphql-ruby/issues).
49
49
  - __Start hacking__ with the [Development guide](https://graphql-ruby.org/development).
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.21
4
+ version: 2.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-04-11 00:00:00.000000000 Z
10
+ date: 2025-03-12 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: base64
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: benchmark-ips
15
28
  requirement: !ruby/object:Gem::Requirement
@@ -53,61 +66,61 @@ dependencies:
53
66
  - !ruby/object:Gem::Version
54
67
  version: '0'
55
68
  - !ruby/object:Gem::Dependency
56
- name: minitest
69
+ name: racc
57
70
  requirement: !ruby/object:Gem::Requirement
58
71
  requirements:
59
72
  - - "~>"
60
73
  - !ruby/object:Gem::Version
61
- version: 5.9.0
74
+ version: '1.4'
62
75
  type: :development
63
76
  prerelease: false
64
77
  version_requirements: !ruby/object:Gem::Requirement
65
78
  requirements:
66
79
  - - "~>"
67
80
  - !ruby/object:Gem::Version
68
- version: 5.9.0
81
+ version: '1.4'
69
82
  - !ruby/object:Gem::Dependency
70
- name: minitest-focus
83
+ name: minitest
71
84
  requirement: !ruby/object:Gem::Requirement
72
85
  requirements:
73
- - - "~>"
86
+ - - ">="
74
87
  - !ruby/object:Gem::Version
75
- version: '1.1'
88
+ version: '0'
76
89
  type: :development
77
90
  prerelease: false
78
91
  version_requirements: !ruby/object:Gem::Requirement
79
92
  requirements:
80
- - - "~>"
93
+ - - ">="
81
94
  - !ruby/object:Gem::Version
82
- version: '1.1'
95
+ version: '0'
83
96
  - !ruby/object:Gem::Dependency
84
- name: minitest-reporters
97
+ name: minitest-focus
85
98
  requirement: !ruby/object:Gem::Requirement
86
99
  requirements:
87
- - - "~>"
100
+ - - ">="
88
101
  - !ruby/object:Gem::Version
89
- version: '1.0'
102
+ version: '0'
90
103
  type: :development
91
104
  prerelease: false
92
105
  version_requirements: !ruby/object:Gem::Requirement
93
106
  requirements:
94
- - - "~>"
107
+ - - ">="
95
108
  - !ruby/object:Gem::Version
96
- version: '1.0'
109
+ version: '0'
97
110
  - !ruby/object:Gem::Dependency
98
- name: racc
111
+ name: minitest-reporters
99
112
  requirement: !ruby/object:Gem::Requirement
100
113
  requirements:
101
- - - "~>"
114
+ - - ">="
102
115
  - !ruby/object:Gem::Version
103
- version: '1.4'
116
+ version: '0'
104
117
  type: :development
105
118
  prerelease: false
106
119
  version_requirements: !ruby/object:Gem::Requirement
107
120
  requirements:
108
- - - "~>"
121
+ - - ">="
109
122
  - !ruby/object:Gem::Version
110
- version: '1.4'
123
+ version: '0'
111
124
  - !ruby/object:Gem::Dependency
112
125
  name: rake
113
126
  requirement: !ruby/object:Gem::Requirement
@@ -395,6 +408,7 @@ files:
395
408
  - lib/graphql/runtime_type_error.rb
396
409
  - lib/graphql/schema.rb
397
410
  - lib/graphql/schema/addition.rb
411
+ - lib/graphql/schema/always_visible.rb
398
412
  - lib/graphql/schema/argument.rb
399
413
  - lib/graphql/schema/base_64_bp.rb
400
414
  - lib/graphql/schema/base_64_encoder.rb
@@ -607,7 +621,6 @@ metadata:
607
621
  source_code_uri: https://github.com/rmosolgo/graphql-ruby
608
622
  bug_tracker_uri: https://github.com/rmosolgo/graphql-ruby/issues
609
623
  mailing_list_uri: https://tinyletter.com/graphql-ruby
610
- post_install_message:
611
624
  rdoc_options: []
612
625
  require_paths:
613
626
  - lib
@@ -622,8 +635,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
622
635
  - !ruby/object:Gem::Version
623
636
  version: '0'
624
637
  requirements: []
625
- rubygems_version: 3.4.1
626
- signing_key:
638
+ rubygems_version: 3.6.3
627
639
  specification_version: 4
628
640
  summary: A GraphQL language and runtime for Ruby
629
641
  test_files: []