graphql 2.0.19 → 2.0.20
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/execution/interpreter/runtime.rb +7 -11
- data/lib/graphql/language/nodes.rb +24 -6
- data/lib/graphql/language/parser.rb +1 -1
- data/lib/graphql/language/parser.y +1 -1
- data/lib/graphql/schema/field.rb +2 -0
- data/lib/graphql/schema/member/base_dsl_methods.rb +13 -11
- data/lib/graphql/schema/member/has_ast_node.rb +12 -0
- data/lib/graphql/schema/member/has_directives.rb +11 -4
- data/lib/graphql/schema/member/has_fields.rb +1 -0
- 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.rb +1 -5
- data/lib/graphql/tracing/appsignal_trace.rb +7 -2
- 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 +7 -7
- metadata +2 -4
- data/lib/graphql/language/lexer.ri +0 -744
- data/lib/graphql/types/relay/default_relay.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b2e44f17a5ec90e92b165e06f843931585a3775096c7404966a51703a65fdb9
|
4
|
+
data.tar.gz: b79ce54109470f38f6cd50cd8ff79af7beaefbea4564ec7e876c3a58ffd0249f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59c16753d159b0d25862dfa72e84a72037e19da288db049297d90ede697d4b4eb0456b5bd9b65b7517ef1f375a94c9d0d3cb246a34f5b6100fc347665f94f688
|
7
|
+
data.tar.gz: 96fb931b54905ee12fd04ac76847e7f20c69f66023b6241e39e69b6de862b7cb8b7ff2dc4db53725e11b0625c55c2c73fbe070a4278ce6eb839a99c2847ac306
|
@@ -599,16 +599,6 @@ module GraphQL
|
|
599
599
|
path
|
600
600
|
end
|
601
601
|
|
602
|
-
def current_depth
|
603
|
-
ti = thread_info
|
604
|
-
depth = 1
|
605
|
-
result = ti[:current_result]
|
606
|
-
while (result = result.graphql_parent)
|
607
|
-
depth += 1
|
608
|
-
end
|
609
|
-
depth
|
610
|
-
end
|
611
|
-
|
612
602
|
HALT = Object.new
|
613
603
|
def continue_value(value, parent_type, field, is_non_null, ast_node, result_name, selection_result) # rubocop:disable Metrics/ParameterLists
|
614
604
|
case value
|
@@ -925,8 +915,9 @@ module GraphQL
|
|
925
915
|
# @return [GraphQL::Execution::Lazy, Object] If loading `object` will be deferred, it's a wrapper over it.
|
926
916
|
def after_lazy(lazy_obj, owner:, field:, owner_object:, arguments:, ast_node:, result:, result_name:, eager: false, trace: true, &block)
|
927
917
|
if lazy?(lazy_obj)
|
918
|
+
orig_result = result
|
928
919
|
lazy = GraphQL::Execution::Lazy.new(field: field) do
|
929
|
-
set_all_interpreter_context(owner_object, field, arguments, result_name,
|
920
|
+
set_all_interpreter_context(owner_object, field, arguments, result_name, orig_result)
|
930
921
|
# Wrap the execution of _this_ method with tracing,
|
931
922
|
# but don't wrap the continuation below
|
932
923
|
inner_obj = begin
|
@@ -953,6 +944,11 @@ module GraphQL
|
|
953
944
|
lazy.value
|
954
945
|
else
|
955
946
|
set_result(result, result_name, lazy)
|
947
|
+
current_depth = 0
|
948
|
+
while result
|
949
|
+
current_depth += 1
|
950
|
+
result = result.graphql_parent
|
951
|
+
end
|
956
952
|
@lazies_at_depth[current_depth] << lazy
|
957
953
|
lazy
|
958
954
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
module GraphQL
|
3
3
|
module Language
|
4
4
|
module Nodes
|
5
|
+
NONE = [].freeze
|
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)
|
@@ -30,6 +32,9 @@ module GraphQL
|
|
30
32
|
position_source = options.delete(:position_source)
|
31
33
|
@line = position_source[1]
|
32
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)
|
@@ -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
|
|
@@ -28,7 +28,7 @@ def parse_document
|
|
28
28
|
@document ||= begin
|
29
29
|
# Break the string into tokens
|
30
30
|
@trace.lex(query_string: @query_string) do
|
31
|
-
@tokens ||= GraphQL.
|
31
|
+
@tokens ||= GraphQL::Language::Lexer.tokenize(@query_string)
|
32
32
|
end
|
33
33
|
# From the tokens, build an AST
|
34
34
|
@trace.parse(query_string: @query_string) do
|
@@ -460,7 +460,7 @@ def parse_document
|
|
460
460
|
@document ||= begin
|
461
461
|
# Break the string into tokens
|
462
462
|
@trace.lex(query_string: @query_string) do
|
463
|
-
@tokens ||= GraphQL.
|
463
|
+
@tokens ||= GraphQL::Language::Lexer.tokenize(@query_string)
|
464
464
|
end
|
465
465
|
# From the tokens, build an AST
|
466
466
|
@trace.parse(query_string: @query_string) do
|
data/lib/graphql/schema/field.rb
CHANGED
@@ -46,7 +46,7 @@ module GraphQL
|
|
46
46
|
elsif defined?(@description)
|
47
47
|
@description
|
48
48
|
else
|
49
|
-
nil
|
49
|
+
@description = nil
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -56,8 +56,12 @@ module GraphQL
|
|
56
56
|
def inherited(child_class)
|
57
57
|
child_class.introspection(introspection)
|
58
58
|
child_class.description(description)
|
59
|
-
|
59
|
+
child_class.default_graphql_name = nil
|
60
|
+
|
61
|
+
if defined?(@graphql_name) && @graphql_name && (self.name.nil? || graphql_name != default_graphql_name)
|
60
62
|
child_class.graphql_name(graphql_name)
|
63
|
+
else
|
64
|
+
child_class.graphql_name = nil
|
61
65
|
end
|
62
66
|
super
|
63
67
|
end
|
@@ -98,7 +102,8 @@ module GraphQL
|
|
98
102
|
def default_graphql_name
|
99
103
|
@default_graphql_name ||= begin
|
100
104
|
raise GraphQL::RequiredImplementationMissingError, 'Anonymous class should declare a `graphql_name`' if name.nil?
|
101
|
-
-name.split("::").last.sub(/Type\Z/, "")
|
105
|
+
-name.split("::").last.sub(/Type\Z/, "")
|
106
|
+
end
|
102
107
|
end
|
103
108
|
|
104
109
|
def visible?(context)
|
@@ -109,16 +114,13 @@ module GraphQL
|
|
109
114
|
true
|
110
115
|
end
|
111
116
|
|
112
|
-
|
113
|
-
|
114
|
-
|
117
|
+
def default_relay
|
118
|
+
false
|
119
|
+
end
|
115
120
|
|
116
|
-
|
121
|
+
protected
|
117
122
|
|
118
|
-
|
119
|
-
super
|
120
|
-
subclass.default_graphql_name = nil
|
121
|
-
end
|
123
|
+
attr_writer :default_graphql_name, :graphql_name
|
122
124
|
end
|
123
125
|
end
|
124
126
|
end
|
@@ -3,6 +3,16 @@ module GraphQL
|
|
3
3
|
class Schema
|
4
4
|
class Member
|
5
5
|
module HasAstNode
|
6
|
+
def self.extended(child_cls)
|
7
|
+
super
|
8
|
+
child_cls.ast_node = nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def inherited(child_cls)
|
12
|
+
super
|
13
|
+
child_cls.ast_node = nil
|
14
|
+
end
|
15
|
+
|
6
16
|
# If this schema was parsed from a `.graphql` file (or other SDL),
|
7
17
|
# this is the AST node that defined this part of the schema.
|
8
18
|
def ast_node(new_ast_node = nil)
|
@@ -14,6 +24,8 @@ module GraphQL
|
|
14
24
|
nil
|
15
25
|
end
|
16
26
|
end
|
27
|
+
|
28
|
+
attr_writer :ast_node
|
17
29
|
end
|
18
30
|
end
|
19
31
|
end
|
@@ -4,6 +4,16 @@ module GraphQL
|
|
4
4
|
class Schema
|
5
5
|
class Member
|
6
6
|
module HasDirectives
|
7
|
+
def self.extended(child_cls)
|
8
|
+
super
|
9
|
+
child_cls.module_eval { self.own_directives = nil }
|
10
|
+
end
|
11
|
+
|
12
|
+
def inherited(child_cls)
|
13
|
+
super
|
14
|
+
child_cls.own_directives = nil
|
15
|
+
end
|
16
|
+
|
7
17
|
# Create an instance of `dir_class` for `self`, using `options`.
|
8
18
|
#
|
9
19
|
# It removes a previously-attached instance of `dir_class`, if there is one.
|
@@ -101,12 +111,9 @@ module GraphQL
|
|
101
111
|
end
|
102
112
|
end
|
103
113
|
|
104
|
-
|
105
114
|
protected
|
106
115
|
|
107
|
-
|
108
|
-
@own_directives
|
109
|
-
end
|
116
|
+
attr_accessor :own_directives
|
110
117
|
end
|
111
118
|
end
|
112
119
|
end
|
@@ -6,6 +6,7 @@ module GraphQL
|
|
6
6
|
module RelayShortcuts
|
7
7
|
def edge_type_class(new_edge_type_class = nil)
|
8
8
|
if new_edge_type_class
|
9
|
+
initialize_relay_metadata
|
9
10
|
@edge_type_class = new_edge_type_class
|
10
11
|
else
|
11
12
|
# Don't call `ancestor.edge_type_class`
|
@@ -22,6 +23,7 @@ module GraphQL
|
|
22
23
|
|
23
24
|
def connection_type_class(new_connection_type_class = nil)
|
24
25
|
if new_connection_type_class
|
26
|
+
initialize_relay_metadata
|
25
27
|
@connection_type_class = new_connection_type_class
|
26
28
|
else
|
27
29
|
# Don't call `ancestor.connection_type_class`
|
@@ -37,6 +39,7 @@ module GraphQL
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def edge_type
|
42
|
+
initialize_relay_metadata
|
40
43
|
@edge_type ||= begin
|
41
44
|
edge_name = self.graphql_name + "Edge"
|
42
45
|
node_type_class = self
|
@@ -48,6 +51,7 @@ module GraphQL
|
|
48
51
|
end
|
49
52
|
|
50
53
|
def connection_type
|
54
|
+
initialize_relay_metadata
|
51
55
|
@connection_type ||= begin
|
52
56
|
conn_name = self.graphql_name + "Connection"
|
53
57
|
edge_type_class = self.edge_type
|
@@ -67,6 +71,21 @@ module GraphQL
|
|
67
71
|
def configured_edge_type_class
|
68
72
|
@edge_type_class
|
69
73
|
end
|
74
|
+
|
75
|
+
attr_writer :edge_type, :connection_type, :connection_type_class, :edge_type_class
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
# If one of thse values is accessed, initialize all the instance variables to retain
|
80
|
+
# a consistent object shape.
|
81
|
+
def initialize_relay_metadata
|
82
|
+
if !defined?(@connection_type)
|
83
|
+
@connection_type = nil
|
84
|
+
@edge_type = nil
|
85
|
+
@connection_type_class = nil
|
86
|
+
@edge_type_class = nil
|
87
|
+
end
|
88
|
+
end
|
70
89
|
end
|
71
90
|
end
|
72
91
|
end
|
data/lib/graphql/schema.rb
CHANGED
@@ -799,11 +799,7 @@ module GraphQL
|
|
799
799
|
end
|
800
800
|
|
801
801
|
if resolved_type.nil? || (resolved_type.is_a?(Module) && resolved_type.respond_to?(:kind))
|
802
|
-
|
803
|
-
[resolved_type, resolved_value]
|
804
|
-
else
|
805
|
-
resolved_type
|
806
|
-
end
|
802
|
+
[resolved_type, resolved_value]
|
807
803
|
else
|
808
804
|
raise ".resolve_type should return a type definition, but got #{resolved_type.inspect} (#{resolved_type.class}) from `resolve_type(#{type}, #{obj}, #{ctx})`"
|
809
805
|
end
|
@@ -5,7 +5,6 @@ module GraphQL
|
|
5
5
|
module AppsignalTrace
|
6
6
|
include PlatformTrace
|
7
7
|
|
8
|
-
|
9
8
|
# @param set_action_name [Boolean] If true, the GraphQL operation name will be used as the transaction name.
|
10
9
|
# This is not advised if you run more than one query per HTTP request, for example, with `graphql-client` or multiplexing.
|
11
10
|
# It can also be specified per-query with `context[:set_appsignal_action_name]`.
|
@@ -46,7 +45,13 @@ module GraphQL
|
|
46
45
|
|
47
46
|
def platform_execute_field(platform_key)
|
48
47
|
Appsignal.instrument(platform_key) do
|
49
|
-
|
48
|
+
yield
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def platform_authorized(platform_key)
|
53
|
+
Appsignal.instrument(platform_key) do
|
54
|
+
yield
|
50
55
|
end
|
51
56
|
end
|
52
57
|
|
@@ -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
|
|
@@ -124,6 +142,10 @@ module GraphQL
|
|
124
142
|
end
|
125
143
|
end
|
126
144
|
|
145
|
+
protected
|
146
|
+
|
147
|
+
attr_writer :edge_type, :node_type, :edge_class
|
148
|
+
|
127
149
|
private
|
128
150
|
|
129
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
|
@@ -49,11 +59,15 @@ module GraphQL
|
|
49
59
|
# Use `node_nullable(false)` in your base class to make non-null `node` field.
|
50
60
|
def node_nullable(new_value = nil)
|
51
61
|
if new_value.nil?
|
52
|
-
|
62
|
+
@node_nullable != nil ? @node_nullable : superclass.node_nullable
|
53
63
|
else
|
54
64
|
@node_nullable = new_value
|
55
65
|
end
|
56
66
|
end
|
67
|
+
|
68
|
+
protected
|
69
|
+
|
70
|
+
attr_writer :node_type, :node_nullable
|
57
71
|
end
|
58
72
|
end
|
59
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/version.rb
CHANGED
data/lib/graphql.rb
CHANGED
@@ -43,7 +43,7 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
43
43
|
# @param graphql_string [String] a GraphQL query string or schema definition
|
44
44
|
# @return [GraphQL::Language::Nodes::Document]
|
45
45
|
def self.parse(graphql_string, trace: GraphQL::Tracing::NullTrace)
|
46
|
-
|
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,16 +51,16 @@ 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
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.parse_with_racc(string, filename: nil, trace: GraphQL::Tracing::NullTrace)
|
58
|
-
GraphQL::Language::Parser.parse(string, filename: filename, trace: trace)
|
54
|
+
default_parser.parse(content, filename: filename)
|
59
55
|
end
|
60
56
|
|
61
57
|
# @return [Array<Array>]
|
62
58
|
def self.scan(graphql_string)
|
63
|
-
|
59
|
+
default_parser.scan(graphql_string)
|
60
|
+
end
|
61
|
+
|
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
66
|
def self.scan_with_ruby(graphql_string)
|
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.20
|
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-03-
|
11
|
+
date: 2023-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -355,7 +355,6 @@ files:
|
|
355
355
|
- lib/graphql/language/document_from_schema_definition.rb
|
356
356
|
- lib/graphql/language/generation.rb
|
357
357
|
- lib/graphql/language/lexer.rb
|
358
|
-
- lib/graphql/language/lexer.ri
|
359
358
|
- lib/graphql/language/nodes.rb
|
360
359
|
- lib/graphql/language/parser.rb
|
361
360
|
- lib/graphql/language/parser.y
|
@@ -583,7 +582,6 @@ files:
|
|
583
582
|
- lib/graphql/types/relay/base_connection.rb
|
584
583
|
- lib/graphql/types/relay/base_edge.rb
|
585
584
|
- lib/graphql/types/relay/connection_behaviors.rb
|
586
|
-
- lib/graphql/types/relay/default_relay.rb
|
587
585
|
- lib/graphql/types/relay/edge_behaviors.rb
|
588
586
|
- lib/graphql/types/relay/has_node_field.rb
|
589
587
|
- lib/graphql/types/relay/has_nodes_field.rb
|