rack-graphql 3.5.0 → 3.7.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: 499d61ebe65ca554ac40efcfb74dffe22850ab8456e339444f65a171f95b9809
4
- data.tar.gz: 2107b50e6fbaecde8ee25440686a9ac0121fa4625ef9aaeddc3c347144520b73
3
+ metadata.gz: 1d2c1ea90ede4e54c5a5489a0851427ad9b09d6413793cbc3af0be433fd04ccf
4
+ data.tar.gz: f7ba119713fd428a0f38acd2d1d62d197f03d74179e4e7e8cb2f29d5735c106f
5
5
  SHA512:
6
- metadata.gz: ea8390fe89e7a32d17c017f63a4ba08971dc652dc1aef67f0895494e8c72c26802fc3da15ed7ce5c279585875b6151de4241f4b56091c2c7e2d2cfbf9f620e8b
7
- data.tar.gz: 4ab5cb0f925617682347476cb7b26f840ed8bb594aa7800718f664fccb711555335cf1b7c3f7216849cdd2158493aafff3f39c9903a0b54e442a83b1eb24a68e
6
+ metadata.gz: 677849f32a33ee3b09fe3bbb43df14b5c5f838995401696a80870b590e02d51c2e9040eee1d0c3ede91915db1fe72723ffef89a23a888134ec1e1c5e59cf757d
7
+ data.tar.gz: 1bb0f2c112fe088d46be05d4d8b766917e239f8924aa8b1a3b81f8f213e2340772f669413245b313590f68c5fae373a0105325b30d908d93edc25bfe3173c858
data/.bundler-version CHANGED
@@ -1 +1 @@
1
- 2.5.6
1
+ 2.5.23
@@ -0,0 +1,15 @@
1
+ version: 2
2
+
3
+ updates:
4
+ - package-ecosystem: "bundler"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+ day: "monday"
9
+ time: "08:00"
10
+ timezone: "UTC"
11
+ commit-message:
12
+ prefix: "[dependabot]"
13
+ labels:
14
+ - "automerge"
15
+ - "dependencies"
@@ -1,13 +1,14 @@
1
1
  name: Auto approve dependency upgrades and hot-fix PRs
2
2
  on:
3
3
  pull_request_target:
4
- types: [labeled, unlabeled, edited, ready_for_review, review_requested, auto_merge_enabled]
5
-
4
+ types:
5
+ - labeled
6
+ - ready_for_review
6
7
  jobs:
7
8
  auto-approve:
8
9
  runs-on: ubuntu-latest
9
10
  steps:
10
11
  - uses: hmarr/auto-approve-action@v3
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
+ 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, 'self-approve') || contains(github.event.pull_request.labels.*.name, 'dependencies')
12
13
  with:
13
14
  github-token: "${{ secrets.GITHUB_TOKEN }}"
@@ -1,22 +1,31 @@
1
1
  name: automerge
2
2
  on:
3
+ pull_request_target:
4
+ types:
5
+ - labeled
3
6
  pull_request_review:
4
7
  types:
5
8
  - submitted
6
9
  check_suite:
7
10
  types:
8
11
  - completed
9
- label:
10
- types:
11
- - created
12
12
  status: {}
13
13
  jobs:
14
14
  automerge:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
17
  - name: automerge
18
- uses: pascalgn/automerge-action@v0.16.2
18
+ uses: pascalgn/automerge-action@v0.16.4
19
+ env:
20
+ GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
21
+ MERGE_METHOD: squash
22
+ MERGE_DELETE_BRANCH: true
23
+ MERGE_LABELS: "automerge,!automerge blocked"
24
+ - name: automerge-dependencies
25
+ uses: pascalgn/automerge-action@v0.16.4
19
26
  env:
20
27
  GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
21
28
  MERGE_METHOD: squash
22
29
  MERGE_DELETE_BRANCH: true
30
+ MERGE_LABELS: "dependencies,!automerge blocked"
31
+ MERGE_REMOVE_LABELS: ""
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: [3.1, 3.2, 3.3]
14
+ ruby-version: [3.2, 3.3]
15
15
 
16
16
  steps:
17
17
  - uses: actions/checkout@v3
data/CHANGELOG.md CHANGED
@@ -1,7 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 3.3.1 - 2024-02-29
4
- - make ruby 3.1 a minimum version
3
+ ## 3.7.0 - 2024-11-08
4
+ - use json gem 2.8+ instead of oj
5
+
6
+ ## 3.6.0 - 2024-04-26
7
+ - drop ruby 3.1 support
8
+ - pass context.headers to the http reponse
9
+
10
+ ## 3.5.0 - 2024-02-29
11
+ - make ruby 3.1 as a minimum ruby version, add ruby 3.3 support
5
12
 
6
13
  ## 3.3.0 - 2023-11-23
7
14
 
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-graphql (3.5.0)
4
+ rack-graphql (3.7.0)
5
5
  graphql (~> 2.0)
6
- oj
6
+ json (>= 2.8.0)
7
7
  rack (>= 2.2.6)
8
8
 
9
9
  GEM
@@ -12,71 +12,60 @@ GEM
12
12
  ast (2.4.2)
13
13
  awesome_print (1.9.2)
14
14
  base64 (0.2.0)
15
- bigdecimal (3.1.6)
16
15
  coderay (1.1.3)
17
16
  diff-lcs (1.5.1)
18
- graphql (2.2.11)
17
+ fiber-storage (1.0.0)
18
+ graphql (2.4.2)
19
19
  base64
20
- json (2.7.1)
20
+ fiber-storage
21
+ json (2.8.1)
21
22
  language_server-protocol (3.17.0.3)
22
- method_source (1.0.0)
23
- oj (3.16.3)
24
- bigdecimal (>= 3.0)
25
- parallel (1.24.0)
26
- parser (3.3.0.5)
23
+ method_source (1.1.0)
24
+ parallel (1.26.3)
25
+ parser (3.3.6.0)
27
26
  ast (~> 2.4.1)
28
27
  racc
29
- prism (0.24.0)
30
28
  pry (0.14.2)
31
29
  coderay (~> 1.1)
32
30
  method_source (~> 1.0)
33
- racc (1.7.3)
34
- rack (3.0.9.1)
31
+ racc (1.8.1)
32
+ rack (3.1.8)
35
33
  rack-test (2.1.0)
36
34
  rack (>= 1.3)
37
35
  rainbow (3.1.1)
38
- rake (13.1.0)
39
- regexp_parser (2.9.0)
40
- rexml (3.2.6)
36
+ rake (13.2.1)
37
+ regexp_parser (2.9.2)
41
38
  rspec (3.13.0)
42
39
  rspec-core (~> 3.13.0)
43
40
  rspec-expectations (~> 3.13.0)
44
41
  rspec-mocks (~> 3.13.0)
45
- rspec-core (3.13.0)
42
+ rspec-core (3.13.2)
46
43
  rspec-support (~> 3.13.0)
47
- rspec-expectations (3.13.0)
44
+ rspec-expectations (3.13.3)
48
45
  diff-lcs (>= 1.2.0, < 2.0)
49
46
  rspec-support (~> 3.13.0)
50
- rspec-mocks (3.13.0)
47
+ rspec-mocks (3.13.2)
51
48
  diff-lcs (>= 1.2.0, < 2.0)
52
49
  rspec-support (~> 3.13.0)
53
50
  rspec-support (3.13.1)
54
- rubocop (1.61.0)
51
+ rubocop (1.68.0)
55
52
  json (~> 2.3)
56
53
  language_server-protocol (>= 3.17.0)
57
54
  parallel (~> 1.10)
58
55
  parser (>= 3.3.0.2)
59
56
  rainbow (>= 2.2.2, < 4.0)
60
- regexp_parser (>= 1.8, < 3.0)
61
- rexml (>= 3.2.5, < 4.0)
62
- rubocop-ast (>= 1.30.0, < 2.0)
57
+ regexp_parser (>= 2.4, < 3.0)
58
+ rubocop-ast (>= 1.32.2, < 2.0)
63
59
  ruby-progressbar (~> 1.7)
64
60
  unicode-display_width (>= 2.4.0, < 3.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)
71
- rubocop (~> 1.41)
61
+ rubocop-ast (1.34.1)
62
+ parser (>= 3.3.1.0)
72
63
  rubocop-rake (0.6.0)
73
64
  rubocop (~> 1.0)
74
- rubocop-rspec (2.26.1)
75
- rubocop (~> 1.40)
76
- rubocop-capybara (~> 2.17)
77
- rubocop-factory_bot (~> 2.22)
65
+ rubocop-rspec (3.2.0)
66
+ rubocop (~> 1.61)
78
67
  ruby-progressbar (1.13.0)
79
- unicode-display_width (2.5.0)
68
+ unicode-display_width (2.6.0)
80
69
 
81
70
  PLATFORMS
82
71
  aarch64-linux-musl
@@ -100,4 +89,4 @@ DEPENDENCIES
100
89
  rubocop-rspec
101
90
 
102
91
  BUNDLED WITH
103
- 2.5.6
92
+ 2.5.23
@@ -18,7 +18,7 @@ module RackGraphql
18
18
  end
19
19
 
20
20
  def body
21
- Oj.dump(
21
+ JSON.dump(
22
22
  'status' => 'ok',
23
23
  'request_ip' => request.ip,
24
24
  'app_name' => app_name,
@@ -55,7 +55,7 @@ module RackGraphql
55
55
  [
56
56
  400,
57
57
  { 'Content-Type' => 'application/json', STATUS_CODE_HEADER_NAME => 400 },
58
- [Oj.dump({})]
58
+ [JSON.dump({})]
59
59
  ]
60
60
  rescue StandardError, LoadError, SyntaxError => e
61
61
  # To respect the graphql spec, all errors need to be returned as json.
@@ -74,7 +74,7 @@ module RackGraphql
74
74
  [
75
75
  status_code,
76
76
  { 'Content-Type' => 'application/json', STATUS_CODE_HEADER_NAME => status_code },
77
- [Oj.dump('errors' => [exception_hash(e)])]
77
+ [JSON.dump('errors' => [exception_hash(e)])]
78
78
  ]
79
79
  ensure
80
80
  request_epilogue.call
@@ -94,8 +94,8 @@ module RackGraphql
94
94
  payload = env['rack.input'].read.to_s
95
95
  return nil if payload.index(NULL_BYTE)
96
96
 
97
- ::Oj.load(payload)
98
- rescue Oj::ParseError
97
+ ::JSON.parse(payload)
98
+ rescue JSON::ParserError
99
99
  nil
100
100
  end
101
101
 
@@ -106,8 +106,8 @@ module RackGraphql
106
106
  return {} if ambiguous_param.empty?
107
107
 
108
108
  begin
109
- ensure_hash(Oj.load(ambiguous_param))
110
- rescue Oj::ParseError
109
+ ensure_hash(JSON.parse(ambiguous_param))
110
+ rescue JSON::ParserError
111
111
  raise AmbiguousParamError, "Unexpected parameter: #{ambiguous_param}"
112
112
  end
113
113
  when Hash
@@ -149,13 +149,15 @@ module RackGraphql
149
149
  end
150
150
 
151
151
  def response_headers(result = nil, status_code: DEFAULT_STATUS_CODE)
152
- {
153
- 'Access-Control-Expose-Headers' => [SUBSCRIPTION_ID_HEADER_NAME, STATUS_CODE_HEADER_NAME].join(', '),
154
- 'Content-Type' => 'application/json',
155
- STATUS_CODE_HEADER_NAME => status_code,
156
- }.tap do |headers|
157
- headers[SUBSCRIPTION_ID_HEADER_NAME] = result.context[:subscription_id] if result_subscription?(result)
152
+ headers = { STATUS_CODE_HEADER_NAME => status_code }
153
+ headers[SUBSCRIPTION_ID_HEADER_NAME] = result.context[:subscription_id] if result_subscription?(result)
154
+ result_collection = result.is_a?(Array) ? result : [result]
155
+ result_collection.each do |part|
156
+ headers.merge!(part.context[:headers]) if part.context[:headers].is_a?(Hash)
158
157
  end
158
+ headers["Access-Control-Expose-Headers"] = [SUBSCRIPTION_ID_HEADER_NAME, STATUS_CODE_HEADER_NAME].join(", ")
159
+ headers["Content-Type"] = "application/json"
160
+ headers
159
161
  end
160
162
 
161
163
  def response_status(result)
@@ -176,7 +178,7 @@ module RackGraphql
176
178
  else
177
179
  body = result.to_h
178
180
  end
179
- Oj.dump(body)
181
+ JSON.dump(body)
180
182
  end
181
183
 
182
184
  def result_subscription?(result)
@@ -1,3 +1,3 @@
1
1
  module RackGraphql
2
- VERSION = '3.5.0'.freeze
2
+ VERSION = '3.7.0'.freeze
3
3
  end
data/lib/rack_graphql.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'oj'
1
+ require 'json'
2
2
  require 'rack'
3
3
  require 'graphql'
4
4
 
data/rack-graphql.gemspec CHANGED
@@ -24,9 +24,9 @@ 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 = Gem::Requirement.new('>= 3.1.0')
27
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.2.0')
28
28
 
29
29
  spec.add_dependency 'graphql', '~> 2.0'
30
- spec.add_dependency 'oj'
30
+ spec.add_dependency 'json', '>= 2.8.0'
31
31
  spec.add_dependency 'rack', '>= 2.2.6'
32
32
  end
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.5.0
4
+ version: 3.7.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: 2024-02-29 00:00:00.000000000 Z
11
+ date: 2024-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: oj
28
+ name: json
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 2.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 2.8.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rack
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -65,8 +65,8 @@ files:
65
65
  - ".github/ISSUE_TEMPLATE/config.yml"
66
66
  - ".github/ISSUE_TEMPLATE/story.md"
67
67
  - ".github/PULL_REQUEST_TEMPLATE.md"
68
+ - ".github/dependabot.yml"
68
69
  - ".github/workflows/auto-approve.yml"
69
- - ".github/workflows/auto-merge-dependencies.yml"
70
70
  - ".github/workflows/auto-merge.yml"
71
71
  - ".github/workflows/ci.yml"
72
72
  - ".gitignore"
@@ -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.1.0
104
+ version: 3.2.0
105
105
  required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - ">="
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.5.3
111
+ rubygems_version: 3.5.23
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Rack middleware implementing graphql endpoint.
@@ -1,24 +0,0 @@
1
- name: automerge-dependencies
2
- on:
3
- pull_request_review:
4
- types:
5
- - submitted
6
- check_suite:
7
- types:
8
- - completed
9
- label:
10
- types:
11
- - created
12
- status: {}
13
- jobs:
14
- automerge:
15
- runs-on: ubuntu-latest
16
- steps:
17
- - name: automerge-dependencies
18
- uses: pascalgn/automerge-action@v0.16.2
19
- env:
20
- GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
21
- MERGE_METHOD: squash
22
- MERGE_DELETE_BRANCH: true
23
- MERGE_LABELS: "dependencies,!automerge blocked"
24
- MERGE_REMOVE_LABELS: ""