graphql 1.11.3 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/graphql/core.rb +8 -0
  3. data/lib/generators/graphql/install_generator.rb +5 -5
  4. data/lib/generators/graphql/object_generator.rb +2 -0
  5. data/lib/generators/graphql/relay_generator.rb +63 -0
  6. data/lib/generators/graphql/templates/base_argument.erb +2 -0
  7. data/lib/generators/graphql/templates/base_connection.erb +8 -0
  8. data/lib/generators/graphql/templates/base_edge.erb +8 -0
  9. data/lib/generators/graphql/templates/base_enum.erb +2 -0
  10. data/lib/generators/graphql/templates/base_field.erb +2 -0
  11. data/lib/generators/graphql/templates/base_input_object.erb +2 -0
  12. data/lib/generators/graphql/templates/base_interface.erb +2 -0
  13. data/lib/generators/graphql/templates/base_mutation.erb +2 -0
  14. data/lib/generators/graphql/templates/base_object.erb +2 -0
  15. data/lib/generators/graphql/templates/base_scalar.erb +2 -0
  16. data/lib/generators/graphql/templates/base_union.erb +2 -0
  17. data/lib/generators/graphql/templates/enum.erb +2 -0
  18. data/lib/generators/graphql/templates/graphql_controller.erb +2 -0
  19. data/lib/generators/graphql/templates/interface.erb +2 -0
  20. data/lib/generators/graphql/templates/loader.erb +2 -0
  21. data/lib/generators/graphql/templates/mutation.erb +2 -0
  22. data/lib/generators/graphql/templates/mutation_type.erb +2 -0
  23. data/lib/generators/graphql/templates/node_type.erb +9 -0
  24. data/lib/generators/graphql/templates/object.erb +3 -1
  25. data/lib/generators/graphql/templates/query_type.erb +3 -3
  26. data/lib/generators/graphql/templates/scalar.erb +2 -0
  27. data/lib/generators/graphql/templates/schema.erb +10 -35
  28. data/lib/generators/graphql/templates/union.erb +3 -1
  29. data/lib/graphql.rb +55 -4
  30. data/lib/graphql/analysis/analyze_query.rb +7 -0
  31. data/lib/graphql/analysis/ast.rb +11 -2
  32. data/lib/graphql/analysis/ast/visitor.rb +9 -1
  33. data/lib/graphql/argument.rb +3 -3
  34. data/lib/graphql/backtrace.rb +28 -19
  35. data/lib/graphql/backtrace/legacy_tracer.rb +56 -0
  36. data/lib/graphql/backtrace/table.rb +22 -2
  37. data/lib/graphql/backtrace/tracer.rb +40 -8
  38. data/lib/graphql/backwards_compatibility.rb +1 -0
  39. data/lib/graphql/compatibility/execution_specification.rb +1 -0
  40. data/lib/graphql/compatibility/lazy_execution_specification.rb +2 -0
  41. data/lib/graphql/compatibility/query_parser_specification.rb +2 -0
  42. data/lib/graphql/compatibility/schema_parser_specification.rb +2 -0
  43. data/lib/graphql/dataloader.rb +197 -0
  44. data/lib/graphql/dataloader/null_dataloader.rb +21 -0
  45. data/lib/graphql/dataloader/request.rb +24 -0
  46. data/lib/graphql/dataloader/request_all.rb +22 -0
  47. data/lib/graphql/dataloader/source.rb +93 -0
  48. data/lib/graphql/define/assign_global_id_field.rb +2 -2
  49. data/lib/graphql/define/instance_definable.rb +32 -2
  50. data/lib/graphql/define/type_definer.rb +5 -5
  51. data/lib/graphql/deprecated_dsl.rb +5 -0
  52. data/lib/graphql/enum_type.rb +2 -0
  53. data/lib/graphql/execution/errors.rb +4 -0
  54. data/lib/graphql/execution/execute.rb +7 -0
  55. data/lib/graphql/execution/interpreter.rb +20 -6
  56. data/lib/graphql/execution/interpreter/arguments.rb +57 -5
  57. data/lib/graphql/execution/interpreter/arguments_cache.rb +8 -0
  58. data/lib/graphql/execution/interpreter/handles_raw_value.rb +0 -7
  59. data/lib/graphql/execution/interpreter/runtime.rb +251 -138
  60. data/lib/graphql/execution/multiplex.rb +20 -6
  61. data/lib/graphql/function.rb +4 -0
  62. data/lib/graphql/input_object_type.rb +2 -0
  63. data/lib/graphql/integer_decoding_error.rb +17 -0
  64. data/lib/graphql/interface_type.rb +3 -1
  65. data/lib/graphql/introspection.rb +96 -0
  66. data/lib/graphql/introspection/field_type.rb +7 -3
  67. data/lib/graphql/introspection/input_value_type.rb +6 -0
  68. data/lib/graphql/introspection/introspection_query.rb +6 -92
  69. data/lib/graphql/introspection/type_type.rb +7 -3
  70. data/lib/graphql/invalid_null_error.rb +1 -1
  71. data/lib/graphql/language/block_string.rb +24 -5
  72. data/lib/graphql/language/document_from_schema_definition.rb +50 -23
  73. data/lib/graphql/language/lexer.rb +7 -3
  74. data/lib/graphql/language/lexer.rl +7 -3
  75. data/lib/graphql/language/nodes.rb +1 -1
  76. data/lib/graphql/language/parser.rb +107 -103
  77. data/lib/graphql/language/parser.y +4 -0
  78. data/lib/graphql/language/sanitized_printer.rb +59 -26
  79. data/lib/graphql/name_validator.rb +6 -7
  80. data/lib/graphql/object_type.rb +2 -0
  81. data/lib/graphql/pagination/connection.rb +5 -1
  82. data/lib/graphql/pagination/connections.rb +15 -17
  83. data/lib/graphql/query.rb +8 -3
  84. data/lib/graphql/query/context.rb +38 -4
  85. data/lib/graphql/query/fingerprint.rb +2 -0
  86. data/lib/graphql/query/serial_execution.rb +1 -0
  87. data/lib/graphql/query/validation_pipeline.rb +4 -1
  88. data/lib/graphql/relay/array_connection.rb +2 -2
  89. data/lib/graphql/relay/base_connection.rb +7 -0
  90. data/lib/graphql/relay/connection_instrumentation.rb +4 -4
  91. data/lib/graphql/relay/connection_type.rb +1 -1
  92. data/lib/graphql/relay/mutation.rb +1 -0
  93. data/lib/graphql/relay/node.rb +3 -0
  94. data/lib/graphql/relay/range_add.rb +14 -5
  95. data/lib/graphql/relay/type_extensions.rb +2 -0
  96. data/lib/graphql/scalar_type.rb +2 -0
  97. data/lib/graphql/schema.rb +107 -38
  98. data/lib/graphql/schema/argument.rb +74 -5
  99. data/lib/graphql/schema/build_from_definition.rb +203 -86
  100. data/lib/graphql/schema/default_type_error.rb +2 -0
  101. data/lib/graphql/schema/directive.rb +76 -0
  102. data/lib/graphql/schema/directive/deprecated.rb +1 -1
  103. data/lib/graphql/schema/directive/flagged.rb +57 -0
  104. data/lib/graphql/schema/enum.rb +3 -0
  105. data/lib/graphql/schema/enum_value.rb +12 -6
  106. data/lib/graphql/schema/field.rb +59 -24
  107. data/lib/graphql/schema/field/connection_extension.rb +11 -9
  108. data/lib/graphql/schema/field/scope_extension.rb +1 -1
  109. data/lib/graphql/schema/input_object.rb +38 -25
  110. data/lib/graphql/schema/interface.rb +2 -1
  111. data/lib/graphql/schema/late_bound_type.rb +2 -2
  112. data/lib/graphql/schema/loader.rb +1 -0
  113. data/lib/graphql/schema/member.rb +4 -0
  114. data/lib/graphql/schema/member/base_dsl_methods.rb +1 -0
  115. data/lib/graphql/schema/member/build_type.rb +17 -7
  116. data/lib/graphql/schema/member/has_arguments.rb +70 -51
  117. data/lib/graphql/schema/member/has_deprecation_reason.rb +25 -0
  118. data/lib/graphql/schema/member/has_directives.rb +98 -0
  119. data/lib/graphql/schema/member/has_fields.rb +2 -2
  120. data/lib/graphql/schema/member/has_validators.rb +31 -0
  121. data/lib/graphql/schema/member/type_system_helpers.rb +3 -3
  122. data/lib/graphql/schema/object.rb +11 -0
  123. data/lib/graphql/schema/printer.rb +5 -4
  124. data/lib/graphql/schema/relay_classic_mutation.rb +4 -2
  125. data/lib/graphql/schema/resolver.rb +7 -0
  126. data/lib/graphql/schema/resolver/has_payload_type.rb +2 -0
  127. data/lib/graphql/schema/subscription.rb +20 -12
  128. data/lib/graphql/schema/timeout.rb +29 -15
  129. data/lib/graphql/schema/timeout_middleware.rb +2 -0
  130. data/lib/graphql/schema/unique_within_type.rb +1 -2
  131. data/lib/graphql/schema/validation.rb +10 -0
  132. data/lib/graphql/schema/validator.rb +163 -0
  133. data/lib/graphql/schema/validator/exclusion_validator.rb +31 -0
  134. data/lib/graphql/schema/validator/format_validator.rb +49 -0
  135. data/lib/graphql/schema/validator/inclusion_validator.rb +33 -0
  136. data/lib/graphql/schema/validator/length_validator.rb +57 -0
  137. data/lib/graphql/schema/validator/numericality_validator.rb +71 -0
  138. data/lib/graphql/schema/validator/required_validator.rb +68 -0
  139. data/lib/graphql/schema/warden.rb +2 -3
  140. data/lib/graphql/static_validation.rb +1 -0
  141. data/lib/graphql/static_validation/all_rules.rb +1 -0
  142. data/lib/graphql/static_validation/rules/fields_will_merge.rb +25 -17
  143. data/lib/graphql/static_validation/rules/input_object_names_are_unique.rb +30 -0
  144. data/lib/graphql/static_validation/rules/input_object_names_are_unique_error.rb +30 -0
  145. data/lib/graphql/static_validation/validation_timeout_error.rb +25 -0
  146. data/lib/graphql/static_validation/validator.rb +31 -7
  147. data/lib/graphql/subscriptions.rb +23 -16
  148. data/lib/graphql/subscriptions/action_cable_subscriptions.rb +21 -7
  149. data/lib/graphql/tracing.rb +2 -2
  150. data/lib/graphql/tracing/appoptics_tracing.rb +12 -2
  151. data/lib/graphql/tracing/platform_tracing.rb +4 -2
  152. data/lib/graphql/tracing/prometheus_tracing/graphql_collector.rb +4 -1
  153. data/lib/graphql/tracing/skylight_tracing.rb +1 -1
  154. data/lib/graphql/types/int.rb +9 -2
  155. data/lib/graphql/types/iso_8601_date_time.rb +2 -1
  156. data/lib/graphql/types/relay.rb +11 -3
  157. data/lib/graphql/types/relay/base_connection.rb +2 -90
  158. data/lib/graphql/types/relay/base_edge.rb +2 -34
  159. data/lib/graphql/types/relay/connection_behaviors.rb +123 -0
  160. data/lib/graphql/types/relay/default_relay.rb +27 -0
  161. data/lib/graphql/types/relay/edge_behaviors.rb +42 -0
  162. data/lib/graphql/types/relay/has_node_field.rb +41 -0
  163. data/lib/graphql/types/relay/has_nodes_field.rb +41 -0
  164. data/lib/graphql/types/relay/node.rb +2 -4
  165. data/lib/graphql/types/relay/node_behaviors.rb +15 -0
  166. data/lib/graphql/types/relay/node_field.rb +1 -19
  167. data/lib/graphql/types/relay/nodes_field.rb +1 -19
  168. data/lib/graphql/types/relay/page_info.rb +2 -14
  169. data/lib/graphql/types/relay/page_info_behaviors.rb +25 -0
  170. data/lib/graphql/types/string.rb +7 -1
  171. data/lib/graphql/unauthorized_error.rb +1 -1
  172. data/lib/graphql/union_type.rb +2 -0
  173. data/lib/graphql/upgrader/member.rb +1 -0
  174. data/lib/graphql/upgrader/schema.rb +1 -0
  175. data/lib/graphql/version.rb +1 -1
  176. data/readme.md +1 -1
  177. metadata +38 -9
  178. data/lib/graphql/types/relay/base_field.rb +0 -22
  179. data/lib/graphql/types/relay/base_interface.rb +0 -29
  180. data/lib/graphql/types/relay/base_object.rb +0 -26
@@ -7,7 +7,13 @@ module GraphQL
7
7
 
8
8
  def self.coerce_result(value, ctx)
9
9
  str = value.to_s
10
- str.encoding == Encoding::UTF_8 ? str : str.encode(Encoding::UTF_8)
10
+ if str.encoding == Encoding::UTF_8
11
+ str
12
+ elsif str.frozen?
13
+ str.encode(Encoding::UTF_8)
14
+ else
15
+ str.encode!(Encoding::UTF_8)
16
+ end
11
17
  rescue EncodingError
12
18
  err = GraphQL::StringEncodingError.new(str)
13
19
  ctx.schema.type_error(err, ctx)
@@ -22,7 +22,7 @@ module GraphQL
22
22
  @object = object
23
23
  @type = type
24
24
  @context = context
25
- message ||= "An instance of #{object.class} failed #{type.name}'s authorization check"
25
+ message ||= "An instance of #{object.class} failed #{type.graphql_name}'s authorization check"
26
26
  super(message)
27
27
  end
28
28
  end
@@ -2,6 +2,8 @@
2
2
  module GraphQL
3
3
  # @api deprecated
4
4
  class UnionType < GraphQL::BaseType
5
+ extend Define::InstanceDefinable::DeprecatedDefine
6
+
5
7
  # Rubocop was unhappy about the syntax when this was a proc literal
6
8
  class AcceptPossibleTypesDefinition
7
9
  def self.call(target, possible_types, options = {})
@@ -771,6 +771,7 @@ module GraphQL
771
771
 
772
772
  class Member
773
773
  def initialize(member, skip: SkipOnNullKeyword, type_transforms: DEFAULT_TYPE_TRANSFORMS, field_transforms: DEFAULT_FIELD_TRANSFORMS, clean_up_transforms: DEFAULT_CLEAN_UP_TRANSFORMS)
774
+ warn "#{self.class} will be removed from GraphQL-Ruby 2.0 (but there's no point in using it after you've transformed your code, anyways)"
774
775
  @member = member
775
776
  @skip = skip
776
777
  @type_transforms = type_transforms
@@ -4,6 +4,7 @@ module GraphQL
4
4
  module Upgrader
5
5
  class Schema
6
6
  def initialize(schema)
7
+ warn "#{self.class} will be removed from GraphQL-Ruby 2.0 (but there's no point in using it after you've transformed your code, anyways)"
7
8
  @schema = schema
8
9
  end
9
10
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "1.11.3"
3
+ VERSION = "1.12.0"
4
4
  end
data/readme.md CHANGED
@@ -9,7 +9,7 @@
9
9
  A Ruby implementation of [GraphQL](https://graphql.org/).
10
10
 
11
11
  - [Website](https://graphql-ruby.org/)
12
- - [API Documentation](https://www.rubydoc.info/gems/graphql)
12
+ - [API Documentation](https://www.rubydoc.info/github/rmosolgo/graphql-ruby)
13
13
  - [Newsletter](https://tinyletter.com/graphql-ruby)
14
14
 
15
15
  ## Installation
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.11.3
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-13 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -334,8 +334,11 @@ files:
334
334
  - lib/generators/graphql/loader_generator.rb
335
335
  - lib/generators/graphql/mutation_generator.rb
336
336
  - lib/generators/graphql/object_generator.rb
337
+ - lib/generators/graphql/relay_generator.rb
337
338
  - lib/generators/graphql/scalar_generator.rb
338
339
  - lib/generators/graphql/templates/base_argument.erb
340
+ - lib/generators/graphql/templates/base_connection.erb
341
+ - lib/generators/graphql/templates/base_edge.erb
339
342
  - lib/generators/graphql/templates/base_enum.erb
340
343
  - lib/generators/graphql/templates/base_field.erb
341
344
  - lib/generators/graphql/templates/base_input_object.erb
@@ -350,6 +353,7 @@ files:
350
353
  - lib/generators/graphql/templates/loader.erb
351
354
  - lib/generators/graphql/templates/mutation.erb
352
355
  - lib/generators/graphql/templates/mutation_type.erb
356
+ - lib/generators/graphql/templates/node_type.erb
353
357
  - lib/generators/graphql/templates/object.erb
354
358
  - lib/generators/graphql/templates/query_type.erb
355
359
  - lib/generators/graphql/templates/scalar.erb
@@ -379,6 +383,7 @@ files:
379
383
  - lib/graphql/authorization.rb
380
384
  - lib/graphql/backtrace.rb
381
385
  - lib/graphql/backtrace/inspect_result.rb
386
+ - lib/graphql/backtrace/legacy_tracer.rb
382
387
  - lib/graphql/backtrace/table.rb
383
388
  - lib/graphql/backtrace/traced_error.rb
384
389
  - lib/graphql/backtrace/tracer.rb
@@ -396,6 +401,11 @@ files:
396
401
  - lib/graphql/compatibility/query_parser_specification/parse_error_specification.rb
397
402
  - lib/graphql/compatibility/query_parser_specification/query_assertions.rb
398
403
  - lib/graphql/compatibility/schema_parser_specification.rb
404
+ - lib/graphql/dataloader.rb
405
+ - lib/graphql/dataloader/null_dataloader.rb
406
+ - lib/graphql/dataloader/request.rb
407
+ - lib/graphql/dataloader/request_all.rb
408
+ - lib/graphql/dataloader/source.rb
399
409
  - lib/graphql/define.rb
400
410
  - lib/graphql/define/assign_argument.rb
401
411
  - lib/graphql/define/assign_connection.rb
@@ -445,6 +455,7 @@ files:
445
455
  - lib/graphql/id_type.rb
446
456
  - lib/graphql/input_object_type.rb
447
457
  - lib/graphql/int_type.rb
458
+ - lib/graphql/integer_decoding_error.rb
448
459
  - lib/graphql/integer_encoding_error.rb
449
460
  - lib/graphql/interface_type.rb
450
461
  - lib/graphql/internal_representation.rb
@@ -554,6 +565,7 @@ files:
554
565
  - lib/graphql/schema/directive.rb
555
566
  - lib/graphql/schema/directive/deprecated.rb
556
567
  - lib/graphql/schema/directive/feature.rb
568
+ - lib/graphql/schema/directive/flagged.rb
557
569
  - lib/graphql/schema/directive/include.rb
558
570
  - lib/graphql/schema/directive/skip.rb
559
571
  - lib/graphql/schema/directive/transform.rb
@@ -580,9 +592,12 @@ files:
580
592
  - lib/graphql/schema/member/graphql_type_names.rb
581
593
  - lib/graphql/schema/member/has_arguments.rb
582
594
  - lib/graphql/schema/member/has_ast_node.rb
595
+ - lib/graphql/schema/member/has_deprecation_reason.rb
596
+ - lib/graphql/schema/member/has_directives.rb
583
597
  - lib/graphql/schema/member/has_fields.rb
584
598
  - lib/graphql/schema/member/has_path.rb
585
599
  - lib/graphql/schema/member/has_unresolved_type_error.rb
600
+ - lib/graphql/schema/member/has_validators.rb
586
601
  - lib/graphql/schema/member/instrumentation.rb
587
602
  - lib/graphql/schema/member/relay_shortcuts.rb
588
603
  - lib/graphql/schema/member/scoped.rb
@@ -609,6 +624,13 @@ files:
609
624
  - lib/graphql/schema/union.rb
610
625
  - lib/graphql/schema/unique_within_type.rb
611
626
  - lib/graphql/schema/validation.rb
627
+ - lib/graphql/schema/validator.rb
628
+ - lib/graphql/schema/validator/exclusion_validator.rb
629
+ - lib/graphql/schema/validator/format_validator.rb
630
+ - lib/graphql/schema/validator/inclusion_validator.rb
631
+ - lib/graphql/schema/validator/length_validator.rb
632
+ - lib/graphql/schema/validator/numericality_validator.rb
633
+ - lib/graphql/schema/validator/required_validator.rb
612
634
  - lib/graphql/schema/warden.rb
613
635
  - lib/graphql/schema/wrapper.rb
614
636
  - lib/graphql/static_validation.rb
@@ -650,6 +672,8 @@ files:
650
672
  - lib/graphql/static_validation/rules/fragments_are_on_composite_types_error.rb
651
673
  - lib/graphql/static_validation/rules/fragments_are_used.rb
652
674
  - lib/graphql/static_validation/rules/fragments_are_used_error.rb
675
+ - lib/graphql/static_validation/rules/input_object_names_are_unique.rb
676
+ - lib/graphql/static_validation/rules/input_object_names_are_unique_error.rb
653
677
  - lib/graphql/static_validation/rules/mutation_root_exists.rb
654
678
  - lib/graphql/static_validation/rules/mutation_root_exists_error.rb
655
679
  - lib/graphql/static_validation/rules/no_definitions_are_present.rb
@@ -676,6 +700,7 @@ files:
676
700
  - lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb
677
701
  - lib/graphql/static_validation/type_stack.rb
678
702
  - lib/graphql/static_validation/validation_context.rb
703
+ - lib/graphql/static_validation/validation_timeout_error.rb
679
704
  - lib/graphql/static_validation/validator.rb
680
705
  - lib/graphql/string_encoding_error.rb
681
706
  - lib/graphql/string_type.rb
@@ -712,13 +737,17 @@ files:
712
737
  - lib/graphql/types/relay.rb
713
738
  - lib/graphql/types/relay/base_connection.rb
714
739
  - lib/graphql/types/relay/base_edge.rb
715
- - lib/graphql/types/relay/base_field.rb
716
- - lib/graphql/types/relay/base_interface.rb
717
- - lib/graphql/types/relay/base_object.rb
740
+ - lib/graphql/types/relay/connection_behaviors.rb
741
+ - lib/graphql/types/relay/default_relay.rb
742
+ - lib/graphql/types/relay/edge_behaviors.rb
743
+ - lib/graphql/types/relay/has_node_field.rb
744
+ - lib/graphql/types/relay/has_nodes_field.rb
718
745
  - lib/graphql/types/relay/node.rb
746
+ - lib/graphql/types/relay/node_behaviors.rb
719
747
  - lib/graphql/types/relay/node_field.rb
720
748
  - lib/graphql/types/relay/nodes_field.rb
721
749
  - lib/graphql/types/relay/page_info.rb
750
+ - lib/graphql/types/relay/page_info_behaviors.rb
722
751
  - lib/graphql/types/string.rb
723
752
  - lib/graphql/unauthorized_error.rb
724
753
  - lib/graphql/unauthorized_field_error.rb
@@ -737,7 +766,7 @@ metadata:
737
766
  source_code_uri: https://github.com/rmosolgo/graphql-ruby
738
767
  bug_tracker_uri: https://github.com/rmosolgo/graphql-ruby/issues
739
768
  mailing_list_uri: https://tinyletter.com/graphql-ruby
740
- post_install_message:
769
+ post_install_message:
741
770
  rdoc_options: []
742
771
  require_paths:
743
772
  - lib
@@ -752,8 +781,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
752
781
  - !ruby/object:Gem::Version
753
782
  version: '0'
754
783
  requirements: []
755
- rubygems_version: 3.1.2
756
- signing_key:
784
+ rubygems_version: 3.2.3
785
+ signing_key:
757
786
  specification_version: 4
758
787
  summary: A GraphQL language and runtime for Ruby
759
788
  test_files: []
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module GraphQL
4
- module Types
5
- module Relay
6
- class BaseField < GraphQL::Schema::Field
7
- def initialize(edge_class: nil, **rest, &block)
8
- @edge_class = edge_class
9
- super(**rest, &block)
10
- end
11
-
12
- def to_graphql
13
- field = super
14
- if @edge_class
15
- field.edge_class = @edge_class
16
- end
17
- field
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module GraphQL
4
- module Types
5
- module Relay
6
- module BaseInterface
7
- include GraphQL::Schema::Interface
8
-
9
- field_class(Types::Relay::BaseField)
10
-
11
- definition_methods do
12
- def default_relay(new_value)
13
- @default_relay = new_value
14
- end
15
-
16
- def default_relay?
17
- !!@default_relay
18
- end
19
-
20
- def to_graphql
21
- type_defn = super
22
- type_defn.default_relay = default_relay?
23
- type_defn
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module GraphQL
4
- module Types
5
- module Relay
6
- class BaseObject < GraphQL::Schema::Object
7
- field_class(Types::Relay::BaseField)
8
- class << self
9
- def default_relay(new_value)
10
- @default_relay = new_value
11
- end
12
-
13
- def default_relay?
14
- !!@default_relay
15
- end
16
-
17
- def to_graphql
18
- type_defn = super
19
- type_defn.default_relay = default_relay?
20
- type_defn
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end