graphql 2.2.3 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7177c15aedde0b99419bee77e944a4907bb84e39b5e9aafb05b2a1360903f3e6
4
- data.tar.gz: e7252b975a41c1d8a0871e71a3fc37522741c0b872899f2f33863b76ad09934d
3
+ metadata.gz: 49aca16aba9ee96f9aa4229e07e5493b1e8c676a892a1fa1e9828323d44dc073
4
+ data.tar.gz: 95eec1c3808a12b28bcc2732bb13baf9d52ddf3f34c4971abf92f6cff3333e93
5
5
  SHA512:
6
- metadata.gz: d29b25a1186ce62664cd2225de1eac675925ebbf93ed14c6513a1008c7cd6a1b01b375a1785082ab14024ead927a073f8e3afb72ffa5905a342fcdec6a60d9fa
7
- data.tar.gz: 6d2a445f577027d5f87a0a0ee0f0c1a562d494d7d9a5bc7209dfbb2fc5c98ce38f5fab86e7101b6537f9b9b590a2d41e1303f5dc606809683a1bde22c6bc283d
6
+ metadata.gz: 287acc2969a3b181d2d53dc94562335fac43de4cb8873844f063b63b604948e3edb7df318e53ec42906f678f7329efc5aa8d28bdbbfd4bc7f9d504a96f745df9
7
+ data.tar.gz: 3ef6c000a5eeaddd295786e9baf147663556cc19c1bc46facf57b67233bf40780e42b4781f39ebd3966ca29bc6bab6b682e9bd475b4c2474f471841454cb3d3c
@@ -3,69 +3,63 @@ module GraphQL
3
3
  class Dataloader
4
4
  class AsyncDataloader < Dataloader
5
5
  def yield
6
- Thread.current[:graphql_dataloader_next_tick].wait
6
+ if (condition = Thread.current[:graphql_dataloader_next_tick])
7
+ condition.wait
8
+ else
9
+ Fiber.yield
10
+ end
7
11
  nil
8
12
  end
9
13
 
10
14
  def run
11
- job_tasks = []
12
- next_job_tasks = []
15
+ job_fibers = []
16
+ next_job_fibers = []
13
17
  source_tasks = []
14
18
  next_source_tasks = []
15
19
  first_pass = true
16
- jobs_condition = Async::Condition.new
17
20
  sources_condition = Async::Condition.new
18
- Sync do |root_task|
19
- while first_pass || job_tasks.any?
21
+ manager = spawn_fiber do
22
+ while first_pass || job_fibers.any?
20
23
  first_pass = false
21
24
 
22
- while (task = job_tasks.shift || spawn_job_task(root_task, jobs_condition))
23
- if task.alive?
24
- next_job_tasks << task
25
- elsif task.failed?
26
- # re-raise a raised error -
27
- # this also covers errors from sources since
28
- # these jobs wait for sources as needed.
29
- task.wait
25
+ while (f = (job_fibers.shift || spawn_job_fiber))
26
+ if f.alive?
27
+ finished = run_fiber(f)
28
+ if !finished
29
+ next_job_fibers << f
30
+ end
30
31
  end
31
32
  end
32
- root_task.yield # give job tasks a chance to run
33
- job_tasks.concat(next_job_tasks)
34
- next_job_tasks.clear
33
+ job_fibers.concat(next_job_fibers)
34
+ next_job_fibers.clear
35
35
 
36
- while source_tasks.any? || @source_cache.each_value.any? { |group_sources| group_sources.each_value.any?(&:pending?) }
37
- while (task = source_tasks.shift || spawn_source_task(root_task, sources_condition))
38
- if task.alive?
39
- next_source_tasks << task
36
+ Sync do |root_task|
37
+ while source_tasks.any? || @source_cache.each_value.any? { |group_sources| group_sources.each_value.any?(&:pending?) }
38
+ while (task = source_tasks.shift || spawn_source_task(root_task, sources_condition))
39
+ if task.alive?
40
+ root_task.yield # give the source task a chance to run
41
+ next_source_tasks << task
42
+ end
40
43
  end
44
+ sources_condition.signal
45
+ source_tasks.concat(next_source_tasks)
46
+ next_source_tasks.clear
41
47
  end
42
- root_task.yield # give source tasks a chance to run
43
- sources_condition.signal
44
- source_tasks.concat(next_source_tasks)
45
- next_source_tasks.clear
46
48
  end
47
- jobs_condition.signal
48
49
  end
49
50
  end
51
+
52
+ manager.resume
53
+ if manager.alive?
54
+ raise "Invariant: Manager didn't terminate successfully: #{manager}"
55
+ end
56
+
50
57
  rescue UncaughtThrowError => e
51
58
  throw e.tag, e.value
52
59
  end
53
60
 
54
61
  private
55
62
 
56
- def spawn_job_task(parent_task, condition)
57
- if @pending_jobs.any?
58
- fiber_vars = get_fiber_variables
59
- parent_task.async do
60
- set_fiber_variables(fiber_vars)
61
- Thread.current[:graphql_dataloader_next_tick] = condition
62
- while job = @pending_jobs.shift
63
- job.call
64
- end
65
- end
66
- end
67
- end
68
-
69
63
  def spawn_source_task(parent_task, condition)
70
64
  pending_sources = nil
71
65
  @source_cache.each_value do |source_by_batch_params|
@@ -513,7 +513,7 @@ module GraphQL
513
513
  end
514
514
  when Array
515
515
  # It's an array full of execution errors; add them all.
516
- if value.any? && value.all? { |v| v.is_a?(GraphQL::ExecutionError) }
516
+ if value.any? && value.all?(GraphQL::ExecutionError)
517
517
  list_type_at_all = (field && (field.type.list?))
518
518
  if selection_result.nil? || !dead_result?(selection_result)
519
519
  value.each_with_index do |error, index|
@@ -333,7 +333,7 @@ module GraphQL
333
333
  v_loc = pos
334
334
  description = if at?(:STRING); string_value; end
335
335
  defn_loc = pos
336
- enum_value = expect_token_value(:IDENTIFIER)
336
+ enum_value = parse_enum_name
337
337
  v_directives = parse_directives
338
338
  list << EnumValueDefinition.new(pos: v_loc, definition_pos: defn_loc, description: description, name: enum_value, directives: v_directives, filename: @filename, source_string: @graphql_str)
339
339
  end
@@ -566,6 +566,15 @@ module GraphQL
566
566
  when :NULL
567
567
  advance_token
568
568
  "null"
569
+ when :ON
570
+ advance_token
571
+ "on"
572
+ when :DIRECTIVE
573
+ advance_token
574
+ "directive"
575
+ when :EXTEND
576
+ advance_token
577
+ "extend"
569
578
  else
570
579
  expect_token(:NAME)
571
580
  end
@@ -14,7 +14,7 @@ module GraphQL
14
14
  # # ONIONS
15
15
  # # PEPPERS
16
16
  # # }
17
- # class PizzaTopping < GraphQL::Enum
17
+ # class PizzaTopping < GraphQL::Schema::Enum
18
18
  # value :MUSHROOMS
19
19
  # value :ONIONS
20
20
  # value :PEPPERS
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "2.2.3"
3
+ VERSION = "2.2.5"
4
4
  end
data/lib/graphql.rb CHANGED
@@ -120,5 +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"
124
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
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-12-28 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: racc
@@ -315,7 +315,6 @@ files:
315
315
  - lib/graphql/dataloader/request_all.rb
316
316
  - lib/graphql/dataloader/source.rb
317
317
  - lib/graphql/date_encoding_error.rb
318
- - lib/graphql/deprecation.rb
319
318
  - lib/graphql/dig.rb
320
319
  - lib/graphql/duration_encoding_error.rb
321
320
  - lib/graphql/execution.rb
@@ -615,7 +614,7 @@ metadata:
615
614
  changelog_uri: https://github.com/rmosolgo/graphql-ruby/blob/master/CHANGELOG.md
616
615
  source_code_uri: https://github.com/rmosolgo/graphql-ruby
617
616
  bug_tracker_uri: https://github.com/rmosolgo/graphql-ruby/issues
618
- mailing_list_uri: https://tinyletter.com/graphql-ruby
617
+ mailing_list_uri: https://buttondown.email/graphql-ruby
619
618
  post_install_message:
620
619
  rdoc_options: []
621
620
  require_paths:
@@ -631,7 +630,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
631
630
  - !ruby/object:Gem::Version
632
631
  version: '0'
633
632
  requirements: []
634
- rubygems_version: 3.5.3
633
+ rubygems_version: 3.4.10
635
634
  signing_key:
636
635
  specification_version: 4
637
636
  summary: A GraphQL language and runtime for Ruby
@@ -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