rack-graphql 2.6.1 → 2.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b053aa44a60a954fb34b510282d975db883c54f3e301778f601cef8cee9f82b
4
- data.tar.gz: 9ef8753993d89d6a0ac98864b01dd0a89ad8552765930e7ea933e63a9d60fd92
3
+ metadata.gz: b0aed325620504c52731b38726309a1633831e5af42af1f2a42b9a85e1c7b662
4
+ data.tar.gz: df13c1c063bab50027908d4c44f0ecc242fca1bf6d7485e1fadb69a2e9dddbac
5
5
  SHA512:
6
- metadata.gz: 1745f7f487e8a06447184464f9f2b2d97ac6f35dc4224d0122f4ed1f4c3ac37aec268c016db8d36c10f379e84e94e11d9b54a1d1512db07a20ac3684c355b31b
7
- data.tar.gz: 2518a9c2c8842b34f23a4323b9579276a25a45065ffe97e7a155b3344cf00aadd5b7018c70af4ab9370979bda61dfdab4c5c046e933b2cd7f42ea51a90b77c15
6
+ metadata.gz: a0ca07400a4d7229462f720310d9da3a734c91ca78318bcba122734d8983cae935563488c1e146f19a991d3a1890be740ba6f752fb6ef0babeca791f188bed3b
7
+ data.tar.gz: 571b478112fd84ae108c78afd17a1e48a7163d8c2c2b582824ec9b2bdb1057aaa934a9a12f9a0dadfa6fe0008a80391e5d210970cc7736bfcfee173b09757ca6
data/.bundler-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.14
@@ -3,9 +3,14 @@ version: 1
3
3
  update_configs:
4
4
  - package_manager: "ruby:bundler"
5
5
  directory: "/"
6
- update_schedule: "monthly"
6
+ update_schedule: "daily"
7
7
  commit_message:
8
8
  prefix: "[dependabot]"
9
9
  allowed_updates:
10
10
  - match:
11
- update_type: "all"
11
+ dependency_type: "all"
12
+ update_type: "security"
13
+ automerged_updates:
14
+ - match:
15
+ dependency_type: "all"
16
+ update_type: "security:patch"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.7.0 - 2021-03-24
4
+
5
+ - Add ability to skip setting up health endpoint on root path with `health_on_root_path` option.
6
+
7
+ ## 2.6.1 - 2021-01-14
8
+
9
+ - Fix uninitialized `Timeout` error. The issue was fixed in https://github.com/rmosolgo/graphql-ruby/commit/56abba472dbb48a1f8445d41f928bea72b5148e9, but new version has not yet been relased.
10
+
3
11
  ## 2.6.0 - 2021-01-14
4
12
 
5
13
  - Add ability to re-raise exception (`re_raise_exceptions` option)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-graphql (2.6.1)
4
+ rack-graphql (2.7.0)
5
5
  graphql
6
6
  oj
7
7
  rack (~> 2.2)
@@ -10,16 +10,16 @@ GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
12
  ast (2.4.2)
13
- awesome_print (1.8.0)
13
+ awesome_print (1.9.2)
14
14
  coderay (1.1.3)
15
15
  diff-lcs (1.4.4)
16
- graphql (1.12.0)
16
+ graphql (1.12.6)
17
17
  method_source (1.0.0)
18
- oj (3.11.1)
18
+ oj (3.11.3)
19
19
  parallel (1.20.1)
20
20
  parser (3.0.0.0)
21
21
  ast (~> 2.4.1)
22
- pry (0.13.1)
22
+ pry (0.14.0)
23
23
  coderay (~> 1.1)
24
24
  method_source (~> 1.0)
25
25
  rack (2.2.3)
@@ -27,7 +27,7 @@ GEM
27
27
  rack (>= 1.0, < 3)
28
28
  rainbow (3.0.0)
29
29
  rake (13.0.3)
30
- regexp_parser (2.0.3)
30
+ regexp_parser (2.1.1)
31
31
  rexml (3.2.4)
32
32
  rspec (3.10.0)
33
33
  rspec-core (~> 3.10.0)
@@ -38,11 +38,11 @@ GEM
38
38
  rspec-expectations (3.10.1)
39
39
  diff-lcs (>= 1.2.0, < 2.0)
40
40
  rspec-support (~> 3.10.0)
41
- rspec-mocks (3.10.1)
41
+ rspec-mocks (3.10.2)
42
42
  diff-lcs (>= 1.2.0, < 2.0)
43
43
  rspec-support (~> 3.10.0)
44
- rspec-support (3.10.1)
45
- rubocop (1.8.1)
44
+ rspec-support (3.10.2)
45
+ rubocop (1.11.0)
46
46
  parallel (~> 1.10)
47
47
  parser (>= 3.0.0.0)
48
48
  rainbow (>= 2.2.2, < 4.0)
@@ -55,7 +55,7 @@ GEM
55
55
  parser (>= 2.7.1.5)
56
56
  rubocop-rake (0.5.1)
57
57
  rubocop
58
- rubocop-rspec (2.1.0)
58
+ rubocop-rspec (2.2.0)
59
59
  rubocop (~> 1.0)
60
60
  rubocop-ast (>= 1.1.0)
61
61
  ruby-progressbar (1.11.0)
@@ -63,6 +63,7 @@ GEM
63
63
 
64
64
  PLATFORMS
65
65
  x86_64-darwin-20
66
+ x86_64-linux
66
67
 
67
68
  DEPENDENCIES
68
69
  awesome_print
@@ -77,4 +78,4 @@ DEPENDENCIES
77
78
  rubocop-rspec
78
79
 
79
80
  BUNDLED WITH
80
- 2.2.4
81
+ 2.2.15
data/README.md CHANGED
@@ -29,6 +29,7 @@ run RackGraphql::Application.call(
29
29
  log_exception_backtrace: !A9n.env.production?, # optional, `false` default
30
30
  # `true` when `RACK_GRAPHQL_LOG_EXCEPTION_BACKTRACE` env var is set to `'1'` or `'true'`
31
31
  health_route: true, # optional, true by default
32
+ health_on_root_path: health_route, # optional, health_route value by default (mind map '/' is covering '/any/path-123')
32
33
  logger: A9n.logger, # optional, not set by default
33
34
  error_status_code_map: { IamTeapotError => 418 }, # optional
34
35
  re_raise_exceptions: true, # optional, false by default
@@ -87,32 +88,31 @@ RackGraphql.log_exception_backtrace = false
87
88
  To respect the graphql spec, all errors need to be returned as json and `rack-graphql` catches all exceptions and does NOT re-raise them. You can change this behavior via `re_raise_exceptions` argument.
88
89
  Because of this, using error tracking middleware (`use Sentry::Rack::CaptureExceptions`, `use Raven::Rack`) does not take any effect for graphql requests.
89
90
 
90
- To use Sentry or other reporting tool for graphql queries, you can use `GraphQL::Schema` middleware:
91
+ To use Sentry or other reporting tool for graphql queries, you should handle it on graphql schema level:
91
92
 
92
93
  ```ruby
93
- class GraphqlErrorTrackerMiddleware
94
- def self.call(parent_type, parent_object, field_definition, field_args, query_context)
95
- yield
96
- rescue StandardError => e
94
+ class MySchema < GraphQL::Schema
95
+ rescue_from StandardError do |e, obj, args, ctx, field|
97
96
  extra = {
98
- parent_type: parent_type.inspect,
99
- parent_object: parent_object.inspect,
100
- field_definition: field_definition.to_s,
101
- field_args: field_args&.to_h,
102
- query_context: query_context&.to_h
97
+ args: args,
98
+ field: field.inspect,
99
+ context: ctx
103
100
  }
104
101
  Sentry.capture_exception(e, extra: extra)
102
+ # re-raise to be handled by rack middleware
105
103
  raise
104
+ # or return execution error
105
+ ::GraphQL::ExecutionError.new(
106
+ exception.class.to_s,
107
+ options: { "http_status" => 500 },
108
+ extensions: {
109
+ "code" => exception.class.to_s,
110
+ "http_status" => 500,
111
+ "details" => exception.inspect
112
+ }
113
+ )
106
114
  end
107
115
  end
108
-
109
- # MySchema.middleware GraphqlErrorTrackerMiddleware
110
- # or
111
- # GraphQL::Schema.middleware GraphqlErrorTrackerMiddleware
112
- # or
113
- # class MySchema < GraphQL::Schema
114
- # middleware GraphqlErrorTrackerMiddleware
115
- # end
116
116
  ```
117
117
 
118
118
  ## Contributing
@@ -9,6 +9,7 @@ module RackGraphql
9
9
  log_exception_backtrace: RackGraphql.log_exception_backtrace,
10
10
  health_route: true,
11
11
  health_response_builder: RackGraphql::HealthResponseBuilder,
12
+ health_on_root_path: health_route,
12
13
  error_status_code_map: {}
13
14
  )
14
15
 
@@ -33,7 +34,9 @@ module RackGraphql
33
34
  map '/healthz' do
34
35
  run ->(env) { health_response_builder.new(app_name: app_name, env: env).build }
35
36
  end
37
+ end
36
38
 
39
+ if health_on_root_path
37
40
  map '/' do
38
41
  run ->(env) { health_response_builder.new(app_name: app_name, env: env).build }
39
42
  end
@@ -1,3 +1,3 @@
1
1
  module RackGraphql
2
- VERSION = '2.6.1'.freeze
2
+ VERSION = '2.7.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-01-25 00:00:00.000000000 Z
12
+ date: 2021-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphql
@@ -187,6 +187,7 @@ executables: []
187
187
  extensions: []
188
188
  extra_rdoc_files: []
189
189
  files:
190
+ - ".bundler-version"
190
191
  - ".dependabot/config.yml"
191
192
  - ".github/ISSUE_TEMPLATE/bug_report.md"
192
193
  - ".github/ISSUE_TEMPLATE/config.yml"
@@ -233,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
234
  - !ruby/object:Gem::Version
234
235
  version: '0'
235
236
  requirements: []
236
- rubygems_version: 3.2.3
237
+ rubygems_version: 3.2.15
237
238
  signing_key:
238
239
  specification_version: 4
239
240
  summary: Rack middleware implementing graphql endpoint.