graphql 2.0.16 → 2.0.21
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/analysis/ast/visitor.rb +42 -35
- 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 +264 -211
- data/lib/graphql/execution/interpreter.rb +15 -10
- data/lib/graphql/execution/lazy.rb +6 -12
- data/lib/graphql/execution/multiplex.rb +2 -1
- data/lib/graphql/filter.rb +7 -2
- data/lib/graphql/introspection/directive_type.rb +2 -2
- data/lib/graphql/introspection/field_type.rb +1 -1
- data/lib/graphql/introspection/schema_type.rb +2 -2
- data/lib/graphql/introspection/type_type.rb +5 -5
- 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 +66 -40
- data/lib/graphql/language/parser.rb +509 -491
- data/lib/graphql/language/parser.y +43 -38
- data/lib/graphql/language/visitor.rb +191 -83
- 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 -13
- data/lib/graphql/schema/build_from_definition.rb +15 -3
- data/lib/graphql/schema/directive.rb +12 -2
- data/lib/graphql/schema/enum.rb +24 -17
- data/lib/graphql/schema/enum_value.rb +2 -3
- data/lib/graphql/schema/field.rb +68 -57
- data/lib/graphql/schema/field_extension.rb +1 -4
- data/lib/graphql/schema/find_inherited_value.rb +2 -7
- data/lib/graphql/schema/interface.rb +0 -10
- data/lib/graphql/schema/late_bound_type.rb +2 -0
- data/lib/graphql/schema/member/base_dsl_methods.rb +17 -14
- data/lib/graphql/schema/member/has_arguments.rb +105 -58
- 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 +95 -38
- data/lib/graphql/schema/member/has_interfaces.rb +49 -8
- data/lib/graphql/schema/member/has_validators.rb +32 -6
- data/lib/graphql/schema/member/relay_shortcuts.rb +19 -0
- data/lib/graphql/schema/member/type_system_helpers.rb +17 -0
- 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 +29 -5
- data/lib/graphql/schema.rb +76 -25
- data/lib/graphql/static_validation/literal_validator.rb +15 -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/subscriptions/event.rb +2 -7
- 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 -6
- data/lib/graphql/types/relay/edge_behaviors.rb +16 -6
- 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/types/string.rb +1 -1
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +16 -9
- metadata +34 -9
- data/lib/graphql/language/lexer.rl +0 -280
- data/lib/graphql/types/relay/default_relay.rb +0 -27
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GraphQL
|
4
|
+
module Tracing
|
5
|
+
module StatsdTrace
|
6
|
+
include PlatformTrace
|
7
|
+
|
8
|
+
# @param statsd [Object] A statsd client
|
9
|
+
def initialize(statsd:, **rest)
|
10
|
+
@statsd = statsd
|
11
|
+
super(**rest)
|
12
|
+
end
|
13
|
+
|
14
|
+
{
|
15
|
+
'lex' => "graphql.lex",
|
16
|
+
'parse' => "graphql.parse",
|
17
|
+
'validate' => "graphql.validate",
|
18
|
+
'analyze_query' => "graphql.analyze_query",
|
19
|
+
'analyze_multiplex' => "graphql.analyze_multiplex",
|
20
|
+
'execute_multiplex' => "graphql.execute_multiplex",
|
21
|
+
'execute_query' => "graphql.execute_query",
|
22
|
+
'execute_query_lazy' => "graphql.execute_query_lazy",
|
23
|
+
}.each do |trace_method, platform_key|
|
24
|
+
module_eval <<-RUBY, __FILE__, __LINE__
|
25
|
+
def #{trace_method}(**data)
|
26
|
+
@statsd.time("#{platform_key}") do
|
27
|
+
super
|
28
|
+
end
|
29
|
+
end
|
30
|
+
RUBY
|
31
|
+
end
|
32
|
+
|
33
|
+
def platform_execute_field(platform_key, &block)
|
34
|
+
@statsd.time(platform_key, &block)
|
35
|
+
end
|
36
|
+
|
37
|
+
def platform_authorized(key, &block)
|
38
|
+
@statsd.time(key, &block)
|
39
|
+
end
|
40
|
+
|
41
|
+
alias :platform_resolve_type :platform_authorized
|
42
|
+
|
43
|
+
def platform_field_key(field)
|
44
|
+
"graphql.#{field.path}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def platform_authorized_key(type)
|
48
|
+
"graphql.authorized.#{type.graphql_name}"
|
49
|
+
end
|
50
|
+
|
51
|
+
def platform_resolve_type_key(type)
|
52
|
+
"graphql.resolve_type.#{type.graphql_name}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module GraphQL
|
3
|
+
module Tracing
|
4
|
+
# This is the base class for a `trace` instance whose methods are called during query execution.
|
5
|
+
# "Trace modes" are subclasses of this with custom tracing modules mixed in.
|
6
|
+
#
|
7
|
+
# A trace module may implement any of the methods on `Trace`, being sure to call `super`
|
8
|
+
# to continue any tracing hooks and call the actual runtime behavior. See {GraphQL::Backtrace::Trace} for example.
|
9
|
+
#
|
10
|
+
class Trace
|
11
|
+
# @param multiplex [GraphQL::Execution::Multiplex, nil]
|
12
|
+
# @param query [GraphQL::Query, nil]
|
13
|
+
def initialize(multiplex: nil, query: nil, **_options)
|
14
|
+
@multiplex = multiplex
|
15
|
+
@query = query
|
16
|
+
end
|
17
|
+
|
18
|
+
def lex(query_string:)
|
19
|
+
yield
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse(query_string:)
|
23
|
+
yield
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate(query:, validate:)
|
27
|
+
yield
|
28
|
+
end
|
29
|
+
|
30
|
+
def analyze_multiplex(multiplex:)
|
31
|
+
yield
|
32
|
+
end
|
33
|
+
|
34
|
+
def analyze_query(query:)
|
35
|
+
yield
|
36
|
+
end
|
37
|
+
|
38
|
+
def execute_multiplex(multiplex:)
|
39
|
+
yield
|
40
|
+
end
|
41
|
+
|
42
|
+
def execute_query(query:)
|
43
|
+
yield
|
44
|
+
end
|
45
|
+
|
46
|
+
def execute_query_lazy(query:, multiplex:)
|
47
|
+
yield
|
48
|
+
end
|
49
|
+
|
50
|
+
def execute_field(field:, query:, ast_node:, arguments:, object:)
|
51
|
+
yield
|
52
|
+
end
|
53
|
+
|
54
|
+
def execute_field_lazy(field:, query:, ast_node:, arguments:, object:)
|
55
|
+
yield
|
56
|
+
end
|
57
|
+
|
58
|
+
def authorized(query:, type:, object:)
|
59
|
+
yield
|
60
|
+
end
|
61
|
+
|
62
|
+
def authorized_lazy(query:, type:, object:)
|
63
|
+
yield
|
64
|
+
end
|
65
|
+
|
66
|
+
def resolve_type(query:, type:, object:)
|
67
|
+
yield
|
68
|
+
end
|
69
|
+
|
70
|
+
def resolve_type_lazy(query:, type:, object:)
|
71
|
+
yield
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/lib/graphql/tracing.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require "graphql/tracing/trace"
|
3
|
+
require "graphql/tracing/legacy_trace"
|
4
|
+
|
5
|
+
# Legacy tracing:
|
2
6
|
require "graphql/tracing/active_support_notifications_tracing"
|
3
7
|
require "graphql/tracing/platform_tracing"
|
4
8
|
require "graphql/tracing/appoptics_tracing"
|
@@ -9,51 +13,24 @@ require "graphql/tracing/scout_tracing"
|
|
9
13
|
require "graphql/tracing/statsd_tracing"
|
10
14
|
require "graphql/tracing/prometheus_tracing"
|
11
15
|
|
16
|
+
# New Tracing:
|
17
|
+
require "graphql/tracing/platform_trace"
|
18
|
+
require "graphql/tracing/appoptics_trace"
|
19
|
+
require "graphql/tracing/appsignal_trace"
|
20
|
+
require "graphql/tracing/data_dog_trace"
|
21
|
+
require "graphql/tracing/new_relic_trace"
|
22
|
+
require "graphql/tracing/notifications_trace"
|
23
|
+
require "graphql/tracing/scout_trace"
|
24
|
+
require "graphql/tracing/statsd_trace"
|
25
|
+
require "graphql/tracing/prometheus_trace"
|
12
26
|
if defined?(PrometheusExporter::Server)
|
13
27
|
require "graphql/tracing/prometheus_tracing/graphql_collector"
|
14
28
|
end
|
15
29
|
|
16
30
|
module GraphQL
|
17
|
-
# Library entry point for performance metric reporting.
|
18
|
-
#
|
19
|
-
# @example Sending custom events
|
20
|
-
# query.trace("my_custom_event", { ... }) do
|
21
|
-
# # do stuff ...
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# @example Adding a tracer to a schema
|
25
|
-
# class MySchema < GraphQL::Schema
|
26
|
-
# tracer MyTracer # <= responds to .trace(key, data, &block)
|
27
|
-
# end
|
28
|
-
#
|
29
|
-
# @example Adding a tracer to a single query
|
30
|
-
# MySchema.execute(query_str, context: { backtrace: true })
|
31
|
-
#
|
32
|
-
# Events:
|
33
|
-
#
|
34
|
-
# Key | Metadata
|
35
|
-
# ----|---------
|
36
|
-
# lex | `{ query_string: String }`
|
37
|
-
# parse | `{ query_string: String }`
|
38
|
-
# validate | `{ query: GraphQL::Query, validate: Boolean }`
|
39
|
-
# analyze_multiplex | `{ multiplex: GraphQL::Execution::Multiplex }`
|
40
|
-
# analyze_query | `{ query: GraphQL::Query }`
|
41
|
-
# execute_multiplex | `{ multiplex: GraphQL::Execution::Multiplex }`
|
42
|
-
# execute_query | `{ query: GraphQL::Query }`
|
43
|
-
# execute_query_lazy | `{ query: GraphQL::Query?, multiplex: GraphQL::Execution::Multiplex? }`
|
44
|
-
# execute_field | `{ owner: Class, field: GraphQL::Schema::Field, query: GraphQL::Query, path: Array<String, Integer>, ast_node: GraphQL::Language::Nodes::Field}`
|
45
|
-
# execute_field_lazy | `{ owner: Class, field: GraphQL::Schema::Field, query: GraphQL::Query, path: Array<String, Integer>, ast_node: GraphQL::Language::Nodes::Field}`
|
46
|
-
# authorized | `{ context: GraphQL::Query::Context, type: Class, object: Object, path: Array<String, Integer> }`
|
47
|
-
# authorized_lazy | `{ context: GraphQL::Query::Context, type: Class, object: Object, path: Array<String, Integer> }`
|
48
|
-
# resolve_type | `{ context: GraphQL::Query::Context, type: Class, object: Object, path: Array<String, Integer> }`
|
49
|
-
# resolve_type_lazy | `{ context: GraphQL::Query::Context, type: Class, object: Object, path: Array<String, Integer> }`
|
50
|
-
#
|
51
|
-
# Note that `execute_field` and `execute_field_lazy` receive different data in different settings:
|
52
|
-
#
|
53
|
-
# - When using {GraphQL::Execution::Interpreter}, they receive `{field:, path:, query:}`
|
54
|
-
# - Otherwise, they receive `{context: ...}`
|
55
|
-
#
|
56
31
|
module Tracing
|
32
|
+
NullTrace = Trace.new
|
33
|
+
|
57
34
|
# Objects may include traceable to gain a `.trace(...)` method.
|
58
35
|
# The object must have a `@tracers` ivar of type `Array<<#trace(k, d, &b)>>`.
|
59
36
|
# @api private
|
data/lib/graphql/type_kinds.rb
CHANGED
@@ -5,12 +5,13 @@ module GraphQL
|
|
5
5
|
# These objects are singletons, eg `GraphQL::TypeKinds::UNION`, `GraphQL::TypeKinds::SCALAR`.
|
6
6
|
class TypeKind
|
7
7
|
attr_reader :name, :description
|
8
|
-
def initialize(name, abstract: false, fields: false, wraps: false, input: false, description: nil)
|
8
|
+
def initialize(name, abstract: false, leaf: false, fields: false, wraps: false, input: false, description: nil)
|
9
9
|
@name = name
|
10
10
|
@abstract = abstract
|
11
11
|
@fields = fields
|
12
12
|
@wraps = wraps
|
13
13
|
@input = input
|
14
|
+
@leaf = leaf
|
14
15
|
@composite = fields? || abstract?
|
15
16
|
@description = description
|
16
17
|
end
|
@@ -27,6 +28,8 @@ module GraphQL
|
|
27
28
|
# Is this TypeKind a valid query input?
|
28
29
|
def input?; @input; end
|
29
30
|
def to_s; @name; end
|
31
|
+
# Is this TypeKind a primitive value?
|
32
|
+
def leaf?; @leaf; end
|
30
33
|
# Is this TypeKind composed of many values?
|
31
34
|
def composite?; @composite; end
|
32
35
|
|
@@ -64,11 +67,11 @@ module GraphQL
|
|
64
67
|
end
|
65
68
|
|
66
69
|
TYPE_KINDS = [
|
67
|
-
SCALAR = TypeKind.new("SCALAR", input: true, description: 'Indicates this type is a scalar.'),
|
70
|
+
SCALAR = TypeKind.new("SCALAR", input: true, leaf: true, description: 'Indicates this type is a scalar.'),
|
68
71
|
OBJECT = TypeKind.new("OBJECT", fields: true, description: 'Indicates this type is an object. `fields` and `interfaces` are valid fields.'),
|
69
72
|
INTERFACE = TypeKind.new("INTERFACE", abstract: true, fields: true, description: 'Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.'),
|
70
73
|
UNION = TypeKind.new("UNION", abstract: true, description: 'Indicates this type is a union. `possibleTypes` is a valid field.'),
|
71
|
-
ENUM = TypeKind.new("ENUM", input: true, description: 'Indicates this type is an enum. `enumValues` is a valid field.'),
|
74
|
+
ENUM = TypeKind.new("ENUM", input: true, leaf: true, description: 'Indicates this type is an enum. `enumValues` is a valid field.'),
|
72
75
|
INPUT_OBJECT = TypeKind.new("INPUT_OBJECT", input: true, description: 'Indicates this type is an input object. `inputFields` is a valid field.'),
|
73
76
|
LIST = TypeKind.new("LIST", wraps: true, description: 'Indicates this type is a list. `ofType` is a valid field.'),
|
74
77
|
NON_NULL = TypeKind.new("NON_NULL", wraps: true, description: 'Indicates this type is a non-null. `ofType` is a valid field.'),
|
@@ -35,7 +35,7 @@ module GraphQL
|
|
35
35
|
# # Alternatively, you can call the class methods followed by your edge type
|
36
36
|
# # edges_nullable true
|
37
37
|
# # edge_nullable true
|
38
|
-
# #
|
38
|
+
# # node_nullable true
|
39
39
|
# # has_nodes_field true
|
40
40
|
# # edge_type Types::PostEdge
|
41
41
|
# end
|
@@ -9,16 +9,34 @@ module GraphQL
|
|
9
9
|
|
10
10
|
def self.included(child_class)
|
11
11
|
child_class.extend(ClassMethods)
|
12
|
-
child_class.extend(Relay::DefaultRelay)
|
13
|
-
child_class.default_relay(true)
|
14
12
|
child_class.has_nodes_field(true)
|
15
13
|
child_class.node_nullable(true)
|
16
14
|
child_class.edges_nullable(true)
|
17
15
|
child_class.edge_nullable(true)
|
16
|
+
child_class.module_eval {
|
17
|
+
self.edge_type = nil
|
18
|
+
self.node_type = nil
|
19
|
+
self.edge_class = nil
|
20
|
+
}
|
18
21
|
add_page_info_field(child_class)
|
19
22
|
end
|
20
23
|
|
21
24
|
module ClassMethods
|
25
|
+
def inherited(child_class)
|
26
|
+
super
|
27
|
+
child_class.has_nodes_field(has_nodes_field)
|
28
|
+
child_class.node_nullable(node_nullable)
|
29
|
+
child_class.edges_nullable(edges_nullable)
|
30
|
+
child_class.edge_nullable(edge_nullable)
|
31
|
+
child_class.edge_type = nil
|
32
|
+
child_class.node_type = nil
|
33
|
+
child_class.edge_class = nil
|
34
|
+
end
|
35
|
+
|
36
|
+
def default_relay?
|
37
|
+
true
|
38
|
+
end
|
39
|
+
|
22
40
|
# @return [Class]
|
23
41
|
attr_reader :node_type
|
24
42
|
|
@@ -79,10 +97,6 @@ module GraphQL
|
|
79
97
|
true # Let nodes be filtered out
|
80
98
|
end
|
81
99
|
|
82
|
-
def accessible?(ctx)
|
83
|
-
node_type.accessible?(ctx)
|
84
|
-
end
|
85
|
-
|
86
100
|
def visible?(ctx)
|
87
101
|
# if this is an abstract base class, there may be no `node_type`
|
88
102
|
node_type ? node_type.visible?(ctx) : super
|
@@ -128,6 +142,10 @@ module GraphQL
|
|
128
142
|
end
|
129
143
|
end
|
130
144
|
|
145
|
+
protected
|
146
|
+
|
147
|
+
attr_writer :edge_type, :node_type, :edge_class
|
148
|
+
|
131
149
|
private
|
132
150
|
|
133
151
|
def define_nodes_field(nullable, field_options: nil)
|
@@ -8,11 +8,21 @@ 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.
|
11
|
+
child_class.class_eval { self.node_type = nil }
|
12
12
|
child_class.node_nullable(true)
|
13
13
|
end
|
14
14
|
|
15
15
|
module ClassMethods
|
16
|
+
def inherited(child_class)
|
17
|
+
super
|
18
|
+
child_class.node_type = nil
|
19
|
+
child_class.node_nullable = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def default_relay?
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
16
26
|
# Get or set the Object type that this edge wraps.
|
17
27
|
#
|
18
28
|
# @param node_type [Class] A `Schema::Object` subclass
|
@@ -41,10 +51,6 @@ module GraphQL
|
|
41
51
|
true
|
42
52
|
end
|
43
53
|
|
44
|
-
def accessible?(ctx)
|
45
|
-
node_type.accessible?(ctx)
|
46
|
-
end
|
47
|
-
|
48
54
|
def visible?(ctx)
|
49
55
|
node_type.visible?(ctx)
|
50
56
|
end
|
@@ -53,11 +59,15 @@ module GraphQL
|
|
53
59
|
# Use `node_nullable(false)` in your base class to make non-null `node` field.
|
54
60
|
def node_nullable(new_value = nil)
|
55
61
|
if new_value.nil?
|
56
|
-
|
62
|
+
@node_nullable != nil ? @node_nullable : superclass.node_nullable
|
57
63
|
else
|
58
64
|
@node_nullable = new_value
|
59
65
|
end
|
60
66
|
end
|
67
|
+
|
68
|
+
protected
|
69
|
+
|
70
|
+
attr_writer :node_type, :node_nullable
|
61
71
|
end
|
62
72
|
end
|
63
73
|
end
|
@@ -5,7 +5,7 @@ module GraphQL
|
|
5
5
|
module Relay
|
6
6
|
module NodeBehaviors
|
7
7
|
def self.included(child_module)
|
8
|
-
child_module.extend(
|
8
|
+
child_module.extend(ClassMethods)
|
9
9
|
child_module.description("An object with an ID.")
|
10
10
|
child_module.field(:id, ID, null: false, description: "ID of the object.", resolver_method: :default_global_id)
|
11
11
|
end
|
@@ -13,6 +13,12 @@ module GraphQL
|
|
13
13
|
def default_global_id
|
14
14
|
context.schema.id_from_object(object, self.class, context)
|
15
15
|
end
|
16
|
+
|
17
|
+
module ClassMethods
|
18
|
+
def default_relay?
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
16
22
|
end
|
17
23
|
end
|
18
24
|
end
|
@@ -4,8 +4,7 @@ module GraphQL
|
|
4
4
|
module Relay
|
5
5
|
module PageInfoBehaviors
|
6
6
|
def self.included(child_class)
|
7
|
-
child_class.extend
|
8
|
-
|
7
|
+
child_class.extend ClassMethods
|
9
8
|
child_class.description "Information about pagination in a connection."
|
10
9
|
child_class.field :has_next_page, Boolean, null: false,
|
11
10
|
description: "When paginating forwards, are there more items?"
|
@@ -20,6 +19,12 @@ module GraphQL
|
|
20
19
|
description: "When paginating forwards, the cursor to continue."
|
21
20
|
end
|
22
21
|
end
|
22
|
+
|
23
|
+
module ClassMethods
|
24
|
+
def default_relay?
|
25
|
+
true
|
26
|
+
end
|
27
|
+
end
|
23
28
|
end
|
24
29
|
end
|
25
30
|
end
|
data/lib/graphql/types/relay.rb
CHANGED
data/lib/graphql/types/string.rb
CHANGED
data/lib/graphql/version.rb
CHANGED
data/lib/graphql.rb
CHANGED
@@ -42,8 +42,8 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
42
42
|
# Turn a query string or schema definition into an AST
|
43
43
|
# @param graphql_string [String] a GraphQL query string or schema definition
|
44
44
|
# @return [GraphQL::Language::Nodes::Document]
|
45
|
-
def self.parse(graphql_string,
|
46
|
-
|
45
|
+
def self.parse(graphql_string, trace: GraphQL::Tracing::NullTrace)
|
46
|
+
default_parser.parse(graphql_string, trace: trace)
|
47
47
|
end
|
48
48
|
|
49
49
|
# Read the contents of `filename` and parse them as GraphQL
|
@@ -51,21 +51,28 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
51
51
|
# @return [GraphQL::Language::Nodes::Document]
|
52
52
|
def self.parse_file(filename)
|
53
53
|
content = File.read(filename)
|
54
|
-
|
54
|
+
default_parser.parse(content, filename: filename)
|
55
55
|
end
|
56
56
|
|
57
|
-
|
58
|
-
|
57
|
+
# @return [Array<Array>]
|
58
|
+
def self.scan(graphql_string)
|
59
|
+
default_parser.scan(graphql_string)
|
59
60
|
end
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
scan_with_ragel(graphql_string)
|
62
|
+
def self.parse_with_racc(string, filename: nil, trace: GraphQL::Tracing::NullTrace)
|
63
|
+
GraphQL::Language::Parser.parse(string, filename: filename, trace: trace)
|
64
64
|
end
|
65
65
|
|
66
|
-
def self.
|
66
|
+
def self.scan_with_ruby(graphql_string)
|
67
67
|
GraphQL::Language::Lexer.tokenize(graphql_string)
|
68
68
|
end
|
69
|
+
|
70
|
+
NOT_CONFIGURED = Object.new
|
71
|
+
private_constant :NOT_CONFIGURED
|
72
|
+
module EmptyObjects
|
73
|
+
EMPTY_HASH = {}.freeze
|
74
|
+
EMPTY_ARRAY = [].freeze
|
75
|
+
end
|
69
76
|
end
|
70
77
|
|
71
78
|
# Order matters for these:
|
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.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -112,16 +112,30 @@ dependencies:
|
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake-compiler
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: rubocop
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -289,6 +303,7 @@ files:
|
|
289
303
|
- lib/graphql/backtrace.rb
|
290
304
|
- lib/graphql/backtrace/inspect_result.rb
|
291
305
|
- lib/graphql/backtrace/table.rb
|
306
|
+
- lib/graphql/backtrace/trace.rb
|
292
307
|
- lib/graphql/backtrace/traced_error.rb
|
293
308
|
- lib/graphql/backtrace/tracer.rb
|
294
309
|
- lib/graphql/coercion_error.rb
|
@@ -341,7 +356,6 @@ files:
|
|
341
356
|
- lib/graphql/language/document_from_schema_definition.rb
|
342
357
|
- lib/graphql/language/generation.rb
|
343
358
|
- lib/graphql/language/lexer.rb
|
344
|
-
- lib/graphql/language/lexer.rl
|
345
359
|
- lib/graphql/language/nodes.rb
|
346
360
|
- lib/graphql/language/parser.rb
|
347
361
|
- lib/graphql/language/parser.y
|
@@ -534,17 +548,29 @@ files:
|
|
534
548
|
- lib/graphql/subscriptions/instrumentation.rb
|
535
549
|
- lib/graphql/subscriptions/serialize.rb
|
536
550
|
- lib/graphql/tracing.rb
|
551
|
+
- lib/graphql/tracing/active_support_notifications_trace.rb
|
537
552
|
- lib/graphql/tracing/active_support_notifications_tracing.rb
|
553
|
+
- lib/graphql/tracing/appoptics_trace.rb
|
538
554
|
- lib/graphql/tracing/appoptics_tracing.rb
|
555
|
+
- lib/graphql/tracing/appsignal_trace.rb
|
539
556
|
- lib/graphql/tracing/appsignal_tracing.rb
|
557
|
+
- lib/graphql/tracing/data_dog_trace.rb
|
540
558
|
- lib/graphql/tracing/data_dog_tracing.rb
|
559
|
+
- lib/graphql/tracing/legacy_trace.rb
|
560
|
+
- lib/graphql/tracing/new_relic_trace.rb
|
541
561
|
- lib/graphql/tracing/new_relic_tracing.rb
|
562
|
+
- lib/graphql/tracing/notifications_trace.rb
|
542
563
|
- lib/graphql/tracing/notifications_tracing.rb
|
564
|
+
- lib/graphql/tracing/platform_trace.rb
|
543
565
|
- lib/graphql/tracing/platform_tracing.rb
|
566
|
+
- lib/graphql/tracing/prometheus_trace.rb
|
544
567
|
- lib/graphql/tracing/prometheus_tracing.rb
|
545
568
|
- lib/graphql/tracing/prometheus_tracing/graphql_collector.rb
|
569
|
+
- lib/graphql/tracing/scout_trace.rb
|
546
570
|
- lib/graphql/tracing/scout_tracing.rb
|
571
|
+
- lib/graphql/tracing/statsd_trace.rb
|
547
572
|
- lib/graphql/tracing/statsd_tracing.rb
|
573
|
+
- lib/graphql/tracing/trace.rb
|
548
574
|
- lib/graphql/type_kinds.rb
|
549
575
|
- lib/graphql/types.rb
|
550
576
|
- lib/graphql/types/big_int.rb
|
@@ -559,7 +585,6 @@ files:
|
|
559
585
|
- lib/graphql/types/relay/base_connection.rb
|
560
586
|
- lib/graphql/types/relay/base_edge.rb
|
561
587
|
- lib/graphql/types/relay/connection_behaviors.rb
|
562
|
-
- lib/graphql/types/relay/default_relay.rb
|
563
588
|
- lib/graphql/types/relay/edge_behaviors.rb
|
564
589
|
- lib/graphql/types/relay/has_node_field.rb
|
565
590
|
- lib/graphql/types/relay/has_nodes_field.rb
|
@@ -597,7 +622,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
597
622
|
- !ruby/object:Gem::Version
|
598
623
|
version: '0'
|
599
624
|
requirements: []
|
600
|
-
rubygems_version: 3.
|
625
|
+
rubygems_version: 3.4.1
|
601
626
|
signing_key:
|
602
627
|
specification_version: 4
|
603
628
|
summary: A GraphQL language and runtime for Ruby
|