graphql 2.3.7 → 2.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/graphql/install_generator.rb +46 -0
  3. data/lib/generators/graphql/orm_mutations_base.rb +1 -1
  4. data/lib/generators/graphql/templates/base_resolver.erb +2 -0
  5. data/lib/generators/graphql/type_generator.rb +1 -1
  6. data/lib/graphql/analysis/field_usage.rb +1 -1
  7. data/lib/graphql/analysis/query_complexity.rb +3 -3
  8. data/lib/graphql/analysis/visitor.rb +8 -7
  9. data/lib/graphql/analysis.rb +4 -4
  10. data/lib/graphql/autoload.rb +37 -0
  11. data/lib/graphql/current.rb +52 -0
  12. data/lib/graphql/dataloader/async_dataloader.rb +7 -6
  13. data/lib/graphql/dataloader/source.rb +7 -4
  14. data/lib/graphql/dataloader.rb +40 -19
  15. data/lib/graphql/execution/interpreter/arguments_cache.rb +5 -10
  16. data/lib/graphql/execution/interpreter/resolve.rb +13 -9
  17. data/lib/graphql/execution/interpreter/runtime.rb +35 -31
  18. data/lib/graphql/execution/interpreter.rb +6 -4
  19. data/lib/graphql/execution/lookahead.rb +18 -11
  20. data/lib/graphql/introspection/directive_type.rb +1 -1
  21. data/lib/graphql/introspection/entry_points.rb +2 -2
  22. data/lib/graphql/introspection/field_type.rb +1 -1
  23. data/lib/graphql/introspection/schema_type.rb +6 -11
  24. data/lib/graphql/introspection/type_type.rb +5 -5
  25. data/lib/graphql/invalid_null_error.rb +1 -1
  26. data/lib/graphql/language/cache.rb +13 -0
  27. data/lib/graphql/language/comment.rb +18 -0
  28. data/lib/graphql/language/document_from_schema_definition.rb +62 -34
  29. data/lib/graphql/language/lexer.rb +18 -15
  30. data/lib/graphql/language/nodes.rb +24 -16
  31. data/lib/graphql/language/parser.rb +14 -1
  32. data/lib/graphql/language/printer.rb +31 -15
  33. data/lib/graphql/language/sanitized_printer.rb +1 -1
  34. data/lib/graphql/language.rb +6 -6
  35. data/lib/graphql/pagination/connection.rb +1 -1
  36. data/lib/graphql/query/context/scoped_context.rb +1 -1
  37. data/lib/graphql/query/context.rb +13 -6
  38. data/lib/graphql/query/null_context.rb +3 -5
  39. data/lib/graphql/query/variable_validation_error.rb +1 -1
  40. data/lib/graphql/query.rb +72 -18
  41. data/lib/graphql/railtie.rb +7 -0
  42. data/lib/graphql/rubocop/graphql/field_type_in_block.rb +144 -0
  43. data/lib/graphql/rubocop/graphql/root_types_in_block.rb +38 -0
  44. data/lib/graphql/rubocop.rb +2 -0
  45. data/lib/graphql/schema/addition.rb +2 -1
  46. data/lib/graphql/schema/always_visible.rb +6 -2
  47. data/lib/graphql/schema/argument.rb +14 -1
  48. data/lib/graphql/schema/build_from_definition.rb +9 -1
  49. data/lib/graphql/schema/directive/flagged.rb +2 -2
  50. data/lib/graphql/schema/directive.rb +1 -1
  51. data/lib/graphql/schema/enum.rb +71 -23
  52. data/lib/graphql/schema/enum_value.rb +10 -2
  53. data/lib/graphql/schema/field/connection_extension.rb +1 -1
  54. data/lib/graphql/schema/field/scope_extension.rb +1 -1
  55. data/lib/graphql/schema/field.rb +102 -47
  56. data/lib/graphql/schema/field_extension.rb +1 -1
  57. data/lib/graphql/schema/has_single_input_argument.rb +5 -2
  58. data/lib/graphql/schema/input_object.rb +90 -39
  59. data/lib/graphql/schema/interface.rb +22 -5
  60. data/lib/graphql/schema/introspection_system.rb +5 -16
  61. data/lib/graphql/schema/loader.rb +1 -1
  62. data/lib/graphql/schema/member/base_dsl_methods.rb +15 -0
  63. data/lib/graphql/schema/member/has_arguments.rb +25 -20
  64. data/lib/graphql/schema/member/has_directives.rb +3 -3
  65. data/lib/graphql/schema/member/has_fields.rb +26 -6
  66. data/lib/graphql/schema/member/has_interfaces.rb +4 -4
  67. data/lib/graphql/schema/member/has_unresolved_type_error.rb +5 -1
  68. data/lib/graphql/schema/member/has_validators.rb +1 -1
  69. data/lib/graphql/schema/object.rb +8 -0
  70. data/lib/graphql/schema/printer.rb +1 -0
  71. data/lib/graphql/schema/relay_classic_mutation.rb +0 -1
  72. data/lib/graphql/schema/resolver.rb +12 -14
  73. data/lib/graphql/schema/subscription.rb +2 -2
  74. data/lib/graphql/schema/type_expression.rb +2 -2
  75. data/lib/graphql/schema/union.rb +1 -1
  76. data/lib/graphql/schema/validator/all_validator.rb +62 -0
  77. data/lib/graphql/schema/validator/required_validator.rb +28 -4
  78. data/lib/graphql/schema/validator.rb +3 -1
  79. data/lib/graphql/schema/visibility/migration.rb +187 -0
  80. data/lib/graphql/schema/visibility/profile.rb +353 -0
  81. data/lib/graphql/schema/visibility/visit.rb +190 -0
  82. data/lib/graphql/schema/visibility.rb +294 -0
  83. data/lib/graphql/schema/warden.rb +166 -16
  84. data/lib/graphql/schema.rb +348 -94
  85. data/lib/graphql/static_validation/base_visitor.rb +6 -5
  86. data/lib/graphql/static_validation/literal_validator.rb +4 -4
  87. data/lib/graphql/static_validation/rules/argument_literals_are_compatible.rb +1 -1
  88. data/lib/graphql/static_validation/rules/argument_names_are_unique.rb +1 -1
  89. data/lib/graphql/static_validation/rules/arguments_are_defined.rb +3 -2
  90. data/lib/graphql/static_validation/rules/directives_are_defined.rb +3 -3
  91. data/lib/graphql/static_validation/rules/directives_are_in_valid_locations.rb +2 -0
  92. data/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb +12 -2
  93. data/lib/graphql/static_validation/rules/fields_have_appropriate_selections.rb +2 -2
  94. data/lib/graphql/static_validation/rules/fields_will_merge.rb +8 -7
  95. data/lib/graphql/static_validation/rules/fragment_spreads_are_possible.rb +3 -3
  96. data/lib/graphql/static_validation/rules/fragment_types_exist.rb +12 -2
  97. data/lib/graphql/static_validation/rules/fragments_are_on_composite_types.rb +1 -1
  98. data/lib/graphql/static_validation/rules/mutation_root_exists.rb +1 -1
  99. data/lib/graphql/static_validation/rules/no_definitions_are_present.rb +1 -1
  100. data/lib/graphql/static_validation/rules/query_root_exists.rb +1 -1
  101. data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +4 -4
  102. data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +3 -3
  103. data/lib/graphql/static_validation/rules/subscription_root_exists.rb +1 -1
  104. data/lib/graphql/static_validation/rules/unique_directives_per_location.rb +1 -1
  105. data/lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb +18 -27
  106. data/lib/graphql/static_validation/rules/variable_names_are_unique.rb +1 -1
  107. data/lib/graphql/static_validation/rules/variable_usages_are_allowed.rb +2 -2
  108. data/lib/graphql/static_validation/rules/variables_are_input_types.rb +11 -2
  109. data/lib/graphql/static_validation/validation_context.rb +18 -2
  110. data/lib/graphql/subscriptions/action_cable_subscriptions.rb +3 -2
  111. data/lib/graphql/subscriptions/broadcast_analyzer.rb +10 -4
  112. data/lib/graphql/subscriptions/event.rb +1 -1
  113. data/lib/graphql/subscriptions.rb +6 -4
  114. data/lib/graphql/testing/helpers.rb +10 -6
  115. data/lib/graphql/tracing/notifications_trace.rb +2 -2
  116. data/lib/graphql/types/relay/connection_behaviors.rb +12 -2
  117. data/lib/graphql/types/relay/edge_behaviors.rb +11 -1
  118. data/lib/graphql/types/relay/page_info_behaviors.rb +4 -0
  119. data/lib/graphql/types.rb +18 -11
  120. data/lib/graphql/unauthorized_enum_value_error.rb +13 -0
  121. data/lib/graphql/version.rb +1 -1
  122. data/lib/graphql.rb +81 -45
  123. metadata +31 -8
  124. data/lib/graphql/language/token.rb +0 -34
  125. data/lib/graphql/schema/invalid_type_error.rb +0 -7
@@ -64,12 +64,12 @@ module GraphQL
64
64
  event_name = event_name.to_s
65
65
 
66
66
  # Try with the verbatim input first:
67
- field = @schema.get_field(@schema.subscription, event_name, context)
67
+ field = dummy_query.types.field(@schema.subscription, event_name) # rubocop:disable Development/ContextIsPassedCop
68
68
 
69
69
  if field.nil?
70
70
  # And if it wasn't found, normalize it:
71
71
  normalized_event_name = normalize_name(event_name)
72
- field = @schema.get_field(@schema.subscription, normalized_event_name, context)
72
+ field = dummy_query.types.field(@schema.subscription, normalized_event_name) # rubocop:disable Development/ContextIsPassedCop
73
73
  if field.nil?
74
74
  raise InvalidTriggerError, "No subscription matching trigger: #{event_name} (looked for #{@schema.subscription.graphql_name}.#{normalized_event_name})"
75
75
  end
@@ -250,6 +250,8 @@ module GraphQL
250
250
  def normalize_arguments(event_name, arg_owner, args, context)
251
251
  case arg_owner
252
252
  when GraphQL::Schema::Field, Class
253
+ return args if args.nil?
254
+
253
255
  if arg_owner.is_a?(Class) && !arg_owner.kind.input_object?
254
256
  # it's a type, but not an input object
255
257
  return args
@@ -289,7 +291,7 @@ module GraphQL
289
291
  end
290
292
  end
291
293
 
292
- if missing_arg_names.any?
294
+ if !missing_arg_names.empty?
293
295
  arg_owner_name = if arg_owner.is_a?(GraphQL::Schema::Field)
294
296
  arg_owner.path
295
297
  elsif arg_owner.is_a?(Class)
@@ -302,7 +304,7 @@ module GraphQL
302
304
 
303
305
  normalized_args
304
306
  when GraphQL::Schema::List
305
- args.map { |a| normalize_arguments(event_name, arg_owner.of_type, a, context) }
307
+ args&.map { |a| normalize_arguments(event_name, arg_owner.of_type, a, context) }
306
308
  when GraphQL::Schema::NonNull
307
309
  normalize_arguments(event_name, arg_owner.of_type, args, context)
308
310
  else
@@ -43,7 +43,7 @@ module GraphQL
43
43
  type_name, *field_names = field_path.split(".")
44
44
  dummy_query = GraphQL::Query.new(schema, "{ __typename }", context: context)
45
45
  query_context = dummy_query.context
46
- object_type = dummy_query.get_type(type_name) # rubocop:disable Development/ContextIsPassedCop
46
+ object_type = dummy_query.types.type(type_name) # rubocop:disable Development/ContextIsPassedCop
47
47
  if object_type
48
48
  graphql_result = object
49
49
  field_names.each do |field_name|
@@ -52,12 +52,13 @@ module GraphQL
52
52
  if graphql_result.nil?
53
53
  return nil
54
54
  end
55
- visible_field = dummy_query.get_field(object_type, field_name)
55
+ visible_field = dummy_query.types.field(object_type, field_name) # rubocop:disable Development/ContextIsPassedCop
56
56
  if visible_field
57
57
  dummy_query.context.dataloader.run_isolated {
58
+ query_context[:current_field] = visible_field
58
59
  field_args = visible_field.coerce_arguments(graphql_result, arguments, query_context)
59
60
  field_args = schema.sync_lazy(field_args)
60
- if visible_field.extras.any?
61
+ if !visible_field.extras.empty?
61
62
  extra_args = {}
62
63
  visible_field.extras.each do |extra|
63
64
  extra_args[extra] = case extra
@@ -90,10 +91,13 @@ module GraphQL
90
91
  end
91
92
  end
92
93
  graphql_result
93
- elsif schema.has_defined_type?(type_name)
94
- raise TypeNotVisibleError.new(type_name: type_name)
95
94
  else
96
- raise TypeNotDefinedError.new(type_name: type_name)
95
+ unfiltered_type = schema.use_visibility_profile? ? schema.visibility.get_type(type_name) : schema.get_type(type_name) # rubocop:disable Development/ContextIsPassedCop
96
+ if unfiltered_type
97
+ raise TypeNotVisibleError.new(type_name: type_name)
98
+ else
99
+ raise TypeNotDefinedError.new(type_name: type_name)
100
+ end
97
101
  end
98
102
  end
99
103
 
@@ -33,8 +33,8 @@ module GraphQL
33
33
  "resolve_type_lazy" => "resolve_type.graphql",
34
34
  }.each do |trace_method, platform_key|
35
35
  module_eval <<-RUBY, __FILE__, __LINE__
36
- def #{trace_method}(**metadata, &blk)
37
- @notifications_engine.instrument("#{platform_key}", metadata, &blk)
36
+ def #{trace_method}(**metadata, &block)
37
+ @notifications_engine.instrument("#{platform_key}", metadata) { super(**metadata, &block) }
38
38
  end
39
39
  RUBY
40
40
  end
@@ -18,6 +18,7 @@ module GraphQL
18
18
  self.node_type = nil
19
19
  self.edge_class = nil
20
20
  }
21
+ child_class.default_broadcastable(nil)
21
22
  add_page_info_field(child_class)
22
23
  end
23
24
 
@@ -31,12 +32,21 @@ module GraphQL
31
32
  child_class.edge_type = nil
32
33
  child_class.node_type = nil
33
34
  child_class.edge_class = nil
35
+ child_class.default_broadcastable(default_broadcastable?)
34
36
  end
35
37
 
36
38
  def default_relay?
37
39
  true
38
40
  end
39
41
 
42
+ def default_broadcastable?
43
+ @default_broadcastable
44
+ end
45
+
46
+ def default_broadcastable(new_value)
47
+ @default_broadcastable = new_value
48
+ end
49
+
40
50
  # @return [Class]
41
51
  attr_reader :node_type
42
52
 
@@ -186,7 +196,7 @@ module GraphQL
186
196
  def edges
187
197
  # Assume that whatever authorization needed to happen
188
198
  # already happened at the connection level.
189
- current_runtime_state = Thread.current[:__graphql_runtime_info]
199
+ current_runtime_state = Fiber[:__graphql_runtime_info]
190
200
  query_runtime_state = current_runtime_state[context.query]
191
201
  query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items?
192
202
  @object.edges
@@ -195,7 +205,7 @@ module GraphQL
195
205
  def nodes
196
206
  # Assume that whatever authorization needed to happen
197
207
  # already happened at the connection level.
198
- current_runtime_state = Thread.current[:__graphql_runtime_info]
208
+ current_runtime_state = Fiber[:__graphql_runtime_info]
199
209
  query_runtime_state = current_runtime_state[context.query]
200
210
  query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items?
201
211
  @object.nodes
@@ -10,10 +10,11 @@ module GraphQL
10
10
  child_class.extend(ClassMethods)
11
11
  child_class.class_eval { self.node_type = nil }
12
12
  child_class.node_nullable(true)
13
+ child_class.default_broadcastable(nil)
13
14
  end
14
15
 
15
16
  def node
16
- current_runtime_state = Thread.current[:__graphql_runtime_info]
17
+ current_runtime_state = Fiber[:__graphql_runtime_info]
17
18
  query_runtime_state = current_runtime_state[context.query]
18
19
  query_runtime_state.was_authorized_by_scope_items = @object.was_authorized_by_scope_items?
19
20
  @object.node
@@ -24,12 +25,21 @@ module GraphQL
24
25
  super
25
26
  child_class.node_type = nil
26
27
  child_class.node_nullable = nil
28
+ child_class.default_broadcastable(default_broadcastable?)
27
29
  end
28
30
 
29
31
  def default_relay?
30
32
  true
31
33
  end
32
34
 
35
+ def default_broadcastable?
36
+ @default_broadcastable
37
+ end
38
+
39
+ def default_broadcastable(new_value)
40
+ @default_broadcastable = new_value
41
+ end
42
+
33
43
  # Get or set the Object type that this edge wraps.
34
44
  #
35
45
  # @param node_type [Class] A `Schema::Object` subclass
@@ -24,6 +24,10 @@ module GraphQL
24
24
  def default_relay?
25
25
  true
26
26
  end
27
+
28
+ def default_broadcastable?
29
+ true
30
+ end
27
31
  end
28
32
  end
29
33
  end
data/lib/graphql/types.rb CHANGED
@@ -1,12 +1,19 @@
1
1
  # frozen_string_literal: true
2
- require "graphql/types/boolean"
3
- require "graphql/types/big_int"
4
- require "graphql/types/float"
5
- require "graphql/types/id"
6
- require "graphql/types/int"
7
- require "graphql/types/iso_8601_date"
8
- require "graphql/types/iso_8601_date_time"
9
- require "graphql/types/iso_8601_duration"
10
- require "graphql/types/json"
11
- require "graphql/types/string"
12
- require "graphql/types/relay"
2
+
3
+ module GraphQL
4
+ module Types
5
+ extend Autoload
6
+
7
+ autoload :Boolean, "graphql/types/boolean"
8
+ autoload :BigInt, "graphql/types/big_int"
9
+ autoload :Float, "graphql/types/float"
10
+ autoload :ID, "graphql/types/id"
11
+ autoload :Int, "graphql/types/int"
12
+ autoload :JSON, "graphql/types/json"
13
+ autoload :String, "graphql/types/string"
14
+ autoload :ISO8601Date, "graphql/types/iso_8601_date"
15
+ autoload :ISO8601DateTime, "graphql/types/iso_8601_date_time"
16
+ autoload :ISO8601Duration, "graphql/types/iso_8601_duration"
17
+ autoload :Relay, "graphql/types/relay"
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ module GraphQL
3
+ class UnauthorizedEnumValueError < GraphQL::UnauthorizedError
4
+ # @return [GraphQL::Schema::EnumValue] The value whose `#authorized?` check returned false
5
+ attr_accessor :enum_value
6
+
7
+ def initialize(type:, context:, enum_value:)
8
+ @enum_value = enum_value
9
+ message ||= "#{enum_value.path} failed authorization"
10
+ super(message, object: enum_value.value, type: type, context: context)
11
+ end
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.3.7"
3
+ VERSION = "2.4.5"
4
4
  end
data/lib/graphql.rb CHANGED
@@ -4,8 +4,19 @@ require "json"
4
4
  require "set"
5
5
  require "singleton"
6
6
  require "forwardable"
7
+ require "fiber/storage"
8
+ require "graphql/autoload"
7
9
 
8
10
  module GraphQL
11
+ extend Autoload
12
+
13
+ # Load all `autoload`-configured classes, and also eager-load dependents who have autoloads of their own.
14
+ def self.eager_load!
15
+ super
16
+ Query.eager_load!
17
+ Types.eager_load!
18
+ end
19
+
9
20
  class Error < StandardError
10
21
  end
11
22
 
@@ -70,54 +81,79 @@ This is probably a bug in GraphQL-Ruby, please report this error on GitHub: http
70
81
  class << self
71
82
  # If true, the parser should raise when an integer or float is followed immediately by an identifier (instead of a space or punctuation)
72
83
  attr_accessor :reject_numbers_followed_by_names
84
+
85
+ # If `production?` is detected but `eager_load!` wasn't called, emit a warning.
86
+ # @return [void]
87
+ def ensure_eager_load!
88
+ if production? && !eager_loading?
89
+ warn <<~WARNING
90
+ GraphQL-Ruby thinks this is a production deployment but didn't eager-load its constants. Address this by:
91
+
92
+ - Calling `GraphQL.eager_load!` in a production-only initializer or setup hook
93
+ - Assign `GraphQL.env = "..."` to something _other_ than `"production"` (for example, `GraphQL.env = "development"`)
94
+
95
+ More details: https://graphql-ruby.org/schema/definition#production-considerations
96
+ WARNING
97
+ end
98
+ end
99
+
100
+ attr_accessor :env
101
+
102
+ private
103
+
104
+ # Detect whether this is a production deployment or not
105
+ def production?
106
+ if env
107
+ # Manually assigned to production?
108
+ env == "production"
109
+ else
110
+ (detected_env = ENV["RACK_ENV"] || ENV["RAILS_ENV"] || ENV["HANAMI_ENV"] || ENV["APP_ENV"]) && detected_env.to_s.downcase == "production"
111
+ end
112
+ end
73
113
  end
74
114
 
75
115
  self.reject_numbers_followed_by_names = false
76
- end
77
116
 
78
- # Order matters for these:
79
-
80
- require "graphql/execution_error"
81
- require "graphql/runtime_type_error"
82
- require "graphql/unresolved_type_error"
83
- require "graphql/invalid_null_error"
84
- require "graphql/analysis_error"
85
- require "graphql/coercion_error"
86
- require "graphql/invalid_name_error"
87
- require "graphql/integer_decoding_error"
88
- require "graphql/integer_encoding_error"
89
- require "graphql/string_encoding_error"
90
- require "graphql/date_encoding_error"
91
- require "graphql/duration_encoding_error"
92
- require "graphql/type_kinds"
93
- require "graphql/name_validator"
94
- require "graphql/language"
95
-
96
- require_relative "./graphql/railtie" if defined? Rails::Railtie
97
-
98
- require "graphql/analysis"
99
- require "graphql/tracing"
100
- require "graphql/dig"
101
- require "graphql/execution"
102
- require "graphql/pagination"
103
- require "graphql/schema"
104
- require "graphql/query"
105
- require "graphql/dataloader"
106
- require "graphql/types"
107
- require "graphql/static_validation"
108
- require "graphql/execution"
109
- require "graphql/schema/built_in_types"
110
- require "graphql/schema/loader"
111
- require "graphql/schema/printer"
112
- require "graphql/introspection"
113
- require "graphql/relay"
117
+ autoload :ExecutionError, "graphql/execution_error"
118
+ autoload :RuntimeTypeError, "graphql/runtime_type_error"
119
+ autoload :UnresolvedTypeError, "graphql/unresolved_type_error"
120
+ autoload :InvalidNullError, "graphql/invalid_null_error"
121
+ autoload :AnalysisError, "graphql/analysis_error"
122
+ autoload :CoercionError, "graphql/coercion_error"
123
+ autoload :InvalidNameError, "graphql/invalid_name_error"
124
+ autoload :IntegerDecodingError, "graphql/integer_decoding_error"
125
+ autoload :IntegerEncodingError, "graphql/integer_encoding_error"
126
+ autoload :StringEncodingError, "graphql/string_encoding_error"
127
+ autoload :DateEncodingError, "graphql/date_encoding_error"
128
+ autoload :DurationEncodingError, "graphql/duration_encoding_error"
129
+ autoload :TypeKinds, "graphql/type_kinds"
130
+ autoload :NameValidator, "graphql/name_validator"
131
+ autoload :Language, "graphql/language"
132
+
133
+ autoload :Analysis, "graphql/analysis"
134
+ autoload :Tracing, "graphql/tracing"
135
+ autoload :Dig, "graphql/dig"
136
+ autoload :Execution, "graphql/execution"
137
+ autoload :Pagination, "graphql/pagination"
138
+ autoload :Schema, "graphql/schema"
139
+ autoload :Query, "graphql/query"
140
+ autoload :Dataloader, "graphql/dataloader"
141
+ autoload :Types, "graphql/types"
142
+ autoload :StaticValidation, "graphql/static_validation"
143
+ autoload :Execution, "graphql/execution"
144
+ autoload :Introspection, "graphql/introspection"
145
+ autoload :Relay, "graphql/relay"
146
+ autoload :Subscriptions, "graphql/subscriptions"
147
+ autoload :ParseError, "graphql/parse_error"
148
+ autoload :Backtrace, "graphql/backtrace"
149
+
150
+ autoload :UnauthorizedError, "graphql/unauthorized_error"
151
+ autoload :UnauthorizedEnumValueError, "graphql/unauthorized_enum_value_error"
152
+ autoload :UnauthorizedFieldError, "graphql/unauthorized_field_error"
153
+ autoload :LoadApplicationObjectFailedError, "graphql/load_application_object_failed_error"
154
+ autoload :Testing, "graphql/testing"
155
+ autoload :Current, "graphql/current"
156
+ end
114
157
 
115
158
  require "graphql/version"
116
- require "graphql/subscriptions"
117
- require "graphql/parse_error"
118
- require "graphql/backtrace"
119
-
120
- require "graphql/unauthorized_error"
121
- require "graphql/unauthorized_field_error"
122
- require "graphql/load_application_object_failed_error"
123
- require "graphql/testing"
159
+ require "graphql/railtie" if defined? Rails::Railtie
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: 2.3.7
4
+ version: 2.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-27 00:00:00.000000000 Z
11
+ date: 2024-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fiber-storage
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: benchmark-ips
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -154,16 +168,16 @@ dependencies:
154
168
  name: rubocop
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - '='
171
+ - - ">="
158
172
  - !ruby/object:Gem::Version
159
- version: '1.12'
173
+ version: '0'
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - '='
178
+ - - ">="
165
179
  - !ruby/object:Gem::Version
166
- version: '1.12'
180
+ version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: jekyll
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -314,6 +328,7 @@ files:
314
328
  - lib/graphql/analysis/query_depth.rb
315
329
  - lib/graphql/analysis/visitor.rb
316
330
  - lib/graphql/analysis_error.rb
331
+ - lib/graphql/autoload.rb
317
332
  - lib/graphql/backtrace.rb
318
333
  - lib/graphql/backtrace/inspect_result.rb
319
334
  - lib/graphql/backtrace/table.rb
@@ -321,6 +336,7 @@ files:
321
336
  - lib/graphql/backtrace/traced_error.rb
322
337
  - lib/graphql/backtrace/tracer.rb
323
338
  - lib/graphql/coercion_error.rb
339
+ - lib/graphql/current.rb
324
340
  - lib/graphql/dataloader.rb
325
341
  - lib/graphql/dataloader/async_dataloader.rb
326
342
  - lib/graphql/dataloader/null_dataloader.rb
@@ -367,6 +383,7 @@ files:
367
383
  - lib/graphql/language.rb
368
384
  - lib/graphql/language/block_string.rb
369
385
  - lib/graphql/language/cache.rb
386
+ - lib/graphql/language/comment.rb
370
387
  - lib/graphql/language/definition_slice.rb
371
388
  - lib/graphql/language/document_from_schema_definition.rb
372
389
  - lib/graphql/language/generation.rb
@@ -376,7 +393,6 @@ files:
376
393
  - lib/graphql/language/printer.rb
377
394
  - lib/graphql/language/sanitized_printer.rb
378
395
  - lib/graphql/language/static_visitor.rb
379
- - lib/graphql/language/token.rb
380
396
  - lib/graphql/language/visitor.rb
381
397
  - lib/graphql/load_application_object_failed_error.rb
382
398
  - lib/graphql/name_validator.rb
@@ -408,6 +424,8 @@ files:
408
424
  - lib/graphql/rubocop/graphql/base_cop.rb
409
425
  - lib/graphql/rubocop/graphql/default_null_true.rb
410
426
  - lib/graphql/rubocop/graphql/default_required_true.rb
427
+ - lib/graphql/rubocop/graphql/field_type_in_block.rb
428
+ - lib/graphql/rubocop/graphql/root_types_in_block.rb
411
429
  - lib/graphql/runtime_type_error.rb
412
430
  - lib/graphql/schema.rb
413
431
  - lib/graphql/schema/addition.rb
@@ -439,7 +457,6 @@ files:
439
457
  - lib/graphql/schema/input_object.rb
440
458
  - lib/graphql/schema/interface.rb
441
459
  - lib/graphql/schema/introspection_system.rb
442
- - lib/graphql/schema/invalid_type_error.rb
443
460
  - lib/graphql/schema/late_bound_type.rb
444
461
  - lib/graphql/schema/list.rb
445
462
  - lib/graphql/schema/loader.rb
@@ -476,6 +493,7 @@ files:
476
493
  - lib/graphql/schema/union.rb
477
494
  - lib/graphql/schema/unique_within_type.rb
478
495
  - lib/graphql/schema/validator.rb
496
+ - lib/graphql/schema/validator/all_validator.rb
479
497
  - lib/graphql/schema/validator/allow_blank_validator.rb
480
498
  - lib/graphql/schema/validator/allow_null_validator.rb
481
499
  - lib/graphql/schema/validator/exclusion_validator.rb
@@ -484,6 +502,10 @@ files:
484
502
  - lib/graphql/schema/validator/length_validator.rb
485
503
  - lib/graphql/schema/validator/numericality_validator.rb
486
504
  - lib/graphql/schema/validator/required_validator.rb
505
+ - lib/graphql/schema/visibility.rb
506
+ - lib/graphql/schema/visibility/migration.rb
507
+ - lib/graphql/schema/visibility/profile.rb
508
+ - lib/graphql/schema/visibility/visit.rb
487
509
  - lib/graphql/schema/warden.rb
488
510
  - lib/graphql/schema/wrapper.rb
489
511
  - lib/graphql/static_validation.rb
@@ -614,6 +636,7 @@ files:
614
636
  - lib/graphql/types/relay/page_info.rb
615
637
  - lib/graphql/types/relay/page_info_behaviors.rb
616
638
  - lib/graphql/types/string.rb
639
+ - lib/graphql/unauthorized_enum_value_error.rb
617
640
  - lib/graphql/unauthorized_error.rb
618
641
  - lib/graphql/unauthorized_field_error.rb
619
642
  - lib/graphql/unresolved_type_error.rb
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
- module GraphQL
3
- module Language
4
- # Emitted by the lexer and passed to the parser.
5
- # Contains type, value and position data.
6
- class Token
7
- # @return [Symbol] The kind of token this is
8
- attr_reader :name
9
- # @return [String] The text of this token
10
- attr_reader :value
11
- attr_reader :prev_token, :line, :col
12
-
13
- def initialize(name, value, line, col, prev_token)
14
- @name = name
15
- @value = -value
16
- @line = line
17
- @col = col
18
- @prev_token = prev_token
19
- end
20
-
21
- alias to_s value
22
- def to_i; @value.to_i; end
23
- def to_f; @value.to_f; end
24
-
25
- def line_and_column
26
- [@line, @col]
27
- end
28
-
29
- def inspect
30
- "(#{@name} #{@value.inspect} [#{@line}:#{@col}])"
31
- end
32
- end
33
- end
34
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
- module GraphQL
3
- class Schema
4
- class InvalidTypeError < GraphQL::Error
5
- end
6
- end
7
- end