@visulima/pagination 5.0.0-alpha.8 → 5.0.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,377 @@
1
- import type { Paginator as PaginatorInterface } from "./types.d.d.ts";
2
- export { default as Paginator } from "./paginator.d.ts";
3
- export { createPaginationMetaSchemaObject, createPaginationSchemaObject } from "./swagger.d.ts";
4
- export declare const paginate: <Result>(page: number, perPage: number, total: number, rows: Result[]) => PaginatorInterface<Result>;
5
- export type { PaginationMeta, PaginationResult, Paginator as PaginatorInterface } from "./types.d.ts";
1
+ import { OpenAPIV3 } from 'openapi-types';
2
+ interface PaginationMeta {
3
+ firstPage: number;
4
+ /**
5
+ * The URL for the first page. Always a string — `getUrl()` never returns null.
6
+ */
7
+ firstPageUrl: string;
8
+ lastPage: number;
9
+ /**
10
+ * The URL for the last page. Always a string — `getUrl()` never returns null.
11
+ */
12
+ lastPageUrl: string;
13
+ nextPageUrl: string | null;
14
+ page: number;
15
+ perPage: number;
16
+ previousPageUrl: string | null;
17
+ total: number;
18
+ }
19
+ interface PaginationResult<Result> {
20
+ data: Result[];
21
+ meta: PaginationMeta;
22
+ }
23
+ /**
24
+ * A key-transform applied to {@link PaginationMeta} keys. Return the desired
25
+ * output key for a given camelCase meta key (e.g. `perPage` -> `per_page`).
26
+ */
27
+ type NamingStrategy = (key: string) => string;
28
+ /**
29
+ * A windowed page-range entry. A `null` `page`/`url` represents an ellipsis ("…")
30
+ * gap that a UI should render between page links.
31
+ */
32
+ interface WindowedUrl {
33
+ isActive: boolean;
34
+ page: number | null;
35
+ url: string | null;
36
+ }
37
+ interface WindowOptions {
38
+ eachSide?: number;
39
+ }
40
+ interface CursorPaginatorOptions<T> {
41
+ /**
42
+ * The cursor that was used to fetch the current page (e.g. the `cursor`
43
+ * query parameter), if any. Used to derive `previousCursor`.
44
+ */
45
+ currentCursor?: string | null;
46
+
47
+ /**
48
+ * Derives the opaque cursor string for a row. Defaults to `String(row.id)`
49
+ * when the row has an `id`, otherwise `String(row)`.
50
+ */
51
+ getCursor?: (row: T) => string;
52
+
53
+ /**
54
+ * Whether a next page exists. Defaults to `false`.
55
+ */
56
+ hasMore?: boolean;
57
+ }
58
+ interface CursorPaginationMeta {
59
+ nextCursor: string | null;
60
+ nextPageUrl: string | null;
61
+ perPage: number;
62
+ previousCursor: string | null;
63
+ previousPageUrl: string | null;
64
+ }
65
+ interface CursorPaginationResult<Result> {
66
+ data: Result[];
67
+ meta: CursorPaginationMeta;
68
+ }
69
+ interface CursorPaginator$1<Result> extends Array<Result> {
70
+ all: () => Result[];
71
+ baseUrl: (url: string) => this;
72
+ getMeta: () => CursorPaginationMeta;
73
+ getNextCursor: () => string | null;
74
+ getPreviousCursor: () => string | null;
75
+ getUrl: (cursor: string | null) => string | null;
76
+ readonly hasMorePages: boolean;
77
+ readonly isEmpty: boolean;
78
+ readonly perPage: number;
79
+ queryString: (values: Record<string, unknown>) => this;
80
+ toJSON: () => CursorPaginationResult<Result>;
81
+ }
82
+ interface Paginator$1<Result> extends Array<Result> {
83
+ all: () => Result[];
84
+ baseUrl: (url: string) => this;
85
+ currentPage: number;
86
+ readonly firstPage: number;
87
+ getMeta: (namingStrategy?: NamingStrategy) => PaginationMeta;
88
+ getNextPageUrl: () => string | null;
89
+ getPreviousPageUrl: () => string | null;
90
+ getUrl: (page: number) => string;
91
+ getUrlsForRange: (start: number, end: number) => {
92
+ isActive: boolean;
93
+ page: number;
94
+ url: string;
95
+ }[];
96
+ getUrlsForWindow: (options?: WindowOptions) => WindowedUrl[];
97
+ readonly hasMorePages: boolean;
98
+ readonly hasPages: boolean;
99
+ readonly hasTotal: boolean;
100
+ readonly isEmpty: boolean;
101
+ readonly lastPage: number;
102
+ readonly perPage: number;
103
+ queryString: (values: Record<string, unknown>) => this;
104
+ toJSON: (namingStrategy?: NamingStrategy) => PaginationResult<Result>;
105
+ readonly total: number;
106
+ }
107
+ /**
108
+ * Cursor-based paginator for stable infinite-scroll / keyset pagination over
109
+ * large tables. Unlike the offset-based `Paginator`, it exposes opaque
110
+ * `nextCursor` / `previousCursor` values instead of page numbers.
111
+ *
112
+ * Like `Paginator`, the rows you pass are the pre-fetched rows for the current
113
+ * page — they are not sliced. `nextCursor` is derived from the last row via
114
+ * `getCursor`.
115
+ */
116
+ declare class CursorPaginator<T = unknown> extends Array<T> implements CursorPaginator$1<T> {
117
+ static override get [Symbol.species](): ArrayConstructor;
118
+ /**
119
+ * Construct a `CursorPaginator` from an array of rows without spreading them
120
+ * as call arguments (safe for large row sets).
121
+ * @param perPage Rows requested per page (clamped to be at least 1).
122
+ * @param rows The pre-fetched rows for the current page.
123
+ * @param options Current cursor, `hasMore` flag and `getCursor` resolver.
124
+ */
125
+ static fromArray<Result = unknown>(perPage: number, rows: Result[], options?: CursorPaginatorOptions<Result>): CursorPaginator<Result>;
126
+ readonly isEmpty: boolean;
127
+ readonly perPage: number;
128
+ private url;
129
+ private qs;
130
+ private baseQuery;
131
+ private readonly currentCursor;
132
+ private readonly getCursor;
133
+ private readonly hasMore;
134
+ constructor(perPage: number, options?: CursorPaginatorOptions<T>);
135
+ /**
136
+ * A shallow copy of the result rows for the current page (plain `Array`).
137
+ */
138
+ all(): T[];
139
+ /**
140
+ * Define base url for making the pagination links.
141
+ */
142
+ baseUrl(url: string): this;
143
+ /**
144
+ * Define query string to be appended to the pagination links.
145
+ */
146
+ queryString(values: Record<string, unknown>): this;
147
+ /**
148
+ * The cursor pointing at the next page, or `null` when there is no next page.
149
+ */
150
+ getNextCursor(): string | null;
151
+ /**
152
+ * The cursor pointing at the previous page (the cursor of the first row of
153
+ * the current page), or `null` when there is no previous page.
154
+ */
155
+ getPreviousCursor(): string | null;
156
+ /**
157
+ * Returns the url for a given cursor, or `null` when the cursor is `null`.
158
+ */
159
+ getUrl(cursor: string | null): string | null;
160
+ /**
161
+ * Returns JSON meta data for the cursor page.
162
+ */
163
+ getMeta(): CursorPaginationMeta;
164
+ /**
165
+ * Returns JSON representation of the paginated data.
166
+ */
167
+ toJSON(): CursorPaginationResult<T>;
168
+ /**
169
+ * Whether there are more pages to come.
170
+ */
171
+ get hasMorePages(): boolean;
172
+ }
173
+ type UrlsForRange = {
174
+ isActive: boolean;
175
+ page: number;
176
+ url: string;
177
+ }[];
178
+ /**
179
+ * Built-in `snake_case` naming strategy. Use it to emit Laravel/AdonisJS-style
180
+ * meta keys (`per_page`, `last_page`, …).
181
+ */
182
+ declare const snakeCaseNamingStrategy: NamingStrategy;
183
+ /**
184
+ * Simple paginator works with the data set provided by the standard
185
+ * `offset` and `limit` based pagination.
186
+ *
187
+ * `Paginator` is an `Array` subclass that holds **only the rows for the current
188
+ * page**. It does NOT slice the rows you pass in — you are expected to pre-slice
189
+ * the page rows (via your data store's `offset`/`limit`) before constructing it.
190
+ * `total` is the count of *all* matching records, used to compute `lastPage` and
191
+ * the pagination URLs.
192
+ */
193
+ declare class Paginator<T = unknown> extends Array<T> implements Paginator$1<T> {
194
+ /**
195
+ * Ensure inherited Array methods (map/filter/slice/...) return plain Arrays
196
+ * instead of partially-constructed Paginator instances.
197
+ */
198
+ static override get [Symbol.species](): ArrayConstructor;
199
+ /**
200
+ * Construct a `Paginator` from an array of rows. Alias for the array-based
201
+ * constructor; kept for backward compatibility. Safe for arbitrarily large
202
+ * row sets (no `Maximum call stack size exceeded`).
203
+ * @param totalNumber Total number of matching records.
204
+ * @param perPage Rows per page (clamped to be at least 1).
205
+ * @param currentPage The current page number (clamped to be at least 1).
206
+ * @param rows The pre-sliced rows for the current page.
207
+ */
208
+ static fromArray<Result = unknown>(totalNumber: number, perPage: number, currentPage: number, rows: Result[]): Paginator<Result>;
209
+ /**
210
+ * The first page is always 1
211
+ */
212
+ readonly firstPage: number;
213
+ /**
214
+ * Find if results set is empty or not
215
+ */
216
+ readonly isEmpty: boolean;
217
+ /**
218
+ * Current page number. Always clamped to be at least 1.
219
+ */
220
+ currentPage: number;
221
+ private readonly totalNumber;
222
+ private readonly perPageNumber;
223
+ private qs;
224
+ private url;
225
+ /**
226
+ * Pre-serialized query string (without the trailing `page` parameter),
227
+ * recomputed only when `queryString()` changes. Avoids re-iterating and
228
+ * re-serializing `this.qs` on every `getUrl()` call in the `getMeta()` hot path.
229
+ */
230
+ private baseQuery;
231
+ /**
232
+ * The `rows` array is accepted as a single parameter (not spread as call
233
+ * arguments): spreading rows (`new Paginator(t, p, c, ...rows)`) or
234
+ * `this.push(...rows)` throws `RangeError: Maximum call stack size exceeded`
235
+ * around ~100k rows on V8. Index-writing the array avoids that entirely.
236
+ * @param totalNumber Total number of matching records (used for `lastPage`/URL math).
237
+ * @param perPage Rows per page (clamped to be at least 1).
238
+ * @param currentPage The current page number (clamped to be at least 1).
239
+ * @param rows The pre-sliced rows for the current page. They are NOT sliced by the paginator. Defaults to an empty array.
240
+ */
241
+ constructor(totalNumber: number, perPage: number, currentPage: number, rows?: T[]);
242
+ /**
243
+ * The number of rows shown per page.
244
+ */
245
+ get perPage(): number;
246
+ /**
247
+ * A reference to the result rows for the current page.
248
+ *
249
+ * Returns a shallow copy so callers cannot mutate the paginator's backing
250
+ * store, and so the returned value is a plain `Array` (not a `Paginator`).
251
+ */
252
+ all(): T[];
253
+ /**
254
+ * Define base url for making the pagination links.
255
+ */
256
+ baseUrl(url: string): this;
257
+ /**
258
+ * Returns JSON meta data. Pass `snakeCaseNamingStrategy` for
259
+ * Laravel/AdonisJS-style output.
260
+ * @param namingStrategy Optional key-transform applied to every meta key.
261
+ */
262
+ getMeta(namingStrategy?: NamingStrategy): PaginationMeta;
263
+ /**
264
+ * Returns url for the next page.
265
+ */
266
+ getNextPageUrl(): string | null;
267
+ /**
268
+ * Returns URL for the previous page.
269
+ */
270
+ getPreviousPageUrl(): string | null;
271
+ /**
272
+ * Returns url for a given page. Doesn't validate the integrity of the
273
+ * page (only clamps the page number to be at least 1).
274
+ */
275
+ getUrl(page: number): string;
276
+ /**
277
+ * Returns an array of urls under a given inclusive range.
278
+ */
279
+ getUrlsForRange(start: number, end: number): UrlsForRange;
280
+ /**
281
+ * Returns a windowed list of page urls centered on the current page, with
282
+ * `null`-page ellipsis markers for the gaps (e.g. `1 … 4 [5] 6 … 20`).
283
+ *
284
+ * Use the `page === null` entries to render an ellipsis ("…") in your UI.
285
+ */
286
+ getUrlsForWindow(options?: WindowOptions): WindowedUrl[];
287
+ /**
288
+ * Define query string to be appended to the pagination links.
289
+ */
290
+ queryString(values: Record<string, unknown>): this;
291
+ /**
292
+ * Returns JSON representation of the paginated data.
293
+ * @param namingStrategy Optional key-transform applied to the `meta` keys.
294
+ */
295
+ toJSON(namingStrategy?: NamingStrategy): PaginationResult<T>;
296
+ /**
297
+ * Find if there are more pages to come.
298
+ */
299
+ get hasMorePages(): boolean;
300
+ /**
301
+ * Find if there are enough results to be paginated or not.
302
+ */
303
+ get hasPages(): boolean;
304
+ /**
305
+ * Find if there are total records or not. This is not same as
306
+ * `isEmpty`.
307
+ *
308
+ * The `isEmpty` reports about the current set of results. However, `hasTotal`
309
+ * reports about the total number of records, regardless of the current.
310
+ */
311
+ get hasTotal(): boolean;
312
+ /**
313
+ * The Last page number.
314
+ */
315
+ get lastPage(): number;
316
+ /**
317
+ * Casting `total` to a number. Later, we can think of situations
318
+ * to cast it to a bigint.
319
+ */
320
+ get total(): number;
321
+ }
322
+ /**
323
+ * Which OpenAPI version to target. `"3.0"` (default) emits `nullable: true` on
324
+ * nullable URL fields; `"3.1"` emits the JSON-Schema `type: ["string", "null"]`
325
+ * form instead.
326
+ */
327
+ type OpenApiVersion = "3.0" | "3.1";
328
+ interface CreatePaginationMetaSchemaOptions {
329
+ /**
330
+ * Target OpenAPI version. Controls how nullable URL fields are encoded.
331
+ * Defaults to `"3.0"`.
332
+ */
333
+ openApiVersion?: OpenApiVersion;
334
+ }
335
+ interface CreatePaginationSchemaOptions {
336
+ /**
337
+ * The `$ref` pointing to the meta schema component.
338
+ * Defaults to `"#/components/schemas/PaginationData"`.
339
+ */
340
+ metaReference?: string;
341
+ }
342
+ /**
343
+ * Builds an OpenAPI schema object describing the `meta` block returned by
344
+ * `Paginator.getMeta()`.
345
+ *
346
+ * `nextPageUrl` and `previousPageUrl` are nullable at runtime (the paginator
347
+ * returns `null` on the first/last page), so they are emitted as nullable.
348
+ * `firstPageUrl`/`lastPageUrl` are always strings. A `required` array is emitted
349
+ * so generated clients treat every field as present. Pass
350
+ * `{ openApiVersion: "3.1" }` to emit JSON-Schema-style nullability.
351
+ * @param name The schema/component name. Defaults to `"PaginationData"`.
352
+ * @param options Schema-building options.
353
+ */
354
+ declare const createPaginationMetaSchemaObject: (name?: string, options?: CreatePaginationMetaSchemaOptions) => Record<string, OpenAPIV3.SchemaObject>;
355
+ /**
356
+ * Builds an OpenAPI schema object describing a full paginated response
357
+ * (`{ data: Item[], meta: PaginationData }`). Both `data` and `meta` are emitted
358
+ * as `required`.
359
+ * @param name The schema/component name.
360
+ * @param items The schema (or `$ref`) for a single item in `data`.
361
+ * @param metaReferenceOrOptions Either the meta `$ref` string (legacy) or an options object.
362
+ */
363
+ declare const createPaginationSchemaObject: (name: string, items: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject, metaReferenceOrOptions?: string | CreatePaginationSchemaOptions) => Record<string, OpenAPIV3.SchemaObject>;
364
+ /**
365
+ * Create a {@link PaginatorInterface} for the given page of rows.
366
+ * @remarks
367
+ * The `rows` you pass in are treated as the rows for the current page **as-is** —
368
+ * they are NOT sliced. Pre-slice your rows at the data source using the offset
369
+ * (`(page - 1) * perPage`) and `perPage` limit. `total` is the count of all
370
+ * matching records and drives `lastPage`/URL computation.
371
+ * @param page The current page (clamped to be at least 1).
372
+ * @param perPage Rows per page (clamped to be at least 1).
373
+ * @param total Total number of matching records.
374
+ * @param rows The pre-sliced rows for the current page.
375
+ */
376
+ declare const paginate: <Result>(page: number, perPage: number, total: number, rows: Result[]) => Paginator$1<Result>;
377
+ export { type CreatePaginationMetaSchemaOptions, type CreatePaginationSchemaOptions, type CursorPaginationMeta, type CursorPaginationResult, CursorPaginator, type CursorPaginator$1 as CursorPaginatorInterface, type CursorPaginatorOptions, type NamingStrategy, type OpenApiVersion, type PaginationMeta, type PaginationResult, Paginator, type Paginator$1 as PaginatorInterface, type WindowOptions, type WindowedUrl, createPaginationMetaSchemaObject, createPaginationSchemaObject, paginate, snakeCaseNamingStrategy };
package/dist/index.js CHANGED
@@ -1,6 +1 @@
1
- import Paginator from './packem_shared/Paginator-B3QHCcfB.js';
2
- export { createPaginationMetaSchemaObject, createPaginationSchemaObject } from './packem_shared/createPaginationMetaSchemaObject-AoC1C8S-.js';
3
-
4
- const paginate = (page, perPage, total, rows) => new Paginator(total, Number(perPage), Number(page), ...rows);
5
-
6
- export { Paginator, paginate };
1
+ import o from"./packem_shared/Paginator-BvWV_Gen.js";import{snakeCaseNamingStrategy as c}from"./packem_shared/Paginator-BvWV_Gen.js";import{default as p}from"./packem_shared/CursorPaginator-6bNX6Dri.js";import{createPaginationMetaSchemaObject as x,createPaginationSchemaObject as P}from"./packem_shared/createPaginationMetaSchemaObject-BLaJWuDt.js";const i=(a,r,t,e)=>o.fromArray(t,r,a,e);export{p as CursorPaginator,o as Paginator,x as createPaginationMetaSchemaObject,P as createPaginationSchemaObject,i as paginate,c as snakeCaseNamingStrategy};
@@ -0,0 +1 @@
1
+ const h=s=>s!==null&&typeof s=="object"&&"id"in s?String(s.id):String(s);class o extends Array{static get[Symbol.species](){return Array}static fromArray(r,t,i={}){const e=new o(r,i),{length:n}=t;e.length=n;for(let u=0;u<n;u++)e[u]=t[u];return e.isEmpty=n===0,e}isEmpty;perPage;url="/";qs={};baseQuery="";currentCursor;getCursor;hasMore;constructor(r,t={}){super(),this.perPage=Number.isFinite(r)&&r>0?Math.trunc(r):1,this.currentCursor=t.currentCursor??null,this.getCursor=t.getCursor??h,this.hasMore=t.hasMore??!1,this.isEmpty=!0}all(){return[...this]}baseUrl(r){return this.url=r,this}queryString(r){this.qs=r;const t=new URLSearchParams;for(const[i,e]of Object.entries(this.qs))e!=null&&t.append(i,String(e));return this.baseQuery=t.toString(),this}getNextCursor(){return!this.hasMorePages||this.length===0?null:this.getCursor(this[this.length-1])}getPreviousCursor(){return this.currentCursor===null||this.length===0?null:this.getCursor(this[0])}getUrl(r){if(r===null)return null;const t=`cursor=${encodeURIComponent(r)}`;return this.baseQuery===""?`${this.url}?${t}`:`${this.url}?${this.baseQuery}&${t}`}getMeta(){const r=this.getNextCursor(),t=this.getPreviousCursor();return{nextCursor:r,nextPageUrl:this.getUrl(r),perPage:this.perPage,previousCursor:t,previousPageUrl:this.getUrl(t)}}toJSON(){return{data:this.all(),meta:this.getMeta()}}get hasMorePages(){return this.hasMore}}export{o as default};
@@ -0,0 +1 @@
1
+ const h=n=>n,P={firstPage:"first_page",firstPageUrl:"first_page_url",lastPage:"last_page",lastPageUrl:"last_page_url",nextPageUrl:"next_page_url",page:"page",perPage:"per_page",previousPageUrl:"previous_page_url",total:"total"},c=n=>P[n]??n;class o extends Array{static get[Symbol.species](){return Array}static fromArray(r,e,s,t){return new o(r,e,s,t)}firstPage=1;isEmpty;currentPage;totalNumber;perPageNumber;qs={};url="/";baseQuery="";constructor(r,e,s,t=[]){super();const{length:a}=t;this.length=a;for(let i=0;i<a;i++)this[i]=t[i];this.totalNumber=Number.isFinite(r)?Math.max(Math.trunc(r),0):0,this.perPageNumber=Number.isFinite(e)&&e>0?Math.trunc(e):1,this.currentPage=Number.isFinite(s)?Math.max(Math.trunc(s),1):1,this.isEmpty=a===0}get perPage(){return this.perPageNumber}all(){return[...this]}baseUrl(r){return this.url=r,this}getMeta(r=h){const e={firstPage:this.firstPage,firstPageUrl:this.getUrl(1),lastPage:this.lastPage,lastPageUrl:this.getUrl(this.lastPage),nextPageUrl:this.getNextPageUrl(),page:this.currentPage,perPage:this.perPage,previousPageUrl:this.getPreviousPageUrl(),total:this.total};if(r===h)return e;const s={};for(const[t,a]of Object.entries(e))s[r(t)]=a;return s}getNextPageUrl(){return this.hasMorePages?this.getUrl(this.currentPage+1):null}getPreviousPageUrl(){return this.currentPage>1?this.getUrl(this.currentPage-1):null}getUrl(r){const e=`page=${encodeURIComponent(String(Math.max(r,1)))}`;return this.baseQuery===""?`${this.url}?${e}`:`${this.url}?${this.baseQuery}&${e}`}getUrlsForRange(r,e){const s=[];for(let t=r;t<=e;t++)s.push({isActive:t===this.currentPage,page:t,url:this.getUrl(t)});return s}getUrlsForWindow(r={}){const e=r.eachSide,s=typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.trunc(e):2,{lastPage:t}=this;if(t<=s*2+3)return this.getUrlsForRange(1,t).map(l=>({...l}));const a=Math.max(this.currentPage-s,1),i=Math.min(this.currentPage+s,t),g=[],u={isActive:!1,page:null,url:null};a>1&&(g.push({isActive:this.currentPage===1,page:1,url:this.getUrl(1)}),a>2&&g.push({...u}));for(const l of this.getUrlsForRange(a,i))g.push(l);return i<t&&(i<t-1&&g.push({...u}),g.push({isActive:this.currentPage===t,page:t,url:this.getUrl(t)})),g}queryString(r){this.qs=r;const e=new URLSearchParams;for(const[s,t]of Object.entries(this.qs))t!=null&&e.append(s,String(t));return this.baseQuery=e.toString(),this}toJSON(r){return{data:this.all(),meta:this.getMeta(r)}}get hasMorePages(){return this.lastPage>this.currentPage}get hasPages(){return this.lastPage!==1}get hasTotal(){return this.total>0}get lastPage(){return Math.max(Math.ceil(this.total/this.perPageNumber),1)}get total(){return this.totalNumber}}export{o as default,c as snakeCaseNamingStrategy};
@@ -0,0 +1 @@
1
+ const n=["firstPage","firstPageUrl","lastPage","lastPageUrl","nextPageUrl","page","perPage","previousPageUrl","total"],r=(e,a)=>a==="3.1"?{description:e,type:["string","null"]}:{description:e,nullable:!0,type:"string"},o=(e="PaginationData",a={})=>{const{openApiVersion:t="3.0"}=a;return{[e]:{properties:{firstPage:{description:"Returns the number for the first page. It is always 1",minimum:0,type:"integer"},firstPageUrl:{description:"The URL for the first page",type:"string"},lastPage:{description:"Returns the value for the last page by taking the total of rows into account",minimum:0,type:"integer"},lastPageUrl:{description:"The URL for the last page",type:"string"},nextPageUrl:r("The URL for the next page, or null when on the last page",t),page:{description:"Current page number",minimum:1,type:"integer"},perPage:{description:"Returns the value for the limit passed to the paginate method",minimum:0,type:"integer"},previousPageUrl:r("The URL for the previous page, or null when on the first page",t),total:{description:"Holds the value for the total number of rows in the database",minimum:0,type:"integer"}},required:[...n],type:"object",xml:{name:e}}}},s=(e,a,t="#/components/schemas/PaginationData")=>{const i=typeof t=="string"?t:t.metaReference??"#/components/schemas/PaginationData";return{[e]:{properties:{data:{items:a,type:"array",xml:{name:"data",wrapped:!0}},meta:{$ref:i}},required:["data","meta"],type:"object",xml:{name:e}}}};export{o as createPaginationMetaSchemaObject,s as createPaginationSchemaObject};
package/package.json CHANGED
@@ -1,21 +1,19 @@
1
1
  {
2
2
  "name": "@visulima/pagination",
3
- "version": "5.0.0-alpha.8",
3
+ "version": "5.0.0",
4
4
  "description": "Simple Pagination for Node.",
5
5
  "keywords": [
6
6
  "anolilab",
7
- "visulima",
8
- "pagination",
9
- "paginator",
10
- "offset",
11
7
  "limit",
8
+ "offset",
12
9
  "page",
13
- "paging"
10
+ "pagination",
11
+ "paginator",
12
+ "paging",
13
+ "visulima"
14
14
  ],
15
15
  "homepage": "https://visulima.com/packages/pagination/",
16
- "bugs": {
17
- "url": "https://github.com/visulima/visulima/issues"
18
- },
16
+ "bugs": "https://github.com/visulima/visulima/issues",
19
17
  "repository": {
20
18
  "type": "git",
21
19
  "url": "git+https://github.com/visulima/visulima.git",
@@ -51,11 +49,8 @@
51
49
  "CHANGELOG.md",
52
50
  "LICENSE.md"
53
51
  ],
54
- "dependencies": {},
55
- "peerDependencies": {},
56
- "optionalDependencies": {},
57
52
  "engines": {
58
- "node": ">=22.13 <=25.x"
53
+ "node": "^22.14.0 || >=24.10.0"
59
54
  },
60
55
  "os": [
61
56
  "darwin",