graphql 2.1.0 → 2.1.2
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/generators/graphql/install/templates/base_mutation.erb +2 -0
- data/lib/generators/graphql/install/templates/mutation_type.erb +2 -0
- data/lib/generators/graphql/templates/base_argument.erb +2 -0
- data/lib/generators/graphql/templates/base_connection.erb +2 -0
- data/lib/generators/graphql/templates/base_edge.erb +2 -0
- data/lib/generators/graphql/templates/base_enum.erb +2 -0
- data/lib/generators/graphql/templates/base_field.erb +2 -0
- data/lib/generators/graphql/templates/base_input_object.erb +2 -0
- data/lib/generators/graphql/templates/base_interface.erb +2 -0
- data/lib/generators/graphql/templates/base_object.erb +2 -0
- data/lib/generators/graphql/templates/base_scalar.erb +2 -0
- data/lib/generators/graphql/templates/base_union.erb +2 -0
- data/lib/generators/graphql/templates/graphql_controller.erb +2 -0
- data/lib/generators/graphql/templates/loader.erb +2 -0
- data/lib/generators/graphql/templates/mutation.erb +2 -0
- data/lib/generators/graphql/templates/node_type.erb +2 -0
- data/lib/generators/graphql/templates/query_type.erb +2 -0
- data/lib/generators/graphql/templates/schema.erb +2 -0
- data/lib/graphql/analysis/ast/analyzer.rb +7 -0
- data/lib/graphql/analysis/ast/query_depth.rb +7 -2
- data/lib/graphql/analysis/ast/visitor.rb +2 -2
- data/lib/graphql/analysis/ast.rb +15 -11
- data/lib/graphql/dataloader/source.rb +7 -0
- data/lib/graphql/dataloader.rb +38 -10
- data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +170 -0
- data/lib/graphql/execution/interpreter/runtime.rb +90 -251
- data/lib/graphql/execution/interpreter.rb +0 -6
- data/lib/graphql/execution/lookahead.rb +1 -1
- data/lib/graphql/introspection/dynamic_fields.rb +1 -1
- data/lib/graphql/introspection/entry_points.rb +2 -2
- data/lib/graphql/language/block_string.rb +28 -16
- data/lib/graphql/language/definition_slice.rb +1 -1
- data/lib/graphql/language/document_from_schema_definition.rb +30 -19
- data/lib/graphql/language/nodes.rb +1 -1
- data/lib/graphql/language/printer.rb +88 -27
- data/lib/graphql/language/sanitized_printer.rb +6 -1
- data/lib/graphql/language/static_visitor.rb +167 -0
- data/lib/graphql/language/visitor.rb +2 -0
- data/lib/graphql/language.rb +1 -0
- data/lib/graphql/query/context/scoped_context.rb +101 -0
- data/lib/graphql/query/context.rb +32 -98
- data/lib/graphql/schema/directive/specified_by.rb +14 -0
- data/lib/graphql/schema/field/connection_extension.rb +1 -15
- data/lib/graphql/schema/field.rb +7 -4
- data/lib/graphql/schema/has_single_input_argument.rb +156 -0
- data/lib/graphql/schema/introspection_system.rb +2 -0
- data/lib/graphql/schema/member/base_dsl_methods.rb +2 -1
- data/lib/graphql/schema/member/has_arguments.rb +19 -4
- data/lib/graphql/schema/member/has_fields.rb +4 -1
- data/lib/graphql/schema/member/has_interfaces.rb +21 -7
- data/lib/graphql/schema/relay_classic_mutation.rb +6 -128
- data/lib/graphql/schema/resolver.rb +4 -0
- data/lib/graphql/schema/scalar.rb +3 -3
- data/lib/graphql/schema/warden.rb +84 -55
- data/lib/graphql/schema.rb +123 -36
- data/lib/graphql/static_validation/all_rules.rb +1 -1
- data/lib/graphql/static_validation/base_visitor.rb +1 -1
- data/lib/graphql/static_validation/literal_validator.rb +1 -1
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +1 -1
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +1 -1
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +1 -1
- data/lib/graphql/static_validation/validation_context.rb +5 -2
- data/lib/graphql/tracing/appoptics_trace.rb +2 -2
- data/lib/graphql/tracing/appoptics_tracing.rb +2 -2
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +1 -1
- metadata +9 -4
@@ -111,7 +111,7 @@ module GraphQL
|
|
111
111
|
# that required fields are missing
|
112
112
|
required_field_names = @warden.arguments(type)
|
113
113
|
.select { |argument| argument.type.kind.non_null? && @warden.get_argument(type, argument.name) }
|
114
|
-
.map(&:name)
|
114
|
+
.map!(&:name)
|
115
115
|
|
116
116
|
present_field_names = ast_node.arguments.map(&:name)
|
117
117
|
missing_required_field_names = required_field_names - present_field_names
|
@@ -340,7 +340,7 @@ module GraphQL
|
|
340
340
|
selections.each do |node|
|
341
341
|
case node
|
342
342
|
when GraphQL::Language::Nodes::Field
|
343
|
-
definition = context.
|
343
|
+
definition = context.warden.get_field(owner_type, node.name)
|
344
344
|
fields << Field.new(node, definition, owner_type, parents)
|
345
345
|
when GraphQL::Language::Nodes::InlineFragment
|
346
346
|
fragment_type = node.type ? context.warden.get_type(node.type.name) : owner_type
|
@@ -21,7 +21,7 @@ module GraphQL
|
|
21
21
|
present_argument_names = ast_node.arguments.map(&:name)
|
22
22
|
required_argument_names = context.warden.arguments(defn)
|
23
23
|
.select { |a| a.type.kind.non_null? && !a.default_value? && context.warden.get_argument(defn, a.name) }
|
24
|
-
.map(&:name)
|
24
|
+
.map!(&:name)
|
25
25
|
|
26
26
|
missing_names = required_argument_names - present_argument_names
|
27
27
|
if missing_names.any?
|
@@ -36,7 +36,7 @@ module GraphQL
|
|
36
36
|
|
37
37
|
required_fields = context.warden.arguments(parent_type)
|
38
38
|
.select{|arg| arg.type.kind.non_null?}
|
39
|
-
.map(&:graphql_name)
|
39
|
+
.map!(&:graphql_name)
|
40
40
|
|
41
41
|
present_fields = ast_node.arguments.map(&:name)
|
42
42
|
missing_fields = required_fields - present_fields
|
@@ -13,12 +13,15 @@ module GraphQL
|
|
13
13
|
|
14
14
|
attr_reader :query, :errors, :visitor,
|
15
15
|
:on_dependency_resolve_handlers,
|
16
|
-
:max_errors
|
16
|
+
:max_errors, :warden, :schema
|
17
17
|
|
18
|
-
|
18
|
+
|
19
|
+
def_delegators :@query, :document, :fragments, :operations
|
19
20
|
|
20
21
|
def initialize(query, visitor_class, max_errors)
|
21
22
|
@query = query
|
23
|
+
@warden = query.warden
|
24
|
+
@schema = query.schema
|
22
25
|
@literal_validator = LiteralValidator.new(context: query.context)
|
23
26
|
@errors = []
|
24
27
|
@max_errors = max_errors || Float::INFINITY
|
@@ -195,7 +195,7 @@ module GraphQL
|
|
195
195
|
else
|
196
196
|
[key, data[key]]
|
197
197
|
end
|
198
|
-
end.flatten(2).each_slice(2).to_h.merge(Spec: 'graphql')
|
198
|
+
end.tap { _1.flatten!(2) }.each_slice(2).to_h.merge(Spec: 'graphql')
|
199
199
|
end
|
200
200
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
201
201
|
|
@@ -226,7 +226,7 @@ module GraphQL
|
|
226
226
|
end
|
227
227
|
|
228
228
|
def graphql_multiplex(data)
|
229
|
-
names = data.queries.map(&:operations).map(&:keys).flatten.compact
|
229
|
+
names = data.queries.map(&:operations).map!(&:keys).tap(&:flatten!).tap(&:compact!)
|
230
230
|
multiplex_transaction_name(names) if names.size > 1
|
231
231
|
|
232
232
|
[:Operations, names.join(', ')]
|
@@ -117,7 +117,7 @@ module GraphQL
|
|
117
117
|
else
|
118
118
|
[key, data[key]]
|
119
119
|
end
|
120
|
-
end.flatten(2).each_slice(2).to_h.merge(Spec: 'graphql')
|
120
|
+
end.tap { _1.flatten!(2) }.each_slice(2).to_h.merge(Spec: 'graphql')
|
121
121
|
end
|
122
122
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
123
123
|
|
@@ -148,7 +148,7 @@ module GraphQL
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def graphql_multiplex(data)
|
151
|
-
names = data.queries.map(&:operations).map(&:keys).flatten.compact
|
151
|
+
names = data.queries.map(&:operations).map!(&:keys).tap(&:flatten!).tap(&:compact!)
|
152
152
|
multiplex_transaction_name(names) if names.size > 1
|
153
153
|
|
154
154
|
[:Operations, names.join(', ')]
|
data/lib/graphql/version.rb
CHANGED
data/lib/graphql.rb
CHANGED
@@ -101,8 +101,8 @@ require "graphql/execution"
|
|
101
101
|
require "graphql/pagination"
|
102
102
|
require "graphql/schema"
|
103
103
|
require "graphql/query"
|
104
|
-
require "graphql/types"
|
105
104
|
require "graphql/dataloader"
|
105
|
+
require "graphql/types"
|
106
106
|
require "graphql/static_validation"
|
107
107
|
require "graphql/execution"
|
108
108
|
require "graphql/schema/built_in_types"
|
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.1.
|
4
|
+
version: 2.1.2
|
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-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -326,6 +326,7 @@ files:
|
|
326
326
|
- lib/graphql/execution/interpreter/handles_raw_value.rb
|
327
327
|
- lib/graphql/execution/interpreter/resolve.rb
|
328
328
|
- lib/graphql/execution/interpreter/runtime.rb
|
329
|
+
- lib/graphql/execution/interpreter/runtime/graphql_result.rb
|
329
330
|
- lib/graphql/execution/lazy.rb
|
330
331
|
- lib/graphql/execution/lazy/lazy_method_map.rb
|
331
332
|
- lib/graphql/execution/lookahead.rb
|
@@ -360,6 +361,7 @@ files:
|
|
360
361
|
- lib/graphql/language/parser.y
|
361
362
|
- lib/graphql/language/printer.rb
|
362
363
|
- lib/graphql/language/sanitized_printer.rb
|
364
|
+
- lib/graphql/language/static_visitor.rb
|
363
365
|
- lib/graphql/language/token.rb
|
364
366
|
- lib/graphql/language/visitor.rb
|
365
367
|
- lib/graphql/load_application_object_failed_error.rb
|
@@ -375,6 +377,7 @@ files:
|
|
375
377
|
- lib/graphql/parse_error.rb
|
376
378
|
- lib/graphql/query.rb
|
377
379
|
- lib/graphql/query/context.rb
|
380
|
+
- lib/graphql/query/context/scoped_context.rb
|
378
381
|
- lib/graphql/query/fingerprint.rb
|
379
382
|
- lib/graphql/query/input_validation_result.rb
|
380
383
|
- lib/graphql/query/null_context.rb
|
@@ -409,6 +412,7 @@ files:
|
|
409
412
|
- lib/graphql/schema/directive/include.rb
|
410
413
|
- lib/graphql/schema/directive/one_of.rb
|
411
414
|
- lib/graphql/schema/directive/skip.rb
|
415
|
+
- lib/graphql/schema/directive/specified_by.rb
|
412
416
|
- lib/graphql/schema/directive/transform.rb
|
413
417
|
- lib/graphql/schema/enum.rb
|
414
418
|
- lib/graphql/schema/enum_value.rb
|
@@ -418,6 +422,7 @@ files:
|
|
418
422
|
- lib/graphql/schema/field_extension.rb
|
419
423
|
- lib/graphql/schema/find_inherited_value.rb
|
420
424
|
- lib/graphql/schema/finder.rb
|
425
|
+
- lib/graphql/schema/has_single_input_argument.rb
|
421
426
|
- lib/graphql/schema/input_object.rb
|
422
427
|
- lib/graphql/schema/interface.rb
|
423
428
|
- lib/graphql/schema/introspection_system.rb
|
@@ -614,14 +619,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
614
619
|
requirements:
|
615
620
|
- - ">="
|
616
621
|
- !ruby/object:Gem::Version
|
617
|
-
version: 2.
|
622
|
+
version: 2.7.0
|
618
623
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
619
624
|
requirements:
|
620
625
|
- - ">="
|
621
626
|
- !ruby/object:Gem::Version
|
622
627
|
version: '0'
|
623
628
|
requirements: []
|
624
|
-
rubygems_version: 3.
|
629
|
+
rubygems_version: 3.5.0.dev
|
625
630
|
signing_key:
|
626
631
|
specification_version: 4
|
627
632
|
summary: A GraphQL language and runtime for Ruby
|