graphql-pagination 2.5.0 → 2.6.0
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 +4 -4
- data/.bundler-version +1 -1
- data/.standard.yml +2 -0
- data/CHANGELOG.md +33 -0
- data/Gemfile.lock +6 -6
- data/README.md +33 -2
- data/lib/graphql_pagination/collection_metadata_type.rb +7 -0
- data/lib/graphql_pagination/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ddabfc6725a633f995134cdc0355e8c8a763b7db51110e8785c6b9e149b45de6
|
|
4
|
+
data.tar.gz: 579d0201b9f6727fd2be05e72924e2ff8b022b2b64a2f925c7a8ff098e83a1f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ea6fbe0d6398a9cb2cc22ffad816e5d028748419101b99a7964c9d121647f720cc3d654d42e1efd874421aa236ff29e9563867c4be07a2030374cb293208551
|
|
7
|
+
data.tar.gz: 2c46b5580886696aca39701c5e010f1649b257a43e0bc1e4791ae8f87176c55bf1d0739f9c1cd06de74ab98c22c4c92c202f241685f51ff6faa764c40c3a5f3b
|
data/.bundler-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.0.
|
|
1
|
+
4.0.10
|
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
## [2.6.0] - 2026-04-28
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Mark `CollectionMetadataType` as `@shareable` under Federation 2 (#253)
|
|
7
|
+
- Bump graphql from 2.5.23 to 2.6.0 (#252)
|
|
8
|
+
|
|
9
|
+
## [2.5.0] - 2026-04-08
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `paginated_field` helper to reduce pagination boilerplate (#239)
|
|
13
|
+
- Complexity calculation for collection fields (#240)
|
|
14
|
+
- `collection_type` support for GraphQL resolvers (#241)
|
|
15
|
+
- Ruby 4.0 support
|
|
16
|
+
|
|
17
|
+
### Security
|
|
18
|
+
- Update activesupport to 8.1.2.1 and json to 2.19.2 to fix vulnerabilities (#250)
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Replace RuboCop with StandardRB
|
|
22
|
+
- Bump graphql from 2.5.18 to 2.5.19 (#243)
|
|
23
|
+
- Upgrade dependencies
|
|
24
|
+
|
|
25
|
+
## [2.4.1] - 2025-09-29
|
|
26
|
+
|
|
27
|
+
## [2.4.0] - 2025-02-05
|
|
28
|
+
|
|
29
|
+
## [2.3.0] - 2024-12-09
|
|
30
|
+
|
|
31
|
+
## [2.2.0] - 2024-02-29
|
|
32
|
+
|
|
33
|
+
## [2.1.3] - 2023-09-17
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
graphql-pagination (2.
|
|
4
|
+
graphql-pagination (2.6.0)
|
|
5
5
|
graphql (>= 2.4.7)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -35,16 +35,16 @@ GEM
|
|
|
35
35
|
date (3.5.1)
|
|
36
36
|
diff-lcs (1.6.2)
|
|
37
37
|
drb (2.2.3)
|
|
38
|
-
erb (6.0.
|
|
38
|
+
erb (6.0.4)
|
|
39
39
|
fiber-storage (1.0.1)
|
|
40
|
-
graphql (2.
|
|
40
|
+
graphql (2.6.0)
|
|
41
41
|
base64
|
|
42
42
|
fiber-storage
|
|
43
43
|
logger
|
|
44
44
|
i18n (1.14.8)
|
|
45
45
|
concurrent-ruby (~> 1.0)
|
|
46
46
|
io-console (0.8.2)
|
|
47
|
-
irb (1.
|
|
47
|
+
irb (1.18.0)
|
|
48
48
|
pp (>= 0.6.0)
|
|
49
49
|
prism (>= 1.3.0)
|
|
50
50
|
rdoc (>= 4.0.0)
|
|
@@ -58,7 +58,7 @@ GEM
|
|
|
58
58
|
lint_roller (1.1.0)
|
|
59
59
|
logger (1.7.0)
|
|
60
60
|
method_source (1.1.0)
|
|
61
|
-
minitest (6.0.
|
|
61
|
+
minitest (6.0.4)
|
|
62
62
|
drb (~> 2.0)
|
|
63
63
|
prism (~> 1.5)
|
|
64
64
|
openssl (4.0.1)
|
|
@@ -80,7 +80,7 @@ GEM
|
|
|
80
80
|
stringio
|
|
81
81
|
racc (1.8.1)
|
|
82
82
|
rainbow (3.1.1)
|
|
83
|
-
rake (13.
|
|
83
|
+
rake (13.4.2)
|
|
84
84
|
rdoc (7.2.0)
|
|
85
85
|
erb
|
|
86
86
|
psych (>= 4.0.0)
|
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Implements page-based pagination returning collection and pagination metadata. I
|
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
|
-
Add `graphql-pagination` to your Gemfile, you can use `kaminari-activerecord` or `kaminari-
|
|
10
|
+
Add `graphql-pagination` to your Gemfile, you can use `kaminari-activerecord` or `kaminari-mongoid` to not implement page scope methods. Kaminari is not loaded by the gem, so you need to decide and load it on your own.
|
|
11
11
|
|
|
12
12
|
```ruby
|
|
13
13
|
gem 'graphql-pagination'
|
|
@@ -82,6 +82,8 @@ This automatically adds `page` and `per` arguments (both optional) to the field.
|
|
|
82
82
|
|
|
83
83
|
## GraphQL query
|
|
84
84
|
|
|
85
|
+
When using manual field definitions (with `limit` argument):
|
|
86
|
+
|
|
85
87
|
```graphql
|
|
86
88
|
{
|
|
87
89
|
fruits(page: 2, limit: 2) {
|
|
@@ -99,10 +101,29 @@ This automatically adds `page` and `per` arguments (both optional) to the field.
|
|
|
99
101
|
}
|
|
100
102
|
```
|
|
101
103
|
|
|
104
|
+
When using the `paginated_field` helper (with `per` argument):
|
|
105
|
+
|
|
106
|
+
```graphql
|
|
107
|
+
{
|
|
108
|
+
fruits(page: 2, per: 2) {
|
|
109
|
+
collection {
|
|
110
|
+
id
|
|
111
|
+
name
|
|
112
|
+
}
|
|
113
|
+
metadata {
|
|
114
|
+
totalPages
|
|
115
|
+
totalCount
|
|
116
|
+
currentPage
|
|
117
|
+
limitValue
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
102
123
|
```json
|
|
103
124
|
{
|
|
104
125
|
"data": {
|
|
105
|
-
"
|
|
126
|
+
"fruits": {
|
|
106
127
|
"collection": [
|
|
107
128
|
{
|
|
108
129
|
"id": "93938bb3-7a6c-4d35-9961-cbb2d4c9e9ac",
|
|
@@ -216,6 +237,16 @@ The complexity will be calculated as:
|
|
|
216
237
|
|
|
217
238
|
If no `limit` or `per` argument is provided, it will use the schema's default page size or fall back to 25 (Kaminari's default).
|
|
218
239
|
|
|
240
|
+
To enforce complexity limits, set `max_complexity` on your schema:
|
|
241
|
+
|
|
242
|
+
```ruby
|
|
243
|
+
class MySchema < GraphQL::Schema
|
|
244
|
+
max_complexity 200
|
|
245
|
+
end
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Queries exceeding this threshold will be rejected before execution.
|
|
249
|
+
|
|
219
250
|
## Contributing
|
|
220
251
|
|
|
221
252
|
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.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
module GraphqlPagination
|
|
2
2
|
class CollectionMetadataType < GraphQL::Schema::Object
|
|
3
|
+
if defined?(ApolloFederation::Object) && defined?(Reconf) &&
|
|
4
|
+
Gem::Version.new(Reconf.fetch("renoql.federation_version") { "1.0" }.to_s) >= Gem::Version.new("2.0.0")
|
|
5
|
+
include ApolloFederation::Object
|
|
6
|
+
|
|
7
|
+
shareable
|
|
8
|
+
end
|
|
9
|
+
|
|
3
10
|
description "Type for CollectionMetadataType"
|
|
4
11
|
field :current_page, Integer, null: false, description: "Current Page of loaded data"
|
|
5
12
|
field :limit_value, Integer, null: false, description: "The number of items per page"
|
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: 2.
|
|
4
|
+
version: 2.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Krzysztof Knapik
|
|
@@ -45,6 +45,8 @@ files:
|
|
|
45
45
|
- ".github/workflows/ci.yml"
|
|
46
46
|
- ".gitignore"
|
|
47
47
|
- ".rspec"
|
|
48
|
+
- ".standard.yml"
|
|
49
|
+
- CHANGELOG.md
|
|
48
50
|
- Gemfile
|
|
49
51
|
- Gemfile.lock
|
|
50
52
|
- LICENSE
|
|
@@ -81,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
81
83
|
- !ruby/object:Gem::Version
|
|
82
84
|
version: '0'
|
|
83
85
|
requirements: []
|
|
84
|
-
rubygems_version: 4.0.
|
|
86
|
+
rubygems_version: 4.0.10
|
|
85
87
|
specification_version: 4
|
|
86
88
|
summary: Page-based kaminari pagination for graphql.
|
|
87
89
|
test_files: []
|