graphqljs-rails 0.4.11 → 0.4.12

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
  SHA1:
3
- metadata.gz: eb83f094fc8bf3613fa4904c8adf849d5f5e24e1
4
- data.tar.gz: 6d74b0e737cd6de4758ff1c5320e6e50a68e1f3e
3
+ metadata.gz: 70be6602f293c1ee44e598ede804dc546a4775cc
4
+ data.tar.gz: 7c184e5f390a2f51ff1428a25f689917f77d9dae
5
5
  SHA512:
6
- metadata.gz: 223a9fb7b0852a969f5c6341d510413f5a65fa715ffbb408197141147ebabd25f12ea07c4407d545efed918b0c44e3ce2257769a2d3bce646a6be4871e03deef
7
- data.tar.gz: 9e9ce1d22ee658ebabb4d8e911c04a903cdc4075842280733b38f5e2e8c27ca616c22e2ecc4fb718e7423029355cc2cf86f5634119748463351ec57199eed499
6
+ metadata.gz: 555229c5622b832029a9ee9961f4a6d6ed3b1d4dddacabfabbee118f9180e318f88e56e9125b94c3f113c93303ecdc5bd27716265f80e56bcc4e2bcd65509b8f
7
+ data.tar.gz: 69d5fdd3113c3c9973c6ea66f8e59f83c9074e7d51a76277e063d5d80af7727b4449dcdba8792b1b77b345544eb625ff74c0d0df596cc7e2644b21bb25d6d371
@@ -167,6 +167,15 @@
167
167
  }
168
168
 
169
169
  GraphQLClient.prototype.processQuery = function (query, fragments) {
170
+ if (typeof query == 'object' && query.hasOwnProperty('kind') && query.hasOwnProperty('definitions')) {
171
+ // This looks like a graphql AST.
172
+ try {
173
+ var graphql = require('graphql')
174
+ query = graphql.print(query)
175
+ } catch (e) {
176
+ throw new Error("You tried to pass a graphql syntax tree but it cannot be compiled to string.")
177
+ }
178
+ }
170
179
  var fragmentRegexp = GraphQLClient.FRAGMENT_PATTERN
171
180
  var collectedFragments = this.collectFragments(query, fragments)
172
181
  query = query.replace(fragmentRegexp, function (_, $m) {
@@ -226,7 +235,7 @@
226
235
  }
227
236
 
228
237
  GraphQLClient.prototype.buildQuery = function (query, variables) {
229
- return this.autoDeclare(this.processQuery(query, this._fragments, variables), variables)
238
+ return this.autoDeclare(this.processQuery(query, this._fragments), variables)
230
239
  }
231
240
 
232
241
  GraphQLClient.prototype.createSenderFunction = function (url) {
@@ -1,5 +1,5 @@
1
1
  module GraphQLJS
2
2
  module Rails
3
- VERSION = "0.4.11"
3
+ VERSION = "0.4.12"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphqljs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fatih Kadir Akın
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-05 00:00:00.000000000 Z
11
+ date: 2017-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties