rack-graphql 3.3.0.beta → 3.5.0

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: 532f0f16301ca51cb072332f905ab255514d771fbf45e78b4841843acd4dc11e
4
- data.tar.gz: 595f33e14ca13493367d7c6bd956fff2f43f1202ab698e1f7641220e46cf8cc0
3
+ metadata.gz: 499d61ebe65ca554ac40efcfb74dffe22850ab8456e339444f65a171f95b9809
4
+ data.tar.gz: 2107b50e6fbaecde8ee25440686a9ac0121fa4625ef9aaeddc3c347144520b73
5
5
  SHA512:
6
- metadata.gz: 7a59eacd519ad77e4848090c18bd823889ed7d7e1edb51004739b83caadf9ea4d91bdd9f4d275c639b3165564160130e1762ab32820de67e0abc7ef3ce57cea7
7
- data.tar.gz: 27624f4f2e3b79f71520ee41bb9455493a4d64b01cfabd402a9db9141a6551fbf7a76613a0bfccf81698080f82d30fa473997304e62c726c7274b51d6fddd47e
6
+ metadata.gz: ea8390fe89e7a32d17c017f63a4ba08971dc652dc1aef67f0895494e8c72c26802fc3da15ed7ce5c279585875b6151de4241f4b56091c2c7e2d2cfbf9f620e8b
7
+ data.tar.gz: 4ab5cb0f925617682347476cb7b26f840ed8bb594aa7800718f664fccb711555335cf1b7c3f7216849cdd2158493aafff3f39c9903a0b54e442a83b1eb24a68e
data/.bundler-version CHANGED
@@ -1 +1 @@
1
- 2.4.21
1
+ 2.5.6
@@ -1,19 +1,15 @@
1
- version: 1
1
+ version: 2
2
2
 
3
- update_configs:
4
- - package_manager: "ruby:bundler"
3
+ updates:
4
+ - package-ecosystem: "bundler"
5
5
  directory: "/"
6
- update_schedule: "daily"
7
- commit_message:
6
+ schedule:
7
+ interval: "weekly"
8
+ day: "monday"
9
+ time: "08:00"
10
+ timezone: "UTC"
11
+ commit-message:
8
12
  prefix: "[dependabot]"
9
- allowed_updates:
10
- - match:
11
- dependency_type: "all"
12
- update_type: "security"
13
- automerged_updates:
14
- - match:
15
- dependency_type: "all"
16
- update_type: "security:patch"
17
13
  labels:
18
14
  - "automerge"
19
15
  - "dependencies"
@@ -8,6 +8,6 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
10
  - uses: hmarr/auto-approve-action@v3
11
- if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' || github.actor == 'renofidev' || contains(toJson(github), 'HOTFIX-AUTO-APPROVE')
11
+ if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' || github.actor == 'renofidev' || contains(github.event.pull_request.labels.*.name, 'HOTFIX-AUTO-APPROVE') || contains(github.event.pull_request.labels.*.name, 'dependencies')
12
12
  with:
13
13
  github-token: "${{ secrets.GITHUB_TOKEN }}"
@@ -15,10 +15,10 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
17
  - name: automerge-dependencies
18
- uses: pascalgn/automerge-action@v0.15.6
18
+ uses: pascalgn/automerge-action@v0.16.2
19
19
  env:
20
20
  GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
21
21
  MERGE_METHOD: squash
22
22
  MERGE_DELETE_BRANCH: true
23
- MERGE_LABELS: dependencies
23
+ MERGE_LABELS: "dependencies,!automerge blocked"
24
24
  MERGE_REMOVE_LABELS: ""
@@ -15,7 +15,7 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
17
  - name: automerge
18
- uses: pascalgn/automerge-action@v0.15.6
18
+ uses: pascalgn/automerge-action@v0.16.2
19
19
  env:
20
20
  GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
21
21
  MERGE_METHOD: squash
@@ -7,11 +7,11 @@ on:
7
7
  branches: [ main ]
8
8
 
9
9
  jobs:
10
- test:
10
+ ci_tests_ruby:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: [3.1, 3.2]
14
+ ruby-version: [3.1, 3.2, 3.3]
15
15
 
16
16
  steps:
17
17
  - uses: actions/checkout@v3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.3.1 - 2024-02-29
4
+ - make ruby 3.1 a minimum version
5
+
6
+ ## 3.3.0 - 2023-11-23
7
+
8
+ - add `request_epilogue` so actions like `ActiveRecord::Base.connection_handler.clear_active_connections!` can be passed manually
9
+ - ruby 3.1 is the minimal ruby version
10
+
3
11
  ## 3.1.3 - 2023-10-10
4
12
 
5
13
  - use `ActiveRecord::Base.connection_handler.clear_active_connections!` instead of ActiveRecord::Base.clear_active_connections!`, which is deprecated
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-graphql (3.3.0.beta)
4
+ rack-graphql (3.5.0)
5
5
  graphql (~> 2.0)
6
6
  oj
7
7
  rack (>= 2.2.6)
@@ -11,62 +11,67 @@ GEM
11
11
  specs:
12
12
  ast (2.4.2)
13
13
  awesome_print (1.9.2)
14
+ base64 (0.2.0)
15
+ bigdecimal (3.1.6)
14
16
  coderay (1.1.3)
15
- diff-lcs (1.5.0)
16
- graphql (2.1.6)
17
- racc (~> 1.4)
18
- json (2.6.3)
17
+ diff-lcs (1.5.1)
18
+ graphql (2.2.11)
19
+ base64
20
+ json (2.7.1)
19
21
  language_server-protocol (3.17.0.3)
20
22
  method_source (1.0.0)
21
- oj (3.16.1)
22
- parallel (1.23.0)
23
- parser (3.2.2.4)
23
+ oj (3.16.3)
24
+ bigdecimal (>= 3.0)
25
+ parallel (1.24.0)
26
+ parser (3.3.0.5)
24
27
  ast (~> 2.4.1)
25
28
  racc
29
+ prism (0.24.0)
26
30
  pry (0.14.2)
27
31
  coderay (~> 1.1)
28
32
  method_source (~> 1.0)
29
33
  racc (1.7.3)
30
- rack (3.0.8)
34
+ rack (3.0.9.1)
31
35
  rack-test (2.1.0)
32
36
  rack (>= 1.3)
33
37
  rainbow (3.1.1)
34
38
  rake (13.1.0)
35
- regexp_parser (2.8.2)
39
+ regexp_parser (2.9.0)
36
40
  rexml (3.2.6)
37
- rspec (3.12.0)
38
- rspec-core (~> 3.12.0)
39
- rspec-expectations (~> 3.12.0)
40
- rspec-mocks (~> 3.12.0)
41
- rspec-core (3.12.2)
42
- rspec-support (~> 3.12.0)
43
- rspec-expectations (3.12.3)
41
+ rspec (3.13.0)
42
+ rspec-core (~> 3.13.0)
43
+ rspec-expectations (~> 3.13.0)
44
+ rspec-mocks (~> 3.13.0)
45
+ rspec-core (3.13.0)
46
+ rspec-support (~> 3.13.0)
47
+ rspec-expectations (3.13.0)
44
48
  diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.12.0)
46
- rspec-mocks (3.12.6)
49
+ rspec-support (~> 3.13.0)
50
+ rspec-mocks (3.13.0)
47
51
  diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.12.0)
49
- rspec-support (3.12.1)
50
- rubocop (1.57.2)
52
+ rspec-support (~> 3.13.0)
53
+ rspec-support (3.13.1)
54
+ rubocop (1.61.0)
51
55
  json (~> 2.3)
52
56
  language_server-protocol (>= 3.17.0)
53
57
  parallel (~> 1.10)
54
- parser (>= 3.2.2.4)
58
+ parser (>= 3.3.0.2)
55
59
  rainbow (>= 2.2.2, < 4.0)
56
60
  regexp_parser (>= 1.8, < 3.0)
57
61
  rexml (>= 3.2.5, < 4.0)
58
- rubocop-ast (>= 1.28.1, < 2.0)
62
+ rubocop-ast (>= 1.30.0, < 2.0)
59
63
  ruby-progressbar (~> 1.7)
60
64
  unicode-display_width (>= 2.4.0, < 3.0)
61
- rubocop-ast (1.30.0)
62
- parser (>= 3.2.1.0)
63
- rubocop-capybara (2.19.0)
65
+ rubocop-ast (1.31.0)
66
+ parser (>= 3.3.0.4)
67
+ prism (>= 0.24.0)
68
+ rubocop-capybara (2.20.0)
69
+ rubocop (~> 1.41)
70
+ rubocop-factory_bot (2.25.1)
64
71
  rubocop (~> 1.41)
65
- rubocop-factory_bot (2.24.0)
66
- rubocop (~> 1.33)
67
72
  rubocop-rake (0.6.0)
68
73
  rubocop (~> 1.0)
69
- rubocop-rspec (2.25.0)
74
+ rubocop-rspec (2.26.1)
70
75
  rubocop (~> 1.40)
71
76
  rubocop-capybara (~> 2.17)
72
77
  rubocop-factory_bot (~> 2.22)
@@ -95,4 +100,4 @@ DEPENDENCIES
95
100
  rubocop-rspec
96
101
 
97
102
  BUNDLED WITH
98
- 2.4.20
103
+ 2.5.6
data/README.md CHANGED
@@ -34,6 +34,7 @@ run RackGraphql::Application.call(
34
34
  logger: A9n.logger, # optional, not set by default
35
35
  error_status_code_map: { IamTeapotError => 418 }, # optional
36
36
  re_raise_exceptions: true, # optional, false by default
37
+ request_epilogue: -> { ActiveRecord::Base.connection_handler.clear_active_connections! }
37
38
  )
38
39
  ```
39
40
 
@@ -11,29 +11,31 @@ module RackGraphql
11
11
  health_response_builder: RackGraphql::HealthResponseBuilder,
12
12
  health_on_root_path: health_route,
13
13
  root_path_app: nil,
14
- error_status_code_map: {}
14
+ error_status_code_map: {},
15
+ request_epilogue: -> {}
15
16
  )
16
17
 
17
18
  ::Rack::Builder.new do
18
19
  map '/graphql' do
19
20
  run RackGraphql::Middleware.new(
20
- app_name: app_name,
21
- schema: schema,
22
- context_handler: context_handler,
23
- re_raise_exceptions: re_raise_exceptions,
24
- logger: logger,
25
- log_exception_backtrace: log_exception_backtrace,
26
- error_status_code_map: error_status_code_map,
21
+ app_name:,
22
+ schema:,
23
+ context_handler:,
24
+ re_raise_exceptions:,
25
+ logger:,
26
+ log_exception_backtrace:,
27
+ error_status_code_map:,
28
+ request_epilogue:,
27
29
  )
28
30
  end
29
31
 
30
32
  if health_route
31
33
  map '/health' do
32
- run ->(env) { health_response_builder.new(app_name: app_name, env: env).build }
34
+ run ->(env) { health_response_builder.new(app_name:, env:).build }
33
35
  end
34
36
 
35
37
  map '/healthz' do
36
- run ->(env) { health_response_builder.new(app_name: app_name, env: env).build }
38
+ run ->(env) { health_response_builder.new(app_name:, env:).build }
37
39
  end
38
40
  end
39
41
 
@@ -43,7 +45,7 @@ module RackGraphql
43
45
  end
44
46
  elsif health_on_root_path
45
47
  map '/' do
46
- run ->(env) { health_response_builder.new(app_name: app_name, env: env).build }
48
+ run ->(env) { health_response_builder.new(app_name:, env:).build }
47
49
  end
48
50
  end
49
51
  end
@@ -13,7 +13,8 @@ module RackGraphql
13
13
  logger: nil,
14
14
  log_exception_backtrace: RackGraphql.log_exception_backtrace,
15
15
  re_raise_exceptions: false,
16
- error_status_code_map: {}
16
+ error_status_code_map: {},
17
+ request_epilogue: -> {}
17
18
  )
18
19
 
19
20
  @schema = schema
@@ -23,6 +24,7 @@ module RackGraphql
23
24
  @log_exception_backtrace = log_exception_backtrace
24
25
  @re_raise_exceptions = re_raise_exceptions
25
26
  @error_status_code_map = error_status_code_map
27
+ @request_epilogue = request_epilogue || -> {}
26
28
  end
27
29
 
28
30
  def call(env)
@@ -37,12 +39,12 @@ module RackGraphql
37
39
  context = context_handler.call(env)
38
40
 
39
41
  log("Executing with params: #{params.inspect}, operationName: #{operation_name}, variables: #{variables.inspect}")
40
- result = execute(params: params, operation_name: operation_name, variables: variables, context: context)
42
+ result = execute(params:, operation_name:, variables:, context:)
41
43
  status_code = response_status(result)
42
44
 
43
45
  [
44
46
  status_code,
45
- response_headers(result, status_code: status_code),
47
+ response_headers(result, status_code:),
46
48
  [response_body(result)]
47
49
  ]
48
50
  rescue AmbiguousParamError => e
@@ -75,14 +77,14 @@ module RackGraphql
75
77
  [Oj.dump('errors' => [exception_hash(e)])]
76
78
  ]
77
79
  ensure
78
- ActiveRecord::Base.connection_handler.flush_idle_connections!(:all) if defined?(ActiveRecord::Base)
79
- ActiveRecord::Base.connection_handler.clear_active_connections!(:all) if defined?(ActiveRecord::Base)
80
+ request_epilogue.call
80
81
  end
81
82
 
82
83
  private
83
84
 
84
85
  attr_reader :schema, :app_name, :logger, :context_handler,
85
- :log_exception_backtrace, :error_status_code_map, :re_raise_exceptions
86
+ :log_exception_backtrace, :error_status_code_map,
87
+ :re_raise_exceptions, :request_epilogue
86
88
 
87
89
  def post_request?(env)
88
90
  env['REQUEST_METHOD'] == 'POST'
@@ -119,14 +121,14 @@ module RackGraphql
119
121
 
120
122
  def execute(params:, operation_name:, variables:, context:)
121
123
  if valid_multiplex?(params)
122
- execute_multi(params['_json'], operation_name: operation_name, variables: variables, context: context)
124
+ execute_multi(params['_json'], operation_name:, variables:, context:)
123
125
  else
124
- execute_single(params['query'], operation_name: operation_name, variables: variables, context: context)
126
+ execute_single(params['query'], operation_name:, variables:, context:)
125
127
  end
126
128
  end
127
129
 
128
130
  def execute_single(query, operation_name:, variables:, context:)
129
- schema.execute(query, operation_name: operation_name, variables: variables, context: context)
131
+ schema.execute(query, operation_name:, variables:, context:)
130
132
  end
131
133
 
132
134
  def valid_multiplex?(params)
@@ -137,9 +139,9 @@ module RackGraphql
137
139
  queries = queries_params.map do |param|
138
140
  {
139
141
  query: param['query'],
140
- operation_name: operation_name,
141
- variables: variables,
142
- context: context
142
+ operation_name:,
143
+ variables:,
144
+ context:
143
145
  }
144
146
  end
145
147
 
@@ -1,3 +1,3 @@
1
1
  module RackGraphql
2
- VERSION = '3.3.0.beta'.freeze
2
+ VERSION = '3.5.0'.freeze
3
3
  end
data/rack-graphql.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.required_ruby_version = '>= 3.0'
27
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
28
28
 
29
29
  spec.add_dependency 'graphql', '~> 2.0'
30
30
  spec.add_dependency 'oj'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0.beta
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-11 00:00:00.000000000 Z
11
+ date: 2024-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -101,14 +101,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: '3.0'
104
+ version: 3.1.0
105
105
  required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">"
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
- version: 1.3.1
109
+ version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.4.21
111
+ rubygems_version: 3.5.3
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Rack middleware implementing graphql endpoint.