av6-core 1.6.3 → 1.6.4
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.js +16 -0
- package/dist/index.mjs +16 -0
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1590,6 +1590,7 @@ var buildJoiSchemaForOp = (cfg, op, ctx) => {
|
|
|
1590
1590
|
|
|
1591
1591
|
// src/utils/dynamicOperation.utils.ts
|
|
1592
1592
|
var import_av6_utils = require("av6-utils");
|
|
1593
|
+
var import_decimal = __toESM(require("decimal.js"));
|
|
1593
1594
|
var OP_PRECEDENCE = {
|
|
1594
1595
|
"u-": 3,
|
|
1595
1596
|
// unary minus
|
|
@@ -1795,6 +1796,20 @@ function getDynamicValueOrExpression(obj, accessorOrExpr) {
|
|
|
1795
1796
|
}
|
|
1796
1797
|
return getDynamicValue(obj, s);
|
|
1797
1798
|
}
|
|
1799
|
+
function toNumberDeep(val) {
|
|
1800
|
+
if (val === null || val === void 0) return val;
|
|
1801
|
+
if (val instanceof import_decimal.default) return val.toNumber();
|
|
1802
|
+
if (val instanceof Date) return val;
|
|
1803
|
+
if (Array.isArray(val)) return val.map(toNumberDeep);
|
|
1804
|
+
if (typeof val === "object") {
|
|
1805
|
+
const out = {};
|
|
1806
|
+
for (const [k, v] of Object.entries(val)) {
|
|
1807
|
+
out[k] = toNumberDeep(v);
|
|
1808
|
+
}
|
|
1809
|
+
return out;
|
|
1810
|
+
}
|
|
1811
|
+
return val;
|
|
1812
|
+
}
|
|
1798
1813
|
|
|
1799
1814
|
// src/services/common.service.ts
|
|
1800
1815
|
var import_axios = __toESM(require("axios"));
|
|
@@ -1839,6 +1854,7 @@ var commonService = (serviceDeps) => {
|
|
|
1839
1854
|
async commonExcelService(searchParams) {
|
|
1840
1855
|
logger.info("entering::commonExcelService::service");
|
|
1841
1856
|
const commonData = await commonRepositoryFactory.fixedSearchWoPagination(searchParams);
|
|
1857
|
+
commonData.data = toNumberDeep(commonData.data);
|
|
1842
1858
|
const wb = new import_exceljs.default.Workbook();
|
|
1843
1859
|
const ws = wb.addWorksheet(`${searchParams.sheetName}`);
|
|
1844
1860
|
ws.properties.defaultRowHeight = 18;
|
package/dist/index.mjs
CHANGED
|
@@ -1540,6 +1540,7 @@ var buildJoiSchemaForOp = (cfg, op, ctx) => {
|
|
|
1540
1540
|
|
|
1541
1541
|
// src/utils/dynamicOperation.utils.ts
|
|
1542
1542
|
import { applyRound } from "av6-utils";
|
|
1543
|
+
import Decimal from "decimal.js";
|
|
1543
1544
|
var OP_PRECEDENCE = {
|
|
1544
1545
|
"u-": 3,
|
|
1545
1546
|
// unary minus
|
|
@@ -1745,6 +1746,20 @@ function getDynamicValueOrExpression(obj, accessorOrExpr) {
|
|
|
1745
1746
|
}
|
|
1746
1747
|
return getDynamicValue(obj, s);
|
|
1747
1748
|
}
|
|
1749
|
+
function toNumberDeep(val) {
|
|
1750
|
+
if (val === null || val === void 0) return val;
|
|
1751
|
+
if (val instanceof Decimal) return val.toNumber();
|
|
1752
|
+
if (val instanceof Date) return val;
|
|
1753
|
+
if (Array.isArray(val)) return val.map(toNumberDeep);
|
|
1754
|
+
if (typeof val === "object") {
|
|
1755
|
+
const out = {};
|
|
1756
|
+
for (const [k, v] of Object.entries(val)) {
|
|
1757
|
+
out[k] = toNumberDeep(v);
|
|
1758
|
+
}
|
|
1759
|
+
return out;
|
|
1760
|
+
}
|
|
1761
|
+
return val;
|
|
1762
|
+
}
|
|
1748
1763
|
|
|
1749
1764
|
// src/services/common.service.ts
|
|
1750
1765
|
import axios from "axios";
|
|
@@ -1789,6 +1804,7 @@ var commonService = (serviceDeps) => {
|
|
|
1789
1804
|
async commonExcelService(searchParams) {
|
|
1790
1805
|
logger.info("entering::commonExcelService::service");
|
|
1791
1806
|
const commonData = await commonRepositoryFactory.fixedSearchWoPagination(searchParams);
|
|
1807
|
+
commonData.data = toNumberDeep(commonData.data);
|
|
1792
1808
|
const wb = new ExcelJs.Workbook();
|
|
1793
1809
|
const ws = wb.addWorksheet(`${searchParams.sheetName}`);
|
|
1794
1810
|
ws.properties.defaultRowHeight = 18;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "av6-core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"av6-utils": "^1.0.4",
|
|
27
27
|
"axios": "^1.11.0",
|
|
28
|
+
"decimal.js": "^10.6.0",
|
|
28
29
|
"exceljs": "^4.4.0",
|
|
29
30
|
"handlebars": "^4.7.8",
|
|
30
31
|
"joi": "^17.13.3",
|