graphql-relay 0.4.1 → 0.4.2

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: 921751eabb371fef7f064ff0bbefccf2cd77569b
4
- data.tar.gz: 19273e08230559f7d181ade786556b831925bc2f
3
+ metadata.gz: b27b8ff701421ecd919a8cb16dfe819e42925769
4
+ data.tar.gz: c87a89aa53e9940ca8c5cf6a822aa3f73f8fec8b
5
5
  SHA512:
6
- metadata.gz: 0871b958af3b912827669e9dbf1d4e2952edb035bcc676104223797c7116480bc1ad63205d72ef51b90429b5ee6e7bc1f1efb08546a4ea6f09c7e276c7d0fa11
7
- data.tar.gz: 2f0b46a36b0843e662f164d7de45b36c51a9a938f0d81e45fa5d786b9c327b92e1ebad019339a8aa24b19e8c6078b5f7096382b674c33f2e289726e628594c53
6
+ metadata.gz: badde6bd6ab29ab7ce5ae3366163491a888e40105cfbf414bbe5c54583d8441a1103d5a8a0fb195df663b410befd9f469362cb9ba5d2dfb3991363b21abd904f
7
+ data.tar.gz: 9d8a4799e0a570a3be0bc58aa026c9a7e87531cd7caf17705e845f0147c97d11b2e5a10bdca0ece40cfc7994435f1d7f4f162574a31113370950a53753493dd2
@@ -24,17 +24,17 @@ module GraphQL
24
24
  underlying_field.arguments = underlying_field.arguments.merge(DEFAULT_ARGUMENTS)
25
25
  # TODO: make a public API on GraphQL::Field to expose this proc
26
26
  original_resolve = underlying_field.instance_variable_get(:@resolve_proc)
27
- underlying_field.resolve = get_connection_resolve(original_resolve)
27
+ underlying_field.resolve = get_connection_resolve(underlying_field.name, original_resolve)
28
28
  underlying_field
29
29
  end
30
30
 
31
31
  private
32
32
 
33
- def self.get_connection_resolve(underlying_resolve)
33
+ def self.get_connection_resolve(field_name, underlying_resolve)
34
34
  -> (obj, args, ctx) {
35
35
  items = underlying_resolve.call(obj, args, ctx)
36
36
  if items == GraphQL::Query::DEFAULT_RESOLVE
37
- items = obj.public_send(name)
37
+ items = obj.public_send(field_name)
38
38
  end
39
39
  connection_class = GraphQL::Relay::BaseConnection.connection_for_items(items)
40
40
  connection_class.new(items, args)
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Relay
3
- VERSION = '0.4.1'
3
+ VERSION = '0.4.2'
4
4
  end
5
5
  end
@@ -122,7 +122,7 @@ describe GraphQL::Relay::RelationConnection do
122
122
  let(:query_string) {%|
123
123
  {
124
124
  empire {
125
- noArgsBases {
125
+ basesClone {
126
126
  edges {
127
127
  node {
128
128
  name
@@ -133,7 +133,7 @@ describe GraphQL::Relay::RelationConnection do
133
133
  }|}
134
134
  it "uses default resolve" do
135
135
  result = query(query_string)
136
- bases = result["data"]["empire"]["noArgsBases"]["edges"]
136
+ bases = result["data"]["empire"]["basesClone"]["edges"]
137
137
  assert_equal(3, bases.length)
138
138
  end
139
139
  end
@@ -37,7 +37,8 @@ rebels = OpenStruct.new({
37
37
  id: '1',
38
38
  name: 'Alliance to Restore the Republic',
39
39
  ships: ['1', '2', '3', '4', '5'],
40
- bases: Base.where(faction_id: 1)
40
+ bases: Base.where(faction_id: 1),
41
+ basesClone: Base.where(faction_id: 1),
41
42
  })
42
43
 
43
44
 
@@ -45,7 +46,8 @@ empire = OpenStruct.new({
45
46
  id: '2',
46
47
  name: 'Galactic Empire',
47
48
  ships: ['6', '7', '8'],
48
- bases: Base.where(faction_id: 2)
49
+ bases: Base.where(faction_id: 2),
50
+ basesClone: Base.where(faction_id: 2),
49
51
  })
50
52
 
51
53
  STAR_WARS_DATA = {
@@ -74,7 +74,7 @@ Faction = GraphQL::ObjectType.define do
74
74
  argument :nameIncludes, types.String
75
75
  end
76
76
 
77
- connection :noArgsBases, BaseConnection, property: :bases
77
+ connection :basesClone, BaseConnection
78
78
  end
79
79
 
80
80
  # Define a mutation. It will also:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-relay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo