graphql 2.0.13 → 2.3.10
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/mutation_root_generator.rb +2 -2
- 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/install_generator.rb +3 -0
- data/lib/generators/graphql/mutation_delete_generator.rb +1 -1
- data/lib/generators/graphql/mutation_update_generator.rb +1 -1
- data/lib/generators/graphql/relay.rb +18 -1
- 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_resolver.erb +6 -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 +8 -0
- data/lib/graphql/analysis/analyzer.rb +89 -0
- data/lib/graphql/analysis/field_usage.rb +82 -0
- data/lib/graphql/analysis/max_query_complexity.rb +20 -0
- data/lib/graphql/analysis/max_query_depth.rb +20 -0
- data/lib/graphql/analysis/query_complexity.rb +183 -0
- data/lib/graphql/analysis/query_depth.rb +58 -0
- data/lib/graphql/analysis/visitor.rb +283 -0
- data/lib/graphql/analysis.rb +92 -1
- data/lib/graphql/backtrace/inspect_result.rb +0 -12
- data/lib/graphql/backtrace/table.rb +2 -2
- data/lib/graphql/backtrace/trace.rb +93 -0
- data/lib/graphql/backtrace/tracer.rb +1 -1
- data/lib/graphql/backtrace.rb +2 -1
- data/lib/graphql/coercion_error.rb +1 -9
- data/lib/graphql/dataloader/async_dataloader.rb +88 -0
- data/lib/graphql/dataloader/null_dataloader.rb +1 -1
- data/lib/graphql/dataloader/request.rb +5 -0
- data/lib/graphql/dataloader/source.rb +89 -45
- data/lib/graphql/dataloader.rb +115 -142
- data/lib/graphql/duration_encoding_error.rb +16 -0
- data/lib/graphql/execution/interpreter/argument_value.rb +5 -1
- data/lib/graphql/execution/interpreter/arguments.rb +1 -1
- data/lib/graphql/execution/interpreter/arguments_cache.rb +33 -33
- data/lib/graphql/execution/interpreter/resolve.rb +19 -0
- data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +175 -0
- data/lib/graphql/execution/interpreter/runtime.rb +331 -455
- data/lib/graphql/execution/interpreter.rb +125 -61
- data/lib/graphql/execution/lazy.rb +6 -12
- data/lib/graphql/execution/lookahead.rb +124 -46
- data/lib/graphql/execution/multiplex.rb +3 -117
- data/lib/graphql/execution.rb +0 -1
- data/lib/graphql/introspection/directive_type.rb +3 -3
- data/lib/graphql/introspection/dynamic_fields.rb +1 -1
- data/lib/graphql/introspection/entry_points.rb +11 -5
- data/lib/graphql/introspection/field_type.rb +2 -2
- data/lib/graphql/introspection/schema_type.rb +10 -13
- data/lib/graphql/introspection/type_type.rb +17 -10
- data/lib/graphql/introspection.rb +3 -2
- data/lib/graphql/language/block_string.rb +34 -18
- data/lib/graphql/language/definition_slice.rb +1 -1
- data/lib/graphql/language/document_from_schema_definition.rb +75 -59
- data/lib/graphql/language/lexer.rb +358 -1506
- data/lib/graphql/language/nodes.rb +166 -93
- data/lib/graphql/language/parser.rb +795 -1953
- data/lib/graphql/language/printer.rb +340 -160
- data/lib/graphql/language/sanitized_printer.rb +21 -23
- data/lib/graphql/language/static_visitor.rb +167 -0
- data/lib/graphql/language/visitor.rb +188 -141
- data/lib/graphql/language.rb +61 -1
- data/lib/graphql/load_application_object_failed_error.rb +5 -1
- data/lib/graphql/pagination/active_record_relation_connection.rb +0 -8
- data/lib/graphql/pagination/array_connection.rb +6 -6
- data/lib/graphql/pagination/connection.rb +33 -6
- data/lib/graphql/pagination/mongoid_relation_connection.rb +1 -2
- data/lib/graphql/query/context/scoped_context.rb +101 -0
- data/lib/graphql/query/context.rb +117 -112
- data/lib/graphql/query/null_context.rb +12 -25
- data/lib/graphql/query/validation_pipeline.rb +6 -5
- data/lib/graphql/query/variables.rb +3 -3
- data/lib/graphql/query.rb +86 -30
- data/lib/graphql/railtie.rb +9 -6
- data/lib/graphql/rake_task.rb +29 -11
- data/lib/graphql/rubocop/graphql/base_cop.rb +1 -1
- data/lib/graphql/schema/addition.rb +59 -23
- data/lib/graphql/schema/always_visible.rb +11 -0
- data/lib/graphql/schema/argument.rb +55 -26
- data/lib/graphql/schema/base_64_encoder.rb +3 -5
- data/lib/graphql/schema/build_from_definition.rb +56 -32
- data/lib/graphql/schema/directive/one_of.rb +24 -0
- data/lib/graphql/schema/directive/specified_by.rb +14 -0
- data/lib/graphql/schema/directive/transform.rb +1 -1
- data/lib/graphql/schema/directive.rb +15 -3
- data/lib/graphql/schema/enum.rb +35 -24
- data/lib/graphql/schema/enum_value.rb +2 -3
- data/lib/graphql/schema/field/connection_extension.rb +2 -16
- data/lib/graphql/schema/field/scope_extension.rb +8 -1
- data/lib/graphql/schema/field.rb +147 -107
- data/lib/graphql/schema/field_extension.rb +1 -4
- data/lib/graphql/schema/find_inherited_value.rb +2 -7
- data/lib/graphql/schema/has_single_input_argument.rb +158 -0
- data/lib/graphql/schema/input_object.rb +47 -11
- data/lib/graphql/schema/interface.rb +15 -21
- data/lib/graphql/schema/introspection_system.rb +7 -17
- data/lib/graphql/schema/late_bound_type.rb +10 -0
- data/lib/graphql/schema/list.rb +2 -2
- data/lib/graphql/schema/loader.rb +2 -3
- data/lib/graphql/schema/member/base_dsl_methods.rb +18 -14
- data/lib/graphql/schema/member/build_type.rb +11 -3
- data/lib/graphql/schema/member/has_arguments.rb +170 -130
- 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 +81 -61
- data/lib/graphql/schema/member/has_fields.rb +100 -38
- data/lib/graphql/schema/member/has_interfaces.rb +65 -10
- data/lib/graphql/schema/member/has_unresolved_type_error.rb +5 -1
- 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/scoped.rb +19 -0
- data/lib/graphql/schema/member/type_system_helpers.rb +16 -0
- data/lib/graphql/schema/member/validates_input.rb +3 -3
- data/lib/graphql/schema/mutation.rb +7 -0
- data/lib/graphql/schema/object.rb +16 -5
- data/lib/graphql/schema/printer.rb +11 -8
- data/lib/graphql/schema/relay_classic_mutation.rb +7 -129
- data/lib/graphql/schema/resolver/has_payload_type.rb +9 -9
- data/lib/graphql/schema/resolver.rb +47 -32
- data/lib/graphql/schema/scalar.rb +3 -3
- data/lib/graphql/schema/subscription.rb +11 -4
- data/lib/graphql/schema/subset.rb +397 -0
- data/lib/graphql/schema/timeout.rb +25 -29
- data/lib/graphql/schema/type_expression.rb +2 -2
- data/lib/graphql/schema/type_membership.rb +3 -0
- data/lib/graphql/schema/union.rb +11 -2
- data/lib/graphql/schema/unique_within_type.rb +1 -1
- data/lib/graphql/schema/validator/all_validator.rb +60 -0
- data/lib/graphql/schema/validator.rb +4 -2
- data/lib/graphql/schema/warden.rb +238 -93
- data/lib/graphql/schema.rb +498 -103
- data/lib/graphql/static_validation/all_rules.rb +2 -1
- data/lib/graphql/static_validation/base_visitor.rb +7 -6
- data/lib/graphql/static_validation/definition_dependencies.rb +7 -1
- data/lib/graphql/static_validation/literal_validator.rb +24 -7
- data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +1 -1
- data/lib/graphql/static_validation/rules/arguments_are_defined.rb +1 -1
- data/lib/graphql/static_validation/rules/directives_are_defined.rb +1 -2
- data/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +1 -1
- data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +12 -4
- data/lib/graphql/static_validation/rules/fields_will_merge.rb +10 -10
- data/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +3 -3
- data/lib/graphql/static_validation/rules/fragment_types_exist.rb +1 -1
- data/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb +1 -1
- data/lib/graphql/static_validation/rules/mutation_root_exists.rb +1 -1
- data/lib/graphql/static_validation/rules/one_of_input_objects_are_valid.rb +66 -0
- data/lib/graphql/static_validation/rules/one_of_input_objects_are_valid_error.rb +29 -0
- data/lib/graphql/static_validation/rules/query_root_exists.rb +1 -1
- data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +4 -4
- data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +5 -5
- data/lib/graphql/static_validation/rules/subscription_root_exists.rb +1 -1
- data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +18 -27
- data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +1 -1
- data/lib/graphql/static_validation/rules/variables_are_input_types.rb +1 -1
- data/lib/graphql/static_validation/validation_context.rb +5 -5
- data/lib/graphql/static_validation/validator.rb +4 -1
- data/lib/graphql/static_validation.rb +0 -1
- data/lib/graphql/subscriptions/action_cable_subscriptions.rb +11 -4
- data/lib/graphql/subscriptions/broadcast_analyzer.rb +11 -5
- data/lib/graphql/subscriptions/event.rb +11 -10
- data/lib/graphql/subscriptions/serialize.rb +2 -0
- data/lib/graphql/subscriptions.rb +20 -13
- data/lib/graphql/testing/helpers.rb +151 -0
- data/lib/graphql/testing.rb +2 -0
- data/lib/graphql/tracing/active_support_notifications_trace.rb +16 -0
- data/lib/graphql/tracing/appoptics_trace.rb +251 -0
- data/lib/graphql/tracing/appoptics_tracing.rb +2 -2
- data/lib/graphql/tracing/appsignal_trace.rb +77 -0
- data/lib/graphql/tracing/data_dog_trace.rb +183 -0
- data/lib/graphql/tracing/data_dog_tracing.rb +9 -21
- data/lib/graphql/{execution/instrumentation.rb → tracing/legacy_hooks_trace.rb} +10 -28
- data/lib/graphql/tracing/legacy_trace.rb +69 -0
- data/lib/graphql/tracing/new_relic_trace.rb +75 -0
- data/lib/graphql/tracing/notifications_trace.rb +45 -0
- data/lib/graphql/tracing/platform_trace.rb +118 -0
- data/lib/graphql/tracing/platform_tracing.rb +17 -3
- data/lib/graphql/tracing/{prometheus_tracing → prometheus_trace}/graphql_collector.rb +4 -2
- data/lib/graphql/tracing/prometheus_trace.rb +89 -0
- data/lib/graphql/tracing/prometheus_tracing.rb +3 -3
- data/lib/graphql/tracing/scout_trace.rb +72 -0
- data/lib/graphql/tracing/sentry_trace.rb +112 -0
- data/lib/graphql/tracing/statsd_trace.rb +56 -0
- data/lib/graphql/tracing/trace.rb +76 -0
- data/lib/graphql/tracing.rb +20 -40
- data/lib/graphql/type_kinds.rb +7 -4
- data/lib/graphql/types/iso_8601_duration.rb +77 -0
- data/lib/graphql/types/relay/base_connection.rb +1 -1
- data/lib/graphql/types/relay/connection_behaviors.rb +68 -6
- data/lib/graphql/types/relay/edge_behaviors.rb +33 -5
- data/lib/graphql/types/relay/node_behaviors.rb +8 -2
- data/lib/graphql/types/relay/page_info_behaviors.rb +11 -2
- data/lib/graphql/types/relay.rb +0 -1
- data/lib/graphql/types/string.rb +1 -1
- data/lib/graphql/types.rb +1 -0
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +27 -20
- data/readme.md +13 -3
- metadata +96 -47
- data/lib/graphql/analysis/ast/analyzer.rb +0 -84
- data/lib/graphql/analysis/ast/field_usage.rb +0 -57
- data/lib/graphql/analysis/ast/max_query_complexity.rb +0 -22
- data/lib/graphql/analysis/ast/max_query_depth.rb +0 -22
- data/lib/graphql/analysis/ast/query_complexity.rb +0 -230
- data/lib/graphql/analysis/ast/query_depth.rb +0 -55
- data/lib/graphql/analysis/ast/visitor.rb +0 -269
- data/lib/graphql/analysis/ast.rb +0 -81
- data/lib/graphql/deprecation.rb +0 -9
- data/lib/graphql/filter.rb +0 -53
- data/lib/graphql/language/lexer.rl +0 -280
- data/lib/graphql/language/parser.y +0 -554
- data/lib/graphql/language/token.rb +0 -34
- data/lib/graphql/schema/base_64_bp.rb +0 -26
- data/lib/graphql/schema/invalid_type_error.rb +0 -7
- data/lib/graphql/static_validation/type_stack.rb +0 -216
- data/lib/graphql/subscriptions/instrumentation.rb +0 -28
- data/lib/graphql/types/relay/default_relay.rb +0 -21
data/lib/graphql.rb
CHANGED
@@ -6,14 +6,6 @@ require "singleton"
|
|
6
6
|
require "forwardable"
|
7
7
|
|
8
8
|
module GraphQL
|
9
|
-
# forwards-compat for argument handling
|
10
|
-
module Ruby2Keywords
|
11
|
-
if RUBY_VERSION < "2.7"
|
12
|
-
def ruby2_keywords(*)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
9
|
class Error < StandardError
|
18
10
|
end
|
19
11
|
|
@@ -42,8 +34,8 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
42
34
|
# Turn a query string or schema definition into an AST
|
43
35
|
# @param graphql_string [String] a GraphQL query string or schema definition
|
44
36
|
# @return [GraphQL::Language::Nodes::Document]
|
45
|
-
def self.parse(graphql_string,
|
46
|
-
|
37
|
+
def self.parse(graphql_string, trace: GraphQL::Tracing::NullTrace, filename: nil, max_tokens: nil)
|
38
|
+
default_parser.parse(graphql_string, trace: trace, filename: filename, max_tokens: max_tokens)
|
47
39
|
end
|
48
40
|
|
49
41
|
# Read the contents of `filename` and parse them as GraphQL
|
@@ -51,21 +43,36 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
|
|
51
43
|
# @return [GraphQL::Language::Nodes::Document]
|
52
44
|
def self.parse_file(filename)
|
53
45
|
content = File.read(filename)
|
54
|
-
|
46
|
+
default_parser.parse(content, filename: filename)
|
55
47
|
end
|
56
48
|
|
57
|
-
|
58
|
-
|
49
|
+
# @return [Array<Array>]
|
50
|
+
def self.scan(graphql_string)
|
51
|
+
default_parser.scan(graphql_string)
|
59
52
|
end
|
60
53
|
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
def self.parse_with_racc(string, filename: nil, trace: GraphQL::Tracing::NullTrace)
|
55
|
+
warn "`GraphQL.parse_with_racc` is deprecated; GraphQL-Ruby no longer uses racc for parsing. Call `GraphQL.parse` or `GraphQL::Language::Parser.parse` instead."
|
56
|
+
GraphQL::Language::Parser.parse(string, filename: filename, trace: trace)
|
64
57
|
end
|
65
58
|
|
66
|
-
def self.
|
59
|
+
def self.scan_with_ruby(graphql_string)
|
67
60
|
GraphQL::Language::Lexer.tokenize(graphql_string)
|
68
61
|
end
|
62
|
+
|
63
|
+
NOT_CONFIGURED = Object.new
|
64
|
+
private_constant :NOT_CONFIGURED
|
65
|
+
module EmptyObjects
|
66
|
+
EMPTY_HASH = {}.freeze
|
67
|
+
EMPTY_ARRAY = [].freeze
|
68
|
+
end
|
69
|
+
|
70
|
+
class << self
|
71
|
+
# If true, the parser should raise when an integer or float is followed immediately by an identifier (instead of a space or punctuation)
|
72
|
+
attr_accessor :reject_numbers_followed_by_names
|
73
|
+
end
|
74
|
+
|
75
|
+
self.reject_numbers_followed_by_names = false
|
69
76
|
end
|
70
77
|
|
71
78
|
# Order matters for these:
|
@@ -81,6 +88,7 @@ require "graphql/integer_decoding_error"
|
|
81
88
|
require "graphql/integer_encoding_error"
|
82
89
|
require "graphql/string_encoding_error"
|
83
90
|
require "graphql/date_encoding_error"
|
91
|
+
require "graphql/duration_encoding_error"
|
84
92
|
require "graphql/type_kinds"
|
85
93
|
require "graphql/name_validator"
|
86
94
|
require "graphql/language"
|
@@ -94,9 +102,8 @@ require "graphql/execution"
|
|
94
102
|
require "graphql/pagination"
|
95
103
|
require "graphql/schema"
|
96
104
|
require "graphql/query"
|
97
|
-
require "graphql/types"
|
98
105
|
require "graphql/dataloader"
|
99
|
-
require "graphql/
|
106
|
+
require "graphql/types"
|
100
107
|
require "graphql/static_validation"
|
101
108
|
require "graphql/execution"
|
102
109
|
require "graphql/schema/built_in_types"
|
@@ -113,4 +120,4 @@ require "graphql/backtrace"
|
|
113
120
|
require "graphql/unauthorized_error"
|
114
121
|
require "graphql/unauthorized_field_error"
|
115
122
|
require "graphql/load_application_object_failed_error"
|
116
|
-
require "graphql/
|
123
|
+
require "graphql/testing"
|
data/readme.md
CHANGED
@@ -7,7 +7,7 @@ A Ruby implementation of [GraphQL](https://graphql.org/).
|
|
7
7
|
|
8
8
|
- [Website](https://graphql-ruby.org/)
|
9
9
|
- [API Documentation](https://www.rubydoc.info/github/rmosolgo/graphql-ruby)
|
10
|
-
- [Newsletter](https://
|
10
|
+
- [Newsletter](https://buttondown.email/graphql-ruby)
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
@@ -34,7 +34,17 @@ Or, see ["Getting Started"](https://graphql-ruby.org/getting_started.html).
|
|
34
34
|
|
35
35
|
## Upgrade
|
36
36
|
|
37
|
-
I also sell [GraphQL::Pro](https://graphql.pro) which provides several features on top of the GraphQL runtime, including
|
37
|
+
I also sell [GraphQL::Pro](https://graphql.pro) which provides several features on top of the GraphQL runtime, including:
|
38
|
+
|
39
|
+
- [Persisted queries](https://graphql-ruby.org/operation_store/overview)
|
40
|
+
- [API versioning](https://graphql-ruby.org/changesets/overview)
|
41
|
+
- [Streaming payloads](https://graphql-ruby.org/defer/overview)
|
42
|
+
- [Server-side caching](https://graphql-ruby.org/object_cache/overview)
|
43
|
+
- [Rate limiters](https://graphql-ruby.org/limiters/overview)
|
44
|
+
- Subscriptions backends for [Pusher](https://graphql-ruby.org/subscriptions/pusher_implementation) and [Ably](https://graphql-ruby.org/subscriptions/ably_implementation)
|
45
|
+
- Authorization plugins for [Pundit](https://graphql-ruby.org/authorization/pundit_integration) and [CanCan](https://graphql-ruby.org/authorization/can_can_integration)
|
46
|
+
|
47
|
+
Besides that, Pro customers get email support and an opportunity to support graphql-ruby's development!
|
38
48
|
|
39
49
|
## Goals
|
40
50
|
|
@@ -44,6 +54,6 @@ I also sell [GraphQL::Pro](https://graphql.pro) which provides several features
|
|
44
54
|
|
45
55
|
## Getting Involved
|
46
56
|
|
47
|
-
- __Say hi & ask questions__ in the #graphql-ruby channel on [Discord](https://discord.com/invite/xud7bH9)
|
57
|
+
- __Say hi & ask questions__ in the #graphql-ruby channel on [Discord](https://discord.com/invite/xud7bH9).
|
48
58
|
- __Report bugs__ by posting a description, full stack trace, and all relevant code in a [GitHub issue](https://github.com/rmosolgo/graphql-ruby/issues).
|
49
59
|
- __Start hacking__ with the [Development guide](https://graphql-ruby.org/development).
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.10
|
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: 2024-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: base64
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: benchmark-ips
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +52,20 @@ dependencies:
|
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: graphql-batch
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: memory_profiler
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,72 +84,72 @@ dependencies:
|
|
56
84
|
name: minitest
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
|
-
- - "
|
87
|
+
- - ">="
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
89
|
+
version: '0'
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
|
-
- - "
|
94
|
+
- - ">="
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: minitest-focus
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
|
-
- - "
|
101
|
+
- - ">="
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
103
|
+
version: '0'
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
|
-
- - "
|
108
|
+
- - ">="
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
110
|
+
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: minitest-reporters
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
|
-
- - "
|
115
|
+
- - ">="
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
117
|
+
version: '0'
|
90
118
|
type: :development
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
93
121
|
requirements:
|
94
|
-
- - "
|
122
|
+
- - ">="
|
95
123
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
124
|
+
version: '0'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
126
|
+
name: rake
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
100
128
|
requirements:
|
101
|
-
- - "
|
129
|
+
- - ">="
|
102
130
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
131
|
+
version: '0'
|
104
132
|
type: :development
|
105
133
|
prerelease: false
|
106
134
|
version_requirements: !ruby/object:Gem::Requirement
|
107
135
|
requirements:
|
108
|
-
- - "
|
136
|
+
- - ">="
|
109
137
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
138
|
+
version: '0'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: rake
|
140
|
+
name: rake-compiler
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
114
142
|
requirements:
|
115
|
-
- - "
|
143
|
+
- - ">="
|
116
144
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
145
|
+
version: '0'
|
118
146
|
type: :development
|
119
147
|
prerelease: false
|
120
148
|
version_requirements: !ruby/object:Gem::Requirement
|
121
149
|
requirements:
|
122
|
-
- - "
|
150
|
+
- - ">="
|
123
151
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
152
|
+
version: '0'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: rubocop
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,6 +284,7 @@ files:
|
|
256
284
|
- lib/generators/graphql/templates/base_input_object.erb
|
257
285
|
- lib/generators/graphql/templates/base_interface.erb
|
258
286
|
- lib/generators/graphql/templates/base_object.erb
|
287
|
+
- lib/generators/graphql/templates/base_resolver.erb
|
259
288
|
- lib/generators/graphql/templates/base_scalar.erb
|
260
289
|
- lib/generators/graphql/templates/base_union.erb
|
261
290
|
- lib/generators/graphql/templates/enum.erb
|
@@ -277,33 +306,33 @@ files:
|
|
277
306
|
- lib/generators/graphql/union_generator.rb
|
278
307
|
- lib/graphql.rb
|
279
308
|
- lib/graphql/analysis.rb
|
280
|
-
- lib/graphql/analysis/
|
281
|
-
- lib/graphql/analysis/
|
282
|
-
- lib/graphql/analysis/
|
283
|
-
- lib/graphql/analysis/
|
284
|
-
- lib/graphql/analysis/
|
285
|
-
- lib/graphql/analysis/
|
286
|
-
- lib/graphql/analysis/
|
287
|
-
- lib/graphql/analysis/ast/visitor.rb
|
309
|
+
- lib/graphql/analysis/analyzer.rb
|
310
|
+
- lib/graphql/analysis/field_usage.rb
|
311
|
+
- lib/graphql/analysis/max_query_complexity.rb
|
312
|
+
- lib/graphql/analysis/max_query_depth.rb
|
313
|
+
- lib/graphql/analysis/query_complexity.rb
|
314
|
+
- lib/graphql/analysis/query_depth.rb
|
315
|
+
- lib/graphql/analysis/visitor.rb
|
288
316
|
- lib/graphql/analysis_error.rb
|
289
317
|
- lib/graphql/backtrace.rb
|
290
318
|
- lib/graphql/backtrace/inspect_result.rb
|
291
319
|
- lib/graphql/backtrace/table.rb
|
320
|
+
- lib/graphql/backtrace/trace.rb
|
292
321
|
- lib/graphql/backtrace/traced_error.rb
|
293
322
|
- lib/graphql/backtrace/tracer.rb
|
294
323
|
- lib/graphql/coercion_error.rb
|
295
324
|
- lib/graphql/dataloader.rb
|
325
|
+
- lib/graphql/dataloader/async_dataloader.rb
|
296
326
|
- lib/graphql/dataloader/null_dataloader.rb
|
297
327
|
- lib/graphql/dataloader/request.rb
|
298
328
|
- lib/graphql/dataloader/request_all.rb
|
299
329
|
- lib/graphql/dataloader/source.rb
|
300
330
|
- lib/graphql/date_encoding_error.rb
|
301
|
-
- lib/graphql/deprecation.rb
|
302
331
|
- lib/graphql/dig.rb
|
332
|
+
- lib/graphql/duration_encoding_error.rb
|
303
333
|
- lib/graphql/execution.rb
|
304
334
|
- lib/graphql/execution/directive_checks.rb
|
305
335
|
- lib/graphql/execution/errors.rb
|
306
|
-
- lib/graphql/execution/instrumentation.rb
|
307
336
|
- lib/graphql/execution/interpreter.rb
|
308
337
|
- lib/graphql/execution/interpreter/argument_value.rb
|
309
338
|
- lib/graphql/execution/interpreter/arguments.rb
|
@@ -312,12 +341,12 @@ files:
|
|
312
341
|
- lib/graphql/execution/interpreter/handles_raw_value.rb
|
313
342
|
- lib/graphql/execution/interpreter/resolve.rb
|
314
343
|
- lib/graphql/execution/interpreter/runtime.rb
|
344
|
+
- lib/graphql/execution/interpreter/runtime/graphql_result.rb
|
315
345
|
- lib/graphql/execution/lazy.rb
|
316
346
|
- lib/graphql/execution/lazy/lazy_method_map.rb
|
317
347
|
- lib/graphql/execution/lookahead.rb
|
318
348
|
- lib/graphql/execution/multiplex.rb
|
319
349
|
- lib/graphql/execution_error.rb
|
320
|
-
- lib/graphql/filter.rb
|
321
350
|
- lib/graphql/integer_decoding_error.rb
|
322
351
|
- lib/graphql/integer_encoding_error.rb
|
323
352
|
- lib/graphql/introspection.rb
|
@@ -342,13 +371,11 @@ files:
|
|
342
371
|
- lib/graphql/language/document_from_schema_definition.rb
|
343
372
|
- lib/graphql/language/generation.rb
|
344
373
|
- lib/graphql/language/lexer.rb
|
345
|
-
- lib/graphql/language/lexer.rl
|
346
374
|
- lib/graphql/language/nodes.rb
|
347
375
|
- lib/graphql/language/parser.rb
|
348
|
-
- lib/graphql/language/parser.y
|
349
376
|
- lib/graphql/language/printer.rb
|
350
377
|
- lib/graphql/language/sanitized_printer.rb
|
351
|
-
- lib/graphql/language/
|
378
|
+
- lib/graphql/language/static_visitor.rb
|
352
379
|
- lib/graphql/language/visitor.rb
|
353
380
|
- lib/graphql/load_application_object_failed_error.rb
|
354
381
|
- lib/graphql/name_validator.rb
|
@@ -363,6 +390,7 @@ files:
|
|
363
390
|
- lib/graphql/parse_error.rb
|
364
391
|
- lib/graphql/query.rb
|
365
392
|
- lib/graphql/query/context.rb
|
393
|
+
- lib/graphql/query/context/scoped_context.rb
|
366
394
|
- lib/graphql/query/fingerprint.rb
|
367
395
|
- lib/graphql/query/input_validation_result.rb
|
368
396
|
- lib/graphql/query/null_context.rb
|
@@ -382,8 +410,8 @@ files:
|
|
382
410
|
- lib/graphql/runtime_type_error.rb
|
383
411
|
- lib/graphql/schema.rb
|
384
412
|
- lib/graphql/schema/addition.rb
|
413
|
+
- lib/graphql/schema/always_visible.rb
|
385
414
|
- lib/graphql/schema/argument.rb
|
386
|
-
- lib/graphql/schema/base_64_bp.rb
|
387
415
|
- lib/graphql/schema/base_64_encoder.rb
|
388
416
|
- lib/graphql/schema/build_from_definition.rb
|
389
417
|
- lib/graphql/schema/build_from_definition/resolve_map.rb
|
@@ -394,7 +422,9 @@ files:
|
|
394
422
|
- lib/graphql/schema/directive/feature.rb
|
395
423
|
- lib/graphql/schema/directive/flagged.rb
|
396
424
|
- lib/graphql/schema/directive/include.rb
|
425
|
+
- lib/graphql/schema/directive/one_of.rb
|
397
426
|
- lib/graphql/schema/directive/skip.rb
|
427
|
+
- lib/graphql/schema/directive/specified_by.rb
|
398
428
|
- lib/graphql/schema/directive/transform.rb
|
399
429
|
- lib/graphql/schema/enum.rb
|
400
430
|
- lib/graphql/schema/enum_value.rb
|
@@ -404,10 +434,10 @@ files:
|
|
404
434
|
- lib/graphql/schema/field_extension.rb
|
405
435
|
- lib/graphql/schema/find_inherited_value.rb
|
406
436
|
- lib/graphql/schema/finder.rb
|
437
|
+
- lib/graphql/schema/has_single_input_argument.rb
|
407
438
|
- lib/graphql/schema/input_object.rb
|
408
439
|
- lib/graphql/schema/interface.rb
|
409
440
|
- lib/graphql/schema/introspection_system.rb
|
410
|
-
- lib/graphql/schema/invalid_type_error.rb
|
411
441
|
- lib/graphql/schema/late_bound_type.rb
|
412
442
|
- lib/graphql/schema/list.rb
|
413
443
|
- lib/graphql/schema/loader.rb
|
@@ -438,12 +468,14 @@ files:
|
|
438
468
|
- lib/graphql/schema/resolver/has_payload_type.rb
|
439
469
|
- lib/graphql/schema/scalar.rb
|
440
470
|
- lib/graphql/schema/subscription.rb
|
471
|
+
- lib/graphql/schema/subset.rb
|
441
472
|
- lib/graphql/schema/timeout.rb
|
442
473
|
- lib/graphql/schema/type_expression.rb
|
443
474
|
- lib/graphql/schema/type_membership.rb
|
444
475
|
- lib/graphql/schema/union.rb
|
445
476
|
- lib/graphql/schema/unique_within_type.rb
|
446
477
|
- lib/graphql/schema/validator.rb
|
478
|
+
- lib/graphql/schema/validator/all_validator.rb
|
447
479
|
- lib/graphql/schema/validator/allow_blank_validator.rb
|
448
480
|
- lib/graphql/schema/validator/allow_null_validator.rb
|
449
481
|
- lib/graphql/schema/validator/exclusion_validator.rb
|
@@ -497,6 +529,8 @@ files:
|
|
497
529
|
- lib/graphql/static_validation/rules/mutation_root_exists_error.rb
|
498
530
|
- lib/graphql/static_validation/rules/no_definitions_are_present.rb
|
499
531
|
- lib/graphql/static_validation/rules/no_definitions_are_present_error.rb
|
532
|
+
- lib/graphql/static_validation/rules/one_of_input_objects_are_valid.rb
|
533
|
+
- lib/graphql/static_validation/rules/one_of_input_objects_are_valid_error.rb
|
500
534
|
- lib/graphql/static_validation/rules/operation_names_are_valid.rb
|
501
535
|
- lib/graphql/static_validation/rules/operation_names_are_valid_error.rb
|
502
536
|
- lib/graphql/static_validation/rules/query_root_exists.rb
|
@@ -519,7 +553,6 @@ files:
|
|
519
553
|
- lib/graphql/static_validation/rules/variables_are_input_types_error.rb
|
520
554
|
- lib/graphql/static_validation/rules/variables_are_used_and_defined.rb
|
521
555
|
- lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb
|
522
|
-
- lib/graphql/static_validation/type_stack.rb
|
523
556
|
- lib/graphql/static_validation/validation_context.rb
|
524
557
|
- lib/graphql/static_validation/validation_timeout_error.rb
|
525
558
|
- lib/graphql/static_validation/validator.rb
|
@@ -529,20 +562,35 @@ files:
|
|
529
562
|
- lib/graphql/subscriptions/broadcast_analyzer.rb
|
530
563
|
- lib/graphql/subscriptions/default_subscription_resolve_extension.rb
|
531
564
|
- lib/graphql/subscriptions/event.rb
|
532
|
-
- lib/graphql/subscriptions/instrumentation.rb
|
533
565
|
- lib/graphql/subscriptions/serialize.rb
|
566
|
+
- lib/graphql/testing.rb
|
567
|
+
- lib/graphql/testing/helpers.rb
|
534
568
|
- lib/graphql/tracing.rb
|
569
|
+
- lib/graphql/tracing/active_support_notifications_trace.rb
|
535
570
|
- lib/graphql/tracing/active_support_notifications_tracing.rb
|
571
|
+
- lib/graphql/tracing/appoptics_trace.rb
|
536
572
|
- lib/graphql/tracing/appoptics_tracing.rb
|
573
|
+
- lib/graphql/tracing/appsignal_trace.rb
|
537
574
|
- lib/graphql/tracing/appsignal_tracing.rb
|
575
|
+
- lib/graphql/tracing/data_dog_trace.rb
|
538
576
|
- lib/graphql/tracing/data_dog_tracing.rb
|
577
|
+
- lib/graphql/tracing/legacy_hooks_trace.rb
|
578
|
+
- lib/graphql/tracing/legacy_trace.rb
|
579
|
+
- lib/graphql/tracing/new_relic_trace.rb
|
539
580
|
- lib/graphql/tracing/new_relic_tracing.rb
|
581
|
+
- lib/graphql/tracing/notifications_trace.rb
|
540
582
|
- lib/graphql/tracing/notifications_tracing.rb
|
583
|
+
- lib/graphql/tracing/platform_trace.rb
|
541
584
|
- lib/graphql/tracing/platform_tracing.rb
|
585
|
+
- lib/graphql/tracing/prometheus_trace.rb
|
586
|
+
- lib/graphql/tracing/prometheus_trace/graphql_collector.rb
|
542
587
|
- lib/graphql/tracing/prometheus_tracing.rb
|
543
|
-
- lib/graphql/tracing/
|
588
|
+
- lib/graphql/tracing/scout_trace.rb
|
544
589
|
- lib/graphql/tracing/scout_tracing.rb
|
590
|
+
- lib/graphql/tracing/sentry_trace.rb
|
591
|
+
- lib/graphql/tracing/statsd_trace.rb
|
545
592
|
- lib/graphql/tracing/statsd_tracing.rb
|
593
|
+
- lib/graphql/tracing/trace.rb
|
546
594
|
- lib/graphql/type_kinds.rb
|
547
595
|
- lib/graphql/types.rb
|
548
596
|
- lib/graphql/types/big_int.rb
|
@@ -552,12 +600,12 @@ files:
|
|
552
600
|
- lib/graphql/types/int.rb
|
553
601
|
- lib/graphql/types/iso_8601_date.rb
|
554
602
|
- lib/graphql/types/iso_8601_date_time.rb
|
603
|
+
- lib/graphql/types/iso_8601_duration.rb
|
555
604
|
- lib/graphql/types/json.rb
|
556
605
|
- lib/graphql/types/relay.rb
|
557
606
|
- lib/graphql/types/relay/base_connection.rb
|
558
607
|
- lib/graphql/types/relay/base_edge.rb
|
559
608
|
- lib/graphql/types/relay/connection_behaviors.rb
|
560
|
-
- lib/graphql/types/relay/default_relay.rb
|
561
609
|
- lib/graphql/types/relay/edge_behaviors.rb
|
562
610
|
- lib/graphql/types/relay/has_node_field.rb
|
563
611
|
- lib/graphql/types/relay/has_nodes_field.rb
|
@@ -579,7 +627,8 @@ metadata:
|
|
579
627
|
changelog_uri: https://github.com/rmosolgo/graphql-ruby/blob/master/CHANGELOG.md
|
580
628
|
source_code_uri: https://github.com/rmosolgo/graphql-ruby
|
581
629
|
bug_tracker_uri: https://github.com/rmosolgo/graphql-ruby/issues
|
582
|
-
mailing_list_uri: https://
|
630
|
+
mailing_list_uri: https://buttondown.email/graphql-ruby
|
631
|
+
rubygems_mfa_required: 'true'
|
583
632
|
post_install_message:
|
584
633
|
rdoc_options: []
|
585
634
|
require_paths:
|
@@ -588,14 +637,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
588
637
|
requirements:
|
589
638
|
- - ">="
|
590
639
|
- !ruby/object:Gem::Version
|
591
|
-
version: 2.
|
640
|
+
version: 2.7.0
|
592
641
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
593
642
|
requirements:
|
594
643
|
- - ">="
|
595
644
|
- !ruby/object:Gem::Version
|
596
645
|
version: '0'
|
597
646
|
requirements: []
|
598
|
-
rubygems_version: 3.
|
647
|
+
rubygems_version: 3.5.12
|
599
648
|
signing_key:
|
600
649
|
specification_version: 4
|
601
650
|
summary: A GraphQL language and runtime for Ruby
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module GraphQL
|
3
|
-
module Analysis
|
4
|
-
module AST
|
5
|
-
# Query analyzer for query ASTs. Query analyzers respond to visitor style methods
|
6
|
-
# but are prefixed by `enter` and `leave`.
|
7
|
-
#
|
8
|
-
# When an analyzer is initialized with a Multiplex, you can always get the current query from
|
9
|
-
# `visitor.query` in the visit methods.
|
10
|
-
#
|
11
|
-
# @param [GraphQL::Query, GraphQL::Execution::Multiplex] The query or multiplex to analyze
|
12
|
-
class Analyzer
|
13
|
-
def initialize(subject)
|
14
|
-
@subject = subject
|
15
|
-
|
16
|
-
if subject.is_a?(GraphQL::Query)
|
17
|
-
@query = subject
|
18
|
-
@multiplex = nil
|
19
|
-
else
|
20
|
-
@multiplex = subject
|
21
|
-
@query = nil
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Analyzer hook to decide at analysis time whether a query should
|
26
|
-
# be analyzed or not.
|
27
|
-
# @return [Boolean] If the query should be analyzed or not
|
28
|
-
def analyze?
|
29
|
-
true
|
30
|
-
end
|
31
|
-
|
32
|
-
# The result for this analyzer. Returning {GraphQL::AnalysisError} results
|
33
|
-
# in a query error.
|
34
|
-
# @return [Any] The analyzer result
|
35
|
-
def result
|
36
|
-
raise GraphQL::RequiredImplementationMissingError
|
37
|
-
end
|
38
|
-
|
39
|
-
class << self
|
40
|
-
private
|
41
|
-
|
42
|
-
def build_visitor_hooks(member_name)
|
43
|
-
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
44
|
-
def on_enter_#{member_name}(node, parent, visitor)
|
45
|
-
end
|
46
|
-
|
47
|
-
def on_leave_#{member_name}(node, parent, visitor)
|
48
|
-
end
|
49
|
-
EOS
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
build_visitor_hooks :argument
|
54
|
-
build_visitor_hooks :directive
|
55
|
-
build_visitor_hooks :document
|
56
|
-
build_visitor_hooks :enum
|
57
|
-
build_visitor_hooks :field
|
58
|
-
build_visitor_hooks :fragment_spread
|
59
|
-
build_visitor_hooks :inline_fragment
|
60
|
-
build_visitor_hooks :input_object
|
61
|
-
build_visitor_hooks :list_type
|
62
|
-
build_visitor_hooks :non_null_type
|
63
|
-
build_visitor_hooks :null_value
|
64
|
-
build_visitor_hooks :operation_definition
|
65
|
-
build_visitor_hooks :type_name
|
66
|
-
build_visitor_hooks :variable_definition
|
67
|
-
build_visitor_hooks :variable_identifier
|
68
|
-
build_visitor_hooks :abstract_node
|
69
|
-
|
70
|
-
protected
|
71
|
-
|
72
|
-
# @return [GraphQL::Query, GraphQL::Execution::Multiplex] Whatever this analyzer is analyzing
|
73
|
-
attr_reader :subject
|
74
|
-
|
75
|
-
# @return [GraphQL::Query, nil] `nil` if this analyzer is visiting a multiplex
|
76
|
-
# (When this is `nil`, use `visitor.query` inside visit methods to get the current query)
|
77
|
-
attr_reader :query
|
78
|
-
|
79
|
-
# @return [GraphQL::Execution::Multiplex, nil] `nil` if this analyzer is visiting a query
|
80
|
-
attr_reader :multiplex
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module GraphQL
|
3
|
-
module Analysis
|
4
|
-
module AST
|
5
|
-
class FieldUsage < Analyzer
|
6
|
-
def initialize(query)
|
7
|
-
super
|
8
|
-
@used_fields = Set.new
|
9
|
-
@used_deprecated_fields = Set.new
|
10
|
-
@used_deprecated_arguments = Set.new
|
11
|
-
end
|
12
|
-
|
13
|
-
def on_leave_field(node, parent, visitor)
|
14
|
-
field_defn = visitor.field_definition
|
15
|
-
field = "#{visitor.parent_type_definition.graphql_name}.#{field_defn.graphql_name}"
|
16
|
-
@used_fields << field
|
17
|
-
@used_deprecated_fields << field if field_defn.deprecation_reason
|
18
|
-
arguments = visitor.query.arguments_for(node, visitor.field_definition)
|
19
|
-
# If there was an error when preparing this argument object,
|
20
|
-
# then this might be an error or something:
|
21
|
-
if arguments.respond_to?(:argument_values)
|
22
|
-
extract_deprecated_arguments(arguments.argument_values)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def result
|
27
|
-
{
|
28
|
-
used_fields: @used_fields.to_a,
|
29
|
-
used_deprecated_fields: @used_deprecated_fields.to_a,
|
30
|
-
used_deprecated_arguments: @used_deprecated_arguments.to_a,
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def extract_deprecated_arguments(argument_values)
|
37
|
-
argument_values.each_pair do |_argument_name, argument|
|
38
|
-
if argument.definition.deprecation_reason
|
39
|
-
@used_deprecated_arguments << argument.definition.path
|
40
|
-
end
|
41
|
-
|
42
|
-
next if argument.value.nil?
|
43
|
-
|
44
|
-
if argument.definition.type.kind.input_object?
|
45
|
-
extract_deprecated_arguments(argument.value.arguments.argument_values) # rubocop:disable Development/ContextIsPassedCop -- runtime args instance
|
46
|
-
elsif argument.definition.type.list?
|
47
|
-
argument
|
48
|
-
.value
|
49
|
-
.select { |value| value.respond_to?(:arguments) }
|
50
|
-
.each { |value| extract_deprecated_arguments(value.arguments.argument_values) } # rubocop:disable Development/ContextIsPassedCop -- runtime args instance
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module GraphQL
|
3
|
-
module Analysis
|
4
|
-
module AST
|
5
|
-
# Used under the hood to implement complexity validation,
|
6
|
-
# see {Schema#max_complexity} and {Query#max_complexity}
|
7
|
-
class MaxQueryComplexity < QueryComplexity
|
8
|
-
def result
|
9
|
-
return if subject.max_complexity.nil?
|
10
|
-
|
11
|
-
total_complexity = max_possible_complexity
|
12
|
-
|
13
|
-
if total_complexity > subject.max_complexity
|
14
|
-
GraphQL::AnalysisError.new("Query has complexity of #{total_complexity}, which exceeds max complexity of #{subject.max_complexity}")
|
15
|
-
else
|
16
|
-
nil
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|