@janiscommerce/api-list
Advanced tools
Comparing version 5.3.1 to 5.3.2
@@ -10,2 +10,6 @@ # Changelog | ||
## [5.3.2] - 2022-04-29 | ||
### Changed | ||
- Changed internal implementation so data fetching can be overriden | ||
## [5.3.1] - 2022-04-21 | ||
@@ -12,0 +16,0 @@ ### Fixed |
@@ -162,7 +162,4 @@ 'use strict'; | ||
const result = await this.model.get(getParams); | ||
const totals = result.length ? await this.model.getTotals() : { total: 0 }; | ||
const { result, total } = await this.fetchData(getParams); | ||
const { total } = totals; | ||
const rows = await this.formatRows(result); | ||
@@ -179,2 +176,17 @@ | ||
/** | ||
* Get the data with client params | ||
* | ||
* @async | ||
* @throws {Object} - Params to fetch data | ||
* @returns {Object{result, total}} - The result and total data obtained | ||
*/ | ||
async fetchData(getParams) { | ||
const result = await this.model.get(getParams); | ||
const { total } = result.length ? await this.model.getTotals() : { total: 0 }; | ||
return { total, result }; | ||
} | ||
/** | ||
* Set the modelName and parents of API after parsing the endpoint | ||
@@ -181,0 +193,0 @@ * |
{ | ||
"name": "@janiscommerce/api-list", | ||
"version": "5.3.1", | ||
"version": "5.3.2", | ||
"description": "A package to handle Janis List APIs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -55,2 +55,10 @@ export = ApiListData; | ||
/** | ||
* Get the data with client params | ||
* | ||
* @async | ||
* @throws {Object} - Params to fetch data | ||
* @returns {Object{result, total}} - The result and total data obtained | ||
*/ | ||
fetchData(getParams: any): any; | ||
/** | ||
* Set the modelName and parents of API after parsing the endpoint | ||
@@ -57,0 +65,0 @@ * |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42165
905