graphql 2.2.11 → 2.2.12

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: 4bcb377d757eba98e3b88e8a3af21bacbf00b7bb28ee994b7d517b5fb296c47a
4
+ data.tar.gz: 43a94034f284af6ecb62dd0961a67e706a7032000c7c500a8029a02995dd1881
5
5
  SHA512:
6
- metadata.gz: 0bd27d12cd1efd1c4166c20062e401fa524bcda469de51cbfe89fd21542fd3433a2f23628c21330c9e3d700a9627c683a6a1691887a06ef06105ede4c2241b26
7
- data.tar.gz: abc65a9217ae76239458695a3ee47d3e2bf3d072e16d62b9df16a65a380110e4a9a207af17473ca0f14fcce5d907a2552866597dd53785c890979a37aa2c500b
6
+ metadata.gz: bb67bbe99e21ce0f88632d6f5e965e842ff2714540d924721fb9234d9502b8ed596954c2748c406079052799386075f65d079c0e900df38c06f1cb1d422c61d8
7
+ data.tar.gz: 2e982944076364c91bc5dac75ff496762d973b0eed0c7b5913e27f5e01de0c0c2394047343c90e96f3f4d54db055adabf0268377bed6d6a06784b2f941b13ac7
@@ -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
@@ -651,27 +647,39 @@ module GraphQL
651
647
  end
652
648
  end
653
649
 
654
- def query_execution_strategy(new_query_execution_strategy = nil)
650
+ def query_execution_strategy(new_query_execution_strategy = nil, deprecation_warning: true)
651
+ if deprecation_warning
652
+ warn "GraphQL::Schema.query_execution_strategy is deprecated without replacement. Use `GraphQL::Query.new` directly to create and execute a custom query instead."
653
+ warn " #{caller(1, 1).first}"
654
+ end
655
655
  if new_query_execution_strategy
656
656
  @query_execution_strategy = new_query_execution_strategy
657
657
  else
658
- @query_execution_strategy || find_inherited_value(:query_execution_strategy, self.default_execution_strategy)
658
+ @query_execution_strategy || (superclass.respond_to?(:query_execution_strategy) ? superclass.query_execution_strategy(deprecation_warning: false) : self.default_execution_strategy)
659
659
  end
660
660
  end
661
661
 
662
- def mutation_execution_strategy(new_mutation_execution_strategy = nil)
662
+ def mutation_execution_strategy(new_mutation_execution_strategy = nil, deprecation_warning: true)
663
+ if deprecation_warning
664
+ warn "GraphQL::Schema.mutation_execution_strategy is deprecated without replacement. Use `GraphQL::Query.new` directly to create and execute a custom query instead."
665
+ warn " #{caller(1, 1).first}"
666
+ end
663
667
  if new_mutation_execution_strategy
664
668
  @mutation_execution_strategy = new_mutation_execution_strategy
665
669
  else
666
- @mutation_execution_strategy || find_inherited_value(:mutation_execution_strategy, self.default_execution_strategy)
670
+ @mutation_execution_strategy || (superclass.respond_to?(:mutation_execution_strategy) ? superclass.mutation_execution_strategy(deprecation_warning: false) : self.default_execution_strategy)
667
671
  end
668
672
  end
669
673
 
670
- def subscription_execution_strategy(new_subscription_execution_strategy = nil)
674
+ def subscription_execution_strategy(new_subscription_execution_strategy = nil, deprecation_warning: true)
675
+ if deprecation_warning
676
+ warn "GraphQL::Schema.subscription_execution_strategy is deprecated without replacement. Use `GraphQL::Query.new` directly to create and execute a custom query instead."
677
+ warn " #{caller(1, 1).first}"
678
+ end
671
679
  if new_subscription_execution_strategy
672
680
  @subscription_execution_strategy = new_subscription_execution_strategy
673
681
  else
674
- @subscription_execution_strategy || find_inherited_value(:subscription_execution_strategy, self.default_execution_strategy)
682
+ @subscription_execution_strategy || (superclass.respond_to?(:subscription_execution_strategy) ? superclass.subscription_execution_strategy(deprecation_warning: false) : self.default_execution_strategy)
675
683
  end
676
684
  end
677
685
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.2.11"
3
+ VERSION = "2.2.12"
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.12
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-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64