av6-core 1.6.2 → 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 +18 -1
- package/dist/index.mjs +18 -1
- package/package.json +37 -35
package/dist/index.js
CHANGED
|
@@ -1589,6 +1589,8 @@ var buildJoiSchemaForOp = (cfg, op, ctx) => {
|
|
|
1589
1589
|
};
|
|
1590
1590
|
|
|
1591
1591
|
// src/utils/dynamicOperation.utils.ts
|
|
1592
|
+
var import_av6_utils = require("av6-utils");
|
|
1593
|
+
var import_decimal = __toESM(require("decimal.js"));
|
|
1592
1594
|
var OP_PRECEDENCE = {
|
|
1593
1595
|
"u-": 3,
|
|
1594
1596
|
// unary minus
|
|
@@ -1782,7 +1784,7 @@ function evalRpn(rpn, rowObj) {
|
|
|
1782
1784
|
}
|
|
1783
1785
|
if (stack.length !== 1) throw new Error("Bad expression (final stack)");
|
|
1784
1786
|
const res = stack[0];
|
|
1785
|
-
return Number.isFinite(res) ? res : null;
|
|
1787
|
+
return Number.isFinite(res) ? (0, import_av6_utils.applyRound)(res, "TO_FIXED", 5) : null;
|
|
1786
1788
|
}
|
|
1787
1789
|
function getDynamicValueOrExpression(obj, accessorOrExpr) {
|
|
1788
1790
|
const s = (accessorOrExpr ?? "").trim();
|
|
@@ -1794,6 +1796,20 @@ function getDynamicValueOrExpression(obj, accessorOrExpr) {
|
|
|
1794
1796
|
}
|
|
1795
1797
|
return getDynamicValue(obj, s);
|
|
1796
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
|
+
}
|
|
1797
1813
|
|
|
1798
1814
|
// src/services/common.service.ts
|
|
1799
1815
|
var import_axios = __toESM(require("axios"));
|
|
@@ -1838,6 +1854,7 @@ var commonService = (serviceDeps) => {
|
|
|
1838
1854
|
async commonExcelService(searchParams) {
|
|
1839
1855
|
logger.info("entering::commonExcelService::service");
|
|
1840
1856
|
const commonData = await commonRepositoryFactory.fixedSearchWoPagination(searchParams);
|
|
1857
|
+
commonData.data = toNumberDeep(commonData.data);
|
|
1841
1858
|
const wb = new import_exceljs.default.Workbook();
|
|
1842
1859
|
const ws = wb.addWorksheet(`${searchParams.sheetName}`);
|
|
1843
1860
|
ws.properties.defaultRowHeight = 18;
|
package/dist/index.mjs
CHANGED
|
@@ -1539,6 +1539,8 @@ var buildJoiSchemaForOp = (cfg, op, ctx) => {
|
|
|
1539
1539
|
};
|
|
1540
1540
|
|
|
1541
1541
|
// src/utils/dynamicOperation.utils.ts
|
|
1542
|
+
import { applyRound } from "av6-utils";
|
|
1543
|
+
import Decimal from "decimal.js";
|
|
1542
1544
|
var OP_PRECEDENCE = {
|
|
1543
1545
|
"u-": 3,
|
|
1544
1546
|
// unary minus
|
|
@@ -1732,7 +1734,7 @@ function evalRpn(rpn, rowObj) {
|
|
|
1732
1734
|
}
|
|
1733
1735
|
if (stack.length !== 1) throw new Error("Bad expression (final stack)");
|
|
1734
1736
|
const res = stack[0];
|
|
1735
|
-
return Number.isFinite(res) ? res : null;
|
|
1737
|
+
return Number.isFinite(res) ? applyRound(res, "TO_FIXED", 5) : null;
|
|
1736
1738
|
}
|
|
1737
1739
|
function getDynamicValueOrExpression(obj, accessorOrExpr) {
|
|
1738
1740
|
const s = (accessorOrExpr ?? "").trim();
|
|
@@ -1744,6 +1746,20 @@ function getDynamicValueOrExpression(obj, accessorOrExpr) {
|
|
|
1744
1746
|
}
|
|
1745
1747
|
return getDynamicValue(obj, s);
|
|
1746
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
|
+
}
|
|
1747
1763
|
|
|
1748
1764
|
// src/services/common.service.ts
|
|
1749
1765
|
import axios from "axios";
|
|
@@ -1788,6 +1804,7 @@ var commonService = (serviceDeps) => {
|
|
|
1788
1804
|
async commonExcelService(searchParams) {
|
|
1789
1805
|
logger.info("entering::commonExcelService::service");
|
|
1790
1806
|
const commonData = await commonRepositoryFactory.fixedSearchWoPagination(searchParams);
|
|
1807
|
+
commonData.data = toNumberDeep(commonData.data);
|
|
1791
1808
|
const wb = new ExcelJs.Workbook();
|
|
1792
1809
|
const ws = wb.addWorksheet(`${searchParams.sheetName}`);
|
|
1793
1810
|
ws.properties.defaultRowHeight = 18;
|
package/package.json
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "av6-core",
|
|
3
|
-
"version": "1.6.
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"module": "dist/index.mjs",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"description": "All utility function for av6 node js projects.",
|
|
8
|
-
"author": "Aniket Sarkar",
|
|
9
|
-
"license": "ISC",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "npm run format && tsup",
|
|
12
|
-
"p:gen": "prisma generate",
|
|
13
|
-
"format": "prettier --write **/*.ts"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@prisma/client": "^6.19.0",
|
|
17
|
-
"@types/nodemailer": "^7.0.3",
|
|
18
|
-
"tsup": "^8.5.0",
|
|
19
|
-
"typescript": "^5.9.2"
|
|
20
|
-
},
|
|
21
|
-
"peerDependencies": {
|
|
22
|
-
"@prisma/client": "^6.19.0",
|
|
23
|
-
"winston": "^3.17.0"
|
|
24
|
-
},
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "av6-core",
|
|
3
|
+
"version": "1.6.4",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/index.mjs",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"description": "All utility function for av6 node js projects.",
|
|
8
|
+
"author": "Aniket Sarkar",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "npm run format && tsup",
|
|
12
|
+
"p:gen": "prisma generate",
|
|
13
|
+
"format": "prettier --write **/*.ts"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@prisma/client": "^6.19.0",
|
|
17
|
+
"@types/nodemailer": "^7.0.3",
|
|
18
|
+
"tsup": "^8.5.0",
|
|
19
|
+
"typescript": "^5.9.2"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@prisma/client": "^6.19.0",
|
|
23
|
+
"winston": "^3.17.0"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"av6-utils": "^1.0.4",
|
|
27
|
+
"axios": "^1.11.0",
|
|
28
|
+
"decimal.js": "^10.6.0",
|
|
29
|
+
"exceljs": "^4.4.0",
|
|
30
|
+
"handlebars": "^4.7.8",
|
|
31
|
+
"joi": "^17.13.3",
|
|
32
|
+
"node-cron": "^4.2.1",
|
|
33
|
+
"nodemailer": "^7.0.10",
|
|
34
|
+
"prettier": "^3.6.2",
|
|
35
|
+
"prisma": "^6.19.0"
|
|
36
|
+
}
|
|
37
|
+
}
|