graphql 1.12.12 → 2.2.14

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 (392) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/graphql/core.rb +3 -8
  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 +2 -0
  8. data/lib/generators/graphql/{templates → install/templates}/mutation_type.erb +2 -0
  9. data/lib/generators/graphql/install_generator.rb +14 -4
  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 +10 -38
  16. data/lib/generators/graphql/orm_mutations_base.rb +40 -0
  17. data/lib/generators/graphql/relay.rb +23 -12
  18. data/lib/generators/graphql/scalar_generator.rb +4 -2
  19. data/lib/generators/graphql/templates/base_argument.erb +2 -0
  20. data/lib/generators/graphql/templates/base_connection.erb +2 -0
  21. data/lib/generators/graphql/templates/base_edge.erb +2 -0
  22. data/lib/generators/graphql/templates/base_enum.erb +2 -0
  23. data/lib/generators/graphql/templates/base_field.erb +2 -0
  24. data/lib/generators/graphql/templates/base_input_object.erb +2 -0
  25. data/lib/generators/graphql/templates/base_interface.erb +2 -0
  26. data/lib/generators/graphql/templates/base_object.erb +2 -0
  27. data/lib/generators/graphql/templates/base_resolver.erb +6 -0
  28. data/lib/generators/graphql/templates/base_scalar.erb +2 -0
  29. data/lib/generators/graphql/templates/base_union.erb +2 -0
  30. data/lib/generators/graphql/templates/enum.erb +5 -1
  31. data/lib/generators/graphql/templates/graphql_controller.erb +2 -0
  32. data/lib/generators/graphql/templates/input.erb +9 -0
  33. data/lib/generators/graphql/templates/interface.erb +4 -2
  34. data/lib/generators/graphql/templates/loader.erb +2 -0
  35. data/lib/generators/graphql/templates/mutation.erb +3 -1
  36. data/lib/generators/graphql/templates/mutation_create.erb +20 -0
  37. data/lib/generators/graphql/templates/mutation_delete.erb +20 -0
  38. data/lib/generators/graphql/templates/mutation_update.erb +21 -0
  39. data/lib/generators/graphql/templates/node_type.erb +2 -0
  40. data/lib/generators/graphql/templates/object.erb +4 -2
  41. data/lib/generators/graphql/templates/query_type.erb +2 -0
  42. data/lib/generators/graphql/templates/scalar.erb +3 -1
  43. data/lib/generators/graphql/templates/schema.erb +19 -2
  44. data/lib/generators/graphql/templates/union.erb +4 -2
  45. data/lib/generators/graphql/type_generator.rb +46 -10
  46. data/lib/generators/graphql/union_generator.rb +5 -5
  47. data/lib/graphql/analysis/ast/analyzer.rb +7 -0
  48. data/lib/graphql/analysis/ast/field_usage.rb +55 -1
  49. data/lib/graphql/analysis/ast/max_query_complexity.rb +0 -1
  50. data/lib/graphql/analysis/ast/query_complexity.rb +88 -140
  51. data/lib/graphql/analysis/ast/query_depth.rb +7 -3
  52. data/lib/graphql/analysis/ast/visitor.rb +50 -42
  53. data/lib/graphql/analysis/ast.rb +26 -23
  54. data/lib/graphql/analysis.rb +0 -7
  55. data/lib/graphql/backtrace/table.rb +4 -22
  56. data/lib/graphql/backtrace/trace.rb +93 -0
  57. data/lib/graphql/backtrace/tracer.rb +8 -6
  58. data/lib/graphql/backtrace.rb +3 -8
  59. data/lib/graphql/coercion_error.rb +1 -9
  60. data/lib/graphql/dataloader/async_dataloader.rb +85 -0
  61. data/lib/graphql/dataloader/null_dataloader.rb +3 -1
  62. data/lib/graphql/dataloader/request.rb +5 -0
  63. data/lib/graphql/dataloader/source.rb +120 -31
  64. data/lib/graphql/dataloader.rb +168 -142
  65. data/lib/graphql/date_encoding_error.rb +16 -0
  66. data/lib/graphql/dig.rb +1 -1
  67. data/lib/graphql/duration_encoding_error.rb +16 -0
  68. data/lib/graphql/execution/errors.rb +12 -81
  69. data/lib/graphql/execution/interpreter/arguments.rb +2 -2
  70. data/lib/graphql/execution/interpreter/arguments_cache.rb +36 -34
  71. data/lib/graphql/execution/interpreter/resolve.rb +32 -2
  72. data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +170 -0
  73. data/lib/graphql/execution/interpreter/runtime.rb +414 -341
  74. data/lib/graphql/execution/interpreter.rb +122 -80
  75. data/lib/graphql/execution/lazy.rb +11 -21
  76. data/lib/graphql/execution/lookahead.rb +125 -54
  77. data/lib/graphql/execution/multiplex.rb +4 -172
  78. data/lib/graphql/execution.rb +11 -4
  79. data/lib/graphql/integer_encoding_error.rb +18 -2
  80. data/lib/graphql/introspection/directive_location_enum.rb +2 -2
  81. data/lib/graphql/introspection/directive_type.rb +5 -3
  82. data/lib/graphql/introspection/dynamic_fields.rb +3 -8
  83. data/lib/graphql/introspection/entry_points.rb +11 -18
  84. data/lib/graphql/introspection/enum_value_type.rb +2 -2
  85. data/lib/graphql/introspection/field_type.rb +3 -3
  86. data/lib/graphql/introspection/input_value_type.rb +10 -4
  87. data/lib/graphql/introspection/schema_type.rb +12 -5
  88. data/lib/graphql/introspection/type_type.rb +25 -12
  89. data/lib/graphql/introspection.rb +6 -2
  90. data/lib/graphql/language/block_string.rb +37 -25
  91. data/lib/graphql/language/definition_slice.rb +1 -1
  92. data/lib/graphql/language/document_from_schema_definition.rb +78 -65
  93. data/lib/graphql/language/lexer.rb +345 -1467
  94. data/lib/graphql/language/nodes.rb +145 -91
  95. data/lib/graphql/language/parser.rb +701 -1921
  96. data/lib/graphql/language/printer.rb +351 -155
  97. data/lib/graphql/language/sanitized_printer.rb +25 -27
  98. data/lib/graphql/language/static_visitor.rb +167 -0
  99. data/lib/graphql/language/token.rb +0 -4
  100. data/lib/graphql/language/visitor.rb +188 -141
  101. data/lib/graphql/language.rb +1 -0
  102. data/lib/graphql/load_application_object_failed_error.rb +5 -1
  103. data/lib/graphql/name_validator.rb +0 -4
  104. data/lib/graphql/pagination/active_record_relation_connection.rb +37 -8
  105. data/lib/graphql/pagination/array_connection.rb +8 -6
  106. data/lib/graphql/pagination/connection.rb +61 -7
  107. data/lib/graphql/pagination/connections.rb +22 -23
  108. data/lib/graphql/pagination/mongoid_relation_connection.rb +1 -2
  109. data/lib/graphql/pagination/relation_connection.rb +60 -28
  110. data/lib/graphql/query/context/scoped_context.rb +101 -0
  111. data/lib/graphql/query/context.rb +109 -189
  112. data/lib/graphql/query/input_validation_result.rb +10 -1
  113. data/lib/graphql/query/null_context.rb +14 -29
  114. data/lib/graphql/query/validation_pipeline.rb +15 -39
  115. data/lib/graphql/query/variable_validation_error.rb +2 -2
  116. data/lib/graphql/query/variables.rb +35 -17
  117. data/lib/graphql/query.rb +78 -65
  118. data/lib/graphql/railtie.rb +8 -109
  119. data/lib/graphql/rake_task/validate.rb +1 -1
  120. data/lib/graphql/rake_task.rb +30 -11
  121. data/lib/graphql/relay/range_add.rb +9 -16
  122. data/lib/graphql/relay.rb +0 -15
  123. data/lib/graphql/rubocop/graphql/base_cop.rb +36 -0
  124. data/lib/graphql/rubocop/graphql/default_null_true.rb +43 -0
  125. data/lib/graphql/rubocop/graphql/default_required_true.rb +43 -0
  126. data/lib/graphql/rubocop.rb +4 -0
  127. data/lib/graphql/schema/addition.rb +78 -45
  128. data/lib/graphql/schema/always_visible.rb +10 -0
  129. data/lib/graphql/schema/argument.rb +134 -80
  130. data/lib/graphql/schema/base_64_encoder.rb +3 -5
  131. data/lib/graphql/schema/build_from_definition.rb +60 -38
  132. data/lib/graphql/schema/directive/feature.rb +1 -1
  133. data/lib/graphql/schema/directive/flagged.rb +2 -2
  134. data/lib/graphql/schema/directive/include.rb +1 -1
  135. data/lib/graphql/schema/directive/one_of.rb +24 -0
  136. data/lib/graphql/schema/directive/skip.rb +1 -1
  137. data/lib/graphql/schema/directive/specified_by.rb +14 -0
  138. data/lib/graphql/schema/directive/transform.rb +2 -2
  139. data/lib/graphql/schema/directive.rb +33 -21
  140. data/lib/graphql/schema/enum.rb +93 -46
  141. data/lib/graphql/schema/enum_value.rb +4 -21
  142. data/lib/graphql/schema/field/connection_extension.rb +6 -16
  143. data/lib/graphql/schema/field/scope_extension.rb +8 -1
  144. data/lib/graphql/schema/field.rb +432 -337
  145. data/lib/graphql/schema/field_extension.rb +86 -2
  146. data/lib/graphql/schema/find_inherited_value.rb +3 -7
  147. data/lib/graphql/schema/finder.rb +5 -5
  148. data/lib/graphql/schema/has_single_input_argument.rb +156 -0
  149. data/lib/graphql/schema/input_object.rb +88 -90
  150. data/lib/graphql/schema/interface.rb +19 -59
  151. data/lib/graphql/schema/introspection_system.rb +6 -9
  152. data/lib/graphql/schema/late_bound_type.rb +8 -2
  153. data/lib/graphql/schema/list.rb +18 -7
  154. data/lib/graphql/schema/loader.rb +3 -3
  155. data/lib/graphql/schema/member/base_dsl_methods.rb +18 -19
  156. data/lib/graphql/schema/member/build_type.rb +16 -13
  157. data/lib/graphql/schema/member/has_arguments.rb +288 -84
  158. data/lib/graphql/schema/member/has_ast_node.rb +12 -0
  159. data/lib/graphql/schema/member/has_deprecation_reason.rb +3 -4
  160. data/lib/graphql/schema/member/has_directives.rb +81 -61
  161. data/lib/graphql/schema/member/has_fields.rb +149 -31
  162. data/lib/graphql/schema/member/has_interfaces.rb +143 -0
  163. data/lib/graphql/schema/member/has_validators.rb +32 -6
  164. data/lib/graphql/schema/member/relay_shortcuts.rb +47 -2
  165. data/lib/graphql/schema/member/scoped.rb +19 -0
  166. data/lib/graphql/schema/member/type_system_helpers.rb +17 -0
  167. data/lib/graphql/schema/member/validates_input.rb +6 -6
  168. data/lib/graphql/schema/member.rb +1 -6
  169. data/lib/graphql/schema/mutation.rb +0 -9
  170. data/lib/graphql/schema/non_null.rb +7 -7
  171. data/lib/graphql/schema/object.rb +30 -119
  172. data/lib/graphql/schema/printer.rb +23 -25
  173. data/lib/graphql/schema/relay_classic_mutation.rb +13 -90
  174. data/lib/graphql/schema/resolver/has_payload_type.rb +46 -11
  175. data/lib/graphql/schema/resolver.rb +101 -102
  176. data/lib/graphql/schema/scalar.rb +20 -21
  177. data/lib/graphql/schema/subscription.rb +45 -17
  178. data/lib/graphql/schema/timeout.rb +25 -29
  179. data/lib/graphql/schema/type_expression.rb +1 -1
  180. data/lib/graphql/schema/type_membership.rb +21 -4
  181. data/lib/graphql/schema/union.rb +15 -15
  182. data/lib/graphql/schema/unique_within_type.rb +1 -1
  183. data/lib/graphql/schema/validator/allow_blank_validator.rb +29 -0
  184. data/lib/graphql/schema/validator/allow_null_validator.rb +26 -0
  185. data/lib/graphql/schema/validator/exclusion_validator.rb +3 -1
  186. data/lib/graphql/schema/validator/format_validator.rb +4 -5
  187. data/lib/graphql/schema/validator/inclusion_validator.rb +3 -1
  188. data/lib/graphql/schema/validator/length_validator.rb +5 -3
  189. data/lib/graphql/schema/validator/numericality_validator.rb +13 -2
  190. data/lib/graphql/schema/validator/required_validator.rb +29 -15
  191. data/lib/graphql/schema/validator.rb +35 -27
  192. data/lib/graphql/schema/warden.rb +259 -132
  193. data/lib/graphql/schema/wrapper.rb +0 -5
  194. data/lib/graphql/schema.rb +658 -989
  195. data/lib/graphql/static_validation/all_rules.rb +3 -1
  196. data/lib/graphql/static_validation/base_visitor.rb +14 -28
  197. data/lib/graphql/static_validation/definition_dependencies.rb +7 -2
  198. data/lib/graphql/static_validation/error.rb +3 -1
  199. data/lib/graphql/static_validation/literal_validator.rb +21 -4
  200. data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +1 -1
  201. data/lib/graphql/static_validation/rules/arguments_are_defined.rb +1 -1
  202. data/lib/graphql/static_validation/rules/directives_are_defined.rb +11 -5
  203. data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +13 -13
  204. data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +12 -4
  205. data/lib/graphql/static_validation/rules/fields_will_merge.rb +54 -28
  206. data/lib/graphql/static_validation/rules/fields_will_merge_error.rb +25 -4
  207. data/lib/graphql/static_validation/rules/fragments_are_finite.rb +2 -2
  208. data/lib/graphql/static_validation/rules/one_of_input_objects_are_valid.rb +66 -0
  209. data/lib/graphql/static_validation/rules/one_of_input_objects_are_valid_error.rb +29 -0
  210. data/lib/graphql/static_validation/rules/query_root_exists.rb +17 -0
  211. data/lib/graphql/static_validation/rules/query_root_exists_error.rb +26 -0
  212. data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +5 -3
  213. data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +4 -4
  214. data/lib/graphql/static_validation/rules/unique_directives_per_location.rb +13 -7
  215. data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +1 -1
  216. data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +13 -7
  217. data/lib/graphql/static_validation/validation_context.rb +16 -6
  218. data/lib/graphql/static_validation/validator.rb +11 -27
  219. data/lib/graphql/static_validation.rb +0 -3
  220. data/lib/graphql/string_encoding_error.rb +13 -3
  221. data/lib/graphql/subscriptions/action_cable_subscriptions.rb +46 -9
  222. data/lib/graphql/subscriptions/default_subscription_resolve_extension.rb +38 -1
  223. data/lib/graphql/subscriptions/event.rb +75 -37
  224. data/lib/graphql/subscriptions/serialize.rb +25 -3
  225. data/lib/graphql/subscriptions.rb +59 -47
  226. data/lib/graphql/testing/helpers.rb +129 -0
  227. data/lib/graphql/testing.rb +2 -0
  228. data/lib/graphql/tracing/active_support_notifications_trace.rb +16 -0
  229. data/lib/graphql/tracing/active_support_notifications_tracing.rb +6 -20
  230. data/lib/graphql/tracing/appoptics_trace.rb +251 -0
  231. data/lib/graphql/tracing/appoptics_tracing.rb +2 -2
  232. data/lib/graphql/tracing/appsignal_trace.rb +77 -0
  233. data/lib/graphql/tracing/appsignal_tracing.rb +15 -0
  234. data/lib/graphql/tracing/data_dog_trace.rb +183 -0
  235. data/lib/graphql/tracing/data_dog_tracing.rb +25 -15
  236. data/lib/graphql/{execution/instrumentation.rb → tracing/legacy_hooks_trace.rb} +10 -28
  237. data/lib/graphql/tracing/legacy_trace.rb +69 -0
  238. data/lib/graphql/tracing/new_relic_trace.rb +75 -0
  239. data/lib/graphql/tracing/notifications_trace.rb +45 -0
  240. data/lib/graphql/tracing/notifications_tracing.rb +59 -0
  241. data/lib/graphql/tracing/platform_trace.rb +118 -0
  242. data/lib/graphql/tracing/platform_tracing.rb +46 -49
  243. data/lib/graphql/tracing/{prometheus_tracing → prometheus_trace}/graphql_collector.rb +4 -2
  244. data/lib/graphql/tracing/prometheus_trace.rb +89 -0
  245. data/lib/graphql/tracing/prometheus_tracing.rb +3 -3
  246. data/lib/graphql/tracing/scout_trace.rb +72 -0
  247. data/lib/graphql/tracing/sentry_trace.rb +112 -0
  248. data/lib/graphql/tracing/statsd_trace.rb +56 -0
  249. data/lib/graphql/tracing/trace.rb +76 -0
  250. data/lib/graphql/tracing.rb +20 -41
  251. data/lib/graphql/type_kinds.rb +6 -3
  252. data/lib/graphql/types/big_int.rb +5 -1
  253. data/lib/graphql/types/int.rb +1 -1
  254. data/lib/graphql/types/iso_8601_date.rb +17 -6
  255. data/lib/graphql/types/iso_8601_date_time.rb +12 -1
  256. data/lib/graphql/types/iso_8601_duration.rb +77 -0
  257. data/lib/graphql/types/relay/base_connection.rb +16 -6
  258. data/lib/graphql/types/relay/connection_behaviors.rb +82 -32
  259. data/lib/graphql/types/relay/edge_behaviors.rb +36 -7
  260. data/lib/graphql/types/relay/has_node_field.rb +2 -2
  261. data/lib/graphql/types/relay/has_nodes_field.rb +2 -2
  262. data/lib/graphql/types/relay/node_behaviors.rb +12 -2
  263. data/lib/graphql/types/relay/page_info_behaviors.rb +7 -2
  264. data/lib/graphql/types/relay.rb +0 -3
  265. data/lib/graphql/types/string.rb +2 -2
  266. data/lib/graphql/types.rb +1 -0
  267. data/lib/graphql/unauthorized_error.rb +1 -1
  268. data/lib/graphql/version.rb +1 -1
  269. data/lib/graphql.rb +33 -95
  270. data/readme.md +13 -6
  271. metadata +102 -185
  272. data/lib/graphql/analysis/analyze_query.rb +0 -98
  273. data/lib/graphql/analysis/field_usage.rb +0 -45
  274. data/lib/graphql/analysis/max_query_complexity.rb +0 -26
  275. data/lib/graphql/analysis/max_query_depth.rb +0 -26
  276. data/lib/graphql/analysis/query_complexity.rb +0 -88
  277. data/lib/graphql/analysis/query_depth.rb +0 -43
  278. data/lib/graphql/analysis/reducer_state.rb +0 -48
  279. data/lib/graphql/argument.rb +0 -131
  280. data/lib/graphql/authorization.rb +0 -82
  281. data/lib/graphql/backtrace/legacy_tracer.rb +0 -56
  282. data/lib/graphql/backwards_compatibility.rb +0 -61
  283. data/lib/graphql/base_type.rb +0 -230
  284. data/lib/graphql/boolean_type.rb +0 -2
  285. data/lib/graphql/compatibility/execution_specification/counter_schema.rb +0 -53
  286. data/lib/graphql/compatibility/execution_specification/specification_schema.rb +0 -200
  287. data/lib/graphql/compatibility/execution_specification.rb +0 -436
  288. data/lib/graphql/compatibility/lazy_execution_specification/lazy_schema.rb +0 -111
  289. data/lib/graphql/compatibility/lazy_execution_specification.rb +0 -215
  290. data/lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb +0 -87
  291. data/lib/graphql/compatibility/query_parser_specification/query_assertions.rb +0 -79
  292. data/lib/graphql/compatibility/query_parser_specification.rb +0 -266
  293. data/lib/graphql/compatibility/schema_parser_specification.rb +0 -682
  294. data/lib/graphql/compatibility.rb +0 -5
  295. data/lib/graphql/define/assign_argument.rb +0 -12
  296. data/lib/graphql/define/assign_connection.rb +0 -13
  297. data/lib/graphql/define/assign_enum_value.rb +0 -18
  298. data/lib/graphql/define/assign_global_id_field.rb +0 -11
  299. data/lib/graphql/define/assign_mutation_function.rb +0 -34
  300. data/lib/graphql/define/assign_object_field.rb +0 -42
  301. data/lib/graphql/define/defined_object_proxy.rb +0 -53
  302. data/lib/graphql/define/instance_definable.rb +0 -240
  303. data/lib/graphql/define/no_definition_error.rb +0 -7
  304. data/lib/graphql/define/non_null_with_bang.rb +0 -16
  305. data/lib/graphql/define/type_definer.rb +0 -31
  306. data/lib/graphql/define.rb +0 -31
  307. data/lib/graphql/deprecated_dsl.rb +0 -47
  308. data/lib/graphql/deprecation.rb +0 -13
  309. data/lib/graphql/directive/deprecated_directive.rb +0 -2
  310. data/lib/graphql/directive/include_directive.rb +0 -2
  311. data/lib/graphql/directive/skip_directive.rb +0 -2
  312. data/lib/graphql/directive.rb +0 -111
  313. data/lib/graphql/enum_type.rb +0 -129
  314. data/lib/graphql/execution/execute.rb +0 -333
  315. data/lib/graphql/execution/flatten.rb +0 -40
  316. data/lib/graphql/execution/lazy/resolve.rb +0 -91
  317. data/lib/graphql/execution/typecast.rb +0 -50
  318. data/lib/graphql/field/resolve.rb +0 -59
  319. data/lib/graphql/field.rb +0 -226
  320. data/lib/graphql/filter.rb +0 -53
  321. data/lib/graphql/float_type.rb +0 -2
  322. data/lib/graphql/function.rb +0 -128
  323. data/lib/graphql/id_type.rb +0 -2
  324. data/lib/graphql/input_object_type.rb +0 -138
  325. data/lib/graphql/int_type.rb +0 -2
  326. data/lib/graphql/interface_type.rb +0 -72
  327. data/lib/graphql/internal_representation/document.rb +0 -27
  328. data/lib/graphql/internal_representation/node.rb +0 -206
  329. data/lib/graphql/internal_representation/print.rb +0 -51
  330. data/lib/graphql/internal_representation/rewrite.rb +0 -184
  331. data/lib/graphql/internal_representation/scope.rb +0 -88
  332. data/lib/graphql/internal_representation/visit.rb +0 -36
  333. data/lib/graphql/internal_representation.rb +0 -7
  334. data/lib/graphql/language/lexer.rl +0 -262
  335. data/lib/graphql/language/parser.y +0 -543
  336. data/lib/graphql/list_type.rb +0 -80
  337. data/lib/graphql/non_null_type.rb +0 -71
  338. data/lib/graphql/object_type.rb +0 -130
  339. data/lib/graphql/query/arguments.rb +0 -189
  340. data/lib/graphql/query/arguments_cache.rb +0 -24
  341. data/lib/graphql/query/executor.rb +0 -52
  342. data/lib/graphql/query/literal_input.rb +0 -136
  343. data/lib/graphql/query/serial_execution/field_resolution.rb +0 -92
  344. data/lib/graphql/query/serial_execution/operation_resolution.rb +0 -19
  345. data/lib/graphql/query/serial_execution/selection_resolution.rb +0 -23
  346. data/lib/graphql/query/serial_execution/value_resolution.rb +0 -87
  347. data/lib/graphql/query/serial_execution.rb +0 -40
  348. data/lib/graphql/relay/array_connection.rb +0 -83
  349. data/lib/graphql/relay/base_connection.rb +0 -189
  350. data/lib/graphql/relay/connection_instrumentation.rb +0 -54
  351. data/lib/graphql/relay/connection_resolve.rb +0 -43
  352. data/lib/graphql/relay/connection_type.rb +0 -41
  353. data/lib/graphql/relay/edge.rb +0 -27
  354. data/lib/graphql/relay/edge_type.rb +0 -19
  355. data/lib/graphql/relay/edges_instrumentation.rb +0 -40
  356. data/lib/graphql/relay/global_id_resolve.rb +0 -18
  357. data/lib/graphql/relay/mongo_relation_connection.rb +0 -50
  358. data/lib/graphql/relay/mutation/instrumentation.rb +0 -23
  359. data/lib/graphql/relay/mutation/resolve.rb +0 -56
  360. data/lib/graphql/relay/mutation/result.rb +0 -38
  361. data/lib/graphql/relay/mutation.rb +0 -106
  362. data/lib/graphql/relay/node.rb +0 -39
  363. data/lib/graphql/relay/page_info.rb +0 -7
  364. data/lib/graphql/relay/relation_connection.rb +0 -188
  365. data/lib/graphql/relay/type_extensions.rb +0 -32
  366. data/lib/graphql/scalar_type.rb +0 -91
  367. data/lib/graphql/schema/base_64_bp.rb +0 -26
  368. data/lib/graphql/schema/catchall_middleware.rb +0 -35
  369. data/lib/graphql/schema/default_parse_error.rb +0 -10
  370. data/lib/graphql/schema/default_type_error.rb +0 -17
  371. data/lib/graphql/schema/member/accepts_definition.rb +0 -152
  372. data/lib/graphql/schema/member/cached_graphql_definition.rb +0 -31
  373. data/lib/graphql/schema/member/instrumentation.rb +0 -131
  374. data/lib/graphql/schema/middleware_chain.rb +0 -82
  375. data/lib/graphql/schema/possible_types.rb +0 -44
  376. data/lib/graphql/schema/rescue_middleware.rb +0 -60
  377. data/lib/graphql/schema/timeout_middleware.rb +0 -88
  378. data/lib/graphql/schema/traversal.rb +0 -228
  379. data/lib/graphql/schema/validation.rb +0 -313
  380. data/lib/graphql/static_validation/default_visitor.rb +0 -15
  381. data/lib/graphql/static_validation/no_validate_visitor.rb +0 -10
  382. data/lib/graphql/static_validation/type_stack.rb +0 -216
  383. data/lib/graphql/string_type.rb +0 -2
  384. data/lib/graphql/subscriptions/instrumentation.rb +0 -79
  385. data/lib/graphql/subscriptions/subscription_root.rb +0 -76
  386. data/lib/graphql/tracing/skylight_tracing.rb +0 -70
  387. data/lib/graphql/types/relay/default_relay.rb +0 -27
  388. data/lib/graphql/types/relay/node_field.rb +0 -25
  389. data/lib/graphql/types/relay/nodes_field.rb +0 -27
  390. data/lib/graphql/union_type.rb +0 -115
  391. data/lib/graphql/upgrader/member.rb +0 -937
  392. data/lib/graphql/upgrader/schema.rb +0 -38
@@ -9,16 +9,34 @@ module GraphQL
9
9
 
10
10
  def self.included(child_class)
11
11
  child_class.extend(ClassMethods)
12
- child_class.extend(Relay::DefaultRelay)
13
- child_class.default_relay(true)
14
12
  child_class.has_nodes_field(true)
15
13
  child_class.node_nullable(true)
16
14
  child_class.edges_nullable(true)
17
15
  child_class.edge_nullable(true)
16
+ child_class.module_eval {
17
+ self.edge_type = nil
18
+ self.node_type = nil
19
+ self.edge_class = nil
20
+ }
18
21
  add_page_info_field(child_class)
19
22
  end
20
23
 
21
24
  module ClassMethods
25
+ def inherited(child_class)
26
+ super
27
+ child_class.has_nodes_field(has_nodes_field)
28
+ child_class.node_nullable(node_nullable)
29
+ child_class.edges_nullable(edges_nullable)
30
+ child_class.edge_nullable(edge_nullable)
31
+ child_class.edge_type = nil
32
+ child_class.node_type = nil
33
+ child_class.edge_class = nil
34
+ end
35
+
36
+ def default_relay?
37
+ true
38
+ end
39
+
22
40
  # @return [Class]
23
41
  attr_reader :node_type
24
42
 
@@ -35,7 +53,8 @@ module GraphQL
35
53
  # It's called when you subclass this base connection, trying to use the
36
54
  # class name to set defaults. You can call it again in the class definition
37
55
  # to override the default (or provide a value, if the default lookup failed).
38
- def edge_type(edge_type_class, edge_class: GraphQL::Relay::Edge, node_type: edge_type_class.node_type, nodes_field: self.has_nodes_field, node_nullable: self.node_nullable, edges_nullable: self.edges_nullable, edge_nullable: self.edge_nullable)
56
+ # @param field_options [Hash] Any extra keyword arguments to pass to the `field :edges, ...` and `field :nodes, ...` configurations
57
+ def edge_type(edge_type_class, edge_class: GraphQL::Pagination::Connection::Edge, node_type: edge_type_class.node_type, nodes_field: self.has_nodes_field, node_nullable: self.node_nullable, edges_nullable: self.edges_nullable, edge_nullable: self.edge_nullable, field_options: nil)
39
58
  # Set this connection's graphql name
40
59
  node_type_name = node_type.graphql_name
41
60
 
@@ -43,13 +62,22 @@ module GraphQL
43
62
  @edge_type = edge_type_class
44
63
  @edge_class = edge_class
45
64
 
46
- field :edges, [edge_type_class, null: edge_nullable],
65
+ base_field_options = {
66
+ name: :edges,
67
+ type: [edge_type_class, null: edge_nullable],
47
68
  null: edges_nullable,
48
69
  description: "A list of edges.",
49
- legacy_edge_class: edge_class, # This is used by the old runtime only, for EdgesInstrumentation
50
- connection: false
70
+ scope: false, # Assume that the connection was already scoped.
71
+ connection: false,
72
+ }
73
+
74
+ if field_options
75
+ base_field_options.merge!(field_options)
76
+ end
51
77
 
52
- define_nodes_field(node_nullable) if nodes_field
78
+ field(**base_field_options)
79
+
80
+ define_nodes_field(node_nullable, field_options: field_options) if nodes_field
53
81
 
54
82
  description("The connection type for #{node_type_name}.")
55
83
  end
@@ -59,21 +87,31 @@ module GraphQL
59
87
  node_type.scope_items(items, context)
60
88
  end
61
89
 
90
+ # The connection will skip auth on its nodes if the node_type is configured for that
91
+ def reauthorize_scoped_objects(new_value = nil)
92
+ if new_value.nil?
93
+ if @reauthorize_scoped_objects != nil
94
+ @reauthorize_scoped_objects
95
+ else
96
+ node_type.reauthorize_scoped_objects
97
+ end
98
+ else
99
+ @reauthorize_scoped_objects = new_value
100
+ end
101
+ end
102
+
62
103
  # Add the shortcut `nodes` field to this connection and its subclasses
63
- def nodes_field(node_nullable: self.node_nullable)
64
- define_nodes_field(node_nullable)
104
+ def nodes_field(node_nullable: self.node_nullable, field_options: nil)
105
+ define_nodes_field(node_nullable, field_options: field_options)
65
106
  end
66
107
 
67
108
  def authorized?(obj, ctx)
68
109
  true # Let nodes be filtered out
69
110
  end
70
111
 
71
- def accessible?(ctx)
72
- node_type.accessible?(ctx)
73
- end
74
-
75
112
  def visible?(ctx)
76
- node_type.visible?(ctx)
113
+ # if this is an abstract base class, there may be no `node_type`
114
+ node_type ? node_type.visible?(ctx) : super
77
115
  end
78
116
 
79
117
  # Set the default `node_nullable` for this class and its child classes. (Defaults to `true`.)
@@ -116,13 +154,26 @@ module GraphQL
116
154
  end
117
155
  end
118
156
 
157
+ protected
158
+
159
+ attr_writer :edge_type, :node_type, :edge_class
160
+
119
161
  private
120
162
 
121
- def define_nodes_field(nullable)
122
- field :nodes, [@node_type, null: nullable],
163
+ def define_nodes_field(nullable, field_options: nil)
164
+ base_field_options = {
165
+ name: :nodes,
166
+ type: [@node_type, null: nullable],
123
167
  null: nullable,
124
168
  description: "A list of nodes.",
125
- connection: false
169
+ connection: false,
170
+ # Assume that the connection was scoped before this step:
171
+ scope: false,
172
+ }
173
+ if field_options
174
+ base_field_options.merge!(field_options)
175
+ end
176
+ field(**base_field_options)
126
177
  end
127
178
  end
128
179
 
@@ -132,23 +183,22 @@ module GraphQL
132
183
  end
133
184
  end
134
185
 
135
- # By default this calls through to the ConnectionWrapper's edge nodes method,
136
- # but sometimes you need to override it to support the `nodes` field
137
- def nodes
138
- @object.edge_nodes
186
+ def edges
187
+ # Assume that whatever authorization needed to happen
188
+ # already happened at the connection level.
189
+ current_runtime_state = Thread.current[:__graphql_runtime_info]
190
+ query_runtime_state = current_runtime_state[context.query]
191
+ query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items?
192
+ @object.edges
139
193
  end
140
194
 
141
- def edges
142
- if @object.is_a?(GraphQL::Pagination::Connection)
143
- @object.edges
144
- elsif context.interpreter?
145
- context.schema.after_lazy(object.edge_nodes) do |nodes|
146
- nodes.map { |n| self.class.edge_class.new(n, object) }
147
- end
148
- else
149
- # This is done by edges_instrumentation
150
- @object.edge_nodes
151
- end
195
+ def nodes
196
+ # Assume that whatever authorization needed to happen
197
+ # already happened at the connection level.
198
+ current_runtime_state = Thread.current[:__graphql_runtime_info]
199
+ query_runtime_state = current_runtime_state[context.query]
200
+ query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items?
201
+ @object.nodes
152
202
  end
153
203
  end
154
204
  end
@@ -8,19 +8,48 @@ module GraphQL
8
8
  child_class.description("An edge in a connection.")
9
9
  child_class.field(:cursor, String, null: false, description: "A cursor for use in pagination.")
10
10
  child_class.extend(ClassMethods)
11
+ child_class.class_eval { self.node_type = nil }
11
12
  child_class.node_nullable(true)
12
13
  end
13
14
 
15
+ def node
16
+ current_runtime_state = Thread.current[:__graphql_runtime_info]
17
+ query_runtime_state = current_runtime_state[context.query]
18
+ query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items?
19
+ @object.node
20
+ end
21
+
14
22
  module ClassMethods
23
+ def inherited(child_class)
24
+ super
25
+ child_class.node_type = nil
26
+ child_class.node_nullable = nil
27
+ end
28
+
29
+ def default_relay?
30
+ true
31
+ end
32
+
15
33
  # Get or set the Object type that this edge wraps.
16
34
  #
17
35
  # @param node_type [Class] A `Schema::Object` subclass
18
36
  # @param null [Boolean]
19
- def node_type(node_type = nil, null: self.node_nullable)
37
+ # @param field_options [Hash] Any extra arguments to pass to the `field :node` configuration
38
+ def node_type(node_type = nil, null: self.node_nullable, field_options: nil)
20
39
  if node_type
21
40
  @node_type = node_type
22
41
  # Add a default `node` field
23
- field :node, node_type, null: null, description: "The item at the end of the edge.", connection: false
42
+ base_field_options = {
43
+ name: :node,
44
+ type: node_type,
45
+ null: null,
46
+ description: "The item at the end of the edge.",
47
+ connection: false,
48
+ }
49
+ if field_options
50
+ base_field_options.merge!(field_options)
51
+ end
52
+ field(**base_field_options)
24
53
  end
25
54
  @node_type
26
55
  end
@@ -29,10 +58,6 @@ module GraphQL
29
58
  true
30
59
  end
31
60
 
32
- def accessible?(ctx)
33
- node_type.accessible?(ctx)
34
- end
35
-
36
61
  def visible?(ctx)
37
62
  node_type.visible?(ctx)
38
63
  end
@@ -41,11 +66,15 @@ module GraphQL
41
66
  # Use `node_nullable(false)` in your base class to make non-null `node` field.
42
67
  def node_nullable(new_value = nil)
43
68
  if new_value.nil?
44
- defined?(@node_nullable) ? @node_nullable : superclass.node_nullable
69
+ @node_nullable != nil ? @node_nullable : superclass.node_nullable
45
70
  else
46
71
  @node_nullable = new_value
47
72
  end
48
73
  end
74
+
75
+ protected
76
+
77
+ attr_writer :node_type, :node_nullable
49
78
  end
50
79
  end
51
80
  end
@@ -3,6 +3,7 @@
3
3
  module GraphQL
4
4
  module Types
5
5
  module Relay
6
+ # Include this module to your root Query type to get a Relay-compliant `node(id: ID!): Node` field that uses the schema's `object_from_id` hook.
6
7
  module HasNodeField
7
8
  def self.included(child_class)
8
9
  child_class.field(**field_options, &field_block)
@@ -12,7 +13,6 @@ module GraphQL
12
13
  def field_options
13
14
  {
14
15
  name: "node",
15
- owner: nil,
16
16
  type: GraphQL::Types::Relay::Node,
17
17
  null: true,
18
18
  description: "Fetches an object given its ID.",
@@ -22,7 +22,7 @@ module GraphQL
22
22
 
23
23
  def field_block
24
24
  Proc.new {
25
- argument :id, "ID!", required: true,
25
+ argument :id, "ID!",
26
26
  description: "ID of the object."
27
27
 
28
28
  def resolve(obj, args, ctx)
@@ -3,6 +3,7 @@
3
3
  module GraphQL
4
4
  module Types
5
5
  module Relay
6
+ # Include this module to your root Query type to get a Relay-style `nodes(id: ID!): [Node]` field that uses the schema's `object_from_id` hook.
6
7
  module HasNodesField
7
8
  def self.included(child_class)
8
9
  child_class.field(**field_options, &field_block)
@@ -12,7 +13,6 @@ module GraphQL
12
13
  def field_options
13
14
  {
14
15
  name: "nodes",
15
- owner: nil,
16
16
  type: [GraphQL::Types::Relay::Node, null: true],
17
17
  null: false,
18
18
  description: "Fetches a list of objects given a list of IDs.",
@@ -22,7 +22,7 @@ module GraphQL
22
22
 
23
23
  def field_block
24
24
  Proc.new {
25
- argument :ids, "[ID!]!", required: true,
25
+ argument :ids, "[ID!]!",
26
26
  description: "IDs of the objects."
27
27
 
28
28
  def resolve(obj, args, ctx)
@@ -5,9 +5,19 @@ module GraphQL
5
5
  module Relay
6
6
  module NodeBehaviors
7
7
  def self.included(child_module)
8
- child_module.extend(DefaultRelay)
8
+ child_module.extend(ClassMethods)
9
9
  child_module.description("An object with an ID.")
10
- child_module.field(:id, ID, null: false, description: "ID of the object.")
10
+ child_module.field(:id, ID, null: false, description: "ID of the object.", resolver_method: :default_global_id)
11
+ end
12
+
13
+ def default_global_id
14
+ context.schema.id_from_object(object, self.class, context)
15
+ end
16
+
17
+ module ClassMethods
18
+ def default_relay?
19
+ true
20
+ end
11
21
  end
12
22
  end
13
23
  end
@@ -4,8 +4,7 @@ module GraphQL
4
4
  module Relay
5
5
  module PageInfoBehaviors
6
6
  def self.included(child_class)
7
- child_class.extend GraphQL::Types::Relay::DefaultRelay
8
-
7
+ child_class.extend ClassMethods
9
8
  child_class.description "Information about pagination in a connection."
10
9
  child_class.field :has_next_page, Boolean, null: false,
11
10
  description: "When paginating forwards, are there more items?"
@@ -20,6 +19,12 @@ module GraphQL
20
19
  description: "When paginating forwards, the cursor to continue."
21
20
  end
22
21
  end
22
+
23
+ module ClassMethods
24
+ def default_relay?
25
+ true
26
+ end
27
+ end
23
28
  end
24
29
  end
25
30
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # behavior modules:
4
- require "graphql/types/relay/default_relay"
5
4
  require "graphql/types/relay/connection_behaviors"
6
5
  require "graphql/types/relay/edge_behaviors"
7
6
  require "graphql/types/relay/node_behaviors"
@@ -14,8 +13,6 @@ require "graphql/types/relay/page_info"
14
13
  require "graphql/types/relay/base_connection"
15
14
  require "graphql/types/relay/base_edge"
16
15
  require "graphql/types/relay/node"
17
- require "graphql/types/relay/node_field"
18
- require "graphql/types/relay/nodes_field"
19
16
 
20
17
  module GraphQL
21
18
  module Types
@@ -7,7 +7,7 @@ module GraphQL
7
7
 
8
8
  def self.coerce_result(value, ctx)
9
9
  str = value.to_s
10
- if str.encoding == Encoding::UTF_8
10
+ if str.encoding == Encoding::UTF_8 || str.ascii_only?
11
11
  str
12
12
  elsif str.frozen?
13
13
  str.encode(Encoding::UTF_8)
@@ -15,7 +15,7 @@ module GraphQL
15
15
  str.encode!(Encoding::UTF_8)
16
16
  end
17
17
  rescue EncodingError
18
- err = GraphQL::StringEncodingError.new(str)
18
+ err = GraphQL::StringEncodingError.new(str, context: ctx)
19
19
  ctx.schema.type_error(err, ctx)
20
20
  end
21
21
 
data/lib/graphql/types.rb CHANGED
@@ -6,6 +6,7 @@ require "graphql/types/id"
6
6
  require "graphql/types/int"
7
7
  require "graphql/types/iso_8601_date"
8
8
  require "graphql/types/iso_8601_date_time"
9
+ require "graphql/types/iso_8601_duration"
9
10
  require "graphql/types/json"
10
11
  require "graphql/types/string"
11
12
  require "graphql/types/relay"
@@ -12,7 +12,7 @@ module GraphQL
12
12
  attr_reader :type
13
13
 
14
14
  # @return [GraphQL::Query::Context] the context for the current query
15
- attr_reader :context
15
+ attr_accessor :context
16
16
 
17
17
  def initialize(message = nil, object: nil, type: nil, context: nil)
18
18
  if message.nil? && object.nil? && type.nil?
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "1.12.12"
3
+ VERSION = "2.2.14"
4
4
  end
data/lib/graphql.rb CHANGED
@@ -17,6 +17,17 @@ module GraphQL
17
17
  class Error < StandardError
18
18
  end
19
19
 
20
+ # This error is raised when GraphQL-Ruby encounters a situation
21
+ # that it *thought* would never happen. Please report this bug!
22
+ class InvariantError < Error
23
+ def initialize(message)
24
+ message += "
25
+
26
+ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: https://github.com/rmosolgo/graphql-ruby/issues/new?template=bug_report.md"
27
+ super(message)
28
+ end
29
+ end
30
+
20
31
  class RequiredImplementationMissingError < Error
21
32
  end
22
33
 
@@ -31,8 +42,8 @@ module GraphQL
31
42
  # Turn a query string or schema definition into an AST
32
43
  # @param graphql_string [String] a GraphQL query string or schema definition
33
44
  # @return [GraphQL::Language::Nodes::Document]
34
- def self.parse(graphql_string, tracer: GraphQL::Tracing::NullTracer)
35
- parse_with_racc(graphql_string, tracer: tracer)
45
+ def self.parse(graphql_string, trace: GraphQL::Tracing::NullTrace, filename: nil)
46
+ default_parser.parse(graphql_string, trace: trace, filename: filename)
36
47
  end
37
48
 
38
49
  # Read the contents of `filename` and parse them as GraphQL
@@ -40,41 +51,28 @@ module GraphQL
40
51
  # @return [GraphQL::Language::Nodes::Document]
41
52
  def self.parse_file(filename)
42
53
  content = File.read(filename)
43
- parse_with_racc(content, filename: filename)
44
- end
45
-
46
- def self.parse_with_racc(string, filename: nil, tracer: GraphQL::Tracing::NullTracer)
47
- GraphQL::Language::Parser.parse(string, filename: filename, tracer: tracer)
54
+ default_parser.parse(content, filename: filename)
48
55
  end
49
56
 
50
- # @return [Array<GraphQL::Language::Token>]
57
+ # @return [Array<Array>]
51
58
  def self.scan(graphql_string)
52
- scan_with_ragel(graphql_string)
59
+ default_parser.scan(graphql_string)
53
60
  end
54
61
 
55
- def self.scan_with_ragel(graphql_string)
56
- GraphQL::Language::Lexer.tokenize(graphql_string)
62
+ def self.parse_with_racc(string, filename: nil, trace: GraphQL::Tracing::NullTrace)
63
+ warn "`GraphQL.parse_with_racc` is deprecated; GraphQL-Ruby no longer uses racc for parsing. Call `GraphQL.parse` or `GraphQL::Language::Parser.parse` instead."
64
+ GraphQL::Language::Parser.parse(string, filename: filename, trace: trace)
57
65
  end
58
66
 
59
- # Support Ruby 2.2 by implementing `-"str"`. If we drop 2.2 support, we can remove this backport.
60
- module StringDedupBackport
61
- refine String do
62
- def -@
63
- if frozen?
64
- self
65
- else
66
- self.dup.freeze
67
- end
68
- end
69
- end
67
+ def self.scan_with_ruby(graphql_string)
68
+ GraphQL::Language::Lexer.tokenize(graphql_string)
70
69
  end
71
70
 
72
- module StringMatchBackport
73
- refine String do
74
- def match?(pattern)
75
- self =~ pattern
76
- end
77
- end
71
+ NOT_CONFIGURED = Object.new
72
+ private_constant :NOT_CONFIGURED
73
+ module EmptyObjects
74
+ EMPTY_HASH = {}.freeze
75
+ EMPTY_ARRAY = [].freeze
78
76
  end
79
77
  end
80
78
 
@@ -90,26 +88,10 @@ require "graphql/invalid_name_error"
90
88
  require "graphql/integer_decoding_error"
91
89
  require "graphql/integer_encoding_error"
92
90
  require "graphql/string_encoding_error"
93
-
94
- require "graphql/define"
95
- require "graphql/base_type"
96
- require "graphql/object_type"
97
- require "graphql/enum_type"
98
- require "graphql/input_object_type"
99
- require "graphql/interface_type"
100
- require "graphql/list_type"
101
- require "graphql/non_null_type"
102
- require "graphql/union_type"
103
-
104
- require "graphql/argument"
105
- require "graphql/field"
91
+ require "graphql/date_encoding_error"
92
+ require "graphql/duration_encoding_error"
106
93
  require "graphql/type_kinds"
107
-
108
- require "graphql/backwards_compatibility"
109
- require "graphql/scalar_type"
110
-
111
94
  require "graphql/name_validator"
112
-
113
95
  require "graphql/language"
114
96
 
115
97
  require_relative "./graphql/railtie" if defined? Rails::Railtie
@@ -121,66 +103,22 @@ require "graphql/execution"
121
103
  require "graphql/pagination"
122
104
  require "graphql/schema"
123
105
  require "graphql/query"
124
- require "graphql/directive"
125
- require "graphql/execution"
106
+ require "graphql/dataloader"
126
107
  require "graphql/types"
127
- require "graphql/relay"
128
- require "graphql/boolean_type"
129
- require "graphql/float_type"
130
- require "graphql/id_type"
131
- require "graphql/int_type"
132
- require "graphql/string_type"
108
+ require "graphql/static_validation"
109
+ require "graphql/execution"
133
110
  require "graphql/schema/built_in_types"
134
111
  require "graphql/schema/loader"
135
112
  require "graphql/schema/printer"
136
- require "graphql/filter"
137
- require "graphql/internal_representation"
138
- require "graphql/static_validation"
139
- require "graphql/dataloader"
140
113
  require "graphql/introspection"
114
+ require "graphql/relay"
141
115
 
142
116
  require "graphql/version"
143
- require "graphql/compatibility"
144
- require "graphql/function"
145
117
  require "graphql/subscriptions"
146
118
  require "graphql/parse_error"
147
119
  require "graphql/backtrace"
148
120
 
149
- require "graphql/deprecated_dsl"
150
- require "graphql/authorization"
151
121
  require "graphql/unauthorized_error"
152
122
  require "graphql/unauthorized_field_error"
153
123
  require "graphql/load_application_object_failed_error"
154
- require "graphql/deprecation"
155
-
156
- module GraphQL
157
- # Ruby has `deprecate_constant`,
158
- # but I don't see a way to give a nice error message in that case,
159
- # so I'm doing this instead.
160
- DEPRECATED_INT_TYPE = INT_TYPE
161
- DEPRECATED_FLOAT_TYPE = FLOAT_TYPE
162
- DEPRECATED_STRING_TYPE = STRING_TYPE
163
- DEPRECATED_BOOLEAN_TYPE = BOOLEAN_TYPE
164
- DEPRECATED_ID_TYPE = ID_TYPE
165
-
166
- remove_const :INT_TYPE
167
- remove_const :FLOAT_TYPE
168
- remove_const :STRING_TYPE
169
- remove_const :BOOLEAN_TYPE
170
- remove_const :ID_TYPE
171
-
172
- def self.const_missing(const_name)
173
- deprecated_const_name = :"DEPRECATED_#{const_name}"
174
- if const_defined?(deprecated_const_name)
175
- deprecated_type = const_get(deprecated_const_name)
176
- deprecated_caller = caller(1, 1).first
177
- # Don't warn about internal uses, like `types.Int`
178
- if !deprecated_caller.include?("lib/graphql")
179
- 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})"
180
- end
181
- deprecated_type
182
- else
183
- super
184
- end
185
- end
186
- end
124
+ require "graphql/testing"
data/readme.md CHANGED
@@ -2,15 +2,12 @@
2
2
 
3
3
  [![CI Suite](https://github.com/rmosolgo/graphql-ruby/actions/workflows/ci.yaml/badge.svg)](https://github.com/rmosolgo/graphql-ruby/actions/workflows/ci.yaml)
4
4
  [![Gem Version](https://badge.fury.io/rb/graphql.svg)](https://rubygems.org/gems/graphql)
5
- [![Code Climate](https://codeclimate.com/github/rmosolgo/graphql-ruby/badges/gpa.svg)](https://codeclimate.com/github/rmosolgo/graphql-ruby)
6
- [![Test Coverage](https://codeclimate.com/github/rmosolgo/graphql-ruby/badges/coverage.svg)](https://codeclimate.com/github/rmosolgo/graphql-ruby)
7
- [![built with love](https://cloud.githubusercontent.com/assets/2231765/6766607/d07992c6-cfc9-11e4-813f-d9240714dd50.png)](https://rmosolgo.github.io/react-badges/)
8
5
 
9
6
  A Ruby implementation of [GraphQL](https://graphql.org/).
10
7
 
11
8
  - [Website](https://graphql-ruby.org/)
12
9
  - [API Documentation](https://www.rubydoc.info/github/rmosolgo/graphql-ruby)
13
- - [Newsletter](https://tinyletter.com/graphql-ruby)
10
+ - [Newsletter](https://buttondown.email/graphql-ruby)
14
11
 
15
12
  ## Installation
16
13
 
@@ -37,7 +34,17 @@ Or, see ["Getting Started"](https://graphql-ruby.org/getting_started.html).
37
34
 
38
35
  ## Upgrade
39
36
 
40
- I also sell [GraphQL::Pro](https://graphql.pro) which provides several features on top of the GraphQL runtime, including [Pundit authorization](https://graphql-ruby.org/authorization/pundit_integration), [CanCan authorization](https://graphql-ruby.org/authorization/can_can_integration), [Pusher-based subscriptions](https://graphql-ruby.org/subscriptions/pusher_implementation) and [persisted queries](https://graphql-ruby.org/operation_store/overview). Besides that, Pro customers get email support and an opportunity to support graphql-ruby's development!
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!
41
48
 
42
49
  ## Goals
43
50
 
@@ -47,6 +54,6 @@ I also sell [GraphQL::Pro](https://graphql.pro) which provides several features
47
54
 
48
55
  ## Getting Involved
49
56
 
50
- - __Say hi & ask questions__ in the [#ruby channel on Slack](https://graphql-slack.herokuapp.com/) or [on Twitter](https://twitter.com/rmosolgo)!
57
+ - __Say hi & ask questions__ in the #graphql-ruby channel on [Discord](https://discord.com/invite/xud7bH9).
51
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).
52
59
  - __Start hacking__ with the [Development guide](https://graphql-ruby.org/development).