graphql 2.0.22 → 2.0.23
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.
Potentially problematic release.
This version of graphql might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/graphql/backtrace.rb +0 -4
- data/lib/graphql/execution/interpreter/runtime.rb +4 -12
- data/lib/graphql/language/document_from_schema_definition.rb +4 -1
- data/lib/graphql/language/printer.rb +28 -14
- data/lib/graphql/query/null_context.rb +5 -18
- data/lib/graphql/query.rb +5 -5
- data/lib/graphql/schema/always_visible.rb +10 -0
- data/lib/graphql/schema/field.rb +20 -9
- data/lib/graphql/schema/timeout.rb +1 -1
- data/lib/graphql/schema/warden.rb +29 -2
- data/lib/graphql/schema.rb +25 -10
- data/lib/graphql/tracing/legacy_trace.rb +5 -1
- data/lib/graphql/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5aade8e5f88eb3dd8e8d6148aa7e8e00b0a351422b090e02a911158f425f1905
|
4
|
+
data.tar.gz: 1ee1e4529f0b1f68596ce73f2b171624637999f0a1d6fc03f377c46fc7756a78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b9cd861e35c529674bdacb6e1a34864bca6852c030022215ecc028d2b36b20da120be4ee45bb5ac5fb906b856e78dc4cfbbcf55609ad47fc47e6d68422a26b1
|
7
|
+
data.tar.gz: b4afc463a0c9058396f274c9224f5a6b0bca73fefc68c1e6f10e53eea24b95b89ef6d9ddd3e22929d90be69b7c46bd81e6ed134ddab2550cbfc4408aee29b8ef
|
data/lib/graphql/backtrace.rb
CHANGED
@@ -343,12 +343,8 @@ module GraphQL
|
|
343
343
|
if node.type
|
344
344
|
type_defn = schema.get_type(node.type.name, context)
|
345
345
|
|
346
|
-
|
347
|
-
|
348
|
-
if t == owner_type
|
349
|
-
gather_selections(owner_object, owner_type, node.selections, selections_to_run, next_selections)
|
350
|
-
break
|
351
|
-
end
|
346
|
+
if query.warden.possible_types(type_defn).include?(owner_type)
|
347
|
+
gather_selections(owner_object, owner_type, node.selections, selections_to_run, next_selections)
|
352
348
|
end
|
353
349
|
else
|
354
350
|
# it's an untyped fragment, definitely continue
|
@@ -357,12 +353,8 @@ module GraphQL
|
|
357
353
|
when GraphQL::Language::Nodes::FragmentSpread
|
358
354
|
fragment_def = query.fragments[node.name]
|
359
355
|
type_defn = query.get_type(fragment_def.type.name)
|
360
|
-
|
361
|
-
|
362
|
-
if t == owner_type
|
363
|
-
gather_selections(owner_object, owner_type, fragment_def.selections, selections_to_run, next_selections)
|
364
|
-
break
|
365
|
-
end
|
356
|
+
if query.warden.possible_types(type_defn).include?(owner_type)
|
357
|
+
gather_selections(owner_object, owner_type, fragment_def.selections, selections_to_run, next_selections)
|
366
358
|
end
|
367
359
|
else
|
368
360
|
raise "Invariant: unexpected selection class: #{node.class}"
|
@@ -36,7 +36,10 @@ module GraphQL
|
|
36
36
|
context: schema_context,
|
37
37
|
)
|
38
38
|
else
|
39
|
-
|
39
|
+
@schema.warden_class.new(
|
40
|
+
schema: @schema,
|
41
|
+
context: schema_context,
|
42
|
+
)
|
40
43
|
end
|
41
44
|
|
42
45
|
schema_context.warden = @warden
|
@@ -131,7 +131,7 @@ module GraphQL
|
|
131
131
|
"$#{variable_identifier.name}".dup
|
132
132
|
end
|
133
133
|
|
134
|
-
def print_schema_definition(schema)
|
134
|
+
def print_schema_definition(schema, extension: false)
|
135
135
|
has_conventional_names = (schema.query.nil? || schema.query == 'Query') &&
|
136
136
|
(schema.mutation.nil? || schema.mutation == 'Mutation') &&
|
137
137
|
(schema.subscription.nil? || schema.subscription == 'Subscription')
|
@@ -140,7 +140,7 @@ module GraphQL
|
|
140
140
|
return
|
141
141
|
end
|
142
142
|
|
143
|
-
out = "schema".dup
|
143
|
+
out = extension ? "extend schema".dup : "schema".dup
|
144
144
|
if schema.directives.any?
|
145
145
|
schema.directives.each do |dir|
|
146
146
|
out << "\n "
|
@@ -164,14 +164,14 @@ module GraphQL
|
|
164
164
|
out
|
165
165
|
end
|
166
166
|
|
167
|
-
def print_scalar_type_definition(scalar_type)
|
168
|
-
out = print_description(scalar_type)
|
167
|
+
def print_scalar_type_definition(scalar_type, extension: false)
|
168
|
+
out = extension ? "extend ".dup : print_description(scalar_type)
|
169
169
|
out << "scalar #{scalar_type.name}"
|
170
170
|
out << print_directives(scalar_type.directives)
|
171
171
|
end
|
172
172
|
|
173
|
-
def print_object_type_definition(object_type)
|
174
|
-
out = print_description(object_type)
|
173
|
+
def print_object_type_definition(object_type, extension: false)
|
174
|
+
out = extension ? "extend ".dup : print_description(object_type)
|
175
175
|
out << "type #{object_type.name}"
|
176
176
|
out << print_implements(object_type) unless object_type.interfaces.empty?
|
177
177
|
out << print_directives(object_type.directives)
|
@@ -210,23 +210,23 @@ module GraphQL
|
|
210
210
|
out << print_directives(field.directives)
|
211
211
|
end
|
212
212
|
|
213
|
-
def print_interface_type_definition(interface_type)
|
214
|
-
out = print_description(interface_type)
|
213
|
+
def print_interface_type_definition(interface_type, extension: false)
|
214
|
+
out = extension ? "extend ".dup : print_description(interface_type)
|
215
215
|
out << "interface #{interface_type.name}"
|
216
216
|
out << print_implements(interface_type) if interface_type.interfaces.any?
|
217
217
|
out << print_directives(interface_type.directives)
|
218
218
|
out << print_field_definitions(interface_type.fields)
|
219
219
|
end
|
220
220
|
|
221
|
-
def print_union_type_definition(union_type)
|
222
|
-
out = print_description(union_type)
|
221
|
+
def print_union_type_definition(union_type, extension: false)
|
222
|
+
out = extension ? "extend ".dup : print_description(union_type)
|
223
223
|
out << "union #{union_type.name}"
|
224
224
|
out << print_directives(union_type.directives)
|
225
225
|
out << " = " + union_type.types.map(&:name).join(" | ")
|
226
226
|
end
|
227
227
|
|
228
|
-
def print_enum_type_definition(enum_type)
|
229
|
-
out = print_description(enum_type)
|
228
|
+
def print_enum_type_definition(enum_type, extension: false)
|
229
|
+
out = extension ? "extend ".dup : print_description(enum_type)
|
230
230
|
out << "enum #{enum_type.name}#{print_directives(enum_type.directives)} {\n"
|
231
231
|
enum_type.values.each.with_index do |value, i|
|
232
232
|
out << print_description(value, indent: ' ', first_in_block: i == 0)
|
@@ -241,8 +241,8 @@ module GraphQL
|
|
241
241
|
out << "\n"
|
242
242
|
end
|
243
243
|
|
244
|
-
def print_input_object_type_definition(input_object_type)
|
245
|
-
out = print_description(input_object_type)
|
244
|
+
def print_input_object_type_definition(input_object_type, extension: false)
|
245
|
+
out = extension ? "extend ".dup : print_description(input_object_type)
|
246
246
|
out << "input #{input_object_type.name}"
|
247
247
|
out << print_directives(input_object_type.directives)
|
248
248
|
if !input_object_type.fields.empty?
|
@@ -347,24 +347,38 @@ module GraphQL
|
|
347
347
|
print_variable_identifier(node)
|
348
348
|
when Nodes::SchemaDefinition
|
349
349
|
print_schema_definition(node)
|
350
|
+
when Nodes::SchemaExtension
|
351
|
+
print_schema_definition(node, extension: true)
|
350
352
|
when Nodes::ScalarTypeDefinition
|
351
353
|
print_scalar_type_definition(node)
|
354
|
+
when Nodes::ScalarTypeExtension
|
355
|
+
print_scalar_type_definition(node, extension: true)
|
352
356
|
when Nodes::ObjectTypeDefinition
|
353
357
|
print_object_type_definition(node)
|
358
|
+
when Nodes::ObjectTypeExtension
|
359
|
+
print_object_type_definition(node, extension: true)
|
354
360
|
when Nodes::InputValueDefinition
|
355
361
|
print_input_value_definition(node)
|
356
362
|
when Nodes::FieldDefinition
|
357
363
|
print_field_definition(node)
|
358
364
|
when Nodes::InterfaceTypeDefinition
|
359
365
|
print_interface_type_definition(node)
|
366
|
+
when Nodes::InterfaceTypeExtension
|
367
|
+
print_interface_type_definition(node, extension: true)
|
360
368
|
when Nodes::UnionTypeDefinition
|
361
369
|
print_union_type_definition(node)
|
370
|
+
when Nodes::UnionTypeExtension
|
371
|
+
print_union_type_definition(node, extension: true)
|
362
372
|
when Nodes::EnumTypeDefinition
|
363
373
|
print_enum_type_definition(node)
|
374
|
+
when Nodes::EnumTypeExtension
|
375
|
+
print_enum_type_definition(node, extension: true)
|
364
376
|
when Nodes::EnumValueDefinition
|
365
377
|
print_enum_value_definition(node)
|
366
378
|
when Nodes::InputObjectTypeDefinition
|
367
379
|
print_input_object_type_definition(node)
|
380
|
+
when Nodes::InputObjectTypeExtension
|
381
|
+
print_input_object_type_definition(node, extension: true)
|
368
382
|
when Nodes::DirectiveDefinition
|
369
383
|
print_directive_definition(node)
|
370
384
|
when FalseClass, Float, Integer, NilClass, String, TrueClass, Symbol
|
@@ -3,14 +3,6 @@ module GraphQL
|
|
3
3
|
class Query
|
4
4
|
# This object can be `ctx` in places where there is no query
|
5
5
|
class NullContext
|
6
|
-
class NullWarden < GraphQL::Schema::Warden
|
7
|
-
def visible_field?(field, ctx); true; end
|
8
|
-
def visible_argument?(arg, ctx); true; end
|
9
|
-
def visible_type?(type, ctx); true; end
|
10
|
-
def visible_enum_value?(ev, ctx); true; end
|
11
|
-
def visible_type_membership?(tm, ctx); true; end
|
12
|
-
end
|
13
|
-
|
14
6
|
class NullQuery
|
15
7
|
def after_lazy(value)
|
16
8
|
yield(value)
|
@@ -20,21 +12,18 @@ module GraphQL
|
|
20
12
|
class NullSchema < GraphQL::Schema
|
21
13
|
end
|
22
14
|
|
15
|
+
extend Forwardable
|
16
|
+
|
23
17
|
attr_reader :schema, :query, :warden, :dataloader
|
18
|
+
def_delegators GraphQL::EmptyObjects::EMPTY_HASH, :[], :fetch, :dig, :key?
|
24
19
|
|
25
20
|
def initialize
|
26
21
|
@query = NullQuery.new
|
27
22
|
@dataloader = GraphQL::Dataloader::NullDataloader.new
|
28
23
|
@schema = NullSchema
|
29
|
-
@warden = NullWarden.new(
|
30
|
-
GraphQL::Filter.new(silence_deprecation_warning: true),
|
31
|
-
context: self,
|
32
|
-
schema: @schema,
|
33
|
-
)
|
24
|
+
@warden = Schema::Warden::NullWarden.new(context: self, schema: @schema)
|
34
25
|
end
|
35
26
|
|
36
|
-
def [](key); end
|
37
|
-
|
38
27
|
def interpreter?
|
39
28
|
true
|
40
29
|
end
|
@@ -42,13 +31,11 @@ module GraphQL
|
|
42
31
|
class << self
|
43
32
|
extend Forwardable
|
44
33
|
|
45
|
-
def [](key); end
|
46
|
-
|
47
34
|
def instance
|
48
35
|
@instance ||= self.new
|
49
36
|
end
|
50
37
|
|
51
|
-
def_delegators :instance, :query, :warden, :schema, :interpreter?, :dataloader
|
38
|
+
def_delegators :instance, :query, :warden, :schema, :interpreter?, :dataloader, :[], :fetch, :dig, :key?
|
52
39
|
end
|
53
40
|
end
|
54
41
|
end
|
data/lib/graphql/query.rb
CHANGED
@@ -102,7 +102,7 @@ module GraphQL
|
|
102
102
|
|
103
103
|
# Support `ctx[:backtrace] = true` for wrapping backtraces
|
104
104
|
if context && context[:backtrace] && !@tracers.include?(GraphQL::Backtrace::Tracer)
|
105
|
-
if schema.trace_class <= GraphQL::Tracing::
|
105
|
+
if schema.trace_class <= GraphQL::Tracing::CallLegacyTracers
|
106
106
|
context_tracers += [GraphQL::Backtrace::Tracer]
|
107
107
|
@tracers << GraphQL::Backtrace::Tracer
|
108
108
|
elsif !(current_trace.class <= GraphQL::Backtrace::Trace)
|
@@ -110,8 +110,8 @@ module GraphQL
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
if context_tracers.any? && !(schema.trace_class <= GraphQL::Tracing::
|
114
|
-
raise ArgumentError, "context[:tracers] are not supported without `
|
113
|
+
if context_tracers.any? && !(schema.trace_class <= GraphQL::Tracing::CallLegacyTracers)
|
114
|
+
raise ArgumentError, "context[:tracers] are not supported without `trace_with(GraphQL::Tracing::CallLegacyTracers)` in the schema configuration, please add it."
|
115
115
|
end
|
116
116
|
|
117
117
|
|
@@ -168,7 +168,7 @@ module GraphQL
|
|
168
168
|
|
169
169
|
# @return [GraphQL::Tracing::Trace]
|
170
170
|
def current_trace
|
171
|
-
@current_trace ||= multiplex ? multiplex.current_trace : schema.new_trace(multiplex: multiplex, query: self)
|
171
|
+
@current_trace ||= context[:trace] || (multiplex ? multiplex.current_trace : schema.new_trace(multiplex: multiplex, query: self))
|
172
172
|
end
|
173
173
|
|
174
174
|
def subscription_update?
|
@@ -385,7 +385,7 @@ module GraphQL
|
|
385
385
|
|
386
386
|
def prepare_ast
|
387
387
|
@prepared_ast = true
|
388
|
-
@warden ||=
|
388
|
+
@warden ||= @schema.warden_class.new(@filter, schema: @schema, context: @context)
|
389
389
|
parse_error = nil
|
390
390
|
@document ||= begin
|
391
391
|
if query_string
|
data/lib/graphql/schema/field.rb
CHANGED
@@ -810,6 +810,17 @@ ERR
|
|
810
810
|
end
|
811
811
|
end
|
812
812
|
|
813
|
+
class ExtendedState
|
814
|
+
def initialize(args, object)
|
815
|
+
@arguments = args
|
816
|
+
@object = object
|
817
|
+
@memos = nil
|
818
|
+
@added_extras = nil
|
819
|
+
end
|
820
|
+
|
821
|
+
attr_accessor :arguments, :object, :memos, :added_extras
|
822
|
+
end
|
823
|
+
|
813
824
|
# Wrap execution with hooks.
|
814
825
|
# Written iteratively to avoid big stack traces.
|
815
826
|
# @return [Object] Whatever the
|
@@ -820,18 +831,18 @@ ERR
|
|
820
831
|
# This is a hack to get the _last_ value for extended obj and args,
|
821
832
|
# in case one of the extensions doesn't `yield`.
|
822
833
|
# (There's another implementation that uses multiple-return, but I'm wary of the perf cost of the extra arrays)
|
823
|
-
extended =
|
834
|
+
extended = ExtendedState.new(args, obj)
|
824
835
|
value = run_extensions_before_resolve(obj, args, ctx, extended) do |obj, args|
|
825
|
-
if (added_extras = extended
|
836
|
+
if (added_extras = extended.added_extras)
|
826
837
|
args = args.dup
|
827
838
|
added_extras.each { |e| args.delete(e) }
|
828
839
|
end
|
829
840
|
yield(obj, args)
|
830
841
|
end
|
831
842
|
|
832
|
-
extended_obj = extended
|
833
|
-
extended_args = extended
|
834
|
-
memos = extended
|
843
|
+
extended_obj = extended.object
|
844
|
+
extended_args = extended.arguments # rubocop:disable Development/ContextIsPassedCop
|
845
|
+
memos = extended.memos || EMPTY_HASH
|
835
846
|
|
836
847
|
ctx.query.after_lazy(value) do |resolved_value|
|
837
848
|
idx = 0
|
@@ -851,17 +862,17 @@ ERR
|
|
851
862
|
if extension
|
852
863
|
extension.resolve(object: obj, arguments: args, context: ctx) do |extended_obj, extended_args, memo|
|
853
864
|
if memo
|
854
|
-
memos = extended
|
865
|
+
memos = extended.memos ||= {}
|
855
866
|
memos[idx] = memo
|
856
867
|
end
|
857
868
|
|
858
869
|
if (extras = extension.added_extras)
|
859
|
-
ae = extended
|
870
|
+
ae = extended.added_extras ||= []
|
860
871
|
ae.concat(extras)
|
861
872
|
end
|
862
873
|
|
863
|
-
extended
|
864
|
-
extended
|
874
|
+
extended.object = extended_obj
|
875
|
+
extended.arguments = extended_args
|
865
876
|
run_extensions_before_resolve(extended_obj, extended_args, ctx, extended, idx: idx + 1) { |o, a| yield(o, a) }
|
866
877
|
end
|
867
878
|
else
|
@@ -90,7 +90,7 @@ module GraphQL
|
|
90
90
|
# The default implementation returns the `max_seconds:` value from installing this plugin.
|
91
91
|
#
|
92
92
|
# @param query [GraphQL::Query] The query that's about to run
|
93
|
-
# @return [
|
93
|
+
# @return [Numeric, false] The number of seconds after which to interrupt query execution and call {#handle_error}, or `false` to bypass the timeout.
|
94
94
|
def max_seconds(query)
|
95
95
|
@max_seconds
|
96
96
|
end
|
@@ -38,8 +38,9 @@ module GraphQL
|
|
38
38
|
# @api private
|
39
39
|
class Warden
|
40
40
|
def self.from_context(context)
|
41
|
-
context.warden
|
42
|
-
rescue
|
41
|
+
context.warden || PassThruWarden
|
42
|
+
rescue NoMethodError
|
43
|
+
# this might be a hash which won't respond to #warden
|
43
44
|
PassThruWarden
|
44
45
|
end
|
45
46
|
|
@@ -87,6 +88,32 @@ module GraphQL
|
|
87
88
|
end
|
88
89
|
end
|
89
90
|
|
91
|
+
class NullWarden
|
92
|
+
def initialize(_filter = nil, context:, schema:)
|
93
|
+
@schema = schema
|
94
|
+
end
|
95
|
+
|
96
|
+
def visible_field?(field_defn, _ctx = nil, owner = nil); true; end
|
97
|
+
def visible_argument?(arg_defn, _ctx = nil); true; end
|
98
|
+
def visible_type?(type_defn, _ctx = nil); true; end
|
99
|
+
def visible_enum_value?(enum_value, _ctx = nil); true; end
|
100
|
+
def visible_type_membership?(type_membership, _ctx = nil); true; end
|
101
|
+
def interface_type_memberships(obj_type, _ctx = nil); obj_type.interface_type_memberships; end
|
102
|
+
def get_type(type_name); @schema.get_type(type_name); end # rubocop:disable Development/ContextIsPassedCop
|
103
|
+
def arguments(argument_owner, ctx = nil); argument_owner.all_argument_definitions; end
|
104
|
+
def enum_values(enum_defn); enum_defn.enum_values; end # rubocop:disable Development/ContextIsPassedCop
|
105
|
+
def get_argument(parent_type, argument_name); parent_type.get_argument(argument_name); end # rubocop:disable Development/ContextIsPassedCop
|
106
|
+
def types; @schema.types; end # rubocop:disable Development/ContextIsPassedCop
|
107
|
+
def root_type_for_operation(op_name); @schema.root_type_for_operation(op_name); end
|
108
|
+
def directives; @schema.directives.values; end
|
109
|
+
def fields(type_defn); type_defn.all_field_definitions; end # rubocop:disable Development/ContextIsPassedCop
|
110
|
+
def get_field(parent_type, field_name); @schema.get_field(parent_type, field_name); end
|
111
|
+
def reachable_type?(type_name); true; end
|
112
|
+
def reachable_types; @schema.types.values; end # rubocop:disable Development/ContextIsPassedCop
|
113
|
+
def possible_types(type_defn); @schema.possible_types(type_defn); end
|
114
|
+
def interfaces(obj_type); obj_type.interfaces; end
|
115
|
+
end
|
116
|
+
|
90
117
|
# @param filter [<#call(member)>] Objects are hidden when `.call(member, ctx)` returns true
|
91
118
|
# @param context [GraphQL::Query::Context]
|
92
119
|
# @param schema [GraphQL::Schema]
|
data/lib/graphql/schema.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "graphql/schema/addition"
|
3
|
+
require "graphql/schema/always_visible"
|
3
4
|
require "graphql/schema/base_64_encoder"
|
4
5
|
require "graphql/schema/find_inherited_value"
|
5
6
|
require "graphql/schema/finder"
|
@@ -157,14 +158,17 @@ module GraphQL
|
|
157
158
|
def trace_class_for(mode)
|
158
159
|
@trace_modes ||= {}
|
159
160
|
@trace_modes[mode] ||= begin
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
161
|
+
if mode == :default_backtrace
|
162
|
+
schema_base_class = trace_class_for(:default)
|
163
|
+
Class.new(schema_base_class) do
|
164
|
+
include(GraphQL::Backtrace::Trace)
|
165
|
+
end
|
166
|
+
elsif superclass.respond_to?(:trace_class_for)
|
167
|
+
superclass_base_class = superclass.trace_class_for(mode)
|
168
|
+
Class.new(superclass_base_class)
|
164
169
|
else
|
165
|
-
GraphQL::Tracing::Trace
|
170
|
+
Class.new(GraphQL::Tracing::Trace)
|
166
171
|
end
|
167
|
-
Class.new(base_class)
|
168
172
|
end
|
169
173
|
end
|
170
174
|
|
@@ -420,6 +424,18 @@ module GraphQL
|
|
420
424
|
@root_types
|
421
425
|
end
|
422
426
|
|
427
|
+
def warden_class
|
428
|
+
if defined?(@warden_class)
|
429
|
+
@warden_class
|
430
|
+
elsif superclass.respond_to?(:warden_class)
|
431
|
+
superclass.warden_class
|
432
|
+
else
|
433
|
+
GraphQL::Schema::Warden
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
437
|
+
attr_writer :warden_class
|
438
|
+
|
423
439
|
# @param type [Module] The type definition whose possible types you want to see
|
424
440
|
# @return [Hash<String, Module>] All possible types, if no `type` is given.
|
425
441
|
# @return [Array<Module>] Possible types for `type`, if it's given.
|
@@ -961,10 +977,8 @@ module GraphQL
|
|
961
977
|
end
|
962
978
|
|
963
979
|
def tracer(new_tracer)
|
964
|
-
if
|
965
|
-
|
966
|
-
else
|
967
|
-
trace_mode(:default, Class.new(GraphQL::Tracing::LegacyTrace))
|
980
|
+
if !(trace_class_for(:default) < GraphQL::Tracing::CallLegacyTracers)
|
981
|
+
trace_with(GraphQL::Tracing::CallLegacyTracers)
|
968
982
|
end
|
969
983
|
|
970
984
|
own_tracers << new_tracer
|
@@ -1036,6 +1050,7 @@ module GraphQL
|
|
1036
1050
|
{
|
1037
1051
|
backtrace: ctx[:backtrace],
|
1038
1052
|
tracers: ctx[:tracers],
|
1053
|
+
trace: ctx[:trace],
|
1039
1054
|
dataloader: ctx[:dataloader],
|
1040
1055
|
}
|
1041
1056
|
else
|
@@ -4,7 +4,7 @@ module GraphQL
|
|
4
4
|
# This trace class calls legacy-style tracer with payload hashes.
|
5
5
|
# New-style `trace_with` modules significantly reduce the overhead of tracing,
|
6
6
|
# but that advantage is lost when legacy-style tracers are also used (since the payload hashes are still constructed).
|
7
|
-
|
7
|
+
module CallLegacyTracers
|
8
8
|
def lex(query_string:)
|
9
9
|
(@multiplex || @query).trace("lex", { query_string: query_string }) { super }
|
10
10
|
end
|
@@ -61,5 +61,9 @@ module GraphQL
|
|
61
61
|
query.trace("resolve_type_lazy", { context: query.context, type: type, object: object, path: query.context[:current_path] }) { super }
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
class LegacyTrace < Trace
|
66
|
+
include CallLegacyTracers
|
67
|
+
end
|
64
68
|
end
|
65
69
|
end
|
data/lib/graphql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -395,6 +395,7 @@ files:
|
|
395
395
|
- lib/graphql/runtime_type_error.rb
|
396
396
|
- lib/graphql/schema.rb
|
397
397
|
- lib/graphql/schema/addition.rb
|
398
|
+
- lib/graphql/schema/always_visible.rb
|
398
399
|
- lib/graphql/schema/argument.rb
|
399
400
|
- lib/graphql/schema/base_64_bp.rb
|
400
401
|
- lib/graphql/schema/base_64_encoder.rb
|