graphql 1.13.25 → 2.0.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/analysis/ast/query_complexity.rb +1 -1
- data/lib/graphql/analysis/ast/query_depth.rb +0 -1
- data/lib/graphql/analysis/ast/visitor.rb +1 -1
- data/lib/graphql/analysis/ast.rb +0 -10
- data/lib/graphql/analysis.rb +0 -7
- data/lib/graphql/backtrace/table.rb +0 -18
- data/lib/graphql/backtrace/tracer.rb +1 -2
- data/lib/graphql/backtrace.rb +2 -8
- data/lib/graphql/dig.rb +1 -1
- data/lib/graphql/execution/errors.rb +1 -9
- data/lib/graphql/execution/interpreter/runtime.rb +6 -13
- data/lib/graphql/execution/interpreter.rb +0 -22
- data/lib/graphql/execution/lazy.rb +1 -1
- data/lib/graphql/execution/lookahead.rb +6 -13
- data/lib/graphql/execution/multiplex.rb +50 -107
- data/lib/graphql/execution.rb +11 -3
- data/lib/graphql/introspection/directive_type.rb +2 -2
- data/lib/graphql/introspection/dynamic_fields.rb +3 -8
- data/lib/graphql/introspection/entry_points.rb +2 -15
- data/lib/graphql/introspection/field_type.rb +1 -1
- data/lib/graphql/introspection/schema_type.rb +2 -2
- data/lib/graphql/introspection/type_type.rb +5 -5
- data/lib/graphql/language/document_from_schema_definition.rb +0 -17
- data/lib/graphql/language/nodes.rb +0 -3
- data/lib/graphql/pagination/connections.rb +2 -28
- data/lib/graphql/pagination/relation_connection.rb +0 -2
- data/lib/graphql/query/context.rb +1 -185
- data/lib/graphql/query/input_validation_result.rb +0 -9
- data/lib/graphql/query/literal_input.rb +8 -13
- data/lib/graphql/query/validation_pipeline.rb +6 -34
- data/lib/graphql/query/variable_validation_error.rb +2 -2
- data/lib/graphql/query/variables.rb +8 -31
- data/lib/graphql/query.rb +5 -34
- data/lib/graphql/railtie.rb +0 -104
- data/lib/graphql/relay/range_add.rb +0 -4
- data/lib/graphql/relay.rb +0 -15
- data/lib/graphql/schema/addition.rb +1 -8
- data/lib/graphql/schema/argument.rb +6 -28
- data/lib/graphql/schema/build_from_definition.rb +7 -9
- data/lib/graphql/schema/directive.rb +1 -22
- data/lib/graphql/schema/enum.rb +3 -19
- data/lib/graphql/schema/enum_value.rb +1 -23
- data/lib/graphql/schema/field.rb +22 -221
- data/lib/graphql/schema/input_object.rb +17 -65
- data/lib/graphql/schema/interface.rb +1 -30
- data/lib/graphql/schema/introspection_system.rb +3 -8
- data/lib/graphql/schema/late_bound_type.rb +2 -2
- data/lib/graphql/schema/list.rb +3 -24
- data/lib/graphql/schema/loader.rb +0 -1
- data/lib/graphql/schema/member/base_dsl_methods.rb +1 -6
- data/lib/graphql/schema/member/build_type.rb +4 -6
- data/lib/graphql/schema/member/has_arguments.rb +16 -20
- data/lib/graphql/schema/member/has_fields.rb +3 -3
- data/lib/graphql/schema/member/has_interfaces.rb +1 -13
- data/lib/graphql/schema/member/validates_input.rb +2 -2
- data/lib/graphql/schema/member.rb +0 -6
- data/lib/graphql/schema/mutation.rb +0 -9
- data/lib/graphql/schema/non_null.rb +3 -9
- data/lib/graphql/schema/object.rb +0 -40
- data/lib/graphql/schema/relay_classic_mutation.rb +17 -28
- data/lib/graphql/schema/scalar.rb +1 -16
- data/lib/graphql/schema/union.rb +0 -16
- data/lib/graphql/schema/warden.rb +3 -12
- data/lib/graphql/schema/wrapper.rb +0 -5
- data/lib/graphql/schema.rb +106 -945
- data/lib/graphql/static_validation/base_visitor.rb +4 -21
- data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +12 -12
- data/lib/graphql/static_validation/validator.rb +2 -24
- data/lib/graphql/static_validation.rb +0 -2
- data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +38 -1
- data/lib/graphql/subscriptions/event.rb +1 -1
- data/lib/graphql/subscriptions/instrumentation.rb +0 -51
- data/lib/graphql/subscriptions.rb +4 -13
- data/lib/graphql/tracing/data_dog_tracing.rb +16 -20
- data/lib/graphql/tracing/platform_tracing.rb +4 -32
- data/lib/graphql/tracing.rb +0 -1
- data/lib/graphql/types/relay/connection_behaviors.rb +2 -6
- data/lib/graphql/types/relay/default_relay.rb +0 -10
- data/lib/graphql/types/relay/node_behaviors.rb +5 -1
- data/lib/graphql/types/relay.rb +0 -2
- data/lib/graphql/types/string.rb +1 -1
- data/lib/graphql/version.rb +1 -1
- data/lib/graphql.rb +1 -66
- metadata +28 -164
- data/lib/graphql/analysis/analyze_query.rb +0 -98
- data/lib/graphql/analysis/field_usage.rb +0 -45
- data/lib/graphql/analysis/max_query_complexity.rb +0 -26
- data/lib/graphql/analysis/max_query_depth.rb +0 -26
- data/lib/graphql/analysis/query_complexity.rb +0 -88
- data/lib/graphql/analysis/query_depth.rb +0 -43
- data/lib/graphql/analysis/reducer_state.rb +0 -48
- data/lib/graphql/argument.rb +0 -131
- data/lib/graphql/authorization.rb +0 -82
- data/lib/graphql/backtrace/legacy_tracer.rb +0 -56
- data/lib/graphql/backwards_compatibility.rb +0 -61
- data/lib/graphql/base_type.rb +0 -232
- data/lib/graphql/boolean_type.rb +0 -2
- data/lib/graphql/compatibility/execution_specification/counter_schema.rb +0 -53
- data/lib/graphql/compatibility/execution_specification/specification_schema.rb +0 -200
- data/lib/graphql/compatibility/execution_specification.rb +0 -436
- data/lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb +0 -111
- data/lib/graphql/compatibility/lazy_execution_specification.rb +0 -215
- data/lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb +0 -87
- data/lib/graphql/compatibility/query_parser_specification/query_assertions.rb +0 -79
- data/lib/graphql/compatibility/query_parser_specification.rb +0 -266
- data/lib/graphql/compatibility/schema_parser_specification.rb +0 -682
- data/lib/graphql/compatibility.rb +0 -5
- data/lib/graphql/define/assign_argument.rb +0 -12
- data/lib/graphql/define/assign_connection.rb +0 -13
- data/lib/graphql/define/assign_enum_value.rb +0 -18
- data/lib/graphql/define/assign_global_id_field.rb +0 -11
- data/lib/graphql/define/assign_mutation_function.rb +0 -34
- data/lib/graphql/define/assign_object_field.rb +0 -42
- data/lib/graphql/define/defined_object_proxy.rb +0 -53
- data/lib/graphql/define/instance_definable.rb +0 -255
- data/lib/graphql/define/no_definition_error.rb +0 -7
- data/lib/graphql/define/non_null_with_bang.rb +0 -16
- data/lib/graphql/define/type_definer.rb +0 -31
- data/lib/graphql/define.rb +0 -31
- data/lib/graphql/deprecated_dsl.rb +0 -55
- data/lib/graphql/directive/deprecated_directive.rb +0 -2
- data/lib/graphql/directive/include_directive.rb +0 -2
- data/lib/graphql/directive/skip_directive.rb +0 -2
- data/lib/graphql/directive.rb +0 -107
- data/lib/graphql/enum_type.rb +0 -133
- data/lib/graphql/execution/execute.rb +0 -333
- data/lib/graphql/execution/flatten.rb +0 -40
- data/lib/graphql/execution/typecast.rb +0 -50
- data/lib/graphql/field/resolve.rb +0 -59
- data/lib/graphql/field.rb +0 -226
- data/lib/graphql/float_type.rb +0 -2
- data/lib/graphql/function.rb +0 -128
- data/lib/graphql/id_type.rb +0 -2
- data/lib/graphql/input_object_type.rb +0 -138
- data/lib/graphql/int_type.rb +0 -2
- data/lib/graphql/interface_type.rb +0 -72
- data/lib/graphql/internal_representation/document.rb +0 -27
- data/lib/graphql/internal_representation/node.rb +0 -206
- data/lib/graphql/internal_representation/print.rb +0 -51
- data/lib/graphql/internal_representation/rewrite.rb +0 -184
- data/lib/graphql/internal_representation/scope.rb +0 -88
- data/lib/graphql/internal_representation/visit.rb +0 -36
- data/lib/graphql/internal_representation.rb +0 -7
- data/lib/graphql/list_type.rb +0 -80
- data/lib/graphql/non_null_type.rb +0 -71
- data/lib/graphql/object_type.rb +0 -130
- data/lib/graphql/query/arguments.rb +0 -189
- data/lib/graphql/query/arguments_cache.rb +0 -24
- data/lib/graphql/query/executor.rb +0 -52
- data/lib/graphql/query/serial_execution/field_resolution.rb +0 -92
- data/lib/graphql/query/serial_execution/operation_resolution.rb +0 -19
- data/lib/graphql/query/serial_execution/selection_resolution.rb +0 -23
- data/lib/graphql/query/serial_execution/value_resolution.rb +0 -87
- data/lib/graphql/query/serial_execution.rb +0 -40
- data/lib/graphql/relay/array_connection.rb +0 -83
- data/lib/graphql/relay/base_connection.rb +0 -189
- data/lib/graphql/relay/connection_instrumentation.rb +0 -54
- data/lib/graphql/relay/connection_resolve.rb +0 -43
- data/lib/graphql/relay/connection_type.rb +0 -54
- data/lib/graphql/relay/edge.rb +0 -27
- data/lib/graphql/relay/edge_type.rb +0 -19
- data/lib/graphql/relay/edges_instrumentation.rb +0 -39
- data/lib/graphql/relay/global_id_resolve.rb +0 -17
- data/lib/graphql/relay/mongo_relation_connection.rb +0 -50
- data/lib/graphql/relay/mutation/instrumentation.rb +0 -23
- data/lib/graphql/relay/mutation/resolve.rb +0 -56
- data/lib/graphql/relay/mutation/result.rb +0 -38
- data/lib/graphql/relay/mutation.rb +0 -106
- data/lib/graphql/relay/node.rb +0 -39
- data/lib/graphql/relay/page_info.rb +0 -7
- data/lib/graphql/relay/relation_connection.rb +0 -188
- data/lib/graphql/relay/type_extensions.rb +0 -32
- data/lib/graphql/scalar_type.rb +0 -91
- data/lib/graphql/schema/catchall_middleware.rb +0 -35
- data/lib/graphql/schema/default_parse_error.rb +0 -10
- data/lib/graphql/schema/default_type_error.rb +0 -17
- data/lib/graphql/schema/member/accepts_definition.rb +0 -164
- data/lib/graphql/schema/member/cached_graphql_definition.rb +0 -58
- data/lib/graphql/schema/member/instrumentation.rb +0 -131
- data/lib/graphql/schema/middleware_chain.rb +0 -82
- data/lib/graphql/schema/possible_types.rb +0 -44
- data/lib/graphql/schema/rescue_middleware.rb +0 -60
- data/lib/graphql/schema/timeout_middleware.rb +0 -88
- data/lib/graphql/schema/traversal.rb +0 -228
- data/lib/graphql/schema/validation.rb +0 -313
- data/lib/graphql/static_validation/default_visitor.rb +0 -15
- data/lib/graphql/static_validation/no_validate_visitor.rb +0 -10
- data/lib/graphql/string_type.rb +0 -2
- data/lib/graphql/subscriptions/subscription_root.rb +0 -76
- data/lib/graphql/tracing/skylight_tracing.rb +0 -70
- data/lib/graphql/types/relay/node_field.rb +0 -24
- data/lib/graphql/types/relay/nodes_field.rb +0 -43
- data/lib/graphql/union_type.rb +0 -115
- data/lib/graphql/upgrader/member.rb +0 -937
- data/lib/graphql/upgrader/schema.rb +0 -38
data/lib/graphql.rb
CHANGED
@@ -4,7 +4,6 @@ require "json"
|
|
4
4
|
require "set"
|
5
5
|
require "singleton"
|
6
6
|
require "forwardable"
|
7
|
-
require "ostruct"
|
8
7
|
|
9
8
|
module GraphQL
|
10
9
|
# forwards-compat for argument handling
|
@@ -82,27 +81,8 @@ require "graphql/integer_decoding_error"
|
|
82
81
|
require "graphql/integer_encoding_error"
|
83
82
|
require "graphql/string_encoding_error"
|
84
83
|
require "graphql/date_encoding_error"
|
85
|
-
|
86
|
-
require "graphql/define"
|
87
|
-
require "graphql/deprecation"
|
88
|
-
require "graphql/base_type"
|
89
|
-
require "graphql/object_type"
|
90
|
-
require "graphql/enum_type"
|
91
|
-
require "graphql/input_object_type"
|
92
|
-
require "graphql/interface_type"
|
93
|
-
require "graphql/list_type"
|
94
|
-
require "graphql/non_null_type"
|
95
|
-
require "graphql/union_type"
|
96
|
-
|
97
|
-
require "graphql/argument"
|
98
|
-
require "graphql/field"
|
99
84
|
require "graphql/type_kinds"
|
100
|
-
|
101
|
-
require "graphql/backwards_compatibility"
|
102
|
-
require "graphql/scalar_type"
|
103
|
-
|
104
85
|
require "graphql/name_validator"
|
105
|
-
|
106
86
|
require "graphql/language"
|
107
87
|
|
108
88
|
require_relative "./graphql/railtie" if defined? Rails::Railtie
|
@@ -117,15 +97,8 @@ require "graphql/query"
|
|
117
97
|
require "graphql/types"
|
118
98
|
require "graphql/dataloader"
|
119
99
|
require "graphql/filter"
|
120
|
-
require "graphql/internal_representation"
|
121
|
-
require "graphql/directive"
|
122
100
|
require "graphql/static_validation"
|
123
101
|
require "graphql/execution"
|
124
|
-
require "graphql/boolean_type"
|
125
|
-
require "graphql/float_type"
|
126
|
-
require "graphql/id_type"
|
127
|
-
require "graphql/int_type"
|
128
|
-
require "graphql/string_type"
|
129
102
|
require "graphql/schema/built_in_types"
|
130
103
|
require "graphql/schema/loader"
|
131
104
|
require "graphql/schema/printer"
|
@@ -133,49 +106,11 @@ require "graphql/introspection"
|
|
133
106
|
require "graphql/relay"
|
134
107
|
|
135
108
|
require "graphql/version"
|
136
|
-
require "graphql/compatibility"
|
137
|
-
require "graphql/function"
|
138
109
|
require "graphql/subscriptions"
|
139
110
|
require "graphql/parse_error"
|
140
111
|
require "graphql/backtrace"
|
141
112
|
|
142
|
-
require "graphql/deprecated_dsl"
|
143
|
-
require "graphql/authorization"
|
144
113
|
require "graphql/unauthorized_error"
|
145
114
|
require "graphql/unauthorized_field_error"
|
146
115
|
require "graphql/load_application_object_failed_error"
|
147
|
-
require "graphql/
|
148
|
-
require "graphql/directive/skip_directive"
|
149
|
-
require "graphql/directive/deprecated_directive"
|
150
|
-
|
151
|
-
module GraphQL
|
152
|
-
# Ruby has `deprecate_constant`,
|
153
|
-
# but I don't see a way to give a nice error message in that case,
|
154
|
-
# so I'm doing this instead.
|
155
|
-
DEPRECATED_INT_TYPE = INT_TYPE
|
156
|
-
DEPRECATED_FLOAT_TYPE = FLOAT_TYPE
|
157
|
-
DEPRECATED_STRING_TYPE = STRING_TYPE
|
158
|
-
DEPRECATED_BOOLEAN_TYPE = BOOLEAN_TYPE
|
159
|
-
DEPRECATED_ID_TYPE = ID_TYPE
|
160
|
-
|
161
|
-
remove_const :INT_TYPE
|
162
|
-
remove_const :FLOAT_TYPE
|
163
|
-
remove_const :STRING_TYPE
|
164
|
-
remove_const :BOOLEAN_TYPE
|
165
|
-
remove_const :ID_TYPE
|
166
|
-
|
167
|
-
def self.const_missing(const_name)
|
168
|
-
deprecated_const_name = :"DEPRECATED_#{const_name}"
|
169
|
-
if const_defined?(deprecated_const_name)
|
170
|
-
deprecated_type = const_get(deprecated_const_name)
|
171
|
-
deprecated_caller = caller(1, 1).first
|
172
|
-
# Don't warn about internal uses, like `types.Int`
|
173
|
-
if !deprecated_caller.include?("lib/graphql")
|
174
|
-
warn "GraphQL::#{const_name} is deprecated and will be removed in GraphQL-Ruby 2.0, use GraphQL::Types::#{deprecated_type.graphql_name} instead. (from #{deprecated_caller})"
|
175
|
-
end
|
176
|
-
deprecated_type
|
177
|
-
else
|
178
|
-
super
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
116
|
+
require "graphql/deprecation"
|
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:
|
4
|
+
version: 2.0.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: 2022-02-09 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
|
@@ -69,72 +56,72 @@ dependencies:
|
|
69
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
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
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
|
-
name: rake
|
112
|
+
name: rake
|
126
113
|
requirement: !ruby/object:Gem::Requirement
|
127
114
|
requirements:
|
128
|
-
- - "
|
115
|
+
- - "~>"
|
129
116
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
117
|
+
version: '12'
|
131
118
|
type: :development
|
132
119
|
prerelease: false
|
133
120
|
version_requirements: !ruby/object:Gem::Requirement
|
134
121
|
requirements:
|
135
|
-
- - "
|
122
|
+
- - "~>"
|
136
123
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
124
|
+
version: '12'
|
138
125
|
- !ruby/object:Gem::Dependency
|
139
126
|
name: rubocop
|
140
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,20 +136,6 @@ dependencies:
|
|
149
136
|
- - '='
|
150
137
|
- !ruby/object:Gem::Version
|
151
138
|
version: '1.12'
|
152
|
-
- !ruby/object:Gem::Dependency
|
153
|
-
name: parser
|
154
|
-
requirement: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - ">="
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '0'
|
159
|
-
type: :development
|
160
|
-
prerelease: false
|
161
|
-
version_requirements: !ruby/object:Gem::Requirement
|
162
|
-
requirements:
|
163
|
-
- - ">="
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
166
139
|
- !ruby/object:Gem::Dependency
|
167
140
|
name: jekyll
|
168
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -304,7 +277,6 @@ files:
|
|
304
277
|
- lib/generators/graphql/union_generator.rb
|
305
278
|
- lib/graphql.rb
|
306
279
|
- lib/graphql/analysis.rb
|
307
|
-
- lib/graphql/analysis/analyze_query.rb
|
308
280
|
- lib/graphql/analysis/ast.rb
|
309
281
|
- lib/graphql/analysis/ast/analyzer.rb
|
310
282
|
- lib/graphql/analysis/ast/field_usage.rb
|
@@ -313,66 +285,24 @@ files:
|
|
313
285
|
- lib/graphql/analysis/ast/query_complexity.rb
|
314
286
|
- lib/graphql/analysis/ast/query_depth.rb
|
315
287
|
- lib/graphql/analysis/ast/visitor.rb
|
316
|
-
- lib/graphql/analysis/field_usage.rb
|
317
|
-
- lib/graphql/analysis/max_query_complexity.rb
|
318
|
-
- lib/graphql/analysis/max_query_depth.rb
|
319
|
-
- lib/graphql/analysis/query_complexity.rb
|
320
|
-
- lib/graphql/analysis/query_depth.rb
|
321
|
-
- lib/graphql/analysis/reducer_state.rb
|
322
288
|
- lib/graphql/analysis_error.rb
|
323
|
-
- lib/graphql/argument.rb
|
324
|
-
- lib/graphql/authorization.rb
|
325
289
|
- lib/graphql/backtrace.rb
|
326
290
|
- lib/graphql/backtrace/inspect_result.rb
|
327
|
-
- lib/graphql/backtrace/legacy_tracer.rb
|
328
291
|
- lib/graphql/backtrace/table.rb
|
329
292
|
- lib/graphql/backtrace/traced_error.rb
|
330
293
|
- lib/graphql/backtrace/tracer.rb
|
331
|
-
- lib/graphql/backwards_compatibility.rb
|
332
|
-
- lib/graphql/base_type.rb
|
333
|
-
- lib/graphql/boolean_type.rb
|
334
294
|
- lib/graphql/coercion_error.rb
|
335
|
-
- lib/graphql/compatibility.rb
|
336
|
-
- lib/graphql/compatibility/execution_specification.rb
|
337
|
-
- lib/graphql/compatibility/execution_specification/counter_schema.rb
|
338
|
-
- lib/graphql/compatibility/execution_specification/specification_schema.rb
|
339
|
-
- lib/graphql/compatibility/lazy_execution_specification.rb
|
340
|
-
- lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb
|
341
|
-
- lib/graphql/compatibility/query_parser_specification.rb
|
342
|
-
- lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb
|
343
|
-
- lib/graphql/compatibility/query_parser_specification/query_assertions.rb
|
344
|
-
- lib/graphql/compatibility/schema_parser_specification.rb
|
345
295
|
- lib/graphql/dataloader.rb
|
346
296
|
- lib/graphql/dataloader/null_dataloader.rb
|
347
297
|
- lib/graphql/dataloader/request.rb
|
348
298
|
- lib/graphql/dataloader/request_all.rb
|
349
299
|
- lib/graphql/dataloader/source.rb
|
350
300
|
- lib/graphql/date_encoding_error.rb
|
351
|
-
- lib/graphql/define.rb
|
352
|
-
- lib/graphql/define/assign_argument.rb
|
353
|
-
- lib/graphql/define/assign_connection.rb
|
354
|
-
- lib/graphql/define/assign_enum_value.rb
|
355
|
-
- lib/graphql/define/assign_global_id_field.rb
|
356
|
-
- lib/graphql/define/assign_mutation_function.rb
|
357
|
-
- lib/graphql/define/assign_object_field.rb
|
358
|
-
- lib/graphql/define/defined_object_proxy.rb
|
359
|
-
- lib/graphql/define/instance_definable.rb
|
360
|
-
- lib/graphql/define/no_definition_error.rb
|
361
|
-
- lib/graphql/define/non_null_with_bang.rb
|
362
|
-
- lib/graphql/define/type_definer.rb
|
363
|
-
- lib/graphql/deprecated_dsl.rb
|
364
301
|
- lib/graphql/deprecation.rb
|
365
302
|
- lib/graphql/dig.rb
|
366
|
-
- lib/graphql/directive.rb
|
367
|
-
- lib/graphql/directive/deprecated_directive.rb
|
368
|
-
- lib/graphql/directive/include_directive.rb
|
369
|
-
- lib/graphql/directive/skip_directive.rb
|
370
|
-
- lib/graphql/enum_type.rb
|
371
303
|
- lib/graphql/execution.rb
|
372
304
|
- lib/graphql/execution/directive_checks.rb
|
373
305
|
- lib/graphql/execution/errors.rb
|
374
|
-
- lib/graphql/execution/execute.rb
|
375
|
-
- lib/graphql/execution/flatten.rb
|
376
306
|
- lib/graphql/execution/instrumentation.rb
|
377
307
|
- lib/graphql/execution/interpreter.rb
|
378
308
|
- lib/graphql/execution/interpreter/argument_value.rb
|
@@ -387,26 +317,10 @@ files:
|
|
387
317
|
- lib/graphql/execution/lazy/resolve.rb
|
388
318
|
- lib/graphql/execution/lookahead.rb
|
389
319
|
- lib/graphql/execution/multiplex.rb
|
390
|
-
- lib/graphql/execution/typecast.rb
|
391
320
|
- lib/graphql/execution_error.rb
|
392
|
-
- lib/graphql/field.rb
|
393
|
-
- lib/graphql/field/resolve.rb
|
394
321
|
- lib/graphql/filter.rb
|
395
|
-
- lib/graphql/float_type.rb
|
396
|
-
- lib/graphql/function.rb
|
397
|
-
- lib/graphql/id_type.rb
|
398
|
-
- lib/graphql/input_object_type.rb
|
399
|
-
- lib/graphql/int_type.rb
|
400
322
|
- lib/graphql/integer_decoding_error.rb
|
401
323
|
- lib/graphql/integer_encoding_error.rb
|
402
|
-
- lib/graphql/interface_type.rb
|
403
|
-
- lib/graphql/internal_representation.rb
|
404
|
-
- lib/graphql/internal_representation/document.rb
|
405
|
-
- lib/graphql/internal_representation/node.rb
|
406
|
-
- lib/graphql/internal_representation/print.rb
|
407
|
-
- lib/graphql/internal_representation/rewrite.rb
|
408
|
-
- lib/graphql/internal_representation/scope.rb
|
409
|
-
- lib/graphql/internal_representation/visit.rb
|
410
324
|
- lib/graphql/introspection.rb
|
411
325
|
- lib/graphql/introspection/base_object.rb
|
412
326
|
- lib/graphql/introspection/directive_location_enum.rb
|
@@ -437,11 +351,8 @@ files:
|
|
437
351
|
- lib/graphql/language/sanitized_printer.rb
|
438
352
|
- lib/graphql/language/token.rb
|
439
353
|
- lib/graphql/language/visitor.rb
|
440
|
-
- lib/graphql/list_type.rb
|
441
354
|
- lib/graphql/load_application_object_failed_error.rb
|
442
355
|
- lib/graphql/name_validator.rb
|
443
|
-
- lib/graphql/non_null_type.rb
|
444
|
-
- lib/graphql/object_type.rb
|
445
356
|
- lib/graphql/pagination.rb
|
446
357
|
- lib/graphql/pagination/active_record_relation_connection.rb
|
447
358
|
- lib/graphql/pagination/array_connection.rb
|
@@ -452,20 +363,12 @@ files:
|
|
452
363
|
- lib/graphql/pagination/sequel_dataset_connection.rb
|
453
364
|
- lib/graphql/parse_error.rb
|
454
365
|
- lib/graphql/query.rb
|
455
|
-
- lib/graphql/query/arguments.rb
|
456
|
-
- lib/graphql/query/arguments_cache.rb
|
457
366
|
- lib/graphql/query/context.rb
|
458
|
-
- lib/graphql/query/executor.rb
|
459
367
|
- lib/graphql/query/fingerprint.rb
|
460
368
|
- lib/graphql/query/input_validation_result.rb
|
461
369
|
- lib/graphql/query/literal_input.rb
|
462
370
|
- lib/graphql/query/null_context.rb
|
463
371
|
- lib/graphql/query/result.rb
|
464
|
-
- lib/graphql/query/serial_execution.rb
|
465
|
-
- lib/graphql/query/serial_execution/field_resolution.rb
|
466
|
-
- lib/graphql/query/serial_execution/operation_resolution.rb
|
467
|
-
- lib/graphql/query/serial_execution/selection_resolution.rb
|
468
|
-
- lib/graphql/query/serial_execution/value_resolution.rb
|
469
372
|
- lib/graphql/query/validation_pipeline.rb
|
470
373
|
- lib/graphql/query/variable_validation_error.rb
|
471
374
|
- lib/graphql/query/variables.rb
|
@@ -473,31 +376,12 @@ files:
|
|
473
376
|
- lib/graphql/rake_task.rb
|
474
377
|
- lib/graphql/rake_task/validate.rb
|
475
378
|
- lib/graphql/relay.rb
|
476
|
-
- lib/graphql/relay/array_connection.rb
|
477
|
-
- lib/graphql/relay/base_connection.rb
|
478
|
-
- lib/graphql/relay/connection_instrumentation.rb
|
479
|
-
- lib/graphql/relay/connection_resolve.rb
|
480
|
-
- lib/graphql/relay/connection_type.rb
|
481
|
-
- lib/graphql/relay/edge.rb
|
482
|
-
- lib/graphql/relay/edge_type.rb
|
483
|
-
- lib/graphql/relay/edges_instrumentation.rb
|
484
|
-
- lib/graphql/relay/global_id_resolve.rb
|
485
|
-
- lib/graphql/relay/mongo_relation_connection.rb
|
486
|
-
- lib/graphql/relay/mutation.rb
|
487
|
-
- lib/graphql/relay/mutation/instrumentation.rb
|
488
|
-
- lib/graphql/relay/mutation/resolve.rb
|
489
|
-
- lib/graphql/relay/mutation/result.rb
|
490
|
-
- lib/graphql/relay/node.rb
|
491
|
-
- lib/graphql/relay/page_info.rb
|
492
379
|
- lib/graphql/relay/range_add.rb
|
493
|
-
- lib/graphql/relay/relation_connection.rb
|
494
|
-
- lib/graphql/relay/type_extensions.rb
|
495
380
|
- lib/graphql/rubocop.rb
|
496
381
|
- lib/graphql/rubocop/graphql/base_cop.rb
|
497
382
|
- lib/graphql/rubocop/graphql/default_null_true.rb
|
498
383
|
- lib/graphql/rubocop/graphql/default_required_true.rb
|
499
384
|
- lib/graphql/runtime_type_error.rb
|
500
|
-
- lib/graphql/scalar_type.rb
|
501
385
|
- lib/graphql/schema.rb
|
502
386
|
- lib/graphql/schema/addition.rb
|
503
387
|
- lib/graphql/schema/argument.rb
|
@@ -507,9 +391,6 @@ files:
|
|
507
391
|
- lib/graphql/schema/build_from_definition/resolve_map.rb
|
508
392
|
- lib/graphql/schema/build_from_definition/resolve_map/default_resolve.rb
|
509
393
|
- lib/graphql/schema/built_in_types.rb
|
510
|
-
- lib/graphql/schema/catchall_middleware.rb
|
511
|
-
- lib/graphql/schema/default_parse_error.rb
|
512
|
-
- lib/graphql/schema/default_type_error.rb
|
513
394
|
- lib/graphql/schema/directive.rb
|
514
395
|
- lib/graphql/schema/directive/deprecated.rb
|
515
396
|
- lib/graphql/schema/directive/feature.rb
|
@@ -533,10 +414,8 @@ files:
|
|
533
414
|
- lib/graphql/schema/list.rb
|
534
415
|
- lib/graphql/schema/loader.rb
|
535
416
|
- lib/graphql/schema/member.rb
|
536
|
-
- lib/graphql/schema/member/accepts_definition.rb
|
537
417
|
- lib/graphql/schema/member/base_dsl_methods.rb
|
538
418
|
- lib/graphql/schema/member/build_type.rb
|
539
|
-
- lib/graphql/schema/member/cached_graphql_definition.rb
|
540
419
|
- lib/graphql/schema/member/graphql_type_names.rb
|
541
420
|
- lib/graphql/schema/member/has_arguments.rb
|
542
421
|
- lib/graphql/schema/member/has_ast_node.rb
|
@@ -547,32 +426,25 @@ files:
|
|
547
426
|
- lib/graphql/schema/member/has_path.rb
|
548
427
|
- lib/graphql/schema/member/has_unresolved_type_error.rb
|
549
428
|
- lib/graphql/schema/member/has_validators.rb
|
550
|
-
- lib/graphql/schema/member/instrumentation.rb
|
551
429
|
- lib/graphql/schema/member/relay_shortcuts.rb
|
552
430
|
- lib/graphql/schema/member/scoped.rb
|
553
431
|
- lib/graphql/schema/member/type_system_helpers.rb
|
554
432
|
- lib/graphql/schema/member/validates_input.rb
|
555
|
-
- lib/graphql/schema/middleware_chain.rb
|
556
433
|
- lib/graphql/schema/mutation.rb
|
557
434
|
- lib/graphql/schema/non_null.rb
|
558
435
|
- lib/graphql/schema/null_mask.rb
|
559
436
|
- lib/graphql/schema/object.rb
|
560
|
-
- lib/graphql/schema/possible_types.rb
|
561
437
|
- lib/graphql/schema/printer.rb
|
562
438
|
- lib/graphql/schema/relay_classic_mutation.rb
|
563
|
-
- lib/graphql/schema/rescue_middleware.rb
|
564
439
|
- lib/graphql/schema/resolver.rb
|
565
440
|
- lib/graphql/schema/resolver/has_payload_type.rb
|
566
441
|
- lib/graphql/schema/scalar.rb
|
567
442
|
- lib/graphql/schema/subscription.rb
|
568
443
|
- lib/graphql/schema/timeout.rb
|
569
|
-
- lib/graphql/schema/timeout_middleware.rb
|
570
|
-
- lib/graphql/schema/traversal.rb
|
571
444
|
- lib/graphql/schema/type_expression.rb
|
572
445
|
- lib/graphql/schema/type_membership.rb
|
573
446
|
- lib/graphql/schema/union.rb
|
574
447
|
- lib/graphql/schema/unique_within_type.rb
|
575
|
-
- lib/graphql/schema/validation.rb
|
576
448
|
- lib/graphql/schema/validator.rb
|
577
449
|
- lib/graphql/schema/validator/allow_blank_validator.rb
|
578
450
|
- lib/graphql/schema/validator/allow_null_validator.rb
|
@@ -587,12 +459,10 @@ files:
|
|
587
459
|
- lib/graphql/static_validation.rb
|
588
460
|
- lib/graphql/static_validation/all_rules.rb
|
589
461
|
- lib/graphql/static_validation/base_visitor.rb
|
590
|
-
- lib/graphql/static_validation/default_visitor.rb
|
591
462
|
- lib/graphql/static_validation/definition_dependencies.rb
|
592
463
|
- lib/graphql/static_validation/error.rb
|
593
464
|
- lib/graphql/static_validation/interpreter_visitor.rb
|
594
465
|
- lib/graphql/static_validation/literal_validator.rb
|
595
|
-
- lib/graphql/static_validation/no_validate_visitor.rb
|
596
466
|
- lib/graphql/static_validation/rules/argument_literals_are_compatible.rb
|
597
467
|
- lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb
|
598
468
|
- lib/graphql/static_validation/rules/argument_names_are_unique.rb
|
@@ -656,7 +526,6 @@ files:
|
|
656
526
|
- lib/graphql/static_validation/validation_timeout_error.rb
|
657
527
|
- lib/graphql/static_validation/validator.rb
|
658
528
|
- lib/graphql/string_encoding_error.rb
|
659
|
-
- lib/graphql/string_type.rb
|
660
529
|
- lib/graphql/subscriptions.rb
|
661
530
|
- lib/graphql/subscriptions/action_cable_subscriptions.rb
|
662
531
|
- lib/graphql/subscriptions/broadcast_analyzer.rb
|
@@ -664,7 +533,6 @@ files:
|
|
664
533
|
- lib/graphql/subscriptions/event.rb
|
665
534
|
- lib/graphql/subscriptions/instrumentation.rb
|
666
535
|
- lib/graphql/subscriptions/serialize.rb
|
667
|
-
- lib/graphql/subscriptions/subscription_root.rb
|
668
536
|
- lib/graphql/tracing.rb
|
669
537
|
- lib/graphql/tracing/active_support_notifications_tracing.rb
|
670
538
|
- lib/graphql/tracing/appoptics_tracing.rb
|
@@ -676,7 +544,6 @@ files:
|
|
676
544
|
- lib/graphql/tracing/prometheus_tracing.rb
|
677
545
|
- lib/graphql/tracing/prometheus_tracing/graphql_collector.rb
|
678
546
|
- lib/graphql/tracing/scout_tracing.rb
|
679
|
-
- lib/graphql/tracing/skylight_tracing.rb
|
680
547
|
- lib/graphql/tracing/statsd_tracing.rb
|
681
548
|
- lib/graphql/type_kinds.rb
|
682
549
|
- lib/graphql/types.rb
|
@@ -698,17 +565,12 @@ files:
|
|
698
565
|
- lib/graphql/types/relay/has_nodes_field.rb
|
699
566
|
- lib/graphql/types/relay/node.rb
|
700
567
|
- lib/graphql/types/relay/node_behaviors.rb
|
701
|
-
- lib/graphql/types/relay/node_field.rb
|
702
|
-
- lib/graphql/types/relay/nodes_field.rb
|
703
568
|
- lib/graphql/types/relay/page_info.rb
|
704
569
|
- lib/graphql/types/relay/page_info_behaviors.rb
|
705
570
|
- lib/graphql/types/string.rb
|
706
571
|
- lib/graphql/unauthorized_error.rb
|
707
572
|
- lib/graphql/unauthorized_field_error.rb
|
708
|
-
- lib/graphql/union_type.rb
|
709
573
|
- lib/graphql/unresolved_type_error.rb
|
710
|
-
- lib/graphql/upgrader/member.rb
|
711
|
-
- lib/graphql/upgrader/schema.rb
|
712
574
|
- lib/graphql/version.rb
|
713
575
|
- readme.md
|
714
576
|
homepage: https://github.com/rmosolgo/graphql-ruby
|
@@ -720,6 +582,7 @@ metadata:
|
|
720
582
|
source_code_uri: https://github.com/rmosolgo/graphql-ruby
|
721
583
|
bug_tracker_uri: https://github.com/rmosolgo/graphql-ruby/issues
|
722
584
|
mailing_list_uri: https://tinyletter.com/graphql-ruby
|
585
|
+
post_install_message:
|
723
586
|
rdoc_options: []
|
724
587
|
require_paths:
|
725
588
|
- lib
|
@@ -734,7 +597,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
734
597
|
- !ruby/object:Gem::Version
|
735
598
|
version: '0'
|
736
599
|
requirements: []
|
737
|
-
rubygems_version: 3.
|
600
|
+
rubygems_version: 3.1.6
|
601
|
+
signing_key:
|
738
602
|
specification_version: 4
|
739
603
|
summary: A GraphQL language and runtime for Ruby
|
740
604
|
test_files: []
|
@@ -1,98 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module GraphQL
|
3
|
-
module Analysis
|
4
|
-
module_function
|
5
|
-
|
6
|
-
def use(schema_class)
|
7
|
-
schema = schema_class.is_a?(Class) ? schema_class : schema_class.target
|
8
|
-
schema.analysis_engine = self
|
9
|
-
end
|
10
|
-
|
11
|
-
# @return [void]
|
12
|
-
def analyze_multiplex(multiplex, analyzers)
|
13
|
-
multiplex.trace("analyze_multiplex", { multiplex: multiplex }) do
|
14
|
-
reducer_states = analyzers.map { |r| ReducerState.new(r, multiplex) }
|
15
|
-
query_results = multiplex.queries.map do |query|
|
16
|
-
if query.valid?
|
17
|
-
analyze_query(query, query.analyzers, multiplex_states: reducer_states)
|
18
|
-
else
|
19
|
-
[]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
multiplex_results = reducer_states.map(&:finalize_reducer)
|
24
|
-
multiplex_errors = analysis_errors(multiplex_results)
|
25
|
-
|
26
|
-
multiplex.queries.each_with_index do |query, idx|
|
27
|
-
query.analysis_errors = multiplex_errors + analysis_errors(query_results[idx])
|
28
|
-
end
|
29
|
-
end
|
30
|
-
nil
|
31
|
-
end
|
32
|
-
|
33
|
-
# Visit `query`'s internal representation, calling `analyzers` along the way.
|
34
|
-
#
|
35
|
-
# - First, query analyzers are filtered down by calling `.analyze?(query)`, if they respond to that method
|
36
|
-
# - Then, query analyzers are initialized by calling `.initial_value(query)`, if they respond to that method.
|
37
|
-
# - Then, they receive `.call(memo, visit_type, irep_node)`, where visit type is `:enter` or `:leave`.
|
38
|
-
# - Last, they receive `.final_value(memo)`, if they respond to that method.
|
39
|
-
#
|
40
|
-
# It returns an array of final `memo` values in the order that `analyzers` were passed in.
|
41
|
-
#
|
42
|
-
# @param query [GraphQL::Query]
|
43
|
-
# @param analyzers [Array<#call>] Objects that respond to `#call(memo, visit_type, irep_node)`
|
44
|
-
# @return [Array<Any>] Results from those analyzers
|
45
|
-
def analyze_query(query, analyzers, multiplex_states: [])
|
46
|
-
GraphQL::Deprecation.warn "Legacy analysis will be removed in GraphQL-Ruby 2.0, please upgrade to AST Analysis: https://graphql-ruby.org/queries/ast_analysis.html (schema: #{query.schema})"
|
47
|
-
|
48
|
-
query.trace("analyze_query", { query: query }) do
|
49
|
-
analyzers_to_run = analyzers.select do |analyzer|
|
50
|
-
if analyzer.respond_to?(:analyze?)
|
51
|
-
analyzer.analyze?(query)
|
52
|
-
else
|
53
|
-
true
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
reducer_states = analyzers_to_run.map { |r| ReducerState.new(r, query) } + multiplex_states
|
58
|
-
|
59
|
-
irep = query.internal_representation
|
60
|
-
|
61
|
-
irep.operation_definitions.each do |name, op_node|
|
62
|
-
reduce_node(op_node, reducer_states)
|
63
|
-
end
|
64
|
-
|
65
|
-
reducer_states.map(&:finalize_reducer)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
module_function
|
72
|
-
|
73
|
-
# Enter the node, visit its children, then leave the node.
|
74
|
-
def reduce_node(irep_node, reducer_states)
|
75
|
-
visit_analyzers(:enter, irep_node, reducer_states)
|
76
|
-
|
77
|
-
irep_node.typed_children.each do |type_defn, children|
|
78
|
-
children.each do |name, child_irep_node|
|
79
|
-
reduce_node(child_irep_node, reducer_states)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
visit_analyzers(:leave, irep_node, reducer_states)
|
84
|
-
end
|
85
|
-
|
86
|
-
def visit_analyzers(visit_type, irep_node, reducer_states)
|
87
|
-
reducer_states.each do |reducer_state|
|
88
|
-
next_memo = reducer_state.call(visit_type, irep_node)
|
89
|
-
|
90
|
-
reducer_state.memo = next_memo
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def analysis_errors(results)
|
95
|
-
results.flatten.select { |r| r.is_a?(GraphQL::AnalysisError) }
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module GraphQL
|
3
|
-
module Analysis
|
4
|
-
# A query reducer for tracking both field usage and deprecated field usage.
|
5
|
-
#
|
6
|
-
# @example Logging field usage and deprecated field usage
|
7
|
-
# Schema.query_analyzers << GraphQL::Analysis::FieldUsage.new { |query, used_fields, used_deprecated_fields|
|
8
|
-
# puts "Used GraphQL fields: #{used_fields.join(', ')}"
|
9
|
-
# puts "Used deprecated GraphQL fields: #{used_deprecated_fields.join(', ')}"
|
10
|
-
# }
|
11
|
-
# Schema.execute(query_str)
|
12
|
-
# # Used GraphQL fields: Cheese.id, Cheese.fatContent, Query.cheese
|
13
|
-
# # Used deprecated GraphQL fields: Cheese.fatContent
|
14
|
-
#
|
15
|
-
class FieldUsage
|
16
|
-
def initialize(&block)
|
17
|
-
@field_usage_handler = block
|
18
|
-
end
|
19
|
-
|
20
|
-
def initial_value(query)
|
21
|
-
{
|
22
|
-
query: query,
|
23
|
-
used_fields: Set.new,
|
24
|
-
used_deprecated_fields: Set.new
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
def call(memo, visit_type, irep_node)
|
29
|
-
if irep_node.ast_node.is_a?(GraphQL::Language::Nodes::Field) && visit_type == :leave
|
30
|
-
field = "#{irep_node.owner_type.name}.#{irep_node.definition.name}"
|
31
|
-
memo[:used_fields] << field
|
32
|
-
if irep_node.definition.deprecation_reason
|
33
|
-
memo[:used_deprecated_fields] << field
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
memo
|
38
|
-
end
|
39
|
-
|
40
|
-
def final_value(memo)
|
41
|
-
@field_usage_handler.call(memo[:query], memo[:used_fields].to_a, memo[:used_deprecated_fields].to_a)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|