@visulima/pagination 3.0.0 → 3.0.1

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 CHANGED
@@ -1,3 +1,12 @@
1
+ ## @visulima/pagination [3.0.1](https://github.com/visulima/visulima/compare/@visulima/pagination@3.0.0...@visulima/pagination@3.0.1) (2023-08-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fixed wrong settings for node 18+ in typescript ([ac6711f](https://github.com/visulima/visulima/commit/ac6711fd2b4fdc5506b03e3a6ae25bb983aa6ea3))
7
+ * remove unused files and refactor imports and typings ([ba2ab03](https://github.com/visulima/visulima/commit/ba2ab03d2d7aff5f49c4d6714a61b99706778f19))
8
+ * updated various package dependencies and optimized code formatting. ([5d71d91](https://github.com/visulima/visulima/commit/5d71d913e857b71a7b741abe848780aaa22d679f))
9
+
1
10
  ## @visulima/pagination [3.0.0](https://github.com/visulima/visulima/compare/@visulima/pagination@2.0.6...@visulima/pagination@3.0.0) (2023-08-28)
2
11
 
3
12
 
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var o = require('qs');
3
+ var g = require('qs');
4
4
 
5
5
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
6
 
7
- var o__default = /*#__PURE__*/_interopDefault(o);
7
+ var g__default = /*#__PURE__*/_interopDefault(g);
8
8
 
9
- var i=class extends Array{constructor(e,a,s,...r){super(...r);this.totalNumber=e;this.perPage=a;this.currentPage=s;this.qs={};this.url="/";this.firstPage=1;this.totalNumber=Number(e),this.rows=r,this.isEmpty=this.rows.length===0;}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){let a=o__default.default.stringify({...this.qs,page:e<1?1:e});return `${this.url}?${a}`}getUrlsForRange(e,a){let s=[];for(let r=e;r<=a;r++)s.push({isActive:r===this.currentPage,page:r,url:this.getUrl(r)});return s}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)}queryString(e){return this.qs=e,this}toJSON(){return {data:this.all(),meta:this.getMeta()}}get total(){return Number(this.totalNumber)}};var g=(t="PaginationData")=>({[t]:{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:t}}}),l=(t,n,e="#/components/schemas/PaginationData")=>({[t]:{properties:{data:{items:n,type:"array",xml:{name:"data",wrapped:!0}},meta:{$ref:e}},type:"object",xml:{name:t}}});var m=(t,n,e,a)=>new i(e,Number(n),Number(t),...a);
9
+ var i=class extends Array{constructor(e,a,s,...r){super(...r);this.totalNumber=e;this.perPage=a;this.currentPage=s;this.qs={};this.url="/";this.firstPage=1;this.totalNumber=Number(e),this.rows=r,this.isEmpty=this.rows.length===0;}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){let a=g__default.default.stringify({...this.qs,page:e<1?1:e});return `${this.url}?${a}`}getUrlsForRange(e,a){let s=[];for(let r=e;r<=a;r++)s.push({isActive:r===this.currentPage,page:r,url:this.getUrl(r)});return s}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)}queryString(e){return this.qs=e,this}toJSON(){return {data:this.all(),meta:this.getMeta()}}get total(){return Number(this.totalNumber)}};var l=(t="PaginationData")=>({[t]:{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:t}}}),u=(t,n,e="#/components/schemas/PaginationData")=>({[t]:{properties:{data:{items:n,type:"array",xml:{name:"data",wrapped:!0}},meta:{$ref:e}},type:"object",xml:{name:t}}});var f=(t,n,e,a)=>new i(e,Number(n),Number(t),...a);
10
10
 
11
11
  exports.Paginator = i;
12
- exports.createPaginationMetaSchemaObject = g;
13
- exports.createPaginationSchemaObject = l;
14
- exports.paginate = m;
12
+ exports.createPaginationMetaSchemaObject = l;
13
+ exports.createPaginationSchemaObject = u;
14
+ exports.paginate = f;
15
15
  //# sourceMappingURL=out.js.map
16
16
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import o from 'qs';
1
+ import l from 'qs';
2
2
 
3
- var i=class extends Array{constructor(e,a,s,...r){super(...r);this.totalNumber=e;this.perPage=a;this.currentPage=s;this.qs={};this.url="/";this.firstPage=1;this.totalNumber=Number(e),this.rows=r,this.isEmpty=this.rows.length===0;}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){let a=o.stringify({...this.qs,page:e<1?1:e});return `${this.url}?${a}`}getUrlsForRange(e,a){let s=[];for(let r=e;r<=a;r++)s.push({isActive:r===this.currentPage,page:r,url:this.getUrl(r)});return s}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)}queryString(e){return this.qs=e,this}toJSON(){return {data:this.all(),meta:this.getMeta()}}get total(){return Number(this.totalNumber)}};var g=(t="PaginationData")=>({[t]:{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:t}}}),l=(t,n,e="#/components/schemas/PaginationData")=>({[t]:{properties:{data:{items:n,type:"array",xml:{name:"data",wrapped:!0}},meta:{$ref:e}},type:"object",xml:{name:t}}});var m=(t,n,e,a)=>new i(e,Number(n),Number(t),...a);
3
+ var i=class extends Array{constructor(e,a,s,...r){super(...r);this.totalNumber=e;this.perPage=a;this.currentPage=s;this.qs={};this.url="/";this.firstPage=1;this.totalNumber=Number(e),this.rows=r,this.isEmpty=this.rows.length===0;}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){let a=l.stringify({...this.qs,page:e<1?1:e});return `${this.url}?${a}`}getUrlsForRange(e,a){let s=[];for(let r=e;r<=a;r++)s.push({isActive:r===this.currentPage,page:r,url:this.getUrl(r)});return s}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)}queryString(e){return this.qs=e,this}toJSON(){return {data:this.all(),meta:this.getMeta()}}get total(){return Number(this.totalNumber)}};var u=(t="PaginationData")=>({[t]:{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:t}}}),p=(t,n,e="#/components/schemas/PaginationData")=>({[t]:{properties:{data:{items:n,type:"array",xml:{name:"data",wrapped:!0}},meta:{$ref:e}},type:"object",xml:{name:t}}});var y=(t,n,e,a)=>new i(e,Number(n),Number(t),...a);
4
4
 
5
- export { i as Paginator, g as createPaginationMetaSchemaObject, l as createPaginationSchemaObject, m as paginate };
5
+ export { i as Paginator, u as createPaginationMetaSchemaObject, p as createPaginationSchemaObject, y as paginate };
6
6
  //# sourceMappingURL=out.js.map
7
7
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/pagination",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Simple Pagination for Node.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -33,8 +33,14 @@
33
33
  "exports": {
34
34
  ".": {
35
35
  "types": "./dist/index.d.ts",
36
- "require": "./dist/index.js",
37
- "import": "./dist/index.mjs"
36
+ "require": {
37
+ "types": "./dist/index.d.ts",
38
+ "default": "./dist/index.js"
39
+ },
40
+ "import": {
41
+ "types": "./dist/index.d.mts",
42
+ "default": "./dist/index.mjs"
43
+ }
38
44
  },
39
45
  "./package.json": "./package.json"
40
46
  },
@@ -54,7 +60,7 @@
54
60
  "clean": "rimraf node_modules dist .eslintcache",
55
61
  "coverage": "vitest run --coverage",
56
62
  "dev": "pnpm run build --watch",
57
- "lint:eslint": "eslint . --ext js,jsx,ts,tsx --max-warnings=0 --config .eslintrc.js --cache --cache-strategy content .",
63
+ "lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.js",
58
64
  "lint:eslint:fix": "pnpm run lint:eslint --fix",
59
65
  "lint:prettier": "prettier --config=.prettierrc.js --check .",
60
66
  "lint:prettier:fix": "prettier --config=.prettierrc.js --write .",
@@ -84,6 +90,7 @@
84
90
  "prettier": "^3.0.2",
85
91
  "rimraf": "^5.0.1",
86
92
  "semantic-release": "^21.1.1",
93
+ "sort-package-json": "^2.5.1",
87
94
  "tsup": "^7.2.0",
88
95
  "typescript": "^5.2.2",
89
96
  "vitest": "^0.34.3"