graphql 2.0.17.2 → 2.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphql/analysis/ast.rb +2 -2
- data/lib/graphql/backtrace/trace.rb +96 -0
- data/lib/graphql/backtrace/tracer.rb +1 -1
- data/lib/graphql/backtrace.rb +6 -1
- data/lib/graphql/execution/interpreter/arguments.rb +1 -1
- data/lib/graphql/execution/interpreter/arguments_cache.rb +2 -3
- data/lib/graphql/execution/interpreter/resolve.rb +19 -0
- data/lib/graphql/execution/interpreter/runtime.rb +254 -211
- data/lib/graphql/execution/interpreter.rb +9 -14
- data/lib/graphql/execution/lazy.rb +2 -4
- data/lib/graphql/execution/multiplex.rb +2 -1
- data/lib/graphql/filter.rb +7 -2
- data/lib/graphql/language/document_from_schema_definition.rb +25 -9
- data/lib/graphql/language/lexer.rb +216 -1505
- data/lib/graphql/language/nodes.rb +27 -9
- data/lib/graphql/language/parser.rb +509 -491
- data/lib/graphql/language/parser.y +43 -38
- data/lib/graphql/pagination/active_record_relation_connection.rb +0 -8
- data/lib/graphql/pagination/connection.rb +5 -5
- data/lib/graphql/query/context.rb +62 -31
- data/lib/graphql/query/null_context.rb +1 -1
- data/lib/graphql/query.rb +22 -5
- data/lib/graphql/schema/argument.rb +7 -9
- data/lib/graphql/schema/build_from_definition.rb +15 -3
- data/lib/graphql/schema/enum_value.rb +2 -5
- data/lib/graphql/schema/field.rb +44 -31
- data/lib/graphql/schema/field_extension.rb +1 -4
- data/lib/graphql/schema/find_inherited_value.rb +2 -7
- data/lib/graphql/schema/member/base_dsl_methods.rb +13 -11
- data/lib/graphql/schema/member/has_arguments.rb +1 -1
- data/lib/graphql/schema/member/has_ast_node.rb +12 -0
- data/lib/graphql/schema/member/has_deprecation_reason.rb +3 -4
- data/lib/graphql/schema/member/has_directives.rb +15 -10
- data/lib/graphql/schema/member/has_fields.rb +87 -37
- data/lib/graphql/schema/member/has_validators.rb +2 -2
- data/lib/graphql/schema/member/relay_shortcuts.rb +19 -0
- data/lib/graphql/schema/member/type_system_helpers.rb +1 -1
- data/lib/graphql/schema/object.rb +2 -4
- data/lib/graphql/schema/resolver/has_payload_type.rb +9 -9
- data/lib/graphql/schema/resolver.rb +4 -4
- data/lib/graphql/schema/timeout.rb +24 -28
- data/lib/graphql/schema/validator.rb +1 -1
- data/lib/graphql/schema/warden.rb +11 -2
- data/lib/graphql/schema.rb +72 -1
- data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +12 -4
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +2 -2
- data/lib/graphql/static_validation/validator.rb +1 -1
- data/lib/graphql/tracing/active_support_notifications_trace.rb +16 -0
- data/lib/graphql/tracing/appoptics_trace.rb +231 -0
- data/lib/graphql/tracing/appsignal_trace.rb +77 -0
- data/lib/graphql/tracing/data_dog_trace.rb +148 -0
- data/lib/graphql/tracing/legacy_trace.rb +65 -0
- data/lib/graphql/tracing/new_relic_trace.rb +75 -0
- data/lib/graphql/tracing/notifications_trace.rb +42 -0
- data/lib/graphql/tracing/platform_trace.rb +109 -0
- data/lib/graphql/tracing/platform_tracing.rb +15 -3
- data/lib/graphql/tracing/prometheus_trace.rb +89 -0
- data/lib/graphql/tracing/prometheus_tracing/graphql_collector.rb +1 -1
- data/lib/graphql/tracing/prometheus_tracing.rb +3 -3
- data/lib/graphql/tracing/scout_trace.rb +72 -0
- data/lib/graphql/tracing/statsd_trace.rb +56 -0
- data/lib/graphql/tracing/trace.rb +75 -0
- data/lib/graphql/tracing.rb +16 -39
- data/lib/graphql/type_kinds.rb +6 -3
- data/lib/graphql/types/relay/base_connection.rb +1 -1
- data/lib/graphql/types/relay/connection_behaviors.rb +24 -2
- data/lib/graphql/types/relay/edge_behaviors.rb +16 -2
- data/lib/graphql/types/relay/node_behaviors.rb +7 -1
- data/lib/graphql/types/relay/page_info_behaviors.rb +7 -2
- data/lib/graphql/types/relay.rb +0 -1
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +16 -9
- metadata +33 -8
- data/lib/graphql/language/lexer.rl +0 -280
- data/lib/graphql/types/relay/default_relay.rb +0 -27
@@ -2,6 +2,7 @@
|
|
2
2
|
module GraphQL
|
3
3
|
module Language
|
4
4
|
module Nodes
|
5
|
+
NONE = GraphQL::EmptyObjects::EMPTY_ARRAY
|
5
6
|
# {AbstractNode} is the base class for all nodes in a GraphQL AST.
|
6
7
|
#
|
7
8
|
# It provides some APIs for working with ASTs:
|
@@ -9,6 +10,7 @@ module GraphQL
|
|
9
10
|
# - `scalars` returns all scalar (Ruby) values attached to this one. Used for comparing nodes.
|
10
11
|
# - `to_query_string` turns an AST node into a GraphQL string
|
11
12
|
class AbstractNode
|
13
|
+
|
12
14
|
module DefinitionNode
|
13
15
|
# This AST node's {#line} returns the first line, which may be the description.
|
14
16
|
# @return [Integer] The first line of the definition (not the description)
|
@@ -28,8 +30,11 @@ module GraphQL
|
|
28
30
|
def initialize(options = {})
|
29
31
|
if options.key?(:position_source)
|
30
32
|
position_source = options.delete(:position_source)
|
31
|
-
@line = position_source
|
32
|
-
@col = position_source
|
33
|
+
@line = position_source[1]
|
34
|
+
@col = position_source[2]
|
35
|
+
else
|
36
|
+
@line = options.delete(:line)
|
37
|
+
@col = options.delete(:col)
|
33
38
|
end
|
34
39
|
|
35
40
|
@filename = options.delete(:filename)
|
@@ -46,7 +51,7 @@ module GraphQL
|
|
46
51
|
other.children == self.children
|
47
52
|
end
|
48
53
|
|
49
|
-
NO_CHILDREN =
|
54
|
+
NO_CHILDREN = GraphQL::EmptyObjects::EMPTY_ARRAY
|
50
55
|
|
51
56
|
# @return [Array<GraphQL::Language::Nodes::AbstractNode>] all nodes in the tree below this one
|
52
57
|
def children
|
@@ -277,10 +282,17 @@ module GraphQL
|
|
277
282
|
assignments = scalar_method_names.map { |m| "@#{m} = #{m}"} +
|
278
283
|
@children_methods.keys.map { |m| "@#{m} = #{m}.freeze" }
|
279
284
|
|
285
|
+
keywords = scalar_method_names.map { |m| "#{m}: #{m}"} +
|
286
|
+
@children_methods.keys.map { |m| "#{m}: #{m}" }
|
287
|
+
|
280
288
|
module_eval <<-RUBY, __FILE__, __LINE__
|
281
289
|
def initialize_node #{arguments.join(", ")}
|
282
290
|
#{assignments.join("\n")}
|
283
291
|
end
|
292
|
+
|
293
|
+
def self.from_a(filename, line, col, #{(scalar_method_names + @children_methods.keys).join(", ")})
|
294
|
+
self.new(filename: filename, line: line, col: col, #{keywords.join(", ")})
|
295
|
+
end
|
284
296
|
RUBY
|
285
297
|
end
|
286
298
|
end
|
@@ -328,8 +340,8 @@ module GraphQL
|
|
328
340
|
attr_reader :description
|
329
341
|
scalar_methods :name, :repeatable
|
330
342
|
children_methods(
|
331
|
-
locations: Nodes::DirectiveLocation,
|
332
343
|
arguments: Nodes::Argument,
|
344
|
+
locations: Nodes::DirectiveLocation,
|
333
345
|
)
|
334
346
|
end
|
335
347
|
|
@@ -343,8 +355,6 @@ module GraphQL
|
|
343
355
|
|
344
356
|
# A single selection in a GraphQL query.
|
345
357
|
class Field < AbstractNode
|
346
|
-
NONE = [].freeze
|
347
|
-
|
348
358
|
scalar_methods :name, :alias
|
349
359
|
children_methods({
|
350
360
|
arguments: GraphQL::Language::Nodes::Argument,
|
@@ -364,6 +374,10 @@ module GraphQL
|
|
364
374
|
@alias = attributes[:alias]
|
365
375
|
end
|
366
376
|
|
377
|
+
def self.from_a(filename, line, col, graphql_alias, name, arguments, directives, selections) # rubocop:disable Metrics/ParameterLists
|
378
|
+
self.new(filename: filename, line: line, col: col, alias: graphql_alias, name: name, arguments: arguments, directives: directives, selections: selections)
|
379
|
+
end
|
380
|
+
|
367
381
|
# Override this because default is `:fields`
|
368
382
|
self.children_method_name = :selections
|
369
383
|
end
|
@@ -382,6 +396,10 @@ module GraphQL
|
|
382
396
|
@selections = selections
|
383
397
|
end
|
384
398
|
|
399
|
+
def self.from_a(filename, line, col, name, type, directives, selections)
|
400
|
+
self.new(filename: filename, line: line, col: col, name: name, type: type, directives: directives, selections: selections)
|
401
|
+
end
|
402
|
+
|
385
403
|
scalar_methods :name, :type
|
386
404
|
children_methods({
|
387
405
|
selections: GraphQL::Language::Nodes::Field,
|
@@ -406,8 +424,8 @@ module GraphQL
|
|
406
424
|
class InlineFragment < AbstractNode
|
407
425
|
scalar_methods :type
|
408
426
|
children_methods({
|
409
|
-
selections: GraphQL::Language::Nodes::Field,
|
410
427
|
directives: GraphQL::Language::Nodes::Directive,
|
428
|
+
selections: GraphQL::Language::Nodes::Field,
|
411
429
|
})
|
412
430
|
|
413
431
|
self.children_method_name = :selections
|
@@ -486,8 +504,8 @@ module GraphQL
|
|
486
504
|
scalar_methods :operation_type, :name
|
487
505
|
children_methods({
|
488
506
|
variables: GraphQL::Language::Nodes::VariableDefinition,
|
489
|
-
selections: GraphQL::Language::Nodes::Field,
|
490
507
|
directives: GraphQL::Language::Nodes::Directive,
|
508
|
+
selections: GraphQL::Language::Nodes::Field,
|
491
509
|
})
|
492
510
|
|
493
511
|
# @!attribute variables
|
@@ -593,8 +611,8 @@ module GraphQL
|
|
593
611
|
attr_reader :description
|
594
612
|
scalar_methods :name, :type
|
595
613
|
children_methods({
|
596
|
-
directives: GraphQL::Language::Nodes::Directive,
|
597
614
|
arguments: GraphQL::Language::Nodes::InputValueDefinition,
|
615
|
+
directives: GraphQL::Language::Nodes::Directive,
|
598
616
|
})
|
599
617
|
self.children_method_name = :fields
|
600
618
|
|