graphql-pagination 1.1.0 → 1.1.1

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: 2ea955b90a7643f1fbbe2ec88c466e1417b7f9f9d0aecae8c86e3072ea787b26
4
- data.tar.gz: 005f943ce8ca3788992052752f1a5e616f0a502640054e46d6f051347048b6c1
3
+ metadata.gz: bb3c73bf0fa8d3efbadf8e202e640aa3b143902e04ced09ccfe03234de48ea03
4
+ data.tar.gz: 3026f512e09729cbecb7b17ff64237573d5b544c56cf7f67b13eb780b5ce5cf6
5
5
  SHA512:
6
- metadata.gz: 6aaa55de384cc91b9e31069e5c3bc2e9970081ba6c04fd95df5dad2ebe391a72d7f050bbb518ebab3b9525a2260eeb931805759d73bb1c705e7c4e6a1043c74f
7
- data.tar.gz: 5904d27c1e2c34aec87cecee6770c0187508f25851e8f0f4e2c1ad87c22593427d54d9a76bd5c425a1f088d8430ec332ad630a6724b6b17e9c02070b3e62cbec
6
+ metadata.gz: f542a291f10be3bf5d00b243e5f5bbfa3bc2660d5eb2acca4946d06a2e5b5e8a6de36130ed9fd217a6bf41428e34fe40ed740a5bb84ab002353bc16c14b8844c
7
+ data.tar.gz: 765f0bbf03c61c8f1518795474f57f21176799675598cabc51a7705c184257423a7ffb96c22f0cb941b09acb6757ed5e24bb4b775189f6f20d5efc4c491ed4e7
@@ -4,6 +4,7 @@ language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
6
  - 2.6
7
+ - 2.7
7
8
  before_install: gem install bundler
8
9
  script:
9
10
  - bundle exec rake spec
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql-pagination (1.1.0)
4
+ graphql-pagination (1.1.1)
5
5
  graphql (~> 1.9)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (6.0.2.1)
11
- activesupport (= 6.0.2.1)
12
- activerecord (6.0.2.1)
13
- activemodel (= 6.0.2.1)
14
- activesupport (= 6.0.2.1)
15
- activesupport (6.0.2.1)
10
+ activemodel (6.0.2.2)
11
+ activesupport (= 6.0.2.2)
12
+ activerecord (6.0.2.2)
13
+ activemodel (= 6.0.2.2)
14
+ activesupport (= 6.0.2.2)
15
+ activesupport (6.0.2.2)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 0.7, < 2)
18
18
  minitest (~> 5.1)
@@ -22,7 +22,7 @@ GEM
22
22
  coderay (1.1.2)
23
23
  concurrent-ruby (1.1.6)
24
24
  diff-lcs (1.3)
25
- graphql (1.10.3)
25
+ graphql (1.10.5)
26
26
  i18n (1.8.2)
27
27
  concurrent-ruby (~> 1.0)
28
28
  jaro_winkler (1.5.4)
@@ -30,14 +30,14 @@ GEM
30
30
  activerecord
31
31
  kaminari-core (= 1.2.0)
32
32
  kaminari-core (1.2.0)
33
- method_source (0.9.2)
33
+ method_source (1.0.0)
34
34
  minitest (5.14.0)
35
35
  parallel (1.19.1)
36
- parser (2.7.0.3)
36
+ parser (2.7.0.5)
37
37
  ast (~> 2.4.0)
38
- pry (0.12.2)
39
- coderay (~> 1.1.0)
40
- method_source (~> 0.9.0)
38
+ pry (0.13.0)
39
+ coderay (~> 1.1)
40
+ method_source (~> 1.0)
41
41
  rainbow (3.0.0)
42
42
  rake (13.0.1)
43
43
  rexml (3.2.4)
@@ -47,31 +47,31 @@ GEM
47
47
  rspec-mocks (~> 3.9.0)
48
48
  rspec-core (3.9.1)
49
49
  rspec-support (~> 3.9.1)
50
- rspec-expectations (3.9.0)
50
+ rspec-expectations (3.9.1)
51
51
  diff-lcs (>= 1.2.0, < 2.0)
52
52
  rspec-support (~> 3.9.0)
53
53
  rspec-mocks (3.9.1)
54
54
  diff-lcs (>= 1.2.0, < 2.0)
55
55
  rspec-support (~> 3.9.0)
56
56
  rspec-support (3.9.2)
57
- rubocop (0.80.0)
57
+ rubocop (0.81.0)
58
58
  jaro_winkler (~> 1.5.1)
59
59
  parallel (~> 1.10)
60
60
  parser (>= 2.7.0.1)
61
61
  rainbow (>= 2.2.2, < 4.0)
62
62
  rexml
63
63
  ruby-progressbar (~> 1.7)
64
- unicode-display_width (>= 1.4.0, < 1.7)
64
+ unicode-display_width (>= 1.4.0, < 2.0)
65
65
  rubocop-performance (1.5.2)
66
66
  rubocop (>= 0.71.0)
67
67
  rubocop-rspec (1.38.1)
68
68
  rubocop (>= 0.68.1)
69
69
  ruby-progressbar (1.10.1)
70
70
  thread_safe (0.3.6)
71
- tzinfo (1.2.6)
71
+ tzinfo (1.2.7)
72
72
  thread_safe (~> 0.1)
73
- unicode-display_width (1.6.1)
74
- zeitwerk (2.2.2)
73
+ unicode-display_width (1.7.0)
74
+ zeitwerk (2.3.0)
75
75
 
76
76
  PLATFORMS
77
77
  ruby
@@ -88,4 +88,4 @@ DEPENDENCIES
88
88
  rubocop-rspec
89
89
 
90
90
  BUNDLED WITH
91
- 2.0.2
91
+ 2.1.4
data/README.md CHANGED
@@ -29,10 +29,9 @@ Add `graphql-pagination` to your Gemfile, you can use `kaminari-activerecord` or
29
29
 
30
30
  Value returned by query resolver must be a kaminari object or implements its page scope methods (`current_page`, `limit_value`, `total_count`, `total_pages`).
31
31
 
32
-
33
32
  ## GraphQL query
34
33
 
35
- ```
34
+ ```graphql
36
35
  {
37
36
  fruits(page: 2, limit: 2) {
38
37
  collection {
@@ -49,31 +48,54 @@ Value returned by query resolver must be a kaminari object or implements its pag
49
48
  }
50
49
  ```
51
50
 
52
- ```
51
+ ```json
53
52
  {
54
- 'data': {
55
- 'checklists': {
56
- 'collection': [
53
+ "data": {
54
+ "checklists": {
55
+ "collection": [
57
56
  {
58
- 'id': '93938bb3-7a6c-4d35-9961-cbb2d4c9e9ac',
59
- 'name': 'Apple'
57
+ "id": "93938bb3-7a6c-4d35-9961-cbb2d4c9e9ac",
58
+ "name": "Apple"
60
59
  },
61
60
  {
62
- 'id': 'b1ee93b2-579a-4107-8454-119bba5afb63',
63
- 'name': 'Mango'
61
+ "id": "b1ee93b2-579a-4107-8454-119bba5afb63",
62
+ "name": "Mango"
64
63
  }
65
64
  ],
66
- 'metadata': {
67
- 'totalPages': 25,
68
- 'totalCount': 50,
69
- 'currentPage': 2,
70
- 'limitValue': 2
65
+ "metadata": {
66
+ "totalPages": 25,
67
+ "totalCount": 50,
68
+ "currentPage": 2,
69
+ "limitValue": 2
71
70
  }
72
71
  }
73
72
  }
74
73
  }
75
74
  ```
76
75
 
76
+ ## Custom Metadata
77
+
78
+ By default, the following fields are present in the metadata block:
79
+
80
+ ```graphql
81
+ metadata {
82
+ totalPages
83
+ totalCount
84
+ currentPage
85
+ limitValue
86
+ }
87
+ ```
88
+
89
+ These fields correspond to the `GraphqlPagination::CollectionMetadataType` used to provide the pagination information for the collection of data delivered. If you want to add more metadata fields to this block, you can do so by extending this `CollectionMetadataType`:
90
+
91
+ ```ruby
92
+ class MyMetadataType < GraphqlPagination::CollectionMetadataType
93
+ field :custom_field, String, null: false
94
+ end
95
+
96
+ field :fruits, Types::FruitType.collection_type(metadata_type: MyMetadataType)
97
+ ```
98
+
77
99
  ## Contributing
78
100
 
79
101
  Bug reports and pull requests are welcome on GitHub at https://github.com/renofi/graphql-pagination. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -81,4 +103,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/renofi
81
103
  ## License
82
104
 
83
105
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
84
-
@@ -1,3 +1,3 @@
1
1
  module GraphqlPagination
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-02-28 00:00:00.000000000 Z
12
+ date: 2020-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphql
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  - !ruby/object:Gem::Version
183
183
  version: '0'
184
184
  requirements: []
185
- rubygems_version: 3.0.6
185
+ rubygems_version: 3.1.2
186
186
  signing_key:
187
187
  specification_version: 4
188
188
  summary: Page-based kaminari pagination for graphql.