@visulima/pagination 3.0.27 → 4.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/CHANGELOG.md +28 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/packem_shared/Paginator-qLvq_0YE.js +1 -0
- package/dist/packem_shared/createPaginationMetaSchemaObject-DGZPqai2.js +1 -0
- package/package.json +5 -20
- package/dist/index.cjs +0 -15
- package/dist/index.d.cts +0 -399
- package/dist/index.d.mts +0 -399
- package/dist/index.mjs +0 -8
- package/dist/packem_shared/Paginator-BMGr4V_x.cjs +0 -529
- package/dist/packem_shared/Paginator-CG8aQkMQ.mjs +0 -527
- package/dist/packem_shared/createPaginationMetaSchemaObject-B2_MNxET.cjs +0 -86
- package/dist/packem_shared/createPaginationMetaSchemaObject-fEupXBbv.mjs +0 -81
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## @visulima/pagination [4.0.0](https://github.com/visulima/visulima/compare/@visulima/pagination@3.0.27...@visulima/pagination@4.0.0) (2025-10-15)
|
|
2
|
+
|
|
3
|
+
### ⚠ BREAKING CHANGES
|
|
4
|
+
|
|
5
|
+
* Adjusted the node engine requirement to support versions 20.19 and above.
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* Adjusted the node engine requirement to support versions 20.19 and above ([86ae4c4](https://github.com/visulima/visulima/commit/86ae4c4c7ed71328d819603dd5c2a87ab8f4d030))
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* update @visulima/packem to 2.0.0-alpha.30 across multiple packages for improved compatibility ([27b346e](https://github.com/visulima/visulima/commit/27b346eaa1c0fb0e420d9a9824482028307f4249))
|
|
14
|
+
|
|
15
|
+
### Styles
|
|
16
|
+
|
|
17
|
+
* cs fixes ([6570d56](https://github.com/visulima/visulima/commit/6570d568a80bd3fd4bfd73c824dc78f7e3a372f8))
|
|
18
|
+
|
|
19
|
+
### Miscellaneous Chores
|
|
20
|
+
|
|
21
|
+
* add Secretlint configuration and refine ESLint settings for improved code quality ([25f0c3c](https://github.com/visulima/visulima/commit/25f0c3c9fdb98dc2f732521faa4e808182278694))
|
|
22
|
+
* **deps:** update build scripts and remove cross-env dependency ([7510e82](https://github.com/visulima/visulima/commit/7510e826b9235a0013fe61c82a7eb333bc4cbb78))
|
|
23
|
+
* **pagination:** update devDependencies ([dc28d9f](https://github.com/visulima/visulima/commit/dc28d9ff81d29a72103b58fb7f05441eb16f1708))
|
|
24
|
+
* update dependencies and fix linting issues ([0e802fe](https://github.com/visulima/visulima/commit/0e802fe02bb9ed791659cb5f3c77605ae5b42ec8))
|
|
25
|
+
* update package dependencies across multiple packages for improved compatibility and performance ([9567591](https://github.com/visulima/visulima/commit/9567591c415da3002f3a4fe08f8caf7ce01ca5f7))
|
|
26
|
+
* update package.json and pnpm-lock.yaml to include publint@0.3.12 and adjust build/test commands to exclude shared-utils ([1f7b3c0](https://github.com/visulima/visulima/commit/1f7b3c0381d77edfeec80ea1bf57b3469e929414))
|
|
27
|
+
* updated dev dependencies ([2433ed5](https://github.com/visulima/visulima/commit/2433ed5fb662e0303c37edee8ddc21b46c21263f))
|
|
28
|
+
|
|
1
29
|
## @visulima/pagination [3.0.27](https://github.com/visulima/visulima/compare/@visulima/pagination@3.0.26...@visulima/pagination@3.0.27) (2025-03-07)
|
|
2
30
|
|
|
3
31
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -396,4 +396,5 @@ declare const createPaginationSchemaObject: (name: string, items: OpenAPIV3.Refe
|
|
|
396
396
|
|
|
397
397
|
declare const paginate: <Result>(page: number, perPage: number, total: number, rows: Result[]) => Paginator$1<Result>;
|
|
398
398
|
|
|
399
|
-
export {
|
|
399
|
+
export { Paginator, createPaginationMetaSchemaObject, createPaginationSchemaObject, paginate };
|
|
400
|
+
export type { PaginationMeta, PaginationResult, Paginator$1 as PaginatorInterface };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var t=(e,a)=>o(e,"name",{value:a,configurable:!0});import i from"./packem_shared/Paginator-qLvq_0YE.js";import{createPaginationMetaSchemaObject as P,createPaginationSchemaObject as j}from"./packem_shared/createPaginationMetaSchemaObject-DGZPqai2.js";var c=Object.defineProperty,m=t((e,a)=>c(e,"name",{value:a,configurable:!0}),"e");const p=m((e,a,r,n)=>new i(r,Number(a),Number(e),...n),"paginate");export{i as Paginator,P as createPaginationMetaSchemaObject,j as createPaginationSchemaObject,p as paginate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Y=Object.defineProperty;var w=(t,e)=>Y(t,"name",{value:e,configurable:!0});var Z=Object.defineProperty,H=w((t,e)=>Z(t,"name",{value:e,configurable:!0}),"e");const tt=String.prototype.replace,et=/%20/g,q={RFC1738:"RFC1738",RFC3986:"RFC3986"},M={RFC1738:H(function(t){return tt.call(t,et,"+")},"RFC1738"),RFC3986:H(function(t){return String(t)},"RFC3986")},rt=q.RFC1738,W=q.RFC3986;var ot=Object.defineProperty,h=w((t,e)=>ot(t,"name",{value:e,configurable:!0}),"u$1");const k=Object.prototype.hasOwnProperty,O=Array.isArray,d=(function(){const t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),nt=h(function(t){for(;t.length>1;){const e=t.pop(),o=e.obj[e.prop];if(O(o)){const r=[];for(let l=0;l<o.length;++l)typeof o[l]<"u"&&r.push(o[l]);e.obj[e.prop]=r}}},"compactQueue"),at=h(function(t,e){const o=e&&e.plainObjects?Object.create(null):{};for(let r=0;r<t.length;++r)typeof t[r]<"u"&&(o[r]=t[r]);return o},"arrayToObject");h(w(function t(e,o,r){if(!o)return e;if(typeof o!="object"){if(O(e))e.push(o);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!k.call(Object.prototype,o))&&(e[o]=!0);else return[e,o];return e}if(!e||typeof e!="object")return[e].concat(o);let l=e;return O(e)&&!O(o)&&(l=at(e,r)),O(e)&&O(o)?(o.forEach(function(n,s){if(k.call(e,s)){const c=e[s];c&&typeof c=="object"&&n&&typeof n=="object"?e[s]=t(c,n,r):e.push(n)}else e[s]=n}),e):Object.keys(o).reduce(function(n,s){const c=o[s];return k.call(n,s)?n[s]=t(n[s],c,r):n[s]=c,n},l)},"i"),"merge");h(function(t,e){return Object.keys(e).reduce(function(o,r){return o[r]=e[r],o},t)},"assignSingleSource");h(function(t,e,o){const r=t.replace(/\+/g," ");if(o==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},"decode");const I=1024,lt=h(function(t,e,o,r,l){if(t.length===0)return t;let n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),o==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let s="";for(let c=0;c<n.length;c+=I){const p=n.length>=I?n.slice(c,c+I):n,u=[];for(let g=0;g<p.length;++g){let a=p.charCodeAt(g);if(a===45||a===46||a===95||a===126||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||l===rt&&(a===40||a===41)){u[u.length]=p.charAt(g);continue}if(a<128){u[u.length]=d[a];continue}if(a<2048){u[u.length]=d[192|a>>6]+d[128|a&63];continue}if(a<55296||a>=57344){u[u.length]=d[224|a>>12]+d[128|a>>6&63]+d[128|a&63];continue}g+=1,a=65536+((a&1023)<<10|p.charCodeAt(g)&1023),u[u.length]=d[240|a>>18]+d[128|a>>12&63]+d[128|a>>6&63]+d[128|a&63]}s+=u.join("")}return s},"encode");h(function(t){const e=[{obj:{o:t},prop:"o"}],o=[];for(let r=0;r<e.length;++r){const l=e[r],n=l.obj[l.prop],s=Object.keys(n);for(let c=0;c<s.length;++c){const p=s[c],u=n[p];typeof u=="object"&&u!==null&&o.indexOf(u)===-1&&(e.push({obj:n,prop:p}),o.push(u))}}return nt(e),t},"compact");h(function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},"isRegExp");const it=h(function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},"isBuffer");h(function(t,e){return[].concat(t,e)},"combine");const V=h(function(t,e){if(O(t)){const o=[];for(let r=0;r<t.length;r+=1)o.push(e(t[r]));return o}return e(t)},"maybeMap");var st=Object.defineProperty,b=w((t,e)=>st(t,"name",{value:e,configurable:!0}),"u");const ct=Object.prototype.hasOwnProperty,J={brackets:b(function(t){return t+"[]"},"brackets"),comma:"comma",indices:b(function(t,e){return t+"["+e+"]"},"indices"),repeat:b(function(t){return t},"repeat")},m=Array.isArray,ut=Array.prototype.push,G=b(function(t,e){ut.apply(t,m(e)?e:[e])},"pushToArray"),ft=Date.prototype.toISOString,$=W,f={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:lt,encodeValuesOnly:!1,format:$,formatter:M[$],indices:!1,serializeDate:b(function(t){return ft.call(t)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},pt=b(function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},"isNonNullishPrimitive"),T={},_=b(function(t,e,o,r,l,n,s,c,p,u,g,a,j,P,E,N,D,x){let i=t,A=x,U=0,K=!1;for(;(A=A.get(T))!==void 0&&!K;){const y=A.get(t);if(U+=1,typeof y<"u"){if(y===U)throw new RangeError("Cyclic object value");K=!0}typeof A.get(T)>"u"&&(U=0)}if(typeof u=="function"?i=u(e,i):i instanceof Date?i=j(i):o==="comma"&&m(i)&&(i=V(i,function(y){return y instanceof Date?j(y):y})),i===null){if(n)return p&&!N?p(e,f.encoder,D,"key",P):e;i=""}if(pt(i)||it(i)){if(p){const y=N?e:p(e,f.encoder,D,"key",P);return[E(y)+"="+E(p(i,f.encoder,D,"value",P))]}return[E(e)+"="+E(String(i))]}const C=[];if(typeof i>"u")return C;let R;if(o==="comma"&&m(i))N&&p&&(i=V(i,p)),R=[{value:i.length>0?i.join(",")||null:void 0}];else if(m(u))R=u;else{const y=Object.keys(i);R=g?y.sort(g):y}const z=c?e.replace(/\./g,"%2E"):e,F=r&&m(i)&&i.length===1?z+"[]":z;if(l&&m(i)&&i.length===0)return F+"[]";for(let y=0;y<R.length;++y){const v=R[y],Q=typeof v=="object"&&typeof v.value<"u"?v.value:i[v];if(s&&Q===null)continue;const S=a&&c?v.replace(/\./g,"%2E"):v,X=m(i)?typeof o=="function"?o(F,S):F:F+(a?"."+S:"["+S+"]");x.set(t,U);const B=new WeakMap;B.set(T,x),G(C,_(Q,X,o,r,l,n,s,c,o==="comma"&&N&&m(i)?null:p,u,g,a,j,P,E,N,D,B))}return C},"stringify"),yt=b(function(t){if(!t)return f;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");const e=t.charset||f.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let o=W;if(typeof t.format<"u"){if(!ct.call(M,t.format))throw new TypeError("Unknown format option provided.");o=t.format}const r=M[o];let l=f.filter;(typeof t.filter=="function"||m(t.filter))&&(l=t.filter);let n;if(t.arrayFormat in J?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=f.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const s=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:f.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:f.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:f.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:f.charsetSentinel,commaRoundTrip:t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?f.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:f.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:f.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:f.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:f.encodeValuesOnly,filter:l,format:o,formatter:r,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:f.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:f.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:f.strictNullHandling}},"normalizeStringifyOptions");function L(t,e){let o=t;const r=yt(e);let l,n;typeof r.filter=="function"?(n=r.filter,o=n("",o)):m(r.filter)&&(n=r.filter,l=n);const s=[];if(typeof o!="object"||o===null)return"";const c=J[r.arrayFormat],p=c==="comma"&&r.commaRoundTrip;l||(l=Object.keys(o)),r.sort&&l.sort(r.sort);const u=new WeakMap;for(let j=0;j<l.length;++j){const P=l[j];r.skipNulls&&o[P]===null||G(s,_(o[P],P,c,p,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,u))}const g=s.join(r.delimiter);let a=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?a+="utf8=%26%2310003%3B&":a+="utf8=%E2%9C%93&"),g.length>0?a+g:""}w(L,"stringify");b(L,"stringify");var gt=Object.defineProperty,ht=w((t,e)=>gt(t,"name",{value:e,configurable:!0}),"n");class mt extends Array{static{w(this,"g")}constructor(e,o,r,...l){super(...l),this.totalNumber=e,this.perPage=o,this.currentPage=r,this.totalNumber=Number(e),this.rows=l,this.isEmpty=this.rows.length===0}static{ht(this,"Paginator")}firstPage=1;isEmpty;qs={};rows;url="/";all(){return this.rows}baseUrl(e){return this.url=e,this}getMeta(){return{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}}getNextPageUrl(){return this.hasMorePages?this.getUrl(this.currentPage+1):null}getPreviousPageUrl(){return this.currentPage>1?this.getUrl(this.currentPage-1):null}getUrl(e){const o=L({...this.qs,page:Math.max(e,1)});return`${this.url}?${o}`}getUrlsForRange(e,o){const r=[];for(let l=e;l<=o;l++)r.push({isActive:l===this.currentPage,page:l,url:this.getUrl(l)});return r}queryString(e){return this.qs=e,this}toJSON(){return{data:this.all(),meta:this.getMeta()}}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.perPage),1)}get total(){return Number(this.totalNumber)}}export{mt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var a=(e,t)=>n(e,"name",{value:t,configurable:!0});var o=Object.defineProperty,r=a((e,t)=>o(e,"name",{value:t,configurable:!0}),"r");const s=r((e="PaginationData")=>({[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:{description:"The URL for the next page",type:"string"},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:{description:"The URL for the previous page",type:"string"},total:{description:"Holds the value for the total number of rows in the database",minimum:0,type:"integer"}},type:"object",xml:{name:e}}}),"createPaginationMetaSchemaObject"),m=r((e,t,i="#/components/schemas/PaginationData")=>({[e]:{properties:{data:{items:t,type:"array",xml:{name:"data",wrapped:!0}},meta:{$ref:i}},type:"object",xml:{name:e}}}),"createPaginationSchemaObject");export{s as createPaginationMetaSchemaObject,m as createPaginationSchemaObject};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/pagination",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Simple Pagination for Node.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -33,29 +33,14 @@
|
|
|
33
33
|
"email": "d.bannert@anolilab.de"
|
|
34
34
|
},
|
|
35
35
|
"sideEffects": false,
|
|
36
|
+
"type": "module",
|
|
36
37
|
"exports": {
|
|
37
38
|
".": {
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"default": "./dist/index.cjs"
|
|
41
|
-
},
|
|
42
|
-
"import": {
|
|
43
|
-
"types": "./dist/index.d.mts",
|
|
44
|
-
"default": "./dist/index.mjs"
|
|
45
|
-
}
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"default": "./dist/index.js"
|
|
46
41
|
},
|
|
47
42
|
"./package.json": "./package.json"
|
|
48
43
|
},
|
|
49
|
-
"main": "dist/index.cjs",
|
|
50
|
-
"module": "dist/index.mjs",
|
|
51
|
-
"types": "dist/index.d.ts",
|
|
52
|
-
"typesVersions": {
|
|
53
|
-
">=5.0": {
|
|
54
|
-
".": [
|
|
55
|
-
"./dist/index.d.ts"
|
|
56
|
-
]
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
44
|
"files": [
|
|
60
45
|
"dist/**",
|
|
61
46
|
"README.md",
|
|
@@ -63,7 +48,7 @@
|
|
|
63
48
|
"LICENSE.md"
|
|
64
49
|
],
|
|
65
50
|
"engines": {
|
|
66
|
-
"node": ">=
|
|
51
|
+
"node": ">=20.19 <=24.x"
|
|
67
52
|
},
|
|
68
53
|
"os": [
|
|
69
54
|
"darwin",
|
package/dist/index.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
const Paginator = require('./packem_shared/Paginator-BMGr4V_x.cjs');
|
|
6
|
-
const createPaginationMetaSchemaObject = require('./packem_shared/createPaginationMetaSchemaObject-B2_MNxET.cjs');
|
|
7
|
-
|
|
8
|
-
var __defProp = Object.defineProperty;
|
|
9
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
-
const paginate = /* @__PURE__ */ __name((page, perPage, total, rows) => new Paginator(total, Number(perPage), Number(page), ...rows), "paginate");
|
|
11
|
-
|
|
12
|
-
exports.Paginator = Paginator;
|
|
13
|
-
exports.createPaginationMetaSchemaObject = createPaginationMetaSchemaObject.createPaginationMetaSchemaObject;
|
|
14
|
-
exports.createPaginationSchemaObject = createPaginationMetaSchemaObject.createPaginationSchemaObject;
|
|
15
|
-
exports.paginate = paginate;
|
package/dist/index.d.cts
DELETED
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
interface PaginationMeta {
|
|
2
|
-
firstPage: number;
|
|
3
|
-
firstPageUrl: string | null;
|
|
4
|
-
lastPage: number;
|
|
5
|
-
lastPageUrl: string | null;
|
|
6
|
-
nextPageUrl: string | null;
|
|
7
|
-
page: number;
|
|
8
|
-
perPage: number;
|
|
9
|
-
previousPageUrl: string | null;
|
|
10
|
-
total: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface PaginationResult<Result> {
|
|
14
|
-
data: Result[];
|
|
15
|
-
meta: PaginationMeta;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface Paginator$1<Result> extends Array<Result> {
|
|
19
|
-
all: () => Result[];
|
|
20
|
-
|
|
21
|
-
baseUrl: (url: string) => this;
|
|
22
|
-
readonly currentPage: number;
|
|
23
|
-
readonly firstPage: number;
|
|
24
|
-
getMeta: () => PaginationMeta;
|
|
25
|
-
getNextPageUrl: () => string | null;
|
|
26
|
-
getPreviousPageUrl: () => string | null;
|
|
27
|
-
getUrl: (page: number) => string;
|
|
28
|
-
getUrlsForRange: (start: number, end: number) => { isActive: boolean; page: number; url: string }[];
|
|
29
|
-
readonly hasMorePages: boolean;
|
|
30
|
-
|
|
31
|
-
readonly hasPages: boolean;
|
|
32
|
-
readonly hasTotal: boolean;
|
|
33
|
-
readonly isEmpty: boolean;
|
|
34
|
-
readonly lastPage: number;
|
|
35
|
-
readonly perPage: number;
|
|
36
|
-
queryString: (values: Record<string, unknown>) => this;
|
|
37
|
-
toJSON: () => PaginationResult<Result>;
|
|
38
|
-
readonly total: number;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
type UrlsForRange = {
|
|
42
|
-
isActive: boolean;
|
|
43
|
-
page: number;
|
|
44
|
-
url: string;
|
|
45
|
-
}[];
|
|
46
|
-
declare class Paginator<T = unknown> extends Array<T> implements Paginator$1<T> {
|
|
47
|
-
private readonly totalNumber;
|
|
48
|
-
readonly perPage: number;
|
|
49
|
-
currentPage: number;
|
|
50
|
-
readonly firstPage: number;
|
|
51
|
-
readonly isEmpty: boolean;
|
|
52
|
-
private qs;
|
|
53
|
-
private readonly rows;
|
|
54
|
-
private url;
|
|
55
|
-
constructor(totalNumber: number, perPage: number, currentPage: number, ...rows: T[]);
|
|
56
|
-
all(): T[];
|
|
57
|
-
baseUrl(url: string): this;
|
|
58
|
-
getMeta(): PaginationMeta;
|
|
59
|
-
getNextPageUrl(): string | null;
|
|
60
|
-
getPreviousPageUrl(): string | null;
|
|
61
|
-
getUrl(page: number): string;
|
|
62
|
-
getUrlsForRange(start: number, end: number): UrlsForRange;
|
|
63
|
-
queryString(values: Record<string, unknown>): this;
|
|
64
|
-
toJSON(): PaginationResult<T>;
|
|
65
|
-
get hasMorePages(): boolean;
|
|
66
|
-
get hasPages(): boolean;
|
|
67
|
-
get hasTotal(): boolean;
|
|
68
|
-
get lastPage(): number;
|
|
69
|
-
get total(): number;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
declare namespace OpenAPIV3 {
|
|
73
|
-
interface Document<T extends {} = {}> {
|
|
74
|
-
openapi: string;
|
|
75
|
-
info: InfoObject;
|
|
76
|
-
servers?: ServerObject[];
|
|
77
|
-
paths: PathsObject<T>;
|
|
78
|
-
components?: ComponentsObject;
|
|
79
|
-
security?: SecurityRequirementObject[];
|
|
80
|
-
tags?: TagObject[];
|
|
81
|
-
externalDocs?: ExternalDocumentationObject;
|
|
82
|
-
'x-express-openapi-additional-middleware'?: (((request: any, response: any, next: any) => Promise<void>) | ((request: any, response: any, next: any) => void))[];
|
|
83
|
-
'x-express-openapi-validation-strict'?: boolean;
|
|
84
|
-
}
|
|
85
|
-
interface InfoObject {
|
|
86
|
-
title: string;
|
|
87
|
-
description?: string;
|
|
88
|
-
termsOfService?: string;
|
|
89
|
-
contact?: ContactObject;
|
|
90
|
-
license?: LicenseObject;
|
|
91
|
-
version: string;
|
|
92
|
-
}
|
|
93
|
-
interface ContactObject {
|
|
94
|
-
name?: string;
|
|
95
|
-
url?: string;
|
|
96
|
-
email?: string;
|
|
97
|
-
}
|
|
98
|
-
interface LicenseObject {
|
|
99
|
-
name: string;
|
|
100
|
-
url?: string;
|
|
101
|
-
}
|
|
102
|
-
interface ServerObject {
|
|
103
|
-
url: string;
|
|
104
|
-
description?: string;
|
|
105
|
-
variables?: {
|
|
106
|
-
[variable: string]: ServerVariableObject;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
interface ServerVariableObject {
|
|
110
|
-
enum?: string[];
|
|
111
|
-
default: string;
|
|
112
|
-
description?: string;
|
|
113
|
-
}
|
|
114
|
-
interface PathsObject<T extends {} = {}, P extends {} = {}> {
|
|
115
|
-
[pattern: string]: (PathItemObject<T> & P) | undefined;
|
|
116
|
-
}
|
|
117
|
-
enum HttpMethods {
|
|
118
|
-
GET = "get",
|
|
119
|
-
PUT = "put",
|
|
120
|
-
POST = "post",
|
|
121
|
-
DELETE = "delete",
|
|
122
|
-
OPTIONS = "options",
|
|
123
|
-
HEAD = "head",
|
|
124
|
-
PATCH = "patch",
|
|
125
|
-
TRACE = "trace"
|
|
126
|
-
}
|
|
127
|
-
type PathItemObject<T extends {} = {}> = {
|
|
128
|
-
$ref?: string;
|
|
129
|
-
summary?: string;
|
|
130
|
-
description?: string;
|
|
131
|
-
servers?: ServerObject[];
|
|
132
|
-
parameters?: (ReferenceObject | ParameterObject)[];
|
|
133
|
-
} & {
|
|
134
|
-
[method in HttpMethods]?: OperationObject<T>;
|
|
135
|
-
};
|
|
136
|
-
type OperationObject<T extends {} = {}> = {
|
|
137
|
-
tags?: string[];
|
|
138
|
-
summary?: string;
|
|
139
|
-
description?: string;
|
|
140
|
-
externalDocs?: ExternalDocumentationObject;
|
|
141
|
-
operationId?: string;
|
|
142
|
-
parameters?: (ReferenceObject | ParameterObject)[];
|
|
143
|
-
requestBody?: ReferenceObject | RequestBodyObject;
|
|
144
|
-
responses: ResponsesObject;
|
|
145
|
-
callbacks?: {
|
|
146
|
-
[callback: string]: ReferenceObject | CallbackObject;
|
|
147
|
-
};
|
|
148
|
-
deprecated?: boolean;
|
|
149
|
-
security?: SecurityRequirementObject[];
|
|
150
|
-
servers?: ServerObject[];
|
|
151
|
-
} & T;
|
|
152
|
-
interface ExternalDocumentationObject {
|
|
153
|
-
description?: string;
|
|
154
|
-
url: string;
|
|
155
|
-
}
|
|
156
|
-
interface ParameterObject extends ParameterBaseObject {
|
|
157
|
-
name: string;
|
|
158
|
-
in: string;
|
|
159
|
-
}
|
|
160
|
-
interface HeaderObject extends ParameterBaseObject {
|
|
161
|
-
}
|
|
162
|
-
interface ParameterBaseObject {
|
|
163
|
-
description?: string;
|
|
164
|
-
required?: boolean;
|
|
165
|
-
deprecated?: boolean;
|
|
166
|
-
allowEmptyValue?: boolean;
|
|
167
|
-
style?: string;
|
|
168
|
-
explode?: boolean;
|
|
169
|
-
allowReserved?: boolean;
|
|
170
|
-
schema?: ReferenceObject | SchemaObject;
|
|
171
|
-
example?: any;
|
|
172
|
-
examples?: {
|
|
173
|
-
[media: string]: ReferenceObject | ExampleObject;
|
|
174
|
-
};
|
|
175
|
-
content?: {
|
|
176
|
-
[media: string]: MediaTypeObject;
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
type NonArraySchemaObjectType = 'boolean' | 'object' | 'number' | 'string' | 'integer';
|
|
180
|
-
type ArraySchemaObjectType = 'array';
|
|
181
|
-
type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
|
|
182
|
-
interface ArraySchemaObject extends BaseSchemaObject {
|
|
183
|
-
type: ArraySchemaObjectType;
|
|
184
|
-
items: ReferenceObject | SchemaObject;
|
|
185
|
-
}
|
|
186
|
-
interface NonArraySchemaObject extends BaseSchemaObject {
|
|
187
|
-
type?: NonArraySchemaObjectType;
|
|
188
|
-
}
|
|
189
|
-
interface BaseSchemaObject {
|
|
190
|
-
title?: string;
|
|
191
|
-
description?: string;
|
|
192
|
-
format?: string;
|
|
193
|
-
default?: any;
|
|
194
|
-
multipleOf?: number;
|
|
195
|
-
maximum?: number;
|
|
196
|
-
exclusiveMaximum?: boolean;
|
|
197
|
-
minimum?: number;
|
|
198
|
-
exclusiveMinimum?: boolean;
|
|
199
|
-
maxLength?: number;
|
|
200
|
-
minLength?: number;
|
|
201
|
-
pattern?: string;
|
|
202
|
-
additionalProperties?: boolean | ReferenceObject | SchemaObject;
|
|
203
|
-
maxItems?: number;
|
|
204
|
-
minItems?: number;
|
|
205
|
-
uniqueItems?: boolean;
|
|
206
|
-
maxProperties?: number;
|
|
207
|
-
minProperties?: number;
|
|
208
|
-
required?: string[];
|
|
209
|
-
enum?: any[];
|
|
210
|
-
properties?: {
|
|
211
|
-
[name: string]: ReferenceObject | SchemaObject;
|
|
212
|
-
};
|
|
213
|
-
allOf?: (ReferenceObject | SchemaObject)[];
|
|
214
|
-
oneOf?: (ReferenceObject | SchemaObject)[];
|
|
215
|
-
anyOf?: (ReferenceObject | SchemaObject)[];
|
|
216
|
-
not?: ReferenceObject | SchemaObject;
|
|
217
|
-
nullable?: boolean;
|
|
218
|
-
discriminator?: DiscriminatorObject;
|
|
219
|
-
readOnly?: boolean;
|
|
220
|
-
writeOnly?: boolean;
|
|
221
|
-
xml?: XMLObject;
|
|
222
|
-
externalDocs?: ExternalDocumentationObject;
|
|
223
|
-
example?: any;
|
|
224
|
-
deprecated?: boolean;
|
|
225
|
-
}
|
|
226
|
-
interface DiscriminatorObject {
|
|
227
|
-
propertyName: string;
|
|
228
|
-
mapping?: {
|
|
229
|
-
[value: string]: string;
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
interface XMLObject {
|
|
233
|
-
name?: string;
|
|
234
|
-
namespace?: string;
|
|
235
|
-
prefix?: string;
|
|
236
|
-
attribute?: boolean;
|
|
237
|
-
wrapped?: boolean;
|
|
238
|
-
}
|
|
239
|
-
interface ReferenceObject {
|
|
240
|
-
$ref: string;
|
|
241
|
-
}
|
|
242
|
-
interface ExampleObject {
|
|
243
|
-
summary?: string;
|
|
244
|
-
description?: string;
|
|
245
|
-
value?: any;
|
|
246
|
-
externalValue?: string;
|
|
247
|
-
}
|
|
248
|
-
interface MediaTypeObject {
|
|
249
|
-
schema?: ReferenceObject | SchemaObject;
|
|
250
|
-
example?: any;
|
|
251
|
-
examples?: {
|
|
252
|
-
[media: string]: ReferenceObject | ExampleObject;
|
|
253
|
-
};
|
|
254
|
-
encoding?: {
|
|
255
|
-
[media: string]: EncodingObject;
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
interface EncodingObject {
|
|
259
|
-
contentType?: string;
|
|
260
|
-
headers?: {
|
|
261
|
-
[header: string]: ReferenceObject | HeaderObject;
|
|
262
|
-
};
|
|
263
|
-
style?: string;
|
|
264
|
-
explode?: boolean;
|
|
265
|
-
allowReserved?: boolean;
|
|
266
|
-
}
|
|
267
|
-
interface RequestBodyObject {
|
|
268
|
-
description?: string;
|
|
269
|
-
content: {
|
|
270
|
-
[media: string]: MediaTypeObject;
|
|
271
|
-
};
|
|
272
|
-
required?: boolean;
|
|
273
|
-
}
|
|
274
|
-
interface ResponsesObject {
|
|
275
|
-
[code: string]: ReferenceObject | ResponseObject;
|
|
276
|
-
}
|
|
277
|
-
interface ResponseObject {
|
|
278
|
-
description: string;
|
|
279
|
-
headers?: {
|
|
280
|
-
[header: string]: ReferenceObject | HeaderObject;
|
|
281
|
-
};
|
|
282
|
-
content?: {
|
|
283
|
-
[media: string]: MediaTypeObject;
|
|
284
|
-
};
|
|
285
|
-
links?: {
|
|
286
|
-
[link: string]: ReferenceObject | LinkObject;
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
interface LinkObject {
|
|
290
|
-
operationRef?: string;
|
|
291
|
-
operationId?: string;
|
|
292
|
-
parameters?: {
|
|
293
|
-
[parameter: string]: any;
|
|
294
|
-
};
|
|
295
|
-
requestBody?: any;
|
|
296
|
-
description?: string;
|
|
297
|
-
server?: ServerObject;
|
|
298
|
-
}
|
|
299
|
-
interface CallbackObject {
|
|
300
|
-
[url: string]: PathItemObject;
|
|
301
|
-
}
|
|
302
|
-
interface SecurityRequirementObject {
|
|
303
|
-
[name: string]: string[];
|
|
304
|
-
}
|
|
305
|
-
interface ComponentsObject {
|
|
306
|
-
schemas?: {
|
|
307
|
-
[key: string]: ReferenceObject | SchemaObject;
|
|
308
|
-
};
|
|
309
|
-
responses?: {
|
|
310
|
-
[key: string]: ReferenceObject | ResponseObject;
|
|
311
|
-
};
|
|
312
|
-
parameters?: {
|
|
313
|
-
[key: string]: ReferenceObject | ParameterObject;
|
|
314
|
-
};
|
|
315
|
-
examples?: {
|
|
316
|
-
[key: string]: ReferenceObject | ExampleObject;
|
|
317
|
-
};
|
|
318
|
-
requestBodies?: {
|
|
319
|
-
[key: string]: ReferenceObject | RequestBodyObject;
|
|
320
|
-
};
|
|
321
|
-
headers?: {
|
|
322
|
-
[key: string]: ReferenceObject | HeaderObject;
|
|
323
|
-
};
|
|
324
|
-
securitySchemes?: {
|
|
325
|
-
[key: string]: ReferenceObject | SecuritySchemeObject;
|
|
326
|
-
};
|
|
327
|
-
links?: {
|
|
328
|
-
[key: string]: ReferenceObject | LinkObject;
|
|
329
|
-
};
|
|
330
|
-
callbacks?: {
|
|
331
|
-
[key: string]: ReferenceObject | CallbackObject;
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
type SecuritySchemeObject = HttpSecurityScheme | ApiKeySecurityScheme | OAuth2SecurityScheme | OpenIdSecurityScheme;
|
|
335
|
-
interface HttpSecurityScheme {
|
|
336
|
-
type: 'http';
|
|
337
|
-
description?: string;
|
|
338
|
-
scheme: string;
|
|
339
|
-
bearerFormat?: string;
|
|
340
|
-
}
|
|
341
|
-
interface ApiKeySecurityScheme {
|
|
342
|
-
type: 'apiKey';
|
|
343
|
-
description?: string;
|
|
344
|
-
name: string;
|
|
345
|
-
in: string;
|
|
346
|
-
}
|
|
347
|
-
interface OAuth2SecurityScheme {
|
|
348
|
-
type: 'oauth2';
|
|
349
|
-
description?: string;
|
|
350
|
-
flows: {
|
|
351
|
-
implicit?: {
|
|
352
|
-
authorizationUrl: string;
|
|
353
|
-
refreshUrl?: string;
|
|
354
|
-
scopes: {
|
|
355
|
-
[scope: string]: string;
|
|
356
|
-
};
|
|
357
|
-
};
|
|
358
|
-
password?: {
|
|
359
|
-
tokenUrl: string;
|
|
360
|
-
refreshUrl?: string;
|
|
361
|
-
scopes: {
|
|
362
|
-
[scope: string]: string;
|
|
363
|
-
};
|
|
364
|
-
};
|
|
365
|
-
clientCredentials?: {
|
|
366
|
-
tokenUrl: string;
|
|
367
|
-
refreshUrl?: string;
|
|
368
|
-
scopes: {
|
|
369
|
-
[scope: string]: string;
|
|
370
|
-
};
|
|
371
|
-
};
|
|
372
|
-
authorizationCode?: {
|
|
373
|
-
authorizationUrl: string;
|
|
374
|
-
tokenUrl: string;
|
|
375
|
-
refreshUrl?: string;
|
|
376
|
-
scopes: {
|
|
377
|
-
[scope: string]: string;
|
|
378
|
-
};
|
|
379
|
-
};
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
interface OpenIdSecurityScheme {
|
|
383
|
-
type: 'openIdConnect';
|
|
384
|
-
description?: string;
|
|
385
|
-
openIdConnectUrl: string;
|
|
386
|
-
}
|
|
387
|
-
interface TagObject {
|
|
388
|
-
name: string;
|
|
389
|
-
description?: string;
|
|
390
|
-
externalDocs?: ExternalDocumentationObject;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
declare const createPaginationMetaSchemaObject: (name?: string) => Record<string, OpenAPIV3.SchemaObject>;
|
|
395
|
-
declare const createPaginationSchemaObject: (name: string, items: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject, metaReference?: string) => Record<string, OpenAPIV3.SchemaObject>;
|
|
396
|
-
|
|
397
|
-
declare const paginate: <Result>(page: number, perPage: number, total: number, rows: Result[]) => Paginator$1<Result>;
|
|
398
|
-
|
|
399
|
-
export { type PaginationMeta, type PaginationResult, Paginator, type Paginator$1 as PaginatorInterface, createPaginationMetaSchemaObject, createPaginationSchemaObject, paginate };
|