graphql-remote_loader 1.0.2 → 1.0.3

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: bbd2e637ecc93810900d66de559f52ed874b5b08
4
- data.tar.gz: 0fd8533f7f4514e6e18216311298eec7485bce18
3
+ metadata.gz: '08255df0d13cc9804c77ad8573250fcf28a324ba'
4
+ data.tar.gz: b16f301f8bb77f5813ef6b96093d61cc583e9664
5
5
  SHA512:
6
- metadata.gz: 8cd9ba1245a71ba2643c9e65b7b0fd461e830f911a4d69e29a214eb0412d459638d9571514e4a683cc01c25919220d23b5ae326e975a55d2127e1367a4553835
7
- data.tar.gz: a20d45c2bac56cf499bc88bcb2e94f66db84c924ae136a94cf81747d95bbeb196798f891f7aedf8d04c0c5ab4c86c0b6ab4d9b8f0af452bae35d0ce2feafa0c5
6
+ metadata.gz: 95baeb95ffc196efa52c8b47cadc8d0f81740719b4d51423ed9fc0ebf1d5afc4149309e01d3e66667baf854634116df6a19c24a626d781e3930cb15d032d7fce
7
+ data.tar.gz: 161a3463f3b6337bf4ff437d60ef7ed8c022f0701c912351cd8c7f36fc653ec87bb2fc193bb631c198339e7a1759125af89056cd42c0e4329cbb3bf3648896df
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql-remote_loader (1.0.1)
4
+ graphql-remote_loader (1.0.2)
5
5
  graphql (~> 1.6)
6
6
  graphql-batch (~> 0.3)
7
7
 
@@ -34,6 +34,22 @@ module GraphQL
34
34
  end
35
35
  end
36
36
 
37
+ # Shorthand helper method for #load calls selecting fields off of a `Node` type
38
+ # E.g. `load_on_relay_node("nodeid", "Type", "friends(first: 5) { totalCount }")`
39
+ # is identical to
40
+ # load("node(id: "nodeid") { ... on Type { friends(first: 5) { totalCount } } }")
41
+ def self.load_on_relay_node(node_id, type, selections, context: {})
42
+ query = <<-GRAPHQL
43
+ node(id: \"#{node_id}\") {
44
+ ... on #{type} {
45
+ #{selections}
46
+ }
47
+ }
48
+ GRAPHQL
49
+
50
+ load(query, context: context)
51
+ end
52
+
37
53
  def self.reset_index
38
54
  @index = nil
39
55
  end
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module RemoteLoader
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-remote_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathaniel Woodthorpe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-12 00:00:00.000000000 Z
11
+ date: 2018-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql