rack-graphql 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/bin/release +7 -0
- data/lib/rack_graphql/application.rb +0 -1
- data/lib/rack_graphql/health_response_builder.rb +1 -1
- data/lib/rack_graphql/middleware.rb +9 -7
- data/lib/rack_graphql/version.rb +1 -1
- data/lib/rack_graphql.rb +2 -1
- data/rack-graphql.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2c44329e54404c5d84af3d21bb11ef103aa2dd6f42548e7ecd41d4306fa2d67
|
4
|
+
data.tar.gz: 0c4f66ac577a3f3de3330a7a1d044814778c541d95e811496f7e49a4fa11db61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b3865eae32648b095fb43dbac0b8614af46d77585510a8c2a37aa5b5bb373ca3bd5d63fbcb7b98f2446b15b3e41e6352d3acb53f2f9465314089f9863e5be18
|
7
|
+
data.tar.gz: 512e9b7f447ecfe684bf0eebea86e1f47e1ff5d72e612082b887a147ec48886c0739f7ba6f4430d564f8c753372036ba979a310fef0c26c3efabac6eca0eb60a
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rack-graphql (0.
|
4
|
+
rack-graphql (0.8.0)
|
5
5
|
graphql (>= 1.9.0)
|
6
|
-
|
6
|
+
oj
|
7
7
|
rack (>= 2.0.0)
|
8
8
|
|
9
9
|
GEM
|
@@ -12,10 +12,10 @@ GEM
|
|
12
12
|
ast (2.4.0)
|
13
13
|
coderay (1.1.2)
|
14
14
|
diff-lcs (1.3)
|
15
|
-
graphql (1.9.
|
16
|
-
jaro_winkler (1.5.
|
15
|
+
graphql (1.9.15)
|
16
|
+
jaro_winkler (1.5.4)
|
17
17
|
method_source (0.9.2)
|
18
|
-
|
18
|
+
oj (3.9.2)
|
19
19
|
parallel (1.18.0)
|
20
20
|
parser (2.6.5.0)
|
21
21
|
ast (~> 2.4.0)
|
@@ -40,7 +40,7 @@ GEM
|
|
40
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
41
|
rspec-support (~> 3.9.0)
|
42
42
|
rspec-support (3.9.0)
|
43
|
-
rubocop (0.
|
43
|
+
rubocop (0.76.0)
|
44
44
|
jaro_winkler (~> 1.5.1)
|
45
45
|
parallel (~> 1.10)
|
46
46
|
parser (>= 2.6)
|
data/bin/release
ADDED
@@ -20,7 +20,7 @@ module RackGraphql
|
|
20
20
|
|
21
21
|
[200, response_headers(result), [response_body(result)]]
|
22
22
|
rescue ArgumentError
|
23
|
-
[400, { 'Content-Type' => 'application/json' }, [
|
23
|
+
[400, { 'Content-Type' => 'application/json' }, [Oj.dump({})]]
|
24
24
|
ensure
|
25
25
|
ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord::Base)
|
26
26
|
end
|
@@ -34,8 +34,8 @@ module RackGraphql
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def post_data(env)
|
37
|
-
::
|
38
|
-
rescue
|
37
|
+
::Oj.load(env['rack.input'].gets)
|
38
|
+
rescue Oj::ParseError
|
39
39
|
nil
|
40
40
|
end
|
41
41
|
|
@@ -46,8 +46,8 @@ module RackGraphql
|
|
46
46
|
return {} if ambiguous_param.empty?
|
47
47
|
|
48
48
|
begin
|
49
|
-
ensure_hash(
|
50
|
-
rescue
|
49
|
+
ensure_hash(Oj.load(ambiguous_param))
|
50
|
+
rescue Oj::ParseError
|
51
51
|
raise ArgumentError, "Unexpected parameter: #{ambiguous_param}"
|
52
52
|
end
|
53
53
|
when Hash
|
@@ -103,10 +103,12 @@ module RackGraphql
|
|
103
103
|
body["data"] ||= {}
|
104
104
|
body["data"][result.query.operation_name] ||= nil
|
105
105
|
body["data"]["subscriptionId"] = result.context[:subscription_id]
|
106
|
+
elsif result.is_a?(Array)
|
107
|
+
body = result.map(&:to_h)
|
106
108
|
else
|
107
|
-
body = result
|
109
|
+
body = result.to_h
|
108
110
|
end
|
109
|
-
|
111
|
+
Oj.dump(body)
|
110
112
|
end
|
111
113
|
|
112
114
|
def result_subscription?(result)
|
data/lib/rack_graphql/version.rb
CHANGED
data/lib/rack_graphql.rb
CHANGED
data/rack-graphql.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.required_ruby_version = '>= 2.5'
|
26
26
|
|
27
27
|
spec.add_dependency 'graphql', '>= 1.9.0'
|
28
|
-
spec.add_dependency '
|
28
|
+
spec.add_dependency 'oj'
|
29
29
|
spec.add_dependency 'rack', '>= 2.0.0'
|
30
30
|
|
31
31
|
spec.add_development_dependency 'bundler'
|
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: 0.
|
4
|
+
version: 0.8.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: 2019-
|
12
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: graphql
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 1.9.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: oj
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- README.md
|
172
172
|
- Rakefile
|
173
173
|
- bin/console
|
174
|
+
- bin/release
|
174
175
|
- bin/setup
|
175
176
|
- lib/rack-graphql.rb
|
176
177
|
- lib/rack_graphql.rb
|