graphql 2.4.9 → 2.4.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/graphql/current.rb +5 -0
  3. data/lib/graphql/dataloader/active_record_association_source.rb +64 -0
  4. data/lib/graphql/dataloader/active_record_source.rb +26 -0
  5. data/lib/graphql/dataloader/async_dataloader.rb +17 -5
  6. data/lib/graphql/dataloader/null_dataloader.rb +1 -1
  7. data/lib/graphql/dataloader/source.rb +2 -2
  8. data/lib/graphql/dataloader.rb +37 -5
  9. data/lib/graphql/execution/interpreter/runtime.rb +25 -6
  10. data/lib/graphql/execution/interpreter.rb +9 -1
  11. data/lib/graphql/language/parser.rb +1 -1
  12. data/lib/graphql/query.rb +8 -4
  13. data/lib/graphql/schema/enum.rb +1 -1
  14. data/lib/graphql/schema/interface.rb +1 -0
  15. data/lib/graphql/schema/loader.rb +1 -0
  16. data/lib/graphql/schema/member/has_dataloader.rb +56 -0
  17. data/lib/graphql/schema/member.rb +1 -0
  18. data/lib/graphql/schema/object.rb +17 -8
  19. data/lib/graphql/schema/resolver.rb +1 -5
  20. data/lib/graphql/schema/visibility/profile.rb +4 -4
  21. data/lib/graphql/schema/visibility.rb +14 -9
  22. data/lib/graphql/schema.rb +4 -4
  23. data/lib/graphql/static_validation/validator.rb +6 -1
  24. data/lib/graphql/tracing/appoptics_trace.rb +1 -1
  25. data/lib/graphql/tracing/new_relic_trace.rb +138 -41
  26. data/lib/graphql/tracing/perfetto_trace/trace.proto +141 -0
  27. data/lib/graphql/tracing/perfetto_trace/trace_pb.rb +33 -0
  28. data/lib/graphql/tracing/perfetto_trace.rb +726 -0
  29. data/lib/graphql/tracing/trace.rb +124 -0
  30. data/lib/graphql/tracing.rb +1 -0
  31. data/lib/graphql/version.rb +1 -1
  32. metadata +36 -3
  33. data/lib/graphql/schema/null_mask.rb +0 -11
@@ -23,6 +23,14 @@ module GraphQL
23
23
  yield
24
24
  end
25
25
 
26
+ # @param query_str [String]
27
+ # @return [void]
28
+ def begin_parse(query_str); end;
29
+ # @param query_str [String]
30
+ # @return [void]
31
+ def end_parse(query_str); end;
32
+ # @param query_string [String]
33
+ # @return [void]
26
34
  def parse(query_string:)
27
35
  yield
28
36
  end
@@ -31,6 +39,22 @@ module GraphQL
31
39
  yield
32
40
  end
33
41
 
42
+ def begin_validate(query, validate)
43
+ end
44
+
45
+ def end_validate(query, validate, errors)
46
+ end
47
+
48
+ # @param multiplex [GraphQL::Execution::Multiplex]
49
+ # @param analyzers [Array<Class>]
50
+ # @return [void]
51
+ def begin_analyze_multiplex(multiplex, analyzers); end
52
+ # @param multiplex [GraphQL::Execution::Multiplex]
53
+ # @param analyzers [Array<Class>]
54
+ # @return [void]
55
+ def end_analyze_multiplex(multiplex, analyzers); end
56
+ # @param multiplex [GraphQL::Execution::Multiplex]
57
+ # @return [void]
34
58
  def analyze_multiplex(multiplex:)
35
59
  yield
36
60
  end
@@ -39,6 +63,20 @@ module GraphQL
39
63
  yield
40
64
  end
41
65
 
66
+ # This is the first event in the tracing lifecycle.
67
+ # Every Query is technically run _inside_ a {GraphQL::Multiplex}.
68
+ # @param multiplex [GraphQL::Execution::Multiplex]
69
+ # @return [void]
70
+ def begin_execute_multiplex(multiplex); end;
71
+
72
+ # This is the last event of the tracing lifecycle.
73
+ # @param multiplex [GraphQL::Execution::Multiplex]
74
+ # @return [void]
75
+ def end_execute_multiplex(multiplex); end;
76
+
77
+ # This wraps an entire `.execute` call.
78
+ # @param multiplex [GraphQL::Execution::Multiplex]
79
+ # @return [void]
42
80
  def execute_multiplex(multiplex:)
43
81
  yield
44
82
  end
@@ -51,6 +89,20 @@ module GraphQL
51
89
  yield
52
90
  end
53
91
 
92
+ # GraphQL is about to resolve this field
93
+ # @param field [GraphQL::Schema::Field]
94
+ # @param object [GraphQL::Schema::Object]
95
+ # @param arguments [Hash]
96
+ # @param query [GraphQL::Query]
97
+ def begin_execute_field(field, object, arguments, query); end
98
+ # GraphQL just finished resolving this field
99
+ # @param field [GraphQL::Schema::Field]
100
+ # @param object [GraphQL::Schema::Object]
101
+ # @param arguments [Hash]
102
+ # @param query [GraphQL::Query]
103
+ # @param result [Object]
104
+ def end_execute_field(field, object, arguments, query, result); end
105
+
54
106
  def execute_field(field:, query:, ast_node:, arguments:, object:)
55
107
  yield
56
108
  end
@@ -63,6 +115,22 @@ module GraphQL
63
115
  yield
64
116
  end
65
117
 
118
+ # A call to `.authorized?` is starting
119
+ # @param type [Class<GraphQL::Schema::Object>]
120
+ # @param object [Object]
121
+ # @param context [GraphQL::Query::Context]
122
+ # @return [void]
123
+ def begin_authorized(type, object, context)
124
+ end
125
+ # A call to `.authorized?` just finished
126
+ # @param type [Class<GraphQL::Schema::Object>]
127
+ # @param object [Object]
128
+ # @param context [GraphQL::Query::Context]
129
+ # @param authorized_result [Boolean]
130
+ # @return [void]
131
+ def end_authorized(type, object, context, authorized_result)
132
+ end
133
+
66
134
  def authorized_lazy(query:, type:, object:)
67
135
  yield
68
136
  end
@@ -74,6 +142,62 @@ module GraphQL
74
142
  def resolve_type_lazy(query:, type:, object:)
75
143
  yield
76
144
  end
145
+
146
+ # A call to `.resolve_type` is starting
147
+ # @param type [Class<GraphQL::Schema::Union>, Module<GraphQL::Schema::Interface>]
148
+ # @param value [Object]
149
+ # @param context [GraphQL::Query::Context]
150
+ # @return [void]
151
+ def begin_resolve_type(type, value, context)
152
+ end
153
+
154
+ # A call to `.resolve_type` just ended
155
+ # @param type [Class<GraphQL::Schema::Union>, Module<GraphQL::Schema::Interface>]
156
+ # @param value [Object]
157
+ # @param context [GraphQL::Query::Context]
158
+ # @param resolved_type [Class<GraphQL::Schema::Object>]
159
+ # @return [void]
160
+ def end_resolve_type(type, value, context, resolved_type)
161
+ end
162
+
163
+ # A dataloader run is starting
164
+ # @param dataloader [GraphQL::Dataloader]
165
+ # @return [void]
166
+ def begin_dataloader(dataloader); end
167
+ # A dataloader run has ended
168
+ # @param dataloder [GraphQL::Dataloader]
169
+ # @return [void]
170
+ def end_dataloader(dataloader); end
171
+
172
+ # A source with pending keys is about to fetch
173
+ # @param source [GraphQL::Dataloader::Source]
174
+ # @return [void]
175
+ def begin_dataloader_source(source); end
176
+ # A fetch call has just ended
177
+ # @param source [GraphQL::Dataloader::Source]
178
+ # @return [void]
179
+ def end_dataloader_source(source); end
180
+
181
+ # Called when Dataloader spins up a new fiber for GraphQL execution
182
+ # @param jobs [Array<#call>] Execution steps to run
183
+ # @return [void]
184
+ def dataloader_spawn_execution_fiber(jobs); end
185
+ # Called when Dataloader spins up a new fiber for fetching data
186
+ # @param pending_sources [GraphQL::Dataloader::Source] Instances with pending keys
187
+ # @return [void]
188
+ def dataloader_spawn_source_fiber(pending_sources); end
189
+ # Called when an execution or source fiber terminates
190
+ # @return [void]
191
+ def dataloader_fiber_exit; end
192
+
193
+ # Called when a Dataloader fiber is paused to wait for data
194
+ # @param source [GraphQL::Dataloader::Source] The Source whose `load` call initiated this `yield`
195
+ # @return [void]
196
+ def dataloader_fiber_yield(source); end
197
+ # Called when a Dataloader fiber is resumed because data has been loaded
198
+ # @param source [GraphQL::Dataloader::Source] The Source whose `load` call previously caused this Fiber to wait
199
+ # @return [void]
200
+ def dataloader_fiber_resume(source); end
77
201
  end
78
202
  end
79
203
  end
@@ -31,6 +31,7 @@ module GraphQL
31
31
  autoload :ScoutTrace, "graphql/tracing/scout_trace"
32
32
  autoload :StatsdTrace, "graphql/tracing/statsd_trace"
33
33
  autoload :PrometheusTrace, "graphql/tracing/prometheus_trace"
34
+ autoload :PerfettoTrace, "graphql/tracing/perfetto_trace"
34
35
 
35
36
  # Objects may include traceable to gain a `.trace(...)` method.
36
37
  # The object must have a `@tracers` ivar of type `Array<<#trace(k, d, &b)>>`.
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.4.9"
3
+ VERSION = "2.4.10"
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.4.9
4
+ version: 2.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-29 00:00:00.000000000 Z
10
+ date: 2025-02-18 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: base64
@@ -79,6 +79,20 @@ dependencies:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '1.0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: google-protobuf
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
82
96
  - !ruby/object:Gem::Dependency
83
97
  name: graphql-batch
84
98
  requirement: !ruby/object:Gem::Requirement
@@ -275,6 +289,20 @@ dependencies:
275
289
  - - ">="
276
290
  - !ruby/object:Gem::Version
277
291
  version: '0'
292
+ - !ruby/object:Gem::Dependency
293
+ name: jekyll-sass-converter
294
+ requirement: !ruby/object:Gem::Requirement
295
+ requirements:
296
+ - - "~>"
297
+ - !ruby/object:Gem::Version
298
+ version: '2.2'
299
+ type: :development
300
+ prerelease: false
301
+ version_requirements: !ruby/object:Gem::Requirement
302
+ requirements:
303
+ - - "~>"
304
+ - !ruby/object:Gem::Version
305
+ version: '2.2'
278
306
  - !ruby/object:Gem::Dependency
279
307
  name: yard
280
308
  requirement: !ruby/object:Gem::Requirement
@@ -432,6 +460,8 @@ files:
432
460
  - lib/graphql/coercion_error.rb
433
461
  - lib/graphql/current.rb
434
462
  - lib/graphql/dataloader.rb
463
+ - lib/graphql/dataloader/active_record_association_source.rb
464
+ - lib/graphql/dataloader/active_record_source.rb
435
465
  - lib/graphql/dataloader/async_dataloader.rb
436
466
  - lib/graphql/dataloader/null_dataloader.rb
437
467
  - lib/graphql/dataloader/request.rb
@@ -560,6 +590,7 @@ files:
560
590
  - lib/graphql/schema/member/graphql_type_names.rb
561
591
  - lib/graphql/schema/member/has_arguments.rb
562
592
  - lib/graphql/schema/member/has_ast_node.rb
593
+ - lib/graphql/schema/member/has_dataloader.rb
563
594
  - lib/graphql/schema/member/has_deprecation_reason.rb
564
595
  - lib/graphql/schema/member/has_directives.rb
565
596
  - lib/graphql/schema/member/has_fields.rb
@@ -573,7 +604,6 @@ files:
573
604
  - lib/graphql/schema/member/validates_input.rb
574
605
  - lib/graphql/schema/mutation.rb
575
606
  - lib/graphql/schema/non_null.rb
576
- - lib/graphql/schema/null_mask.rb
577
607
  - lib/graphql/schema/object.rb
578
608
  - lib/graphql/schema/printer.rb
579
609
  - lib/graphql/schema/relay_classic_mutation.rb
@@ -698,6 +728,9 @@ files:
698
728
  - lib/graphql/tracing/notifications_trace.rb
699
729
  - lib/graphql/tracing/notifications_tracing.rb
700
730
  - lib/graphql/tracing/null_trace.rb
731
+ - lib/graphql/tracing/perfetto_trace.rb
732
+ - lib/graphql/tracing/perfetto_trace/trace.proto
733
+ - lib/graphql/tracing/perfetto_trace/trace_pb.rb
701
734
  - lib/graphql/tracing/platform_trace.rb
702
735
  - lib/graphql/tracing/platform_tracing.rb
703
736
  - lib/graphql/tracing/prometheus_trace.rb
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
- module GraphQL
3
- class Schema
4
- # @api private
5
- module NullMask
6
- def self.call(member, ctx)
7
- false
8
- end
9
- end
10
- end
11
- end