graphql-pagination 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Gemfile.lock +20 -20
- data/README.md +37 -16
- data/lib/graphql_pagination/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb3c73bf0fa8d3efbadf8e202e640aa3b143902e04ced09ccfe03234de48ea03
|
4
|
+
data.tar.gz: 3026f512e09729cbecb7b17ff64237573d5b544c56cf7f67b13eb780b5ce5cf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f542a291f10be3bf5d00b243e5f5bbfa3bc2660d5eb2acca4946d06a2e5b5e8a6de36130ed9fd217a6bf41428e34fe40ed740a5bb84ab002353bc16c14b8844c
|
7
|
+
data.tar.gz: 765f0bbf03c61c8f1518795474f57f21176799675598cabc51a7705c184257423a7ffb96c22f0cb941b09acb6757ed5e24bb4b775189f6f20d5efc4c491ed4e7
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
graphql-pagination (1.1.
|
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.
|
11
|
-
activesupport (= 6.0.2.
|
12
|
-
activerecord (6.0.2.
|
13
|
-
activemodel (= 6.0.2.
|
14
|
-
activesupport (= 6.0.2.
|
15
|
-
activesupport (6.0.2.
|
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.
|
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.
|
33
|
+
method_source (1.0.0)
|
34
34
|
minitest (5.14.0)
|
35
35
|
parallel (1.19.1)
|
36
|
-
parser (2.7.0.
|
36
|
+
parser (2.7.0.5)
|
37
37
|
ast (~> 2.4.0)
|
38
|
-
pry (0.
|
39
|
-
coderay (~> 1.1
|
40
|
-
method_source (~>
|
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.
|
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.
|
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, <
|
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.
|
71
|
+
tzinfo (1.2.7)
|
72
72
|
thread_safe (~> 0.1)
|
73
|
-
unicode-display_width (1.
|
74
|
-
zeitwerk (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.
|
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
|
-
|
55
|
-
|
56
|
-
|
53
|
+
"data": {
|
54
|
+
"checklists": {
|
55
|
+
"collection": [
|
57
56
|
{
|
58
|
-
|
59
|
-
|
57
|
+
"id": "93938bb3-7a6c-4d35-9961-cbb2d4c9e9ac",
|
58
|
+
"name": "Apple"
|
60
59
|
},
|
61
60
|
{
|
62
|
-
|
63
|
-
|
61
|
+
"id": "b1ee93b2-579a-4107-8454-119bba5afb63",
|
62
|
+
"name": "Mango"
|
64
63
|
}
|
65
64
|
],
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
-
|
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.
|
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-
|
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.
|
185
|
+
rubygems_version: 3.1.2
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Page-based kaminari pagination for graphql.
|