esse-pagy 0.0.2 → 0.43.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a5bc051ed525825e1e41fa010dd7192dc1417cd5988fc772a969060fd398b1c
4
- data.tar.gz: 98cc1531ffb9d3e514584628b564bdbd4710d7cbd10bfff40708e26e0949238d
3
+ metadata.gz: 5aab1fef790c9d1d136cb6c05d818645495c02ceec882b00b6b71e9bebb0f286
4
+ data.tar.gz: 7af8032792e1ca50ce4673f800c0f6d77427aba635b069e1b0b106f426f24652
5
5
  SHA512:
6
- metadata.gz: 75905c59da32a8bd9c9c24abb1cc114f1ff338a5ac6c4611e70052d2ed8b66e483c6a822eacc6da15968fa91cfe1e7e603950a30ffcf60050448c44460275e38
7
- data.tar.gz: d9c2fb8ba6f11e1d6d15612d9dac6a8b89fc31b945c0d0ec07b23814b58d2781f85c8d5d339de8d065f867944920c267abcadf04299a7eded8e0288bbc4e9b60
6
+ metadata.gz: 435eb6d94097ab144ddafc1c63dab793b5c08f215503acaeced3b008f54db706d4197edcbf9b892859c531f9431d58c923be4c0988514488ebffa03b003f853f
7
+ data.tar.gz: e4acd964c62740ef144cfddd99a9f96bde82c6b4e97071009a8d8029e588b6d5396670833a85a73e34c5791bfb09b30c6e5e6f536123f8eef2a2072b3bb0e94a
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 0.43.0
8
+
9
+ ### Added
10
+ * Pagy 43 support: `new_from_esse` builds a `Pagy::Offset` (bare `Pagy` is abstract in 43), and the controller-helper defaults / `Pagy::Backend` integration are only registered on Pagy versions that ship them (43 froze `Pagy::DEFAULT` and removed `Pagy::Backend`).
11
+ * CI gemfile + matrix entry for Pagy 43.
12
+
7
13
  ## 0.0.2 - 2024-12-19
8
14
 
9
15
  ### Added
data/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This gem is a [esse](https://github.com/marcosgz/esse) plugin for the [pagy](https://github.com/ddnexus/pagy) pagination.
4
4
 
5
+ ## Documentation
6
+
7
+ Full guides, pagination examples, and API reference are published at **[gems.marcosz.com.br/esse-pagy](https://gems.marcosz.com.br/esse-pagy/)** — part of the [marcosgz Ruby gem catalogue](https://gems.marcosz.com.br).
8
+
5
9
  ## Installation
6
10
 
7
11
  Add this line to your application's Gemfile:
@@ -18,12 +22,26 @@ $ bundle install
18
22
 
19
23
  ## Pagy Version Compatibility
20
24
 
21
- This gem supports Pagy versions 5.x through 9.x, but with different Ruby version requirements:
25
+ Pagy 43 reorganized its internals (it froze `Pagy::DEFAULT`, removed the
26
+ `Pagy::Backend` mixin, and split paginators into `Pagy::Offset`/`Keyset`/`Search`),
27
+ which is not backward compatible. esse-pagy releases track the supported Pagy major:
28
+
29
+ | esse-pagy | Pagy | Ruby Version Required |
30
+ |-------------|-------------|--------------------------------------------|
31
+ | `>= 0.43` | 43.x | >= 3.1.0 |
32
+ | `<= 0.0.2` | 5.x – 9.x | >= 2.5.0 (5.x, 6.x), >= 3.1.0 (7.x–9.x) |
33
+
34
+ If your app is still on Pagy 5–9, pin the previous esse-pagy release:
35
+
36
+ ```ruby
37
+ gem "esse-pagy", "~> 0.0.2"
38
+ ```
39
+
40
+ For Pagy 43+:
22
41
 
23
- | Pagy Version | Ruby Version Required |
24
- |--------------|----------------------|
25
- | 5.x, 6.x | >= 2.5.0 |
26
- | 7.x, 8.x, 9.x| >= 3.1.0 |
42
+ ```ruby
43
+ gem "esse-pagy", ">= 0.43"
44
+ ```
27
45
 
28
46
  ## Usage
29
47
 
data/docs/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # esse-pagy
2
+
3
+ [Pagy](https://github.com/ddnexus/pagy) pagination for [Esse](../../esse/docs/README.md) search queries.
4
+
5
+ Unlike `esse-kaminari`, which adds chainable query methods, `esse-pagy` uses Pagy's **controller-backend** pattern: the index builds a delayed search description, and the `pagy_esse` controller helper executes it with pagination.
6
+
7
+ ## Contents
8
+
9
+ - [Usage guide](usage.md)
10
+ - [API reference](api.md)
11
+
12
+ ## Install
13
+
14
+ ```ruby
15
+ # Gemfile
16
+ gem 'esse', '>= 0.2.4'
17
+ gem 'pagy', '>= 5'
18
+ gem 'esse-pagy'
19
+ ```
20
+
21
+ In your controller (Pagy's `Pagy::Backend` is typically included in `ApplicationController`):
22
+
23
+ ```ruby
24
+ class UsersController < ApplicationController
25
+ def index
26
+ @pagy, @response = pagy_esse(
27
+ UsersIndex.pagy_search(body: { query: { match: { name: params[:q] } } }),
28
+ items: 10
29
+ )
30
+ @results = @response.results
31
+ end
32
+ end
33
+ ```
34
+
35
+ In the view:
36
+
37
+ ```erb
38
+ <%== pagy_nav(@pagy) %>
39
+ <% @results.each { |hit| %><%= hit.dig('_source', 'name') %><br><% } %>
40
+ ```
41
+
42
+ ## Multi-index pagination
43
+
44
+ ```ruby
45
+ @pagy, @response = pagy_esse(
46
+ Esse.cluster.pagy_search(CitiesIndex, CountiesIndex, body: body),
47
+ items: 25
48
+ )
49
+ ```
50
+
51
+ ## Version
52
+
53
+ - Version: **0.0.1**
54
+ - Ruby: `>= 2.5.0`
55
+ - Depends on: `esse >= 0.2.4`, `pagy >= 5`
56
+
57
+ ## License
58
+
59
+ MIT.
data/docs/api.md ADDED
@@ -0,0 +1,125 @@
1
+ # API Reference
2
+
3
+ The gem adds methods at four layers:
4
+
5
+ 1. `Esse::Index.pagy_search` — build a deferred search description.
6
+ 2. `Esse::Cluster#pagy_search` — same, for multi-index/cluster searches.
7
+ 3. `Pagy.new_from_esse` — build a Pagy instance from an already-executed query.
8
+ 4. `Pagy::Backend#pagy_esse` — controller helper that executes the description with pagination.
9
+
10
+ ---
11
+
12
+ ## `Esse::Index.pagy_search`
13
+
14
+ Module: `Esse::Pagy::IndexSearch` (extended into `Esse::Index`).
15
+
16
+ ### `.pagy_search(q = nil, **kwargs, &block) → Array`
17
+
18
+ Returns `[cluster, self, { q: q, **kwargs }, block]` — a **description** of what to search, not an actual search.
19
+
20
+ ```ruby
21
+ args = UsersIndex.pagy_search(body: { query: { match_all: {} } })
22
+ # => [UsersIndex.cluster, UsersIndex, { body: {...} }, nil]
23
+ ```
24
+
25
+ Alias configurable via `Pagy::DEFAULT[:esse_pagy_search]` (default: `:pagy_search`).
26
+
27
+ ---
28
+
29
+ ## `Esse::Cluster#pagy_search`
30
+
31
+ Module: `Esse::Pagy::ClusterSearch` (prepended into `Esse::Cluster`).
32
+
33
+ ### `#pagy_search(*indices, **kwargs, &block) → Array`
34
+
35
+ Returns `[self, indices, kwargs, block]`.
36
+
37
+ ```ruby
38
+ Esse.cluster.pagy_search(CitiesIndex, CountiesIndex, body: { ... })
39
+ ```
40
+
41
+ Indices can be classes, strings, or wildcard patterns.
42
+
43
+ ---
44
+
45
+ ## `Pagy.new_from_esse`
46
+
47
+ Module: `Esse::Pagy::ClassMethods` (extended into `Pagy`).
48
+
49
+ ### `Pagy.new_from_esse(query, vars = {}) → Pagy`
50
+
51
+ Builds a Pagy instance from an already-executed `Esse::Search::Query`.
52
+
53
+ ```ruby
54
+ query = UsersIndex.search(body: body).limit(10).offset(20)
55
+ pagy = Pagy.new_from_esse(query)
56
+ ```
57
+
58
+ Internally:
59
+
60
+ ```ruby
61
+ vars[:count] = query.response.total
62
+ vars[:page] = (query.offset_value / query.limit_value.to_f).ceil + 1
63
+ vars[:items] = query.limit_value
64
+ Pagy.new(vars)
65
+ ```
66
+
67
+ ---
68
+
69
+ ## `Pagy::Backend#pagy_esse`
70
+
71
+ Module: `Esse::Pagy::Backend` (prepended into `Pagy::Backend`).
72
+
73
+ ### `#pagy_esse(pagy_search_args, vars = {}) → [Pagy, Esse::Search::Query]`
74
+
75
+ Executes the deferred search with pagination applied.
76
+
77
+ ```ruby
78
+ @pagy, @response = pagy_esse(UsersIndex.pagy_search(body: body), items: 10)
79
+ ```
80
+
81
+ Flow:
82
+
83
+ 1. Extract `cluster, indices, kwargs, block` from the description.
84
+ 2. Merge pagination vars with `params` (uses `Pagy::DEFAULT[:page_param]` and `Pagy::DEFAULT[:items]`).
85
+ 3. Build the query by calling the search method (default `.search`, configurable via `Pagy::DEFAULT[:esse_search]`) and applying `.limit(items).offset((page - 1) * items)`.
86
+ 4. Extract total count from `query.response.total`.
87
+ 5. Construct a `Pagy` instance.
88
+ 6. Handle `overflow: :last_page` if `Pagy::OverflowExtra` is loaded.
89
+ 7. Return `[pagy, query]`.
90
+
91
+ ### `#pagy_esse_get_vars(_query, vars)`
92
+
93
+ Helper: merges Pagy configuration and request params into the vars hash.
94
+
95
+ | Precedence (high → low) | Source |
96
+ |-------------------------|--------|
97
+ | Explicit `vars[:page]` / `vars[:items]` | caller |
98
+ | `params[page_param]`, `params[:items]` | request |
99
+ | `Pagy::DEFAULT[:items]` | config |
100
+
101
+ ---
102
+
103
+ ## Pagy configuration keys used
104
+
105
+ | Key | Default | Purpose |
106
+ |-----|---------|---------|
107
+ | `Pagy::DEFAULT[:esse_search]` | `:search` | Name of the search method to call (`.search` by default) |
108
+ | `Pagy::DEFAULT[:esse_pagy_search]` | `:pagy_search` | Alias name for the deferred-search method |
109
+ | `Pagy::DEFAULT[:items]` | Pagy default | Items per page fallback |
110
+ | `Pagy::DEFAULT[:page_param]` | `:page` | Request parameter name for page |
111
+
112
+ ---
113
+
114
+ ## Integration summary
115
+
116
+ On load:
117
+
118
+ ```ruby
119
+ Esse::Index.extend(Esse::Pagy::IndexSearch)
120
+ Esse::Cluster.prepend(Esse::Pagy::ClusterSearch)
121
+ Pagy::Backend.prepend(Esse::Pagy::Backend)
122
+ Pagy.extend(Esse::Pagy::ClassMethods)
123
+ ```
124
+
125
+ No configuration is required beyond whatever Pagy setup you already have.
data/docs/usage.md ADDED
@@ -0,0 +1,140 @@
1
+ # Usage Guide
2
+
3
+ ## Installation
4
+
5
+ ```ruby
6
+ # Gemfile
7
+ gem 'esse'
8
+ gem 'pagy'
9
+ gem 'esse-pagy'
10
+ ```
11
+
12
+ Loading the gem:
13
+
14
+ - Extends every `Esse::Index` with `pagy_search`.
15
+ - Prepends `pagy_search` into `Esse::Cluster`.
16
+ - Adds `pagy_esse` to `Pagy::Backend` (already included in your controllers).
17
+ - Adds `Pagy.new_from_esse`.
18
+
19
+ No initializer needed.
20
+
21
+ ## Basic controller usage
22
+
23
+ ```ruby
24
+ class UsersController < ApplicationController
25
+ def index
26
+ @pagy, @response = pagy_esse(
27
+ UsersIndex.pagy_search(body: { query: { match_all: {} } }),
28
+ items: 10
29
+ )
30
+ end
31
+ end
32
+ ```
33
+
34
+ - `UsersIndex.pagy_search(...)` returns a deferred "search description" (it does **not** execute a query).
35
+ - `pagy_esse(description, **vars)` executes the search with the pagination info pulled from `params` (or provided `vars`) and returns `[pagy_instance, query_or_response]`.
36
+
37
+ ## Rendering
38
+
39
+ ```erb
40
+ <%== pagy_nav(@pagy) %>
41
+
42
+ <% @response.results.each do |hit| %>
43
+ <%= hit.dig('_source', 'name') %>
44
+ <% end %>
45
+ ```
46
+
47
+ ## Multiple indices / cluster search
48
+
49
+ Use `Esse.cluster.pagy_search`:
50
+
51
+ ```ruby
52
+ @pagy, @response = pagy_esse(
53
+ Esse.cluster.pagy_search(CitiesIndex, CountiesIndex, body: body),
54
+ items: 20
55
+ )
56
+ ```
57
+
58
+ You can also pass wildcard index names:
59
+
60
+ ```ruby
61
+ @pagy, @response = pagy_esse(
62
+ Esse.cluster.pagy_search('geos_*', body: { query: { match_all: {} } }),
63
+ items: 15
64
+ )
65
+ ```
66
+
67
+ ## Passing a query-modification block
68
+
69
+ The block is forwarded to the underlying `search` call:
70
+
71
+ ```ruby
72
+ @pagy, @response = pagy_esse(
73
+ UsersIndex.pagy_search("*") { |query| query.filter('status', 'active') },
74
+ items: 10
75
+ )
76
+ ```
77
+
78
+ ## Reading params
79
+
80
+ By default `pagy_esse` reads `params[:page]` and `params[:items]`:
81
+
82
+ ```
83
+ /users?page=2&items=25
84
+ ```
85
+
86
+ Override by passing `vars`:
87
+
88
+ ```ruby
89
+ pagy_esse(description, page: 3, items: 50)
90
+ ```
91
+
92
+ Pagy's standard configuration applies:
93
+
94
+ ```ruby
95
+ # config/initializers/pagy.rb
96
+ Pagy::DEFAULT[:items] = 20
97
+ Pagy::DEFAULT[:page_param] = :p
98
+ ```
99
+
100
+ ## Creating a Pagy from an executed query
101
+
102
+ If you have a query already executed, use:
103
+
104
+ ```ruby
105
+ query = UsersIndex.search(body: body).limit(10).offset(20)
106
+ pagy = Pagy.new_from_esse(query)
107
+
108
+ # pagy.page => 3
109
+ # pagy.items => 10
110
+ # pagy.count => total hits
111
+ ```
112
+
113
+ ## Overflow handling
114
+
115
+ With `Pagy::OverflowExtra` loaded:
116
+
117
+ ```ruby
118
+ @pagy, @response = pagy_esse(description, items: 10, overflow: :last_page)
119
+ ```
120
+
121
+ When the requested page is beyond the available pages, Pagy falls back to the last valid page instead of raising `Pagy::OverflowError`.
122
+
123
+ ## Customizing method names
124
+
125
+ The default method is `pagy_search`, aliased from `pagy_esse`. Change the alias name via Pagy's defaults:
126
+
127
+ ```ruby
128
+ Pagy::DEFAULT[:esse_pagy_search] = :my_method
129
+ ```
130
+
131
+ Now call `UsersIndex.my_method(...)` and `Esse.cluster.my_method(...)`.
132
+
133
+ ## Comparing to esse-kaminari
134
+
135
+ | Aspect | esse-pagy | esse-kaminari |
136
+ |--------|-----------|---------------|
137
+ | Style | Controller backend | Chainable query methods |
138
+ | Multi-index | Built-in via cluster | Single-index focus |
139
+ | Execution | Deferred until `pagy_esse` | Lazy until `.response` |
140
+ | Best for | Rails controllers, multi-index | Service objects, single-index |
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "pagy", "~> 43.0"
6
+ gem "esse", "~> 0.2.4"
7
+ gem "esse-rspec", "~> 0.0.1"
8
+
9
+ group :test do
10
+ gem "activesupport"
11
+ gem "rack"
12
+ gem "rake-manifest"
13
+ end
14
+
15
+ # Specify your gem's dependencies in esse-pagy.gemspec
16
+ gemspec path: ".."
@@ -0,0 +1,202 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ esse-pagy (0.43.0)
5
+ esse (>= 0.2.4)
6
+ pagy (>= 5)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (8.1.3)
12
+ base64
13
+ bigdecimal
14
+ concurrent-ruby (~> 1.0, >= 1.3.1)
15
+ connection_pool (>= 2.2.5)
16
+ drb
17
+ i18n (>= 1.6, < 2)
18
+ json
19
+ logger (>= 1.4.2)
20
+ minitest (>= 5.1)
21
+ securerandom (>= 0.3)
22
+ tzinfo (~> 2.0, >= 2.0.5)
23
+ uri (>= 0.13.1)
24
+ ast (2.4.3)
25
+ base64 (0.3.0)
26
+ bigdecimal (4.1.2)
27
+ coderay (1.1.3)
28
+ concurrent-ruby (1.3.7)
29
+ connection_pool (3.0.2)
30
+ diff-lcs (1.6.2)
31
+ drb (2.2.3)
32
+ esse (0.2.6)
33
+ multi_json
34
+ thor (>= 0.19)
35
+ esse-rspec (0.0.6)
36
+ esse (>= 0.2.4)
37
+ rspec (>= 3)
38
+ i18n (1.15.2)
39
+ concurrent-ruby (~> 1.0)
40
+ io-console (0.8.2)
41
+ json (2.20.0)
42
+ language_server-protocol (3.17.0.5)
43
+ lint_roller (1.1.0)
44
+ logger (1.7.0)
45
+ method_source (1.1.0)
46
+ minitest (6.0.6)
47
+ drb (~> 2.0)
48
+ prism (~> 1.5)
49
+ multi_json (1.21.1)
50
+ pagy (43.5.6)
51
+ json
52
+ uri
53
+ yaml
54
+ parallel (2.1.0)
55
+ parser (3.3.11.1)
56
+ ast (~> 2.4.1)
57
+ racc
58
+ prism (1.9.0)
59
+ pry (0.16.0)
60
+ coderay (~> 1.1)
61
+ method_source (~> 1.0)
62
+ reline (>= 0.6.0)
63
+ racc (1.8.1)
64
+ rack (3.2.6)
65
+ rainbow (3.1.1)
66
+ rake-manifest (0.2.4)
67
+ regexp_parser (2.12.0)
68
+ reline (0.6.3)
69
+ io-console (~> 0.5)
70
+ rspec (3.13.2)
71
+ rspec-core (~> 3.13.0)
72
+ rspec-expectations (~> 3.13.0)
73
+ rspec-mocks (~> 3.13.0)
74
+ rspec-core (3.13.6)
75
+ rspec-support (~> 3.13.0)
76
+ rspec-expectations (3.13.5)
77
+ diff-lcs (>= 1.2.0, < 2.0)
78
+ rspec-support (~> 3.13.0)
79
+ rspec-mocks (3.13.8)
80
+ diff-lcs (>= 1.2.0, < 2.0)
81
+ rspec-support (~> 3.13.0)
82
+ rspec-support (3.13.7)
83
+ rubocop (1.88.0)
84
+ json (~> 2.3)
85
+ language_server-protocol (~> 3.17.0.2)
86
+ lint_roller (~> 1.1.0)
87
+ parallel (>= 1.10)
88
+ parser (>= 3.3.0.2)
89
+ rainbow (>= 2.2.2, < 4.0)
90
+ regexp_parser (>= 2.9.3, < 3.0)
91
+ rubocop-ast (>= 1.49.0, < 2.0)
92
+ ruby-progressbar (~> 1.7)
93
+ unicode-display_width (>= 2.4.0, < 4.0)
94
+ rubocop-ast (1.49.1)
95
+ parser (>= 3.3.7.2)
96
+ prism (~> 1.7)
97
+ rubocop-performance (1.26.1)
98
+ lint_roller (~> 1.1)
99
+ rubocop (>= 1.75.0, < 2.0)
100
+ rubocop-ast (>= 1.47.1, < 2.0)
101
+ rubocop-rspec (3.10.2)
102
+ lint_roller (~> 1.1)
103
+ regexp_parser (>= 2.0)
104
+ rubocop (~> 1.86, >= 1.86.2)
105
+ ruby-progressbar (1.13.0)
106
+ securerandom (0.4.1)
107
+ standard (1.35.0.1)
108
+ language_server-protocol (~> 3.17.0.2)
109
+ lint_roller (~> 1.0)
110
+ rubocop (~> 1.62)
111
+ standard-custom (~> 1.0.0)
112
+ standard-performance (~> 1.3)
113
+ standard-custom (1.0.2)
114
+ lint_roller (~> 1.0)
115
+ rubocop (~> 1.50)
116
+ standard-performance (1.9.0)
117
+ lint_roller (~> 1.1)
118
+ rubocop-performance (~> 1.26.0)
119
+ thor (1.5.0)
120
+ tzinfo (2.0.6)
121
+ concurrent-ruby (~> 1.0)
122
+ unicode-display_width (3.2.0)
123
+ unicode-emoji (~> 4.1)
124
+ unicode-emoji (4.2.0)
125
+ uri (1.1.1)
126
+ yaml (0.4.0)
127
+
128
+ PLATFORMS
129
+ ruby
130
+ x86_64-linux
131
+
132
+ DEPENDENCIES
133
+ activesupport
134
+ esse (~> 0.2.4)
135
+ esse-pagy!
136
+ esse-rspec (~> 0.0.1)
137
+ pagy (~> 43.0)
138
+ pry
139
+ rack
140
+ rake-manifest
141
+ rspec
142
+ rubocop
143
+ rubocop-performance
144
+ rubocop-rspec
145
+ standard
146
+
147
+ CHECKSUMS
148
+ activesupport (8.1.3) sha256=21a5e0dfbd4c3ddd9e1317ec6a4d782fa226e7867dc70b0743acda81a1dca20e
149
+ ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
150
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
151
+ bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
152
+ coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b
153
+ concurrent-ruby (1.3.7) sha256=4412caec3a5ea2e5fdc52076724c071a81f2c0593d83b2ac8cbb8ca63b3151b0
154
+ connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
155
+ diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
156
+ drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
157
+ esse (0.2.6) sha256=0cada03f5230ea4637add87e918d3b4e88c9c46e4e560c57ad7878f4b3793486
158
+ esse-pagy (0.43.0)
159
+ esse-rspec (0.0.6) sha256=7f373949721ffc45fec44fc4946cce77ea7fb07bafb603584e1ff4b08c5ccfd6
160
+ i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5
161
+ io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
162
+ json (2.20.0) sha256=9362bc6e55a952b056abf9167cf053358181c904cb70cd6eee0808ea830fc32b
163
+ language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
164
+ lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
165
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
166
+ method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
167
+ minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
168
+ multi_json (1.21.1) sha256=e6126a31808e3b4d19f483c775ceac34df190dffa62adfb63a165ee14ba68080
169
+ pagy (43.5.6) sha256=4d46d262826e055d69713fbbd2c42257cc1d0e87c13a1221764c15d30e46ff85
170
+ parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
171
+ parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54
172
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
173
+ pry (0.16.0) sha256=d76c69065698ed1f85e717bd33d7942c38a50868f6b0673c636192b3d1b6054e
174
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
175
+ rack (3.2.6) sha256=5ed78e1f73b2e25679bec7d45ee2d4483cc4146eb1be0264fc4d94cb5ef212c2
176
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
177
+ rake-manifest (0.2.4) sha256=a53781f6100f37fcc33e9518b65b025111e0d17be894fa3bc319888552a28970
178
+ regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
179
+ reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
180
+ rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
181
+ rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
182
+ rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
183
+ rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
184
+ rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
185
+ rubocop (1.88.0) sha256=e420ddf1662d0ef34bc8a2910ac4b396a7ddda0b51a708264405241734b08e0b
186
+ rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
187
+ rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
188
+ rubocop-rspec (3.10.2) sha256=0b3e2ecc592cd10ecbf0095bb58d1e357905276e069643523cc19eb7495f65e2
189
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
190
+ securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
191
+ standard (1.35.0.1) sha256=ec8992af82aede242b86755970336fe481e2264d23e96de3da7eb28101601e97
192
+ standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b
193
+ standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2
194
+ thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
195
+ tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
196
+ unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
197
+ unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
198
+ uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
199
+ yaml (0.4.0) sha256=240e69d1e6ce3584d6085978719a0faa6218ae426e034d8f9b02fb54d3471942
200
+
201
+ BUNDLED WITH
202
+ 4.0.7
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- esse-pagy (0.0.2)
4
+ esse-pagy (0.43.0)
5
5
  esse (>= 0.2.4)
6
6
  pagy (>= 5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- esse-pagy (0.0.2)
4
+ esse-pagy (0.43.0)
5
5
  esse (>= 0.2.4)
6
6
  pagy (>= 5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- esse-pagy (0.0.2)
4
+ esse-pagy (0.43.0)
5
5
  esse (>= 0.2.4)
6
6
  pagy (>= 5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- esse-pagy (0.0.2)
4
+ esse-pagy (0.43.0)
5
5
  esse (>= 0.2.4)
6
6
  pagy (>= 5)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- esse-pagy (0.0.2)
4
+ esse-pagy (0.43.0)
5
5
  esse (>= 0.2.4)
6
6
  pagy (>= 5)
7
7
 
data/lib/esse/pagy.rb CHANGED
@@ -3,8 +3,14 @@
3
3
  require "esse"
4
4
  require "pagy"
5
5
 
6
- ::Pagy::DEFAULT[:esse_search] ||= :search
7
- ::Pagy::DEFAULT[:esse_pagy_search] ||= :pagy_search
6
+ # Pagy < 43 ships a mutable DEFAULT and a Backend mixin used by the
7
+ # `pagy_esse`/`pagy_search` controller helpers. Pagy 43 froze DEFAULT, removed
8
+ # the Backend mixin, and split paginators into Pagy::Offset/Keyset/Search.
9
+ # Only register the controller-helper defaults where they apply.
10
+ unless ::Pagy::DEFAULT.frozen?
11
+ ::Pagy::DEFAULT[:esse_search] ||= :search
12
+ ::Pagy::DEFAULT[:esse_pagy_search] ||= :pagy_search
13
+ end
8
14
 
9
15
  # I'll try to move this to the `pagy` gem. But we need to wait for the `pagy` author to accept the PR.
10
16
  # @see https://github.com/ddnexus/pagy/blob/master/lib/pagy/extras/elasticsearch_rails.rb
@@ -18,7 +24,7 @@ module Esse
18
24
  args.define_singleton_method(:method_missing) { |*a| args += a }
19
25
  end
20
26
  end
21
- alias_method ::Pagy::DEFAULT[:esse_pagy_search], :pagy_esse
27
+ alias_method :pagy_search, :pagy_esse
22
28
  end
23
29
 
24
30
  module ClusterSearch
@@ -27,7 +33,7 @@ module Esse
27
33
  args.define_singleton_method(:method_missing) { |*a| args += a }
28
34
  end
29
35
  end
30
- alias_method ::Pagy::DEFAULT[:esse_pagy_search], :pagy_esse
36
+ alias_method :pagy_search, :pagy_esse
31
37
  end
32
38
 
33
39
  module ClassMethods
@@ -36,7 +42,10 @@ module Esse
36
42
  vars[:page] = (query.offset_value / query.limit_value.to_f).ceil + 1
37
43
  vars[:limit] = query.limit_value
38
44
 
39
- if ::Pagy::VERSION.to_i < 9
45
+ if defined?(::Pagy::Offset)
46
+ # Pagy 43+: bare Pagy is abstract; offset pagination is Pagy::Offset.
47
+ ::Pagy::Offset.new(**vars)
48
+ elsif ::Pagy::VERSION.to_i < 9
40
49
  # Convert :limit back to :items for older Pagy versions
41
50
  vars[:items] = vars.delete(:limit)
42
51
  ::Pagy.new(vars)
@@ -46,7 +55,8 @@ module Esse
46
55
  end
47
56
  end
48
57
 
49
- # Add specialized backend methods to paginate Esse::Search::Query
58
+ # Add specialized backend methods to paginate Esse::Search::Query.
59
+ # Only relevant on Pagy versions that still ship Pagy::Backend (< 43).
50
60
  module Backend
51
61
  private
52
62
 
@@ -95,7 +105,13 @@ module Esse
95
105
  end
96
106
  end
97
107
 
98
- ::Pagy::Backend.prepend(Esse::Pagy::Backend)
99
108
  ::Pagy.extend(Esse::Pagy::ClassMethods)
100
109
  ::Esse::Index.extend(Esse::Pagy::IndexSearch)
101
110
  ::Esse::Cluster.prepend(Esse::Pagy::ClusterSearch)
111
+ # Pagy::Backend was removed in Pagy 43; reference it (autoloads on older Pagy)
112
+ # and skip the integration when it is gone.
113
+ begin
114
+ ::Pagy::Backend.prepend(Esse::Pagy::Backend)
115
+ rescue NameError
116
+ nil
117
+ end
data/mise.toml CHANGED
@@ -1,2 +1,2 @@
1
1
  [tools]
2
- ruby = "2.7.8"
2
+ ruby = "3.4.8"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esse-pagy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcos G. Zimmermann
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-09-26 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: esse
@@ -135,6 +134,11 @@ files:
135
134
  - Gemfile.lock
136
135
  - LICENSE
137
136
  - README.md
137
+ - docs/README.md
138
+ - docs/api.md
139
+ - docs/usage.md
140
+ - gemfiles/Gemfile.pagy-43
141
+ - gemfiles/Gemfile.pagy-43.lock
138
142
  - gemfiles/Gemfile.pagy-5
139
143
  - gemfiles/Gemfile.pagy-5.lock
140
144
  - gemfiles/Gemfile.pagy-6
@@ -154,7 +158,6 @@ metadata:
154
158
  homepage_uri: https://github.com/marcosgz/esse-pagy
155
159
  source_code_uri: https://github.com/marcosgz/esse-pagy
156
160
  changelog_uri: https://github.com/marcosgz/esse-pagy/blob/main/CHANGELOG.md
157
- post_install_message:
158
161
  rdoc_options: []
159
162
  require_paths:
160
163
  - lib
@@ -169,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
172
  - !ruby/object:Gem::Version
170
173
  version: '0'
171
174
  requirements: []
172
- rubygems_version: 3.4.22
173
- signing_key:
175
+ rubygems_version: 3.6.9
174
176
  specification_version: 4
175
177
  summary: Pagy extensions for Esse
176
178
  test_files: []