graphql-batch 0.3.3 → 0.3.4

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: b69567be96fe5b00779872cbb3a6d1e14b3d2a28
4
- data.tar.gz: cfc2323ef559f92884560f68713b3d9cd41a3017
3
+ metadata.gz: c839447dcaacc5db8e6e16d95a30c2fc2db4e899
4
+ data.tar.gz: ca03f0ee057d56cd2311ef51df54de199baa53ca
5
5
  SHA512:
6
- metadata.gz: 423111d4a94fde2835dcfea8cafa234047100d0dd2bc248362b988537ee1dc1c35c86e5924f8db3730d95b09fbb20a49c3dfa3d6e8858271d1ad060a8303e086
7
- data.tar.gz: d31cc1b4cddb5db6d1650e51632b26f113e5414c6d9dc44916785b7a5911c0c953e9b1fd476395fea8d9eca2ad502e08a55ead3c7bec994ebdd4059284635980
6
+ metadata.gz: e5b0461239a98c5aa53924f2c9a721bfe8d3fc7a59ae70d261255ecf3421b574fc44626d55c514b57b403368ca94c7e2714f37ca66cf324fbdc3ca69735ea8fc
7
+ data.tar.gz: abcf9f692f944ac758fa21d6bcd9929a1ceaa9edf8adb6c9c14e019c4c032445dc532cd564fca0010471b02f32903bbdcb13df4a8bae0adde74958bad11387a3
data/lib/graphql/batch.rb CHANGED
@@ -20,7 +20,11 @@ module GraphQL
20
20
  end
21
21
 
22
22
  def self.use(schema_defn)
23
- schema_defn.instrument(:query, GraphQL::Batch::Setup)
23
+ if GraphQL::VERSION >= "1.6.0"
24
+ schema_defn.instrument(:multiplex, GraphQL::Batch::SetupMultiplex)
25
+ else
26
+ schema_defn.instrument(:query, GraphQL::Batch::Setup)
27
+ end
24
28
  schema_defn.lazy_resolve(::Promise, :sync)
25
29
  end
26
30
 
@@ -34,3 +38,4 @@ require_relative "batch/loader"
34
38
  require_relative "batch/executor"
35
39
  require_relative "batch/promise"
36
40
  require_relative "batch/setup"
41
+ require_relative "batch/setup_multiplex"
@@ -58,6 +58,7 @@ module GraphQL::Batch
58
58
  # For Promise#sync
59
59
  def wait #:nodoc:
60
60
  if executor
61
+ executor.loaders.delete(loader_key)
61
62
  executor.resolve(self)
62
63
  else
63
64
  resolve
@@ -0,0 +1,14 @@
1
+ module GraphQL::Batch
2
+ module SetupMultiplex
3
+ extend self
4
+
5
+ def before_multiplex(multiplex)
6
+ raise NestedError if GraphQL::Batch::Executor.current
7
+ GraphQL::Batch::Executor.current = GraphQL::Batch::Executor.new
8
+ end
9
+
10
+ def after_multiplex(multiplex)
11
+ GraphQL::Batch::Executor.current = nil
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Batch
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Thacker-Smith
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-31 00:00:00.000000000 Z
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -124,6 +124,7 @@ files:
124
124
  - lib/graphql/batch/mutation_execution_strategy.rb
125
125
  - lib/graphql/batch/promise.rb
126
126
  - lib/graphql/batch/setup.rb
127
+ - lib/graphql/batch/setup_multiplex.rb
127
128
  - lib/graphql/batch/version.rb
128
129
  homepage: https://github.com/Shopify/graphql-batch
129
130
  licenses: