graphql-smart_select 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ca57cd0d224feeea180728e03b39548353d7ce6b325c73b71c074d51c4d9832
4
- data.tar.gz: 556d21cf7668437c3610cfe3c8da774612c559a4de3308773c8ee483082fd863
3
+ metadata.gz: 4b35591fcb5f47c110caf75ba05727f483898bb8e27bfe642715a5df4d8883b5
4
+ data.tar.gz: 2876debd30fa7d6cf0f2e106053e1505ed22a4532f4fe5cc5f9f338b0d132110
5
5
  SHA512:
6
- metadata.gz: 8e4a31c7aa8ee42ff911ad401f1823c4ce3c29db929706cf53eaf6755e980b8a5496d1a8c21894928ce26befe27acb89a453cf4f81759117191e3f743c32929e
7
- data.tar.gz: 6eed5d0b7fa5531105280d575a3830d963e7c0bdc7429bf9d6d864b08f33b97e770be3aacf3c2f6c3c7746a433d45243b82c492b0a75c83231a227d65ee535c6
6
+ metadata.gz: 97d7e64a5987e4b3b681b09896489beb2082a3fb882465b0518d16bd9b64193c1d7325451c9922223dd229360f996b52fed40d5dad4492bf0aa1e34b52c8c0d2
7
+ data.tar.gz: 9f3e80cc80bf2509fe743c53f8b92dabf436719fa059c9c7f46489bd8062fec06a5e760c0fdb5114ba81158768ff3e31dece6408d142f5c8bf1231e83ae46d37
@@ -0,0 +1,7 @@
1
+ # Change log
2
+
3
+ ## master
4
+
5
+ ## 0.1.3 (2018-11-08)
6
+
7
+ - Support Relay Connections feature from GraphQL
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/Arkweid/graphql-smart_select.svg?branch=master)](https://travis-ci.org/Arkweid/graphql-smart_select)
1
+ [![Cult Of Martians](http://cultofmartians.com/assets/badges/badge.svg)](http://cultofmartians.com) [![Gem Version](https://badge.fury.io/rb/graphql-smart_select.svg)](https://badge.fury.io/rb/graphql-smart_select) [![Build Status](https://travis-ci.org/Arkweid/graphql-smart_select.svg?branch=master)](https://travis-ci.org/Arkweid/graphql-smart_select)
2
2
 
3
3
  # GraphQL::SmartSelect
4
4
 
@@ -103,6 +103,21 @@ query {
103
103
  It perform following request:
104
104
  ```SELECT id, title, raw_content, another_content, user_id FROM posts```
105
105
 
106
+ ## Notes
107
+
108
+ [Custom Resolvers](http://graphql-ruby.org/fields/resolvers.html) feature not supported.
109
+
110
+ Tested for activerecord version >= 4.2
111
+
112
+ ## Development
113
+ For regression testing, run the following
114
+ ```shell
115
+ # install Appraisals dependencies
116
+ bundle exec appraisal install
117
+ # run test suit through all dependencies listed in Appraisals file
118
+ bundle exec appraisal rake spec
119
+ ```
120
+
106
121
  ## License
107
122
 
108
123
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GraphQL
4
+ module SmartSelect
5
+ #
6
+ # Check field for Connections type
7
+ # Dig through edges -> nodes to db fields
8
+ #
9
+ module ConnectionsProxy
10
+ module_function
11
+
12
+ def call(ctx)
13
+ return yield unless ctx.field.connection?
14
+
15
+ digging('node') do
16
+ digging('edges') do
17
+ yield
18
+ end
19
+ end
20
+ end
21
+
22
+ def digging(node_name)
23
+ yield[node_name].scoped_children.values.first
24
+ end
25
+ end
26
+ end
27
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'graphql/smart_select/assosiations'
4
4
  require 'graphql/smart_select/options'
5
+ require 'graphql/smart_select/connections_proxy'
5
6
 
6
7
  module GraphQL
7
8
  module SmartSelect
@@ -28,7 +29,9 @@ module GraphQL
28
29
  private
29
30
 
30
31
  def list_of_nodes
31
- @list_of_nodes ||= ctx.irep_node.typed_children[ctx.type.unwrap]
32
+ @list_of_nodes ||= ConnectionsProxy.call(ctx) do
33
+ ctx.irep_node.typed_children[ctx.type.unwrap]
34
+ end
32
35
  end
33
36
 
34
37
  def query_fields
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  module SmartSelect
5
- VERSION = '0.1.2'
5
+ VERSION = '0.1.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-smart_select
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Abroskin
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5.2'
33
+ version: '4.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '5.2'
40
+ version: '4.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,21 @@ dependencies:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: 1.3.13
117
- description: Provide logic for select only required fields for query
117
+ - !ruby/object:Gem::Dependency
118
+ name: appraisal
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '2.2'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '2.2'
131
+ description: Provide logic for select only required fields from query
118
132
  email:
119
133
  - a.a.abroskin@yandex.ru
120
134
  executables: []
@@ -126,6 +140,7 @@ files:
126
140
  - README.md
127
141
  - lib/graphql/smart_select.rb
128
142
  - lib/graphql/smart_select/assosiations.rb
143
+ - lib/graphql/smart_select/connections_proxy.rb
129
144
  - lib/graphql/smart_select/options.rb
130
145
  - lib/graphql/smart_select/resolver.rb
131
146
  - lib/graphql/smart_select/version.rb