graphql 1.13.6 → 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.

Files changed (216) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/graphql/core.rb +0 -7
  3. data/lib/generators/graphql/enum_generator.rb +4 -10
  4. data/lib/generators/graphql/field_extractor.rb +31 -0
  5. data/lib/generators/graphql/input_generator.rb +50 -0
  6. data/lib/generators/graphql/install/mutation_root_generator.rb +34 -0
  7. data/lib/generators/graphql/{templates → install/templates}/base_mutation.erb +0 -0
  8. data/lib/generators/graphql/{templates → install/templates}/mutation_type.erb +0 -0
  9. data/lib/generators/graphql/install_generator.rb +1 -1
  10. data/lib/generators/graphql/interface_generator.rb +7 -7
  11. data/lib/generators/graphql/mutation_create_generator.rb +22 -0
  12. data/lib/generators/graphql/mutation_delete_generator.rb +22 -0
  13. data/lib/generators/graphql/mutation_generator.rb +5 -30
  14. data/lib/generators/graphql/mutation_update_generator.rb +22 -0
  15. data/lib/generators/graphql/object_generator.rb +8 -37
  16. data/lib/generators/graphql/orm_mutations_base.rb +40 -0
  17. data/lib/generators/graphql/scalar_generator.rb +4 -2
  18. data/lib/generators/graphql/templates/enum.erb +5 -1
  19. data/lib/generators/graphql/templates/input.erb +9 -0
  20. data/lib/generators/graphql/templates/interface.erb +4 -2
  21. data/lib/generators/graphql/templates/mutation.erb +1 -1
  22. data/lib/generators/graphql/templates/mutation_create.erb +20 -0
  23. data/lib/generators/graphql/templates/mutation_delete.erb +20 -0
  24. data/lib/generators/graphql/templates/mutation_update.erb +21 -0
  25. data/lib/generators/graphql/templates/object.erb +4 -2
  26. data/lib/generators/graphql/templates/scalar.erb +3 -1
  27. data/lib/generators/graphql/templates/union.erb +4 -2
  28. data/lib/generators/graphql/type_generator.rb +46 -9
  29. data/lib/generators/graphql/union_generator.rb +5 -5
  30. data/lib/graphql/analysis/ast/query_complexity.rb +1 -1
  31. data/lib/graphql/analysis/ast/query_depth.rb +0 -1
  32. data/lib/graphql/analysis/ast/visitor.rb +3 -2
  33. data/lib/graphql/analysis/ast.rb +0 -10
  34. data/lib/graphql/analysis.rb +0 -7
  35. data/lib/graphql/backtrace/table.rb +0 -18
  36. data/lib/graphql/backtrace/tracer.rb +1 -2
  37. data/lib/graphql/backtrace.rb +2 -8
  38. data/lib/graphql/dataloader/source.rb +2 -2
  39. data/lib/graphql/dig.rb +1 -1
  40. data/lib/graphql/execution/errors.rb +1 -9
  41. data/lib/graphql/execution/interpreter/runtime.rb +2 -9
  42. data/lib/graphql/execution/interpreter.rb +0 -22
  43. data/lib/graphql/execution/lazy.rb +1 -1
  44. data/lib/graphql/execution/lookahead.rb +6 -13
  45. data/lib/graphql/execution/multiplex.rb +50 -107
  46. data/lib/graphql/execution.rb +11 -3
  47. data/lib/graphql/introspection/dynamic_fields.rb +3 -8
  48. data/lib/graphql/introspection/entry_points.rb +2 -15
  49. data/lib/graphql/introspection.rb +4 -4
  50. data/lib/graphql/language/document_from_schema_definition.rb +0 -17
  51. data/lib/graphql/pagination/connections.rb +2 -28
  52. data/lib/graphql/query/context.rb +1 -185
  53. data/lib/graphql/query/literal_input.rb +8 -13
  54. data/lib/graphql/query/validation_pipeline.rb +8 -37
  55. data/lib/graphql/query/variables.rb +22 -18
  56. data/lib/graphql/query.rb +5 -35
  57. data/lib/graphql/railtie.rb +0 -104
  58. data/lib/graphql/relay.rb +0 -15
  59. data/lib/graphql/rubocop/graphql/default_required_true.rb +4 -4
  60. data/lib/graphql/schema/addition.rb +1 -8
  61. data/lib/graphql/schema/argument.rb +18 -25
  62. data/lib/graphql/schema/build_from_definition.rb +0 -1
  63. data/lib/graphql/schema/directive.rb +4 -21
  64. data/lib/graphql/schema/enum.rb +1 -18
  65. data/lib/graphql/schema/enum_value.rb +0 -22
  66. data/lib/graphql/schema/field.rb +22 -194
  67. data/lib/graphql/schema/input_object.rb +10 -57
  68. data/lib/graphql/schema/interface.rb +0 -25
  69. data/lib/graphql/schema/introspection_system.rb +3 -8
  70. data/lib/graphql/schema/late_bound_type.rb +2 -2
  71. data/lib/graphql/schema/list.rb +0 -6
  72. data/lib/graphql/schema/loader.rb +0 -1
  73. data/lib/graphql/schema/member/base_dsl_methods.rb +0 -5
  74. data/lib/graphql/schema/member/build_type.rb +4 -6
  75. data/lib/graphql/schema/member/has_arguments.rb +14 -18
  76. data/lib/graphql/schema/member/has_fields.rb +2 -2
  77. data/lib/graphql/schema/member/has_interfaces.rb +0 -2
  78. data/lib/graphql/schema/member.rb +0 -6
  79. data/lib/graphql/schema/mutation.rb +0 -9
  80. data/lib/graphql/schema/non_null.rb +1 -7
  81. data/lib/graphql/schema/object.rb +0 -40
  82. data/lib/graphql/schema/relay_classic_mutation.rb +17 -28
  83. data/lib/graphql/schema/scalar.rb +0 -15
  84. data/lib/graphql/schema/union.rb +0 -16
  85. data/lib/graphql/schema/warden.rb +1 -1
  86. data/lib/graphql/schema/wrapper.rb +0 -5
  87. data/lib/graphql/schema.rb +107 -949
  88. data/lib/graphql/static_validation/base_visitor.rb +4 -21
  89. data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +12 -12
  90. data/lib/graphql/static_validation/validator.rb +2 -24
  91. data/lib/graphql/static_validation.rb +0 -2
  92. data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +38 -1
  93. data/lib/graphql/subscriptions/event.rb +1 -1
  94. data/lib/graphql/subscriptions/instrumentation.rb +0 -51
  95. data/lib/graphql/subscriptions.rb +4 -13
  96. data/lib/graphql/tracing/platform_tracing.rb +0 -23
  97. data/lib/graphql/tracing.rb +0 -1
  98. data/lib/graphql/types/iso_8601_date_time.rb +8 -1
  99. data/lib/graphql/types/relay/connection_behaviors.rb +4 -7
  100. data/lib/graphql/types/relay/default_relay.rb +0 -10
  101. data/lib/graphql/types/relay/node_behaviors.rb +5 -1
  102. data/lib/graphql/types/relay.rb +0 -2
  103. data/lib/graphql/version.rb +1 -1
  104. data/lib/graphql.rb +12 -65
  105. metadata +15 -129
  106. data/lib/graphql/analysis/analyze_query.rb +0 -98
  107. data/lib/graphql/analysis/field_usage.rb +0 -45
  108. data/lib/graphql/analysis/max_query_complexity.rb +0 -26
  109. data/lib/graphql/analysis/max_query_depth.rb +0 -26
  110. data/lib/graphql/analysis/query_complexity.rb +0 -88
  111. data/lib/graphql/analysis/query_depth.rb +0 -43
  112. data/lib/graphql/analysis/reducer_state.rb +0 -48
  113. data/lib/graphql/argument.rb +0 -131
  114. data/lib/graphql/authorization.rb +0 -82
  115. data/lib/graphql/backtrace/legacy_tracer.rb +0 -56
  116. data/lib/graphql/backwards_compatibility.rb +0 -61
  117. data/lib/graphql/base_type.rb +0 -232
  118. data/lib/graphql/boolean_type.rb +0 -2
  119. data/lib/graphql/compatibility/execution_specification/counter_schema.rb +0 -53
  120. data/lib/graphql/compatibility/execution_specification/specification_schema.rb +0 -200
  121. data/lib/graphql/compatibility/execution_specification.rb +0 -436
  122. data/lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb +0 -111
  123. data/lib/graphql/compatibility/lazy_execution_specification.rb +0 -215
  124. data/lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb +0 -87
  125. data/lib/graphql/compatibility/query_parser_specification/query_assertions.rb +0 -79
  126. data/lib/graphql/compatibility/query_parser_specification.rb +0 -266
  127. data/lib/graphql/compatibility/schema_parser_specification.rb +0 -682
  128. data/lib/graphql/compatibility.rb +0 -5
  129. data/lib/graphql/define/assign_argument.rb +0 -12
  130. data/lib/graphql/define/assign_connection.rb +0 -13
  131. data/lib/graphql/define/assign_enum_value.rb +0 -18
  132. data/lib/graphql/define/assign_global_id_field.rb +0 -11
  133. data/lib/graphql/define/assign_mutation_function.rb +0 -34
  134. data/lib/graphql/define/assign_object_field.rb +0 -42
  135. data/lib/graphql/define/defined_object_proxy.rb +0 -53
  136. data/lib/graphql/define/instance_definable.rb +0 -240
  137. data/lib/graphql/define/no_definition_error.rb +0 -7
  138. data/lib/graphql/define/non_null_with_bang.rb +0 -16
  139. data/lib/graphql/define/type_definer.rb +0 -31
  140. data/lib/graphql/define.rb +0 -31
  141. data/lib/graphql/deprecated_dsl.rb +0 -55
  142. data/lib/graphql/directive/deprecated_directive.rb +0 -2
  143. data/lib/graphql/directive/include_directive.rb +0 -2
  144. data/lib/graphql/directive/skip_directive.rb +0 -2
  145. data/lib/graphql/directive.rb +0 -107
  146. data/lib/graphql/enum_type.rb +0 -133
  147. data/lib/graphql/execution/execute.rb +0 -333
  148. data/lib/graphql/execution/flatten.rb +0 -40
  149. data/lib/graphql/execution/typecast.rb +0 -50
  150. data/lib/graphql/field/resolve.rb +0 -59
  151. data/lib/graphql/field.rb +0 -226
  152. data/lib/graphql/float_type.rb +0 -2
  153. data/lib/graphql/function.rb +0 -128
  154. data/lib/graphql/id_type.rb +0 -2
  155. data/lib/graphql/input_object_type.rb +0 -138
  156. data/lib/graphql/int_type.rb +0 -2
  157. data/lib/graphql/interface_type.rb +0 -72
  158. data/lib/graphql/internal_representation/document.rb +0 -27
  159. data/lib/graphql/internal_representation/node.rb +0 -206
  160. data/lib/graphql/internal_representation/print.rb +0 -51
  161. data/lib/graphql/internal_representation/rewrite.rb +0 -184
  162. data/lib/graphql/internal_representation/scope.rb +0 -88
  163. data/lib/graphql/internal_representation/visit.rb +0 -36
  164. data/lib/graphql/internal_representation.rb +0 -7
  165. data/lib/graphql/list_type.rb +0 -80
  166. data/lib/graphql/non_null_type.rb +0 -71
  167. data/lib/graphql/object_type.rb +0 -130
  168. data/lib/graphql/query/arguments.rb +0 -189
  169. data/lib/graphql/query/arguments_cache.rb +0 -24
  170. data/lib/graphql/query/executor.rb +0 -52
  171. data/lib/graphql/query/serial_execution/field_resolution.rb +0 -92
  172. data/lib/graphql/query/serial_execution/operation_resolution.rb +0 -19
  173. data/lib/graphql/query/serial_execution/selection_resolution.rb +0 -23
  174. data/lib/graphql/query/serial_execution/value_resolution.rb +0 -87
  175. data/lib/graphql/query/serial_execution.rb +0 -40
  176. data/lib/graphql/relay/array_connection.rb +0 -83
  177. data/lib/graphql/relay/base_connection.rb +0 -189
  178. data/lib/graphql/relay/connection_instrumentation.rb +0 -54
  179. data/lib/graphql/relay/connection_resolve.rb +0 -43
  180. data/lib/graphql/relay/connection_type.rb +0 -41
  181. data/lib/graphql/relay/edge.rb +0 -27
  182. data/lib/graphql/relay/edge_type.rb +0 -19
  183. data/lib/graphql/relay/edges_instrumentation.rb +0 -39
  184. data/lib/graphql/relay/global_id_resolve.rb +0 -18
  185. data/lib/graphql/relay/mongo_relation_connection.rb +0 -50
  186. data/lib/graphql/relay/mutation/instrumentation.rb +0 -23
  187. data/lib/graphql/relay/mutation/resolve.rb +0 -56
  188. data/lib/graphql/relay/mutation/result.rb +0 -38
  189. data/lib/graphql/relay/mutation.rb +0 -106
  190. data/lib/graphql/relay/node.rb +0 -39
  191. data/lib/graphql/relay/page_info.rb +0 -7
  192. data/lib/graphql/relay/relation_connection.rb +0 -188
  193. data/lib/graphql/relay/type_extensions.rb +0 -32
  194. data/lib/graphql/scalar_type.rb +0 -91
  195. data/lib/graphql/schema/catchall_middleware.rb +0 -35
  196. data/lib/graphql/schema/default_parse_error.rb +0 -10
  197. data/lib/graphql/schema/default_type_error.rb +0 -17
  198. data/lib/graphql/schema/member/accepts_definition.rb +0 -164
  199. data/lib/graphql/schema/member/cached_graphql_definition.rb +0 -58
  200. data/lib/graphql/schema/member/instrumentation.rb +0 -131
  201. data/lib/graphql/schema/middleware_chain.rb +0 -82
  202. data/lib/graphql/schema/possible_types.rb +0 -44
  203. data/lib/graphql/schema/rescue_middleware.rb +0 -60
  204. data/lib/graphql/schema/timeout_middleware.rb +0 -88
  205. data/lib/graphql/schema/traversal.rb +0 -228
  206. data/lib/graphql/schema/validation.rb +0 -313
  207. data/lib/graphql/static_validation/default_visitor.rb +0 -15
  208. data/lib/graphql/static_validation/no_validate_visitor.rb +0 -10
  209. data/lib/graphql/string_type.rb +0 -2
  210. data/lib/graphql/subscriptions/subscription_root.rb +0 -76
  211. data/lib/graphql/tracing/skylight_tracing.rb +0 -70
  212. data/lib/graphql/types/relay/node_field.rb +0 -24
  213. data/lib/graphql/types/relay/nodes_field.rb +0 -43
  214. data/lib/graphql/union_type.rb +0 -115
  215. data/lib/graphql/upgrader/member.rb +0 -937
  216. data/lib/graphql/upgrader/schema.rb +0 -38
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: 1.13.6
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-20 00:00:00.000000000 Z
11
+ date: 2022-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -136,20 +136,6 @@ dependencies:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1.12'
139
- - !ruby/object:Gem::Dependency
140
- name: parser
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: jekyll
155
141
  requirement: !ruby/object:Gem::Requirement
@@ -245,11 +231,20 @@ files:
245
231
  - MIT-LICENSE
246
232
  - lib/generators/graphql/core.rb
247
233
  - lib/generators/graphql/enum_generator.rb
234
+ - lib/generators/graphql/field_extractor.rb
235
+ - lib/generators/graphql/input_generator.rb
236
+ - lib/generators/graphql/install/mutation_root_generator.rb
237
+ - lib/generators/graphql/install/templates/base_mutation.erb
238
+ - lib/generators/graphql/install/templates/mutation_type.erb
248
239
  - lib/generators/graphql/install_generator.rb
249
240
  - lib/generators/graphql/interface_generator.rb
250
241
  - lib/generators/graphql/loader_generator.rb
242
+ - lib/generators/graphql/mutation_create_generator.rb
243
+ - lib/generators/graphql/mutation_delete_generator.rb
251
244
  - lib/generators/graphql/mutation_generator.rb
245
+ - lib/generators/graphql/mutation_update_generator.rb
252
246
  - lib/generators/graphql/object_generator.rb
247
+ - lib/generators/graphql/orm_mutations_base.rb
253
248
  - lib/generators/graphql/relay.rb
254
249
  - lib/generators/graphql/relay_generator.rb
255
250
  - lib/generators/graphql/scalar_generator.rb
@@ -260,16 +255,18 @@ files:
260
255
  - lib/generators/graphql/templates/base_field.erb
261
256
  - lib/generators/graphql/templates/base_input_object.erb
262
257
  - lib/generators/graphql/templates/base_interface.erb
263
- - lib/generators/graphql/templates/base_mutation.erb
264
258
  - lib/generators/graphql/templates/base_object.erb
265
259
  - lib/generators/graphql/templates/base_scalar.erb
266
260
  - lib/generators/graphql/templates/base_union.erb
267
261
  - lib/generators/graphql/templates/enum.erb
268
262
  - lib/generators/graphql/templates/graphql_controller.erb
263
+ - lib/generators/graphql/templates/input.erb
269
264
  - lib/generators/graphql/templates/interface.erb
270
265
  - lib/generators/graphql/templates/loader.erb
271
266
  - lib/generators/graphql/templates/mutation.erb
272
- - lib/generators/graphql/templates/mutation_type.erb
267
+ - lib/generators/graphql/templates/mutation_create.erb
268
+ - lib/generators/graphql/templates/mutation_delete.erb
269
+ - lib/generators/graphql/templates/mutation_update.erb
273
270
  - lib/generators/graphql/templates/node_type.erb
274
271
  - lib/generators/graphql/templates/object.erb
275
272
  - lib/generators/graphql/templates/query_type.erb
@@ -280,7 +277,6 @@ files:
280
277
  - lib/generators/graphql/union_generator.rb
281
278
  - lib/graphql.rb
282
279
  - lib/graphql/analysis.rb
283
- - lib/graphql/analysis/analyze_query.rb
284
280
  - lib/graphql/analysis/ast.rb
285
281
  - lib/graphql/analysis/ast/analyzer.rb
286
282
  - lib/graphql/analysis/ast/field_usage.rb
@@ -289,66 +285,24 @@ files:
289
285
  - lib/graphql/analysis/ast/query_complexity.rb
290
286
  - lib/graphql/analysis/ast/query_depth.rb
291
287
  - lib/graphql/analysis/ast/visitor.rb
292
- - lib/graphql/analysis/field_usage.rb
293
- - lib/graphql/analysis/max_query_complexity.rb
294
- - lib/graphql/analysis/max_query_depth.rb
295
- - lib/graphql/analysis/query_complexity.rb
296
- - lib/graphql/analysis/query_depth.rb
297
- - lib/graphql/analysis/reducer_state.rb
298
288
  - lib/graphql/analysis_error.rb
299
- - lib/graphql/argument.rb
300
- - lib/graphql/authorization.rb
301
289
  - lib/graphql/backtrace.rb
302
290
  - lib/graphql/backtrace/inspect_result.rb
303
- - lib/graphql/backtrace/legacy_tracer.rb
304
291
  - lib/graphql/backtrace/table.rb
305
292
  - lib/graphql/backtrace/traced_error.rb
306
293
  - lib/graphql/backtrace/tracer.rb
307
- - lib/graphql/backwards_compatibility.rb
308
- - lib/graphql/base_type.rb
309
- - lib/graphql/boolean_type.rb
310
294
  - lib/graphql/coercion_error.rb
311
- - lib/graphql/compatibility.rb
312
- - lib/graphql/compatibility/execution_specification.rb
313
- - lib/graphql/compatibility/execution_specification/counter_schema.rb
314
- - lib/graphql/compatibility/execution_specification/specification_schema.rb
315
- - lib/graphql/compatibility/lazy_execution_specification.rb
316
- - lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb
317
- - lib/graphql/compatibility/query_parser_specification.rb
318
- - lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb
319
- - lib/graphql/compatibility/query_parser_specification/query_assertions.rb
320
- - lib/graphql/compatibility/schema_parser_specification.rb
321
295
  - lib/graphql/dataloader.rb
322
296
  - lib/graphql/dataloader/null_dataloader.rb
323
297
  - lib/graphql/dataloader/request.rb
324
298
  - lib/graphql/dataloader/request_all.rb
325
299
  - lib/graphql/dataloader/source.rb
326
300
  - lib/graphql/date_encoding_error.rb
327
- - lib/graphql/define.rb
328
- - lib/graphql/define/assign_argument.rb
329
- - lib/graphql/define/assign_connection.rb
330
- - lib/graphql/define/assign_enum_value.rb
331
- - lib/graphql/define/assign_global_id_field.rb
332
- - lib/graphql/define/assign_mutation_function.rb
333
- - lib/graphql/define/assign_object_field.rb
334
- - lib/graphql/define/defined_object_proxy.rb
335
- - lib/graphql/define/instance_definable.rb
336
- - lib/graphql/define/no_definition_error.rb
337
- - lib/graphql/define/non_null_with_bang.rb
338
- - lib/graphql/define/type_definer.rb
339
- - lib/graphql/deprecated_dsl.rb
340
301
  - lib/graphql/deprecation.rb
341
302
  - lib/graphql/dig.rb
342
- - lib/graphql/directive.rb
343
- - lib/graphql/directive/deprecated_directive.rb
344
- - lib/graphql/directive/include_directive.rb
345
- - lib/graphql/directive/skip_directive.rb
346
- - lib/graphql/enum_type.rb
347
303
  - lib/graphql/execution.rb
348
304
  - lib/graphql/execution/directive_checks.rb
349
305
  - lib/graphql/execution/errors.rb
350
- - lib/graphql/execution/execute.rb
351
- - lib/graphql/execution/flatten.rb
352
306
  - lib/graphql/execution/instrumentation.rb
353
307
  - lib/graphql/execution/interpreter.rb
354
308
  - lib/graphql/execution/interpreter/argument_value.rb
@@ -363,26 +317,10 @@ files:
363
317
  - lib/graphql/execution/lazy/resolve.rb
364
318
  - lib/graphql/execution/lookahead.rb
365
319
  - lib/graphql/execution/multiplex.rb
366
- - lib/graphql/execution/typecast.rb
367
320
  - lib/graphql/execution_error.rb
368
- - lib/graphql/field.rb
369
- - lib/graphql/field/resolve.rb
370
321
  - lib/graphql/filter.rb
371
- - lib/graphql/float_type.rb
372
- - lib/graphql/function.rb
373
- - lib/graphql/id_type.rb
374
- - lib/graphql/input_object_type.rb
375
- - lib/graphql/int_type.rb
376
322
  - lib/graphql/integer_decoding_error.rb
377
323
  - lib/graphql/integer_encoding_error.rb
378
- - lib/graphql/interface_type.rb
379
- - lib/graphql/internal_representation.rb
380
- - lib/graphql/internal_representation/document.rb
381
- - lib/graphql/internal_representation/node.rb
382
- - lib/graphql/internal_representation/print.rb
383
- - lib/graphql/internal_representation/rewrite.rb
384
- - lib/graphql/internal_representation/scope.rb
385
- - lib/graphql/internal_representation/visit.rb
386
324
  - lib/graphql/introspection.rb
387
325
  - lib/graphql/introspection/base_object.rb
388
326
  - lib/graphql/introspection/directive_location_enum.rb
@@ -413,11 +351,8 @@ files:
413
351
  - lib/graphql/language/sanitized_printer.rb
414
352
  - lib/graphql/language/token.rb
415
353
  - lib/graphql/language/visitor.rb
416
- - lib/graphql/list_type.rb
417
354
  - lib/graphql/load_application_object_failed_error.rb
418
355
  - lib/graphql/name_validator.rb
419
- - lib/graphql/non_null_type.rb
420
- - lib/graphql/object_type.rb
421
356
  - lib/graphql/pagination.rb
422
357
  - lib/graphql/pagination/active_record_relation_connection.rb
423
358
  - lib/graphql/pagination/array_connection.rb
@@ -428,20 +363,12 @@ files:
428
363
  - lib/graphql/pagination/sequel_dataset_connection.rb
429
364
  - lib/graphql/parse_error.rb
430
365
  - lib/graphql/query.rb
431
- - lib/graphql/query/arguments.rb
432
- - lib/graphql/query/arguments_cache.rb
433
366
  - lib/graphql/query/context.rb
434
- - lib/graphql/query/executor.rb
435
367
  - lib/graphql/query/fingerprint.rb
436
368
  - lib/graphql/query/input_validation_result.rb
437
369
  - lib/graphql/query/literal_input.rb
438
370
  - lib/graphql/query/null_context.rb
439
371
  - lib/graphql/query/result.rb
440
- - lib/graphql/query/serial_execution.rb
441
- - lib/graphql/query/serial_execution/field_resolution.rb
442
- - lib/graphql/query/serial_execution/operation_resolution.rb
443
- - lib/graphql/query/serial_execution/selection_resolution.rb
444
- - lib/graphql/query/serial_execution/value_resolution.rb
445
372
  - lib/graphql/query/validation_pipeline.rb
446
373
  - lib/graphql/query/variable_validation_error.rb
447
374
  - lib/graphql/query/variables.rb
@@ -449,31 +376,12 @@ files:
449
376
  - lib/graphql/rake_task.rb
450
377
  - lib/graphql/rake_task/validate.rb
451
378
  - lib/graphql/relay.rb
452
- - lib/graphql/relay/array_connection.rb
453
- - lib/graphql/relay/base_connection.rb
454
- - lib/graphql/relay/connection_instrumentation.rb
455
- - lib/graphql/relay/connection_resolve.rb
456
- - lib/graphql/relay/connection_type.rb
457
- - lib/graphql/relay/edge.rb
458
- - lib/graphql/relay/edge_type.rb
459
- - lib/graphql/relay/edges_instrumentation.rb
460
- - lib/graphql/relay/global_id_resolve.rb
461
- - lib/graphql/relay/mongo_relation_connection.rb
462
- - lib/graphql/relay/mutation.rb
463
- - lib/graphql/relay/mutation/instrumentation.rb
464
- - lib/graphql/relay/mutation/resolve.rb
465
- - lib/graphql/relay/mutation/result.rb
466
- - lib/graphql/relay/node.rb
467
- - lib/graphql/relay/page_info.rb
468
379
  - lib/graphql/relay/range_add.rb
469
- - lib/graphql/relay/relation_connection.rb
470
- - lib/graphql/relay/type_extensions.rb
471
380
  - lib/graphql/rubocop.rb
472
381
  - lib/graphql/rubocop/graphql/base_cop.rb
473
382
  - lib/graphql/rubocop/graphql/default_null_true.rb
474
383
  - lib/graphql/rubocop/graphql/default_required_true.rb
475
384
  - lib/graphql/runtime_type_error.rb
476
- - lib/graphql/scalar_type.rb
477
385
  - lib/graphql/schema.rb
478
386
  - lib/graphql/schema/addition.rb
479
387
  - lib/graphql/schema/argument.rb
@@ -483,9 +391,6 @@ files:
483
391
  - lib/graphql/schema/build_from_definition/resolve_map.rb
484
392
  - lib/graphql/schema/build_from_definition/resolve_map/default_resolve.rb
485
393
  - lib/graphql/schema/built_in_types.rb
486
- - lib/graphql/schema/catchall_middleware.rb
487
- - lib/graphql/schema/default_parse_error.rb
488
- - lib/graphql/schema/default_type_error.rb
489
394
  - lib/graphql/schema/directive.rb
490
395
  - lib/graphql/schema/directive/deprecated.rb
491
396
  - lib/graphql/schema/directive/feature.rb
@@ -509,10 +414,8 @@ files:
509
414
  - lib/graphql/schema/list.rb
510
415
  - lib/graphql/schema/loader.rb
511
416
  - lib/graphql/schema/member.rb
512
- - lib/graphql/schema/member/accepts_definition.rb
513
417
  - lib/graphql/schema/member/base_dsl_methods.rb
514
418
  - lib/graphql/schema/member/build_type.rb
515
- - lib/graphql/schema/member/cached_graphql_definition.rb
516
419
  - lib/graphql/schema/member/graphql_type_names.rb
517
420
  - lib/graphql/schema/member/has_arguments.rb
518
421
  - lib/graphql/schema/member/has_ast_node.rb
@@ -523,32 +426,25 @@ files:
523
426
  - lib/graphql/schema/member/has_path.rb
524
427
  - lib/graphql/schema/member/has_unresolved_type_error.rb
525
428
  - lib/graphql/schema/member/has_validators.rb
526
- - lib/graphql/schema/member/instrumentation.rb
527
429
  - lib/graphql/schema/member/relay_shortcuts.rb
528
430
  - lib/graphql/schema/member/scoped.rb
529
431
  - lib/graphql/schema/member/type_system_helpers.rb
530
432
  - lib/graphql/schema/member/validates_input.rb
531
- - lib/graphql/schema/middleware_chain.rb
532
433
  - lib/graphql/schema/mutation.rb
533
434
  - lib/graphql/schema/non_null.rb
534
435
  - lib/graphql/schema/null_mask.rb
535
436
  - lib/graphql/schema/object.rb
536
- - lib/graphql/schema/possible_types.rb
537
437
  - lib/graphql/schema/printer.rb
538
438
  - lib/graphql/schema/relay_classic_mutation.rb
539
- - lib/graphql/schema/rescue_middleware.rb
540
439
  - lib/graphql/schema/resolver.rb
541
440
  - lib/graphql/schema/resolver/has_payload_type.rb
542
441
  - lib/graphql/schema/scalar.rb
543
442
  - lib/graphql/schema/subscription.rb
544
443
  - lib/graphql/schema/timeout.rb
545
- - lib/graphql/schema/timeout_middleware.rb
546
- - lib/graphql/schema/traversal.rb
547
444
  - lib/graphql/schema/type_expression.rb
548
445
  - lib/graphql/schema/type_membership.rb
549
446
  - lib/graphql/schema/union.rb
550
447
  - lib/graphql/schema/unique_within_type.rb
551
- - lib/graphql/schema/validation.rb
552
448
  - lib/graphql/schema/validator.rb
553
449
  - lib/graphql/schema/validator/allow_blank_validator.rb
554
450
  - lib/graphql/schema/validator/allow_null_validator.rb
@@ -563,12 +459,10 @@ files:
563
459
  - lib/graphql/static_validation.rb
564
460
  - lib/graphql/static_validation/all_rules.rb
565
461
  - lib/graphql/static_validation/base_visitor.rb
566
- - lib/graphql/static_validation/default_visitor.rb
567
462
  - lib/graphql/static_validation/definition_dependencies.rb
568
463
  - lib/graphql/static_validation/error.rb
569
464
  - lib/graphql/static_validation/interpreter_visitor.rb
570
465
  - lib/graphql/static_validation/literal_validator.rb
571
- - lib/graphql/static_validation/no_validate_visitor.rb
572
466
  - lib/graphql/static_validation/rules/argument_literals_are_compatible.rb
573
467
  - lib/graphql/static_validation/rules/argument_literals_are_compatible_error.rb
574
468
  - lib/graphql/static_validation/rules/argument_names_are_unique.rb
@@ -632,7 +526,6 @@ files:
632
526
  - lib/graphql/static_validation/validation_timeout_error.rb
633
527
  - lib/graphql/static_validation/validator.rb
634
528
  - lib/graphql/string_encoding_error.rb
635
- - lib/graphql/string_type.rb
636
529
  - lib/graphql/subscriptions.rb
637
530
  - lib/graphql/subscriptions/action_cable_subscriptions.rb
638
531
  - lib/graphql/subscriptions/broadcast_analyzer.rb
@@ -640,7 +533,6 @@ files:
640
533
  - lib/graphql/subscriptions/event.rb
641
534
  - lib/graphql/subscriptions/instrumentation.rb
642
535
  - lib/graphql/subscriptions/serialize.rb
643
- - lib/graphql/subscriptions/subscription_root.rb
644
536
  - lib/graphql/tracing.rb
645
537
  - lib/graphql/tracing/active_support_notifications_tracing.rb
646
538
  - lib/graphql/tracing/appoptics_tracing.rb
@@ -652,7 +544,6 @@ files:
652
544
  - lib/graphql/tracing/prometheus_tracing.rb
653
545
  - lib/graphql/tracing/prometheus_tracing/graphql_collector.rb
654
546
  - lib/graphql/tracing/scout_tracing.rb
655
- - lib/graphql/tracing/skylight_tracing.rb
656
547
  - lib/graphql/tracing/statsd_tracing.rb
657
548
  - lib/graphql/type_kinds.rb
658
549
  - lib/graphql/types.rb
@@ -674,17 +565,12 @@ files:
674
565
  - lib/graphql/types/relay/has_nodes_field.rb
675
566
  - lib/graphql/types/relay/node.rb
676
567
  - lib/graphql/types/relay/node_behaviors.rb
677
- - lib/graphql/types/relay/node_field.rb
678
- - lib/graphql/types/relay/nodes_field.rb
679
568
  - lib/graphql/types/relay/page_info.rb
680
569
  - lib/graphql/types/relay/page_info_behaviors.rb
681
570
  - lib/graphql/types/string.rb
682
571
  - lib/graphql/unauthorized_error.rb
683
572
  - lib/graphql/unauthorized_field_error.rb
684
- - lib/graphql/union_type.rb
685
573
  - lib/graphql/unresolved_type_error.rb
686
- - lib/graphql/upgrader/member.rb
687
- - lib/graphql/upgrader/schema.rb
688
574
  - lib/graphql/version.rb
689
575
  - readme.md
690
576
  homepage: https://github.com/rmosolgo/graphql-ruby
@@ -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
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
- require_relative "./query_complexity"
3
- module GraphQL
4
- module Analysis
5
- # Used under the hood to implement complexity validation,
6
- # see {Schema#max_complexity} and {Query#max_complexity}
7
- #
8
- # @example Assert max complexity of 10
9
- # # DON'T actually do this, graphql-ruby
10
- # # Does this for you based on your `max_complexity` setting
11
- # MySchema.query_analyzers << GraphQL::Analysis::MaxQueryComplexity.new(10)
12
- #
13
- class MaxQueryComplexity < GraphQL::Analysis::QueryComplexity
14
- def initialize(max_complexity)
15
- disallow_excessive_complexity = ->(query, complexity) {
16
- if complexity > max_complexity
17
- GraphQL::AnalysisError.new("Query has complexity of #{complexity}, which exceeds max complexity of #{max_complexity}")
18
- else
19
- nil
20
- end
21
- }
22
- super(&disallow_excessive_complexity)
23
- end
24
- end
25
- end
26
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
- require_relative "./query_depth"
3
- module GraphQL
4
- module Analysis
5
- # Used under the hood to implement depth validation,
6
- # see {Schema#max_depth} and {Query#max_depth}
7
- #
8
- # @example Assert max depth of 10
9
- # # DON'T actually do this, graphql-ruby
10
- # # Does this for you based on your `max_depth` setting
11
- # MySchema.query_analyzers << GraphQL::Analysis::MaxQueryDepth.new(10)
12
- #
13
- class MaxQueryDepth < GraphQL::Analysis::QueryDepth
14
- def initialize(max_depth)
15
- disallow_excessive_depth = ->(query, depth) {
16
- if depth > max_depth
17
- GraphQL::AnalysisError.new("Query has depth of #{depth}, which exceeds max depth of #{max_depth}")
18
- else
19
- nil
20
- end
21
- }
22
- super(&disallow_excessive_depth)
23
- end
24
- end
25
- end
26
- end
@@ -1,88 +0,0 @@
1
- # frozen_string_literal: true
2
- module GraphQL
3
- module Analysis
4
- # Calculate the complexity of a query, using {Field#complexity} values.
5
- #
6
- # @example Log the complexity of incoming queries
7
- # MySchema.query_analyzers << GraphQL::Analysis::QueryComplexity.new do |query, complexity|
8
- # Rails.logger.info("Complexity: #{complexity}")
9
- # end
10
- #
11
- class QueryComplexity
12
- # @yield [query, complexity] Called for each query analyzed by the schema, before executing it
13
- # @yieldparam query [GraphQL::Query] The query that was analyzed
14
- # @yieldparam complexity [Numeric] The complexity for this query
15
- def initialize(&block)
16
- @complexity_handler = block
17
- end
18
-
19
- # State for the query complexity calcuation:
20
- # - `target` is passed to handler
21
- # - `complexities_on_type` holds complexity scores for each type in an IRep node
22
- def initial_value(target)
23
- {
24
- target: target,
25
- complexities_on_type: [TypeComplexity.new],
26
- }
27
- end
28
-
29
- # Implement the query analyzer API
30
- def call(memo, visit_type, irep_node)
31
- if irep_node.ast_node.is_a?(GraphQL::Language::Nodes::Field)
32
- if visit_type == :enter
33
- memo[:complexities_on_type].push(TypeComplexity.new)
34
- else
35
- type_complexities = memo[:complexities_on_type].pop
36
- child_complexity = type_complexities.max_possible_complexity
37
- own_complexity = get_complexity(irep_node, child_complexity)
38
- memo[:complexities_on_type].last.merge(irep_node.owner_type, own_complexity)
39
- end
40
- end
41
- memo
42
- end
43
-
44
- # Send the query and complexity to the block
45
- # @return [Object, GraphQL::AnalysisError] Whatever the handler returns
46
- def final_value(reduced_value)
47
- total_complexity = reduced_value[:complexities_on_type].last.max_possible_complexity
48
- @complexity_handler.call(reduced_value[:target], total_complexity)
49
- end
50
-
51
- private
52
-
53
- # Get a complexity value for a field,
54
- # by getting the number or calling its proc
55
- def get_complexity(irep_node, child_complexity)
56
- field_defn = irep_node.definition
57
- defined_complexity = field_defn.complexity
58
- case defined_complexity
59
- when Proc
60
- defined_complexity.call(irep_node.query.context, irep_node.arguments, child_complexity)
61
- when Numeric
62
- defined_complexity + (child_complexity || 0)
63
- else
64
- raise("Invalid complexity: #{defined_complexity.inspect} on #{field_defn.name}")
65
- end
66
- end
67
-
68
- # Selections on an object may apply differently depending on what is _actually_ returned by the resolve function.
69
- # Find the maximum possible complexity among those combinations.
70
- class TypeComplexity
71
- def initialize
72
- @types = Hash.new(0)
73
- end
74
-
75
- # Return the max possible complexity for types in this selection
76
- def max_possible_complexity
77
- @types.each_value.max || 0
78
- end
79
-
80
- # Store the complexity for the branch on `type_defn`.
81
- # Later we will see if this is the max complexity among branches.
82
- def merge(type_defn, complexity)
83
- @types[type_defn] += complexity
84
- end
85
- end
86
- end
87
- end
88
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
- module GraphQL
3
- module Analysis
4
- # A query reducer for measuring the depth of a given query.
5
- #
6
- # @example Logging the depth of a query
7
- # Schema.query_analyzers << GraphQL::Analysis::QueryDepth.new { |query, depth| puts "GraphQL query depth: #{depth}" }
8
- # Schema.execute(query_str)
9
- # # GraphQL query depth: 8
10
- #
11
- class QueryDepth
12
- def initialize(&block)
13
- @depth_handler = block
14
- end
15
-
16
- def initial_value(query)
17
- {
18
- max_depth: 0,
19
- current_depth: 0,
20
- query: query,
21
- }
22
- end
23
-
24
- def call(memo, visit_type, irep_node)
25
- if irep_node.ast_node.is_a?(GraphQL::Language::Nodes::Field)
26
- if visit_type == :enter
27
- memo[:current_depth] += 1
28
- else
29
- if memo[:max_depth] < memo[:current_depth]
30
- memo[:max_depth] = memo[:current_depth]
31
- end
32
- memo[:current_depth] -= 1
33
- end
34
- end
35
- memo
36
- end
37
-
38
- def final_value(memo)
39
- @depth_handler.call(memo[:query], memo[:max_depth])
40
- end
41
- end
42
- end
43
- end