graphql 2.0.32 → 2.1.0
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 +27 -34
- data/lib/graphql/language/document_from_schema_definition.rb +6 -16
- data/lib/graphql/language/nodes.rb +1 -4
- data/lib/graphql/language/printer.rb +233 -145
- data/lib/graphql/language/sanitized_printer.rb +14 -21
- data/lib/graphql/language/visitor.rb +56 -122
- data/lib/graphql/pagination/connection.rb +23 -1
- data/lib/graphql/query.rb +2 -19
- data/lib/graphql/rake_task.rb +3 -12
- data/lib/graphql/schema/argument.rb +5 -3
- data/lib/graphql/schema/build_from_definition.rb +7 -8
- data/lib/graphql/schema/directive.rb +1 -1
- data/lib/graphql/schema/enum_value.rb +1 -1
- data/lib/graphql/schema/field/scope_extension.rb +7 -1
- data/lib/graphql/schema/field.rb +1 -1
- data/lib/graphql/schema/input_object.rb +6 -8
- data/lib/graphql/schema/interface.rb +1 -5
- data/lib/graphql/schema/member/has_directives.rb +1 -1
- data/lib/graphql/schema/member/has_fields.rb +1 -1
- data/lib/graphql/schema/member/has_interfaces.rb +1 -1
- data/lib/graphql/schema/member/scoped.rb +19 -0
- data/lib/graphql/schema/member/type_system_helpers.rb +1 -1
- data/lib/graphql/schema/object.rb +8 -0
- data/lib/graphql/schema/printer.rb +8 -7
- data/lib/graphql/schema/subscription.rb +11 -4
- data/lib/graphql/schema/warden.rb +3 -34
- data/lib/graphql/schema.rb +4 -20
- data/lib/graphql/static_validation/validation_context.rb +0 -3
- data/lib/graphql/static_validation.rb +0 -1
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +2 -1
- data/lib/graphql/subscriptions.rb +11 -6
- data/lib/graphql/tracing/appoptics_trace.rb +0 -4
- data/lib/graphql/tracing/appsignal_trace.rb +0 -4
- data/lib/graphql/tracing/data_dog_trace.rb +34 -25
- data/lib/graphql/tracing/data_dog_tracing.rb +21 -7
- data/lib/graphql/tracing/notifications_trace.rb +0 -4
- data/lib/graphql/tracing/platform_trace.rb +0 -5
- data/lib/graphql/tracing/prometheus_trace.rb +0 -4
- data/lib/graphql/tracing/scout_trace.rb +0 -3
- data/lib/graphql/tracing/statsd_trace.rb +0 -4
- data/lib/graphql/types/relay/connection_behaviors.rb +20 -3
- data/lib/graphql/types/relay/edge_behaviors.rb +8 -1
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +0 -1
- metadata +24 -37
- data/lib/graphql/filter.rb +0 -59
- data/lib/graphql/static_validation/type_stack.rb +0 -216
metadata
CHANGED
@@ -1,28 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Mosolgo
|
8
|
+
autorequire:
|
8
9
|
bindir: bin
|
9
10
|
cert_chain: []
|
10
|
-
date:
|
11
|
+
date: 2023-08-30 00:00:00.000000000 Z
|
11
12
|
dependencies:
|
12
|
-
- !ruby/object:Gem::Dependency
|
13
|
-
name: base64
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
15
|
-
requirements:
|
16
|
-
- - ">="
|
17
|
-
- !ruby/object:Gem::Version
|
18
|
-
version: '0'
|
19
|
-
type: :runtime
|
20
|
-
prerelease: false
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
-
requirements:
|
23
|
-
- - ">="
|
24
|
-
- !ruby/object:Gem::Version
|
25
|
-
version: '0'
|
26
13
|
- !ruby/object:Gem::Dependency
|
27
14
|
name: benchmark-ips
|
28
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,61 +53,61 @@ dependencies:
|
|
66
53
|
- !ruby/object:Gem::Version
|
67
54
|
version: '0'
|
68
55
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
56
|
+
name: minitest
|
70
57
|
requirement: !ruby/object:Gem::Requirement
|
71
58
|
requirements:
|
72
59
|
- - "~>"
|
73
60
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
61
|
+
version: 5.9.0
|
75
62
|
type: :development
|
76
63
|
prerelease: false
|
77
64
|
version_requirements: !ruby/object:Gem::Requirement
|
78
65
|
requirements:
|
79
66
|
- - "~>"
|
80
67
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
68
|
+
version: 5.9.0
|
82
69
|
- !ruby/object:Gem::Dependency
|
83
|
-
name: minitest
|
70
|
+
name: minitest-focus
|
84
71
|
requirement: !ruby/object:Gem::Requirement
|
85
72
|
requirements:
|
86
|
-
- - "
|
73
|
+
- - "~>"
|
87
74
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
75
|
+
version: '1.1'
|
89
76
|
type: :development
|
90
77
|
prerelease: false
|
91
78
|
version_requirements: !ruby/object:Gem::Requirement
|
92
79
|
requirements:
|
93
|
-
- - "
|
80
|
+
- - "~>"
|
94
81
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
82
|
+
version: '1.1'
|
96
83
|
- !ruby/object:Gem::Dependency
|
97
|
-
name: minitest-
|
84
|
+
name: minitest-reporters
|
98
85
|
requirement: !ruby/object:Gem::Requirement
|
99
86
|
requirements:
|
100
|
-
- - "
|
87
|
+
- - "~>"
|
101
88
|
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
89
|
+
version: '1.0'
|
103
90
|
type: :development
|
104
91
|
prerelease: false
|
105
92
|
version_requirements: !ruby/object:Gem::Requirement
|
106
93
|
requirements:
|
107
|
-
- - "
|
94
|
+
- - "~>"
|
108
95
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
96
|
+
version: '1.0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
98
|
+
name: racc
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
100
|
requirements:
|
114
|
-
- - "
|
101
|
+
- - "~>"
|
115
102
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
103
|
+
version: '1.4'
|
117
104
|
type: :development
|
118
105
|
prerelease: false
|
119
106
|
version_requirements: !ruby/object:Gem::Requirement
|
120
107
|
requirements:
|
121
|
-
- - "
|
108
|
+
- - "~>"
|
122
109
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
110
|
+
version: '1.4'
|
124
111
|
- !ruby/object:Gem::Dependency
|
125
112
|
name: rake
|
126
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -344,7 +331,6 @@ files:
|
|
344
331
|
- lib/graphql/execution/lookahead.rb
|
345
332
|
- lib/graphql/execution/multiplex.rb
|
346
333
|
- lib/graphql/execution_error.rb
|
347
|
-
- lib/graphql/filter.rb
|
348
334
|
- lib/graphql/integer_decoding_error.rb
|
349
335
|
- lib/graphql/integer_encoding_error.rb
|
350
336
|
- lib/graphql/introspection.rb
|
@@ -549,7 +535,6 @@ files:
|
|
549
535
|
- lib/graphql/static_validation/rules/variables_are_input_types_error.rb
|
550
536
|
- lib/graphql/static_validation/rules/variables_are_used_and_defined.rb
|
551
537
|
- lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb
|
552
|
-
- lib/graphql/static_validation/type_stack.rb
|
553
538
|
- lib/graphql/static_validation/validation_context.rb
|
554
539
|
- lib/graphql/static_validation/validation_timeout_error.rb
|
555
540
|
- lib/graphql/static_validation/validator.rb
|
@@ -621,6 +606,7 @@ metadata:
|
|
621
606
|
source_code_uri: https://github.com/rmosolgo/graphql-ruby
|
622
607
|
bug_tracker_uri: https://github.com/rmosolgo/graphql-ruby/issues
|
623
608
|
mailing_list_uri: https://tinyletter.com/graphql-ruby
|
609
|
+
post_install_message:
|
624
610
|
rdoc_options: []
|
625
611
|
require_paths:
|
626
612
|
- lib
|
@@ -635,7 +621,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
635
621
|
- !ruby/object:Gem::Version
|
636
622
|
version: '0'
|
637
623
|
requirements: []
|
638
|
-
rubygems_version: 3.
|
624
|
+
rubygems_version: 3.4.10
|
625
|
+
signing_key:
|
639
626
|
specification_version: 4
|
640
627
|
summary: A GraphQL language and runtime for Ruby
|
641
628
|
test_files: []
|
data/lib/graphql/filter.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require "graphql/deprecation"
|
3
|
-
|
4
|
-
module GraphQL
|
5
|
-
# @api private
|
6
|
-
class Filter
|
7
|
-
def initialize(only: nil, except: nil, silence_deprecation_warning: false)
|
8
|
-
if !silence_deprecation_warning
|
9
|
-
line = caller(2, 10).find { |l| !l.include?("lib/graphql") }
|
10
|
-
GraphQL::Deprecation.warn("GraphQL::Filter, `only:`, `except:`, and `.merge_filters` are deprecated and will be removed in v2.1.0. Implement `visible?` on your schema members instead (https://graphql-ruby.org/authorization/visibility.html).\n #{line}")
|
11
|
-
end
|
12
|
-
@only = only
|
13
|
-
@except = except
|
14
|
-
end
|
15
|
-
|
16
|
-
# Returns true if `member, ctx` passes this filter
|
17
|
-
def call(member, ctx)
|
18
|
-
(@only ? @only.call(member, ctx) : true) &&
|
19
|
-
(@except ? !@except.call(member, ctx) : true)
|
20
|
-
end
|
21
|
-
|
22
|
-
def merge(only: nil, except: nil)
|
23
|
-
onlies = [self].concat(Array(only))
|
24
|
-
merged_only = MergedOnly.build(onlies)
|
25
|
-
merged_except = MergedExcept.build(Array(except))
|
26
|
-
self.class.new(only: merged_only, except: merged_except, silence_deprecation_warning: true)
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
class MergedOnly
|
32
|
-
def initialize(first, second)
|
33
|
-
@first = first
|
34
|
-
@second = second
|
35
|
-
end
|
36
|
-
|
37
|
-
def call(member, ctx)
|
38
|
-
@first.call(member, ctx) && @second.call(member, ctx)
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.build(onlies)
|
42
|
-
case onlies.size
|
43
|
-
when 0
|
44
|
-
nil
|
45
|
-
when 1
|
46
|
-
onlies[0]
|
47
|
-
else
|
48
|
-
onlies.reduce { |memo, only| self.new(memo, only) }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
class MergedExcept < MergedOnly
|
54
|
-
def call(member, ctx)
|
55
|
-
@first.call(member, ctx) || @second.call(member, ctx)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,216 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module GraphQL
|
3
|
-
module StaticValidation
|
4
|
-
# - Ride along with `GraphQL::Language::Visitor`
|
5
|
-
# - Track type info, expose it to validators
|
6
|
-
class TypeStack
|
7
|
-
# These are jumping-off points for infering types down the tree
|
8
|
-
TYPE_INFERRENCE_ROOTS = [
|
9
|
-
GraphQL::Language::Nodes::OperationDefinition,
|
10
|
-
GraphQL::Language::Nodes::FragmentDefinition,
|
11
|
-
]
|
12
|
-
|
13
|
-
# @return [GraphQL::Schema] the schema whose types are present in this document
|
14
|
-
attr_reader :schema
|
15
|
-
|
16
|
-
# When it enters an object (starting with query or mutation root), it's pushed on this stack.
|
17
|
-
# When it exits, it's popped off.
|
18
|
-
# @return [Array<GraphQL::ObjectType, GraphQL::Union, GraphQL::Interface>]
|
19
|
-
attr_reader :object_types
|
20
|
-
|
21
|
-
# When it enters a field, it's pushed on this stack (useful for nested fields, args).
|
22
|
-
# When it exits, it's popped off.
|
23
|
-
# @return [Array<GraphQL::Field>] fields which have been entered
|
24
|
-
attr_reader :field_definitions
|
25
|
-
|
26
|
-
# Directives are pushed on, then popped off while traversing the tree
|
27
|
-
# @return [Array<GraphQL::Node::Directive>] directives which have been entered
|
28
|
-
attr_reader :directive_definitions
|
29
|
-
|
30
|
-
# @return [Array<GraphQL::Node::Argument>] arguments which have been entered
|
31
|
-
attr_reader :argument_definitions
|
32
|
-
|
33
|
-
# @return [Array<String>] fields which have been entered (by their AST name)
|
34
|
-
attr_reader :path
|
35
|
-
|
36
|
-
# @param schema [GraphQL::Schema] the schema whose types to use when climbing this document
|
37
|
-
# @param visitor [GraphQL::Language::Visitor] a visitor to follow & watch the types
|
38
|
-
def initialize(schema, visitor)
|
39
|
-
@schema = schema
|
40
|
-
@object_types = []
|
41
|
-
@field_definitions = []
|
42
|
-
@directive_definitions = []
|
43
|
-
@argument_definitions = []
|
44
|
-
@path = []
|
45
|
-
|
46
|
-
PUSH_STRATEGIES.each do |node_class, strategy|
|
47
|
-
visitor[node_class].enter << EnterWithStrategy.new(self, strategy)
|
48
|
-
visitor[node_class].leave << LeaveWithStrategy.new(self, strategy)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
|
55
|
-
module FragmentWithTypeStrategy
|
56
|
-
def push(stack, node)
|
57
|
-
object_type = if node.type
|
58
|
-
stack.schema.get_type(node.type.name)
|
59
|
-
else
|
60
|
-
stack.object_types.last
|
61
|
-
end
|
62
|
-
if !object_type.nil?
|
63
|
-
object_type = object_type.unwrap
|
64
|
-
end
|
65
|
-
stack.object_types.push(object_type)
|
66
|
-
push_path_member(stack, node)
|
67
|
-
end
|
68
|
-
|
69
|
-
def pop(stack, node)
|
70
|
-
stack.object_types.pop
|
71
|
-
stack.path.pop
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
module FragmentDefinitionStrategy
|
76
|
-
extend FragmentWithTypeStrategy
|
77
|
-
module_function
|
78
|
-
def push_path_member(stack, node)
|
79
|
-
stack.path.push("fragment #{node.name}")
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
module InlineFragmentStrategy
|
84
|
-
extend FragmentWithTypeStrategy
|
85
|
-
module_function
|
86
|
-
def push_path_member(stack, node)
|
87
|
-
stack.path.push("...#{node.type ? " on #{node.type.to_query_string}" : ""}")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
module OperationDefinitionStrategy
|
92
|
-
module_function
|
93
|
-
def push(stack, node)
|
94
|
-
# eg, QueryType, MutationType
|
95
|
-
object_type = stack.schema.root_type_for_operation(node.operation_type)
|
96
|
-
stack.object_types.push(object_type)
|
97
|
-
stack.path.push("#{node.operation_type}#{node.name ? " #{node.name}" : ""}")
|
98
|
-
end
|
99
|
-
|
100
|
-
def pop(stack, node)
|
101
|
-
stack.object_types.pop
|
102
|
-
stack.path.pop
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
module FieldStrategy
|
107
|
-
module_function
|
108
|
-
def push(stack, node)
|
109
|
-
parent_type = stack.object_types.last
|
110
|
-
parent_type = parent_type.unwrap
|
111
|
-
|
112
|
-
field_definition = stack.schema.get_field(parent_type, node.name)
|
113
|
-
stack.field_definitions.push(field_definition)
|
114
|
-
if !field_definition.nil?
|
115
|
-
next_object_type = field_definition.type
|
116
|
-
stack.object_types.push(next_object_type)
|
117
|
-
else
|
118
|
-
stack.object_types.push(nil)
|
119
|
-
end
|
120
|
-
stack.path.push(node.alias || node.name)
|
121
|
-
end
|
122
|
-
|
123
|
-
def pop(stack, node)
|
124
|
-
stack.field_definitions.pop
|
125
|
-
stack.object_types.pop
|
126
|
-
stack.path.pop
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
module DirectiveStrategy
|
131
|
-
module_function
|
132
|
-
def push(stack, node)
|
133
|
-
directive_defn = stack.schema.directives[node.name]
|
134
|
-
stack.directive_definitions.push(directive_defn)
|
135
|
-
end
|
136
|
-
|
137
|
-
def pop(stack, node)
|
138
|
-
stack.directive_definitions.pop
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
module ArgumentStrategy
|
143
|
-
module_function
|
144
|
-
# Push `argument_defn` onto the stack.
|
145
|
-
# It's possible that `argument_defn` will be nil.
|
146
|
-
# Push it anyways so `pop` has something to pop.
|
147
|
-
def push(stack, node)
|
148
|
-
if stack.argument_definitions.last
|
149
|
-
arg_type = stack.argument_definitions.last.type.unwrap
|
150
|
-
if arg_type.kind.input_object?
|
151
|
-
argument_defn = arg_type.arguments[node.name]
|
152
|
-
else
|
153
|
-
argument_defn = nil
|
154
|
-
end
|
155
|
-
elsif stack.directive_definitions.last
|
156
|
-
argument_defn = stack.directive_definitions.last.arguments[node.name]
|
157
|
-
elsif stack.field_definitions.last
|
158
|
-
argument_defn = stack.field_definitions.last.arguments[node.name]
|
159
|
-
else
|
160
|
-
argument_defn = nil
|
161
|
-
end
|
162
|
-
stack.argument_definitions.push(argument_defn)
|
163
|
-
stack.path.push(node.name)
|
164
|
-
end
|
165
|
-
|
166
|
-
def pop(stack, node)
|
167
|
-
stack.argument_definitions.pop
|
168
|
-
stack.path.pop
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
module FragmentSpreadStrategy
|
173
|
-
module_function
|
174
|
-
def push(stack, node)
|
175
|
-
stack.path.push("... #{node.name}")
|
176
|
-
end
|
177
|
-
|
178
|
-
def pop(stack, node)
|
179
|
-
stack.path.pop
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
PUSH_STRATEGIES = {
|
184
|
-
GraphQL::Language::Nodes::FragmentDefinition => FragmentDefinitionStrategy,
|
185
|
-
GraphQL::Language::Nodes::InlineFragment => InlineFragmentStrategy,
|
186
|
-
GraphQL::Language::Nodes::FragmentSpread => FragmentSpreadStrategy,
|
187
|
-
GraphQL::Language::Nodes::Argument => ArgumentStrategy,
|
188
|
-
GraphQL::Language::Nodes::Field => FieldStrategy,
|
189
|
-
GraphQL::Language::Nodes::Directive => DirectiveStrategy,
|
190
|
-
GraphQL::Language::Nodes::OperationDefinition => OperationDefinitionStrategy,
|
191
|
-
}
|
192
|
-
|
193
|
-
class EnterWithStrategy
|
194
|
-
def initialize(stack, strategy)
|
195
|
-
@stack = stack
|
196
|
-
@strategy = strategy
|
197
|
-
end
|
198
|
-
|
199
|
-
def call(node, parent)
|
200
|
-
@strategy.push(@stack, node)
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
class LeaveWithStrategy
|
205
|
-
def initialize(stack, strategy)
|
206
|
-
@stack = stack
|
207
|
-
@strategy = strategy
|
208
|
-
end
|
209
|
-
|
210
|
-
def call(node, parent)
|
211
|
-
@strategy.pop(@stack, node)
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
215
|
-
end
|
216
|
-
end
|