graphql 2.2.11 → 2.2.13

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1bae060f1dcf449082e9e53be024476505d848448a13d592f31e67c11024caa4
4
- data.tar.gz: ebc753b89b657c18771641869a4dffea9e79fe324a3f7e46c1a84304a6cc3375
3
+ metadata.gz: 1a0011bdb75efaaad6d3b2b56dd9ad5302c58b85cec60c676aab08a857f8da23
4
+ data.tar.gz: 3816babbb95e6798bcd0368efba9f0e64c8abeaa12a7fe153efe21c711ed4ed8
5
5
  SHA512:
6
- metadata.gz: 0bd27d12cd1efd1c4166c20062e401fa524bcda469de51cbfe89fd21542fd3433a2f23628c21330c9e3d700a9627c683a6a1691887a06ef06105ede4c2241b26
7
- data.tar.gz: abc65a9217ae76239458695a3ee47d3e2bf3d072e16d62b9df16a65a380110e4a9a207af17473ca0f14fcce5d907a2552866597dd53785c890979a37aa2c500b
6
+ metadata.gz: 6ff0e5f9ed0aa3eb37063d77507927673d1f12286bbcc72ec8e5c6b9e1d419a58b5c59b3981b5df04376c415ea83c59969d7ad1d0b9ea97cc65d1bc3412121d6
7
+ data.tar.gz: a59c9c9aadcba96a84079c2f428488b0258a4f68cff547db6b4c3bedbf6fcf8d78cb92fe88b6983f733f4151ecf9446bd3c59509a26e14086da52aead627aacc
@@ -81,6 +81,9 @@ module GraphQL
81
81
  end
82
82
  rescue Timeout::Error
83
83
  [GraphQL::AnalysisError.new("Timeout on validation of query")]
84
+ rescue GraphQL::UnauthorizedError
85
+ # This error was raised during analysis and will be returned the client before execution
86
+ []
84
87
  end
85
88
 
86
89
  def analysis_errors(results)
@@ -47,7 +47,7 @@ module GraphQL
47
47
  begin
48
48
  # Since this is basically the batching context,
49
49
  # share it for a whole multiplex
50
- multiplex.context[:interpreter_instance] ||= multiplex.schema.query_execution_strategy.new
50
+ multiplex.context[:interpreter_instance] ||= multiplex.schema.query_execution_strategy(deprecation_warning: false).new
51
51
  # Do as much eager evaluation of the query as possible
52
52
  results = []
53
53
  queries.each_with_index do |query, idx|
@@ -56,12 +56,12 @@ module GraphQL
56
56
  false
57
57
  end
58
58
 
59
- @has_next_page = if first_value && first
60
- # There are more items after these items
61
- sliced_nodes.count > first
62
- elsif before
59
+ @has_next_page = if before
63
60
  # The original array is longer than the `before` index
64
61
  index_from_cursor(before) < items.length + 1
62
+ elsif first
63
+ # There are more items after these items
64
+ sliced_nodes.count > first
65
65
  else
66
66
  false
67
67
  end
@@ -29,14 +29,14 @@ module GraphQL
29
29
 
30
30
  def has_next_page
31
31
  if @has_next_page.nil?
32
- @has_next_page = if first && first_value
32
+ @has_next_page = if before_offset && before_offset > 0
33
+ true
34
+ elsif first
33
35
  if @nodes && @nodes.count < first
34
36
  false
35
37
  else
36
38
  relation_larger_than(sliced_nodes, @sliced_nodes_offset, first)
37
39
  end
38
- elsif before_offset && before_offset > 0
39
- true
40
40
  else
41
41
  false
42
42
  end
@@ -471,6 +471,8 @@ module GraphQL
471
471
  if arguments[:last] && (max_possible_page_size.nil? || arguments[:last] > max_possible_page_size)
472
472
  max_possible_page_size = arguments[:last]
473
473
  end
474
+ elsif arguments.is_a?(GraphQL::UnauthorizedError)
475
+ raise arguments
474
476
  end
475
477
 
476
478
  if max_possible_page_size.nil?
@@ -50,7 +50,7 @@ module GraphQL
50
50
  if loads && arg_defn.type.list?
51
51
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
52
52
  def #{method_owner}load_#{arg_defn.keyword}(values, context = nil)
53
- argument = get_argument("#{arg_defn.graphql_name}")
53
+ argument = get_argument("#{arg_defn.graphql_name}", context || self.context)
54
54
  (context || self.context).query.after_lazy(values) do |values2|
55
55
  GraphQL::Execution::Lazy.all(values2.map { |value| load_application_object(argument, value, context || self.context) })
56
56
  end
@@ -59,7 +59,7 @@ module GraphQL
59
59
  elsif loads
60
60
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
61
61
  def #{method_owner}load_#{arg_defn.keyword}(value, context = nil)
62
- argument = get_argument("#{arg_defn.graphql_name}")
62
+ argument = get_argument("#{arg_defn.graphql_name}", context || self.context)
63
63
  load_application_object(argument, value, context || self.context)
64
64
  end
65
65
  RUBY
@@ -63,10 +63,6 @@ module GraphQL
63
63
  # Schemas can restrict large incoming queries with `max_depth` and `max_complexity` configurations.
64
64
  # (These configurations can be overridden by specific calls to {Schema#execute})
65
65
  #
66
- # Schemas can specify how queries should be executed against them.
67
- # `query_execution_strategy`, `mutation_execution_strategy` and `subscription_execution_strategy`
68
- # each apply to corresponding root types.
69
- #
70
66
  # @example defining a schema
71
67
  # class MySchema < GraphQL::Schema
72
68
  # query QueryType
@@ -162,6 +158,10 @@ module GraphQL
162
158
 
163
159
  def trace_class(new_class = nil)
164
160
  if new_class
161
+ # If any modules were already added for `:default`,
162
+ # re-apply them here
163
+ mods = trace_modules_for(:default)
164
+ mods.each { |mod| new_class.include(mod) }
165
165
  trace_mode(:default, new_class)
166
166
  backtrace_class = Class.new(new_class)
167
167
  backtrace_class.include(GraphQL::Backtrace::Trace)
@@ -651,27 +651,39 @@ module GraphQL
651
651
  end
652
652
  end
653
653
 
654
- def query_execution_strategy(new_query_execution_strategy = nil)
654
+ def query_execution_strategy(new_query_execution_strategy = nil, deprecation_warning: true)
655
+ if deprecation_warning
656
+ warn "GraphQL::Schema.query_execution_strategy is deprecated without replacement. Use `GraphQL::Query.new` directly to create and execute a custom query instead."
657
+ warn " #{caller(1, 1).first}"
658
+ end
655
659
  if new_query_execution_strategy
656
660
  @query_execution_strategy = new_query_execution_strategy
657
661
  else
658
- @query_execution_strategy || find_inherited_value(:query_execution_strategy, self.default_execution_strategy)
662
+ @query_execution_strategy || (superclass.respond_to?(:query_execution_strategy) ? superclass.query_execution_strategy(deprecation_warning: false) : self.default_execution_strategy)
659
663
  end
660
664
  end
661
665
 
662
- def mutation_execution_strategy(new_mutation_execution_strategy = nil)
666
+ def mutation_execution_strategy(new_mutation_execution_strategy = nil, deprecation_warning: true)
667
+ if deprecation_warning
668
+ warn "GraphQL::Schema.mutation_execution_strategy is deprecated without replacement. Use `GraphQL::Query.new` directly to create and execute a custom query instead."
669
+ warn " #{caller(1, 1).first}"
670
+ end
663
671
  if new_mutation_execution_strategy
664
672
  @mutation_execution_strategy = new_mutation_execution_strategy
665
673
  else
666
- @mutation_execution_strategy || find_inherited_value(:mutation_execution_strategy, self.default_execution_strategy)
674
+ @mutation_execution_strategy || (superclass.respond_to?(:mutation_execution_strategy) ? superclass.mutation_execution_strategy(deprecation_warning: false) : self.default_execution_strategy)
667
675
  end
668
676
  end
669
677
 
670
- def subscription_execution_strategy(new_subscription_execution_strategy = nil)
678
+ def subscription_execution_strategy(new_subscription_execution_strategy = nil, deprecation_warning: true)
679
+ if deprecation_warning
680
+ warn "GraphQL::Schema.subscription_execution_strategy is deprecated without replacement. Use `GraphQL::Query.new` directly to create and execute a custom query instead."
681
+ warn " #{caller(1, 1).first}"
682
+ end
671
683
  if new_subscription_execution_strategy
672
684
  @subscription_execution_strategy = new_subscription_execution_strategy
673
685
  else
674
- @subscription_execution_strategy || find_inherited_value(:subscription_execution_strategy, self.default_execution_strategy)
686
+ @subscription_execution_strategy || (superclass.respond_to?(:subscription_execution_strategy) ? superclass.subscription_execution_strategy(deprecation_warning: false) : self.default_execution_strategy)
675
687
  end
676
688
  end
677
689
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.2.11"
3
+ VERSION = "2.2.13"
4
4
  end
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.2.11
4
+ version: 2.2.13
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-02-27 00:00:00.000000000 Z
11
+ date: 2024-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: graphql-batch
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: memory_profiler
57
71
  requirement: !ruby/object:Gem::Requirement