graphql-batch 0.3.9 → 0.3.10

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: b611b5510ff666b9ed400c9066839af2a64d8695
4
- data.tar.gz: 15aca5ee2baeffd739b1a23192e33d0c50aa31bc
3
+ metadata.gz: c793255ae48cf638179b9e786d03493a469d1629
4
+ data.tar.gz: d235b788e4f9208747d7145e7d2599c2279319d1
5
5
  SHA512:
6
- metadata.gz: bc8fa00ef926af4abbba3c22ebdc8c0a1c91d0ffb3ba2172efaa5ab5628d6fa80245710365128bf0e701340d266d94c9c00d8fa291aa455df8790cc913b14b4a
7
- data.tar.gz: 697e6c1f7b077a8b7803ba0aab1decfb4e77f699dc96d7d4cb41424faf5d695b5289198831b1b62f5b752c0ce8636aa9482529cbfcae1c898e036527ffbeaa40
6
+ metadata.gz: 7b263790b1871d54d9258e7bd2541c17361b8177a79e07aac146f9d3ccf05570cf07f8aaac40cf4dbe76c3b6f1677f3cd957a32904742c069a133d3906044767
7
+ data.tar.gz: d00d449a8872286251cc21d555b54be0690002f697dddb8afc1f43e6b90d75e42367ad70f54c701fc75d89b04427b4d127879481c406a24555d3ada35ce0582f
data/README.md CHANGED
@@ -72,6 +72,12 @@ The loader class can be used from the resolve proc for a graphql field by callin
72
72
  resolve -> (obj, args, context) { RecordLoader.for(Product).load(args["id"]) }
73
73
  ```
74
74
 
75
+ The loader also supports batch loading an array of records instead of just a single record, via `load_many`. For example:
76
+
77
+ ```ruby
78
+ resolve -> (obj, args, context) { RecordLoader.for(Product).load_many(args["ids"]) }
79
+ ```
80
+
75
81
  Although this library doesn't have a dependency on active record,
76
82
  the [examples directory](examples) has record and association loaders
77
83
  for active record which handles edge cases like type casting ids
@@ -119,13 +119,16 @@ module GraphQL::Batch
119
119
 
120
120
  def reject_pending_promises(load_keys, err)
121
121
  load_keys.each do |key|
122
- # promise.rb ignores reject if promise isn't pending
122
+ next unless promise_for(key).pending?
123
+
123
124
  reject(key, err)
124
125
  end
125
126
  end
126
127
 
127
128
  def check_for_broken_promises(load_keys)
128
129
  load_keys.each do |key|
130
+ next unless promise_for(key).pending?
131
+
129
132
  reject(key, ::Promise::BrokenError.new("#{self.class} didn't fulfill promise for key #{key.inspect}"))
130
133
  end
131
134
  end
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Batch
3
- VERSION = "0.3.9"
3
+ VERSION = "0.3.10"
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.9
4
+ version: 0.3.10
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: 2018-01-09 00:00:00.000000000 Z
11
+ date: 2018-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql