graphql 2.0.27 → 2.2.5

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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/graphql/install/templates/base_mutation.erb +2 -0
  3. data/lib/generators/graphql/install/templates/mutation_type.erb +2 -0
  4. data/lib/generators/graphql/install_generator.rb +3 -0
  5. data/lib/generators/graphql/templates/base_argument.erb +2 -0
  6. data/lib/generators/graphql/templates/base_connection.erb +2 -0
  7. data/lib/generators/graphql/templates/base_edge.erb +2 -0
  8. data/lib/generators/graphql/templates/base_enum.erb +2 -0
  9. data/lib/generators/graphql/templates/base_field.erb +2 -0
  10. data/lib/generators/graphql/templates/base_input_object.erb +2 -0
  11. data/lib/generators/graphql/templates/base_interface.erb +2 -0
  12. data/lib/generators/graphql/templates/base_object.erb +2 -0
  13. data/lib/generators/graphql/templates/base_resolver.erb +6 -0
  14. data/lib/generators/graphql/templates/base_scalar.erb +2 -0
  15. data/lib/generators/graphql/templates/base_union.erb +2 -0
  16. data/lib/generators/graphql/templates/graphql_controller.erb +2 -0
  17. data/lib/generators/graphql/templates/loader.erb +2 -0
  18. data/lib/generators/graphql/templates/mutation.erb +2 -0
  19. data/lib/generators/graphql/templates/node_type.erb +2 -0
  20. data/lib/generators/graphql/templates/query_type.erb +2 -0
  21. data/lib/generators/graphql/templates/schema.erb +2 -0
  22. data/lib/graphql/analysis/ast/analyzer.rb +7 -0
  23. data/lib/graphql/analysis/ast/query_complexity.rb +80 -128
  24. data/lib/graphql/analysis/ast/query_depth.rb +7 -2
  25. data/lib/graphql/analysis/ast/visitor.rb +2 -2
  26. data/lib/graphql/analysis/ast.rb +15 -11
  27. data/lib/graphql/backtrace/trace.rb +12 -15
  28. data/lib/graphql/dataloader/async_dataloader.rb +85 -0
  29. data/lib/graphql/dataloader/source.rb +11 -3
  30. data/lib/graphql/dataloader.rb +109 -142
  31. data/lib/graphql/duration_encoding_error.rb +16 -0
  32. data/lib/graphql/execution/interpreter/runtime/graphql_result.rb +170 -0
  33. data/lib/graphql/execution/interpreter/runtime.rb +70 -248
  34. data/lib/graphql/execution/interpreter.rb +1 -7
  35. data/lib/graphql/execution/lookahead.rb +88 -21
  36. data/lib/graphql/introspection/dynamic_fields.rb +1 -1
  37. data/lib/graphql/introspection/entry_points.rb +2 -2
  38. data/lib/graphql/language/block_string.rb +34 -18
  39. data/lib/graphql/language/definition_slice.rb +1 -1
  40. data/lib/graphql/language/document_from_schema_definition.rb +36 -35
  41. data/lib/graphql/language/lexer.rb +271 -177
  42. data/lib/graphql/language/nodes.rb +74 -56
  43. data/lib/graphql/language/parser.rb +697 -1986
  44. data/lib/graphql/language/printer.rb +299 -146
  45. data/lib/graphql/language/sanitized_printer.rb +20 -22
  46. data/lib/graphql/language/static_visitor.rb +167 -0
  47. data/lib/graphql/language/visitor.rb +20 -81
  48. data/lib/graphql/language.rb +1 -0
  49. data/lib/graphql/load_application_object_failed_error.rb +5 -1
  50. data/lib/graphql/pagination/connection.rb +28 -1
  51. data/lib/graphql/pagination/mongoid_relation_connection.rb +1 -2
  52. data/lib/graphql/query/context/scoped_context.rb +101 -0
  53. data/lib/graphql/query/context.rb +36 -98
  54. data/lib/graphql/query/null_context.rb +4 -11
  55. data/lib/graphql/query.rb +12 -21
  56. data/lib/graphql/railtie.rb +9 -6
  57. data/lib/graphql/rake_task.rb +3 -12
  58. data/lib/graphql/schema/argument.rb +6 -1
  59. data/lib/graphql/schema/build_from_definition.rb +0 -11
  60. data/lib/graphql/schema/directive/one_of.rb +12 -0
  61. data/lib/graphql/schema/directive/specified_by.rb +14 -0
  62. data/lib/graphql/schema/directive.rb +1 -1
  63. data/lib/graphql/schema/enum.rb +3 -3
  64. data/lib/graphql/schema/field/connection_extension.rb +1 -15
  65. data/lib/graphql/schema/field/scope_extension.rb +8 -1
  66. data/lib/graphql/schema/field.rb +8 -5
  67. data/lib/graphql/schema/has_single_input_argument.rb +156 -0
  68. data/lib/graphql/schema/input_object.rb +2 -2
  69. data/lib/graphql/schema/interface.rb +10 -10
  70. data/lib/graphql/schema/introspection_system.rb +2 -0
  71. data/lib/graphql/schema/loader.rb +0 -2
  72. data/lib/graphql/schema/member/base_dsl_methods.rb +2 -1
  73. data/lib/graphql/schema/member/has_arguments.rb +61 -38
  74. data/lib/graphql/schema/member/has_fields.rb +8 -5
  75. data/lib/graphql/schema/member/has_interfaces.rb +23 -9
  76. data/lib/graphql/schema/member/scoped.rb +19 -0
  77. data/lib/graphql/schema/member/validates_input.rb +3 -3
  78. data/lib/graphql/schema/object.rb +8 -0
  79. data/lib/graphql/schema/printer.rb +8 -7
  80. data/lib/graphql/schema/relay_classic_mutation.rb +6 -128
  81. data/lib/graphql/schema/resolver.rb +7 -3
  82. data/lib/graphql/schema/scalar.rb +3 -3
  83. data/lib/graphql/schema/subscription.rb +11 -4
  84. data/lib/graphql/schema/union.rb +1 -1
  85. data/lib/graphql/schema/warden.rb +96 -94
  86. data/lib/graphql/schema.rb +193 -72
  87. data/lib/graphql/static_validation/all_rules.rb +1 -1
  88. data/lib/graphql/static_validation/base_visitor.rb +1 -1
  89. data/lib/graphql/static_validation/literal_validator.rb +1 -1
  90. data/lib/graphql/static_validation/rules/fields_will_merge.rb +1 -1
  91. data/lib/graphql/static_validation/rules/required_arguments_are_present.rb +1 -1
  92. data/lib/graphql/static_validation/rules/required_input_object_attributes_are_present.rb +1 -1
  93. data/lib/graphql/static_validation/validation_context.rb +5 -5
  94. data/lib/graphql/static_validation.rb +0 -1
  95. data/lib/graphql/subscriptions/action_cable_subscriptions.rb +3 -2
  96. data/lib/graphql/subscriptions/event.rb +8 -2
  97. data/lib/graphql/subscriptions.rb +14 -9
  98. data/lib/graphql/testing/helpers.rb +125 -0
  99. data/lib/graphql/testing.rb +2 -0
  100. data/lib/graphql/tracing/appoptics_trace.rb +2 -2
  101. data/lib/graphql/tracing/appoptics_tracing.rb +2 -2
  102. data/lib/graphql/tracing/trace.rb +1 -0
  103. data/lib/graphql/types/iso_8601_duration.rb +77 -0
  104. data/lib/graphql/types/relay/connection_behaviors.rb +32 -2
  105. data/lib/graphql/types/relay/edge_behaviors.rb +7 -0
  106. data/lib/graphql/types.rb +1 -0
  107. data/lib/graphql/version.rb +1 -1
  108. data/lib/graphql.rb +3 -3
  109. data/readme.md +12 -2
  110. metadata +29 -22
  111. data/lib/graphql/deprecation.rb +0 -9
  112. data/lib/graphql/filter.rb +0 -59
  113. data/lib/graphql/language/parser.y +0 -560
  114. data/lib/graphql/static_validation/type_stack.rb +0 -216
@@ -62,7 +62,7 @@ module GraphQL
62
62
  # @return [void]
63
63
  def trigger(event_name, args, object, scope: nil, context: {})
64
64
  # Make something as context-like as possible, even though there isn't a current query:
65
- dummy_query = GraphQL::Query.new(@schema, "", validate: false, context: context)
65
+ dummy_query = @schema.query_class.new(@schema, "{ __typename }", validate: false, context: context)
66
66
  context = dummy_query.context
67
67
  event_name = event_name.to_s
68
68
 
@@ -83,7 +83,7 @@ module GraphQL
83
83
 
84
84
  # Normalize symbol-keyed args to strings, try camelizing them
85
85
  # Should this accept a real context somehow?
86
- normalized_args = normalize_arguments(normalized_event_name, field, args, GraphQL::Query::NullContext)
86
+ normalized_args = normalize_arguments(normalized_event_name, field, args, GraphQL::Query::NullContext.instance)
87
87
 
88
88
  event = Subscriptions::Event.new(
89
89
  name: normalized_event_name,
@@ -125,10 +125,10 @@ module GraphQL
125
125
  variables: variables,
126
126
  root_value: object,
127
127
  }
128
-
128
+
129
129
  # merge event's and query's context together
130
130
  context.merge!(event.context) unless event.context.nil? || context.nil?
131
-
131
+
132
132
  execute_options[:validate] = validate_update?(**execute_options)
133
133
  result = @schema.execute(**execute_options)
134
134
  subscriptions_context = result.context.namespace(:subscriptions)
@@ -136,11 +136,9 @@ module GraphQL
136
136
  result = nil
137
137
  end
138
138
 
139
- unsubscribed = subscriptions_context[:unsubscribed]
140
-
141
- if unsubscribed
139
+ if subscriptions_context[:unsubscribed] && !subscriptions_context[:final_update]
142
140
  # `unsubscribe` was called, clean up on our side
143
- # TODO also send `{more: false}` to client?
141
+ # The transport should also send `{more: false}` to client
144
142
  delete_subscription(subscription_id)
145
143
  result = nil
146
144
  end
@@ -164,7 +162,14 @@ module GraphQL
164
162
  res = execute_update(subscription_id, event, object)
165
163
  if !res.nil?
166
164
  deliver(subscription_id, res)
165
+
166
+ if res.context.namespace(:subscriptions)[:unsubscribed]
167
+ # `unsubscribe` was called, clean up on our side
168
+ # The transport should also send `{more: false}` to client
169
+ delete_subscription(subscription_id)
170
+ end
167
171
  end
172
+
168
173
  end
169
174
 
170
175
  # Event `event` occurred on `object`,
@@ -229,7 +234,7 @@ module GraphQL
229
234
 
230
235
  # @return [Boolean] if true, then a query like this one would be broadcasted
231
236
  def broadcastable?(query_str, **query_options)
232
- query = GraphQL::Query.new(@schema, query_str, **query_options)
237
+ query = @schema.query_class.new(@schema, query_str, **query_options)
233
238
  if !query.valid?
234
239
  raise "Invalid query: #{query.validation_errors.map(&:to_h).inspect}"
235
240
  end
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: true
2
+ module GraphQL
3
+ module Testing
4
+ module Helpers
5
+ # @param schema_class [Class<GraphQL::Schema>]
6
+ # @return [Module] A helpers module which always uses the given schema
7
+ def self.for(schema_class)
8
+ Module.new do
9
+ include SchemaHelpers
10
+ @@schema_class_for_helpers = schema_class
11
+ end
12
+ end
13
+
14
+ class Error < GraphQL::Error
15
+ end
16
+
17
+ class TypeNotVisibleError < Error
18
+ def initialize(type_name:)
19
+ message = "`#{type_name}` should be `visible?` this field resolution and `context`, but it was not"
20
+ super(message)
21
+ end
22
+ end
23
+
24
+ class FieldNotVisibleError < Error
25
+ def initialize(type_name:, field_name:)
26
+ message = "`#{type_name}.#{field_name}` should be `visible?` for this resolution, but it was not"
27
+ super(message)
28
+ end
29
+ end
30
+
31
+ class TypeNotDefinedError < Error
32
+ def initialize(type_name:)
33
+ message = "No type named `#{type_name}` is defined; choose another type name or define this type."
34
+ super(message)
35
+ end
36
+ end
37
+
38
+ class FieldNotDefinedError < Error
39
+ def initialize(type_name:, field_name:)
40
+ message = "`#{type_name}` has no field named `#{field_name}`; pick another name or define this field."
41
+ super(message)
42
+ end
43
+ end
44
+
45
+ def run_graphql_field(schema, field_path, object, arguments: {}, context: {})
46
+ type_name, *field_names = field_path.split(".")
47
+ dummy_query = GraphQL::Query.new(schema, context: context)
48
+ query_context = dummy_query.context
49
+ object_type = dummy_query.get_type(type_name) # rubocop:disable Development/ContextIsPassedCop
50
+ if object_type
51
+ graphql_result = object
52
+ field_names.each do |field_name|
53
+ inner_object = graphql_result
54
+ graphql_result = object_type.wrap(inner_object, query_context)
55
+ if graphql_result.nil?
56
+ return nil
57
+ end
58
+ visible_field = dummy_query.get_field(object_type, field_name)
59
+ if visible_field
60
+ dummy_query.context.dataloader.run_isolated {
61
+ field_args = visible_field.coerce_arguments(graphql_result, arguments, query_context)
62
+ field_args = schema.sync_lazy(field_args)
63
+ graphql_result = visible_field.resolve(graphql_result, field_args.keyword_arguments, query_context)
64
+ graphql_result = schema.sync_lazy(graphql_result)
65
+ }
66
+ object_type = visible_field.type.unwrap
67
+ elsif object_type.all_field_definitions.any? { |f| f.graphql_name == field_name }
68
+ raise FieldNotVisibleError.new(field_name: field_name, type_name: type_name)
69
+ else
70
+ raise FieldNotDefinedError.new(type_name: type_name, field_name: field_name)
71
+ end
72
+ end
73
+ graphql_result
74
+ elsif schema.has_defined_type?(type_name)
75
+ raise TypeNotVisibleError.new(type_name: type_name)
76
+ else
77
+ raise TypeNotDefinedError.new(type_name: type_name)
78
+ end
79
+ end
80
+
81
+ def with_resolution_context(schema, type:, object:, context:{})
82
+ resolution_context = ResolutionAssertionContext.new(
83
+ self,
84
+ schema: schema,
85
+ type_name: type,
86
+ object: object,
87
+ context: context
88
+ )
89
+ yield(resolution_context)
90
+ end
91
+
92
+ class ResolutionAssertionContext
93
+ def initialize(test, type_name:, object:, schema:, context:)
94
+ @test = test
95
+ @type_name = type_name
96
+ @object = object
97
+ @schema = schema
98
+ @context = context
99
+ end
100
+
101
+
102
+ def run_graphql_field(field_name, arguments: {})
103
+ if @schema
104
+ @test.run_graphql_field(@schema, "#{@type_name}.#{field_name}", @object, arguments: arguments, context: @context)
105
+ else
106
+ @test.run_graphql_field("#{@type_name}.#{field_name}", @object, arguments: arguments, context: @context)
107
+ end
108
+ end
109
+ end
110
+
111
+ module SchemaHelpers
112
+ include Helpers
113
+
114
+ def run_graphql_field(field_path, object, arguments: {}, context: {})
115
+ super(@@schema_class_for_helpers, field_path, object, arguments: arguments, context: context)
116
+ end
117
+
118
+ def with_resolution_context(*args, **kwargs, &block)
119
+ # schema will be added later
120
+ super(nil, *args, **kwargs, &block)
121
+ end
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,2 @@
1
+ # frozen_string_literal: true
2
+ require "graphql/testing/helpers"
@@ -195,7 +195,7 @@ module GraphQL
195
195
  else
196
196
  [key, data[key]]
197
197
  end
198
- end.flatten(2).each_slice(2).to_h.merge(Spec: 'graphql')
198
+ end.tap { _1.flatten!(2) }.each_slice(2).to_h.merge(Spec: 'graphql')
199
199
  end
200
200
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
201
201
 
@@ -226,7 +226,7 @@ module GraphQL
226
226
  end
227
227
 
228
228
  def graphql_multiplex(data)
229
- names = data.queries.map(&:operations).map(&:keys).flatten.compact
229
+ names = data.queries.map(&:operations).map!(&:keys).tap(&:flatten!).tap(&:compact!)
230
230
  multiplex_transaction_name(names) if names.size > 1
231
231
 
232
232
  [:Operations, names.join(', ')]
@@ -117,7 +117,7 @@ module GraphQL
117
117
  else
118
118
  [key, data[key]]
119
119
  end
120
- end.flatten(2).each_slice(2).to_h.merge(Spec: 'graphql')
120
+ end.tap { _1.flatten!(2) }.each_slice(2).to_h.merge(Spec: 'graphql')
121
121
  end
122
122
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
123
123
 
@@ -148,7 +148,7 @@ module GraphQL
148
148
  end
149
149
 
150
150
  def graphql_multiplex(data)
151
- names = data.queries.map(&:operations).map(&:keys).flatten.compact
151
+ names = data.queries.map(&:operations).map!(&:keys).tap(&:flatten!).tap(&:compact!)
152
152
  multiplex_transaction_name(names) if names.size > 1
153
153
 
154
154
  [:Operations, names.join(', ')]
@@ -15,6 +15,7 @@ module GraphQL
15
15
  @query = query
16
16
  end
17
17
 
18
+ # The Ruby parser doesn't call this method (`graphql/c_parser` does.)
18
19
  def lex(query_string:)
19
20
  yield
20
21
  end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+ module GraphQL
3
+ module Types
4
+ # This scalar takes `Duration`s and transmits them as strings,
5
+ # using ISO 8601 format. ActiveSupport >= 5.0 must be loaded to use
6
+ # this scalar.
7
+ #
8
+ # Use it for fields or arguments as follows:
9
+ #
10
+ # field :age, GraphQL::Types::ISO8601Duration, null: false
11
+ #
12
+ # argument :interval, GraphQL::Types::ISO8601Duration, null: false
13
+ #
14
+ # Alternatively, use this built-in scalar as inspiration for your
15
+ # own Duration type.
16
+ class ISO8601Duration < GraphQL::Schema::Scalar
17
+ description "An ISO 8601-encoded duration"
18
+
19
+ # @return [Integer, nil]
20
+ def self.seconds_precision
21
+ # ActiveSupport::Duration precision defaults to whatever input was given
22
+ @seconds_precision
23
+ end
24
+
25
+ # @param [Integer, nil] value
26
+ def self.seconds_precision=(value)
27
+ @seconds_precision = value
28
+ end
29
+
30
+ # @param value [ActiveSupport::Duration, String]
31
+ # @return [String]
32
+ # @raise [GraphQL::Error] if ActiveSupport::Duration is not defined or if an incompatible object is passed
33
+ def self.coerce_result(value, _ctx)
34
+ unless defined?(ActiveSupport::Duration)
35
+ raise GraphQL::Error, "ActiveSupport >= 5.0 must be loaded to use the built-in ISO8601Duration type."
36
+ end
37
+
38
+ begin
39
+ case value
40
+ when ActiveSupport::Duration
41
+ value.iso8601(precision: seconds_precision)
42
+ when ::String
43
+ ActiveSupport::Duration.parse(value).iso8601(precision: seconds_precision)
44
+ else
45
+ # Try calling as ActiveSupport::Duration compatible as a fallback
46
+ value.iso8601(precision: seconds_precision)
47
+ end
48
+ rescue StandardError => error
49
+ raise GraphQL::Error, "An incompatible object (#{value.class}) was given to #{self}. Make sure that only ActiveSupport::Durations and well-formatted Strings are used with this type. (#{error.message})"
50
+ end
51
+ end
52
+
53
+ # @param value [String, ActiveSupport::Duration]
54
+ # @return [ActiveSupport::Duration, nil]
55
+ # @raise [GraphQL::Error] if ActiveSupport::Duration is not defined
56
+ # @raise [GraphQL::DurationEncodingError] if duration cannot be parsed
57
+ def self.coerce_input(value, ctx)
58
+ unless defined?(ActiveSupport::Duration)
59
+ raise GraphQL::Error, "ActiveSupport >= 5.0 must be loaded to use the built-in ISO8601Duration type."
60
+ end
61
+
62
+ begin
63
+ if value.is_a?(ActiveSupport::Duration)
64
+ value
65
+ elsif value.nil?
66
+ nil
67
+ else
68
+ ActiveSupport::Duration.parse(value)
69
+ end
70
+ rescue ArgumentError, TypeError
71
+ err = GraphQL::DurationEncodingError.new(value)
72
+ ctx.schema.type_error(err, ctx)
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -67,9 +67,8 @@ module GraphQL
67
67
  type: [edge_type_class, null: edge_nullable],
68
68
  null: edges_nullable,
69
69
  description: "A list of edges.",
70
+ scope: false, # Assume that the connection was already scoped.
70
71
  connection: false,
71
- # Assume that the connection was scoped before this step:
72
- scope: false,
73
72
  }
74
73
 
75
74
  if field_options
@@ -88,6 +87,19 @@ module GraphQL
88
87
  node_type.scope_items(items, context)
89
88
  end
90
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
+
91
103
  # Add the shortcut `nodes` field to this connection and its subclasses
92
104
  def nodes_field(node_nullable: self.node_nullable, field_options: nil)
93
105
  define_nodes_field(node_nullable, field_options: field_options)
@@ -170,6 +182,24 @@ module GraphQL
170
182
  obj_type.field :page_info, GraphQL::Types::Relay::PageInfo, null: false, description: "Information to aid in pagination."
171
183
  end
172
184
  end
185
+
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
193
+ end
194
+
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
202
+ end
173
203
  end
174
204
  end
175
205
  end
@@ -12,6 +12,13 @@ module GraphQL
12
12
  child_class.node_nullable(true)
13
13
  end
14
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
+
15
22
  module ClassMethods
16
23
  def inherited(child_class)
17
24
  super
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"
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.0.27"
3
+ VERSION = "2.2.5"
4
4
  end
data/lib/graphql.rb CHANGED
@@ -88,6 +88,7 @@ require "graphql/integer_decoding_error"
88
88
  require "graphql/integer_encoding_error"
89
89
  require "graphql/string_encoding_error"
90
90
  require "graphql/date_encoding_error"
91
+ require "graphql/duration_encoding_error"
91
92
  require "graphql/type_kinds"
92
93
  require "graphql/name_validator"
93
94
  require "graphql/language"
@@ -101,9 +102,8 @@ require "graphql/execution"
101
102
  require "graphql/pagination"
102
103
  require "graphql/schema"
103
104
  require "graphql/query"
104
- require "graphql/types"
105
105
  require "graphql/dataloader"
106
- require "graphql/filter"
106
+ require "graphql/types"
107
107
  require "graphql/static_validation"
108
108
  require "graphql/execution"
109
109
  require "graphql/schema/built_in_types"
@@ -120,4 +120,4 @@ require "graphql/backtrace"
120
120
  require "graphql/unauthorized_error"
121
121
  require "graphql/unauthorized_field_error"
122
122
  require "graphql/load_application_object_failed_error"
123
- require "graphql/deprecation"
123
+ require "graphql/testing"
data/readme.md CHANGED
@@ -7,7 +7,7 @@ A Ruby implementation of [GraphQL](https://graphql.org/).
7
7
 
8
8
  - [Website](https://graphql-ruby.org/)
9
9
  - [API Documentation](https://www.rubydoc.info/github/rmosolgo/graphql-ruby)
10
- - [Newsletter](https://tinyletter.com/graphql-ruby)
10
+ - [Newsletter](https://buttondown.email/graphql-ruby)
11
11
 
12
12
  ## Installation
13
13
 
@@ -34,7 +34,17 @@ Or, see ["Getting Started"](https://graphql-ruby.org/getting_started.html).
34
34
 
35
35
  ## Upgrade
36
36
 
37
- 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!
38
48
 
39
49
  ## Goals
40
50
 
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.27
4
+ version: 2.2.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: 2023-08-30 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: racc
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: benchmark-ips
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,20 +108,6 @@ dependencies:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
110
  version: '1.0'
97
- - !ruby/object:Gem::Dependency
98
- name: racc
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '1.4'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '1.4'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -270,6 +270,7 @@ files:
270
270
  - lib/generators/graphql/templates/base_input_object.erb
271
271
  - lib/generators/graphql/templates/base_interface.erb
272
272
  - lib/generators/graphql/templates/base_object.erb
273
+ - lib/generators/graphql/templates/base_resolver.erb
273
274
  - lib/generators/graphql/templates/base_scalar.erb
274
275
  - lib/generators/graphql/templates/base_union.erb
275
276
  - lib/generators/graphql/templates/enum.erb
@@ -308,13 +309,14 @@ files:
308
309
  - lib/graphql/backtrace/tracer.rb
309
310
  - lib/graphql/coercion_error.rb
310
311
  - lib/graphql/dataloader.rb
312
+ - lib/graphql/dataloader/async_dataloader.rb
311
313
  - lib/graphql/dataloader/null_dataloader.rb
312
314
  - lib/graphql/dataloader/request.rb
313
315
  - lib/graphql/dataloader/request_all.rb
314
316
  - lib/graphql/dataloader/source.rb
315
317
  - lib/graphql/date_encoding_error.rb
316
- - lib/graphql/deprecation.rb
317
318
  - lib/graphql/dig.rb
319
+ - lib/graphql/duration_encoding_error.rb
318
320
  - lib/graphql/execution.rb
319
321
  - lib/graphql/execution/directive_checks.rb
320
322
  - lib/graphql/execution/errors.rb
@@ -326,12 +328,12 @@ files:
326
328
  - lib/graphql/execution/interpreter/handles_raw_value.rb
327
329
  - lib/graphql/execution/interpreter/resolve.rb
328
330
  - lib/graphql/execution/interpreter/runtime.rb
331
+ - lib/graphql/execution/interpreter/runtime/graphql_result.rb
329
332
  - lib/graphql/execution/lazy.rb
330
333
  - lib/graphql/execution/lazy/lazy_method_map.rb
331
334
  - lib/graphql/execution/lookahead.rb
332
335
  - lib/graphql/execution/multiplex.rb
333
336
  - lib/graphql/execution_error.rb
334
- - lib/graphql/filter.rb
335
337
  - lib/graphql/integer_decoding_error.rb
336
338
  - lib/graphql/integer_encoding_error.rb
337
339
  - lib/graphql/introspection.rb
@@ -358,9 +360,9 @@ files:
358
360
  - lib/graphql/language/lexer.rb
359
361
  - lib/graphql/language/nodes.rb
360
362
  - lib/graphql/language/parser.rb
361
- - lib/graphql/language/parser.y
362
363
  - lib/graphql/language/printer.rb
363
364
  - lib/graphql/language/sanitized_printer.rb
365
+ - lib/graphql/language/static_visitor.rb
364
366
  - lib/graphql/language/token.rb
365
367
  - lib/graphql/language/visitor.rb
366
368
  - lib/graphql/load_application_object_failed_error.rb
@@ -376,6 +378,7 @@ files:
376
378
  - lib/graphql/parse_error.rb
377
379
  - lib/graphql/query.rb
378
380
  - lib/graphql/query/context.rb
381
+ - lib/graphql/query/context/scoped_context.rb
379
382
  - lib/graphql/query/fingerprint.rb
380
383
  - lib/graphql/query/input_validation_result.rb
381
384
  - lib/graphql/query/null_context.rb
@@ -410,6 +413,7 @@ files:
410
413
  - lib/graphql/schema/directive/include.rb
411
414
  - lib/graphql/schema/directive/one_of.rb
412
415
  - lib/graphql/schema/directive/skip.rb
416
+ - lib/graphql/schema/directive/specified_by.rb
413
417
  - lib/graphql/schema/directive/transform.rb
414
418
  - lib/graphql/schema/enum.rb
415
419
  - lib/graphql/schema/enum_value.rb
@@ -419,6 +423,7 @@ files:
419
423
  - lib/graphql/schema/field_extension.rb
420
424
  - lib/graphql/schema/find_inherited_value.rb
421
425
  - lib/graphql/schema/finder.rb
426
+ - lib/graphql/schema/has_single_input_argument.rb
422
427
  - lib/graphql/schema/input_object.rb
423
428
  - lib/graphql/schema/interface.rb
424
429
  - lib/graphql/schema/introspection_system.rb
@@ -536,7 +541,6 @@ files:
536
541
  - lib/graphql/static_validation/rules/variables_are_input_types_error.rb
537
542
  - lib/graphql/static_validation/rules/variables_are_used_and_defined.rb
538
543
  - lib/graphql/static_validation/rules/variables_are_used_and_defined_error.rb
539
- - lib/graphql/static_validation/type_stack.rb
540
544
  - lib/graphql/static_validation/validation_context.rb
541
545
  - lib/graphql/static_validation/validation_timeout_error.rb
542
546
  - lib/graphql/static_validation/validator.rb
@@ -548,6 +552,8 @@ files:
548
552
  - lib/graphql/subscriptions/event.rb
549
553
  - lib/graphql/subscriptions/instrumentation.rb
550
554
  - lib/graphql/subscriptions/serialize.rb
555
+ - lib/graphql/testing.rb
556
+ - lib/graphql/testing/helpers.rb
551
557
  - lib/graphql/tracing.rb
552
558
  - lib/graphql/tracing/active_support_notifications_trace.rb
553
559
  - lib/graphql/tracing/active_support_notifications_tracing.rb
@@ -581,6 +587,7 @@ files:
581
587
  - lib/graphql/types/int.rb
582
588
  - lib/graphql/types/iso_8601_date.rb
583
589
  - lib/graphql/types/iso_8601_date_time.rb
590
+ - lib/graphql/types/iso_8601_duration.rb
584
591
  - lib/graphql/types/json.rb
585
592
  - lib/graphql/types/relay.rb
586
593
  - lib/graphql/types/relay/base_connection.rb
@@ -607,7 +614,7 @@ metadata:
607
614
  changelog_uri: https://github.com/rmosolgo/graphql-ruby/blob/master/CHANGELOG.md
608
615
  source_code_uri: https://github.com/rmosolgo/graphql-ruby
609
616
  bug_tracker_uri: https://github.com/rmosolgo/graphql-ruby/issues
610
- mailing_list_uri: https://tinyletter.com/graphql-ruby
617
+ mailing_list_uri: https://buttondown.email/graphql-ruby
611
618
  post_install_message:
612
619
  rdoc_options: []
613
620
  require_paths:
@@ -616,7 +623,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
616
623
  requirements:
617
624
  - - ">="
618
625
  - !ruby/object:Gem::Version
619
- version: 2.4.0
626
+ version: 2.7.0
620
627
  required_rubygems_version: !ruby/object:Gem::Requirement
621
628
  requirements:
622
629
  - - ">="
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module GraphQL
4
- module Deprecation
5
- def self.warn(message)
6
- Kernel.warn(message)
7
- end
8
- end
9
- end