rack-graphql 0.5.2 → 0.6.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 +4 -4
- data/Gemfile.lock +2 -2
- data/lib/rack_graphql/middleware.rb +13 -1
- data/lib/rack_graphql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eb088c288a3e2fda3f114d31b769a48869e2acb81822ca68b916a46e7702d6f6
|
|
4
|
+
data.tar.gz: 4e24c3b8d96246abe38b41ac773dac0ca5f2a29e4fb01edb65f87364056f47ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8f2ae69e4e062ecc073c26e6602c146d0a2ecc1421a4a13efc2cbd2704f29faede0c19437a4a8caf43b7f442accc2deb29823c2ca5c53e7ce8f70f53ed06954e
|
|
7
|
+
data.tar.gz: 99f0ca2ba3a3c441475902ac41c02ff5a822e3355d0d7386b535277a5d44f7882f9979b7fb18f8adaaa57fced2c958db60110945375d0b05b80a72ffd5b2b3e4
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rack-graphql (0.
|
|
4
|
+
rack-graphql (0.6.0)
|
|
5
5
|
graphql (>= 1.9.0)
|
|
6
6
|
multi_json
|
|
7
7
|
rack (>= 2.0.0)
|
|
@@ -12,7 +12,7 @@ GEM
|
|
|
12
12
|
ast (2.4.0)
|
|
13
13
|
coderay (1.1.2)
|
|
14
14
|
diff-lcs (1.3)
|
|
15
|
-
graphql (1.9.
|
|
15
|
+
graphql (1.9.8)
|
|
16
16
|
jaro_winkler (1.5.3)
|
|
17
17
|
method_source (0.9.2)
|
|
18
18
|
multi_json (1.13.1)
|
|
@@ -15,7 +15,7 @@ module RackGraphql
|
|
|
15
15
|
|
|
16
16
|
result = execute(params: params, operation_name: operation_name, variables: variables, context: context)
|
|
17
17
|
|
|
18
|
-
[200, response_headers(result), [
|
|
18
|
+
[200, response_headers(result), [response_body(result)]]
|
|
19
19
|
rescue ArgumentError
|
|
20
20
|
[400, { 'Content-Type' => 'application/json' }, [MultiJson.dump({})]]
|
|
21
21
|
ensure
|
|
@@ -94,6 +94,18 @@ module RackGraphql
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
+
def response_body(result = nil)
|
|
98
|
+
if result_subscription?(result)
|
|
99
|
+
body = result.to_h
|
|
100
|
+
body["data"] ||= {}
|
|
101
|
+
body["data"][result.query.operation_name] ||= nil
|
|
102
|
+
body["data"]["subscriptionId"] = result.context[:subscription_id]
|
|
103
|
+
else
|
|
104
|
+
body = result
|
|
105
|
+
end
|
|
106
|
+
MultiJson.dump(body)
|
|
107
|
+
end
|
|
108
|
+
|
|
97
109
|
def result_subscription?(result)
|
|
98
110
|
return false unless result.is_a?(GraphQL::Query::Result)
|
|
99
111
|
|
data/lib/rack_graphql/version.rb
CHANGED
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.6.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-07-
|
|
12
|
+
date: 2019-07-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: graphql
|