asv-hlps 1.4.43 → 1.4.45

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.
@@ -0,0 +1,14 @@
1
+ import { SelectQueryBuilder } from "typeorm";
2
+ declare class HlpQuery {
3
+ where: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
4
+ whereIn: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
5
+ whereNotIn: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
6
+ opDate: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any) => void;
7
+ join: <T = any>(qb: SelectQueryBuilder<T>, key: string, rStr: string, status?: "lj" | "ljs") => void;
8
+ joker: <T = any>(qb: SelectQueryBuilder<T>, joker: {
9
+ qId: string;
10
+ qProp: string | number;
11
+ }) => void;
12
+ }
13
+ declare const _default: HlpQuery;
14
+ export default _default;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const typeorm_1 = require("../npms/typeorm");
4
+ class HlpQuery {
5
+ constructor() {
6
+ this.where = (qb, key, prm, qOn) => {
7
+ const qVar = !qOn ? key.substring(key.indexOf(".") + 1) : qOn;
8
+ if (prm) {
9
+ qb.andWhere(`${key} = :${qVar}`, { [qVar]: prm });
10
+ }
11
+ };
12
+ this.whereIn = (qb, key, prm, qOn) => {
13
+ const qVar = !qOn ? key.substring(key.indexOf(".") + 1) : qOn;
14
+ if (prm) {
15
+ qb.andWhere(`LOWER(${key}) IN (:...${qVar}) `, { [qVar]: prm });
16
+ }
17
+ };
18
+ this.whereNotIn = (qb, key, prm, qOn) => {
19
+ const qVar = !qOn ? key.substring(key.indexOf(".") + 1) : qOn;
20
+ if (prm) {
21
+ qb.andWhere(`LOWER(${key}) NOT IN (:...${qVar}) `, { [qVar]: prm });
22
+ // qb.andWhere("LOWER(role.code) IN (:...roleCodes)", { roleCodes: prms.roleCodes.ins });
23
+ }
24
+ };
25
+ this.opDate = (qb, key, prm) => {
26
+ var _a, _b, _c;
27
+ if (prm === null || prm === void 0 ? void 0 : prm.opDate) {
28
+ (0, typeorm_1.tormDateParams)(qb, `${key}`, (_a = prm === null || prm === void 0 ? void 0 : prm.opDate) === null || _a === void 0 ? void 0 : _a.eDate, (_b = prm === null || prm === void 0 ? void 0 : prm.opDate) === null || _b === void 0 ? void 0 : _b.dates, (_c = prm === null || prm === void 0 ? void 0 : prm.opDate) === null || _c === void 0 ? void 0 : _c.datesBy);
29
+ }
30
+ };
31
+ this.join = (qb, key, rStr, status = "ljs") => {
32
+ if (status === "ljs") {
33
+ qb.leftJoinAndSelect(`${key}`, `${rStr}`);
34
+ }
35
+ else {
36
+ qb.leftJoin(`${key}`, `${rStr}`);
37
+ }
38
+ };
39
+ this.joker = (qb, joker) => {
40
+ if (joker) {
41
+ qb.andWhere(`${joker.qId} = :joker`, { joker: joker["qProp"] });
42
+ }
43
+ };
44
+ }
45
+ }
46
+ exports.default = new HlpQuery();
@@ -130,7 +130,7 @@ const tabLabel = (sale) => {
130
130
  exports.tabLabel = tabLabel;
131
131
  const refSaleGenerator = () => {
132
132
  let date = new Date();
133
- const nDate = "C" + date.toLocaleDateString().split("-").join("") + date.toLocaleTimeString().split(":").join("");
133
+ const nDate = "C" + date.toLocaleDateString().split("-").join("") + date.toLocaleTimeString("en-US", { hour12: false }).split(":").join("");
134
134
  return (0, utils_1.removeBackSlashOccurences)(nDate, "").toLocaleUpperCase();
135
135
  // return randomatic('A', 4) + date.toLocaleDateString().split('-').join('') + date.toLocaleTimeString().split(':').join('')
136
136
  };
package/lib/cjs/utils.js CHANGED
@@ -260,7 +260,9 @@ exports.removeBackSlashOccurences = removeBackSlashOccurences;
260
260
  }; */
261
261
  const refGenerator = (char = "c", regex = /\/+/gi, toChar = "") => {
262
262
  let date = new Date();
263
- let nDate = char.toUpperCase() + date.toLocaleDateString().split("-").join("") + date.toLocaleTimeString().split(":").join("");
263
+ let nDate = char.toUpperCase() +
264
+ date.toLocaleDateString().split("-").join("") +
265
+ date.toLocaleTimeString("en-US", { hour12: false }).split(":").join("");
264
266
  nDate = (0, exports.replaceAllIn)(nDate, regex, toChar).toLocaleUpperCase();
265
267
  return nDate.indexOf(" ") ? nDate.substring(0, nDate.indexOf(" ")).trim() : nDate;
266
268
  };
@@ -0,0 +1,14 @@
1
+ import { SelectQueryBuilder } from "typeorm";
2
+ declare class HlpQuery {
3
+ where: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
4
+ whereIn: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
5
+ whereNotIn: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
6
+ opDate: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any) => void;
7
+ join: <T = any>(qb: SelectQueryBuilder<T>, key: string, rStr: string, status?: "lj" | "ljs") => void;
8
+ joker: <T = any>(qb: SelectQueryBuilder<T>, joker: {
9
+ qId: string;
10
+ qProp: string | number;
11
+ }) => void;
12
+ }
13
+ declare const _default: HlpQuery;
14
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { tormDateParams } from "../npms/typeorm";
2
+ class HlpQuery {
3
+ constructor() {
4
+ this.where = (qb, key, prm, qOn) => {
5
+ const qVar = !qOn ? key.substring(key.indexOf(".") + 1) : qOn;
6
+ if (prm) {
7
+ qb.andWhere(`${key} = :${qVar}`, { [qVar]: prm });
8
+ }
9
+ };
10
+ this.whereIn = (qb, key, prm, qOn) => {
11
+ const qVar = !qOn ? key.substring(key.indexOf(".") + 1) : qOn;
12
+ if (prm) {
13
+ qb.andWhere(`LOWER(${key}) IN (:...${qVar}) `, { [qVar]: prm });
14
+ }
15
+ };
16
+ this.whereNotIn = (qb, key, prm, qOn) => {
17
+ const qVar = !qOn ? key.substring(key.indexOf(".") + 1) : qOn;
18
+ if (prm) {
19
+ qb.andWhere(`LOWER(${key}) NOT IN (:...${qVar}) `, { [qVar]: prm });
20
+ // qb.andWhere("LOWER(role.code) IN (:...roleCodes)", { roleCodes: prms.roleCodes.ins });
21
+ }
22
+ };
23
+ this.opDate = (qb, key, prm) => {
24
+ var _a, _b, _c;
25
+ if (prm === null || prm === void 0 ? void 0 : prm.opDate) {
26
+ tormDateParams(qb, `${key}`, (_a = prm === null || prm === void 0 ? void 0 : prm.opDate) === null || _a === void 0 ? void 0 : _a.eDate, (_b = prm === null || prm === void 0 ? void 0 : prm.opDate) === null || _b === void 0 ? void 0 : _b.dates, (_c = prm === null || prm === void 0 ? void 0 : prm.opDate) === null || _c === void 0 ? void 0 : _c.datesBy);
27
+ }
28
+ };
29
+ this.join = (qb, key, rStr, status = "ljs") => {
30
+ if (status === "ljs") {
31
+ qb.leftJoinAndSelect(`${key}`, `${rStr}`);
32
+ }
33
+ else {
34
+ qb.leftJoin(`${key}`, `${rStr}`);
35
+ }
36
+ };
37
+ this.joker = (qb, joker) => {
38
+ if (joker) {
39
+ qb.andWhere(`${joker.qId} = :joker`, { joker: joker["qProp"] });
40
+ }
41
+ };
42
+ }
43
+ }
44
+ export default new HlpQuery();
@@ -110,7 +110,7 @@ export const tabLabel = (sale) => {
110
110
  };
111
111
  export const refSaleGenerator = () => {
112
112
  let date = new Date();
113
- const nDate = "C" + date.toLocaleDateString().split("-").join("") + date.toLocaleTimeString().split(":").join("");
113
+ const nDate = "C" + date.toLocaleDateString().split("-").join("") + date.toLocaleTimeString("en-US", { hour12: false }).split(":").join("");
114
114
  return removeBackSlashOccurences(nDate, "").toLocaleUpperCase();
115
115
  // return randomatic('A', 4) + date.toLocaleDateString().split('-').join('') + date.toLocaleTimeString().split(':').join('')
116
116
  };
package/lib/esm/utils.js CHANGED
@@ -225,7 +225,9 @@ export const removeBackSlashOccurences = (text, toChar) => {
225
225
  }; */
226
226
  export const refGenerator = (char = "c", regex = /\/+/gi, toChar = "") => {
227
227
  let date = new Date();
228
- let nDate = char.toUpperCase() + date.toLocaleDateString().split("-").join("") + date.toLocaleTimeString().split(":").join("");
228
+ let nDate = char.toUpperCase() +
229
+ date.toLocaleDateString().split("-").join("") +
230
+ date.toLocaleTimeString("en-US", { hour12: false }).split(":").join("");
229
231
  nDate = replaceAllIn(nDate, regex, toChar).toLocaleUpperCase();
230
232
  return nDate.indexOf(" ") ? nDate.substring(0, nDate.indexOf(" ")).trim() : nDate;
231
233
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.4.43",
3
+ "version": "1.4.45",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -18,14 +18,14 @@
18
18
  "devDependencies": {
19
19
  "@types/express": "^5.0.3",
20
20
  "@types/jwt-decode": "^3.1.0",
21
- "@types/lodash": "^4.17.17",
21
+ "@types/lodash": "^4.17.19",
22
22
  "@types/pdfmake": "^0.2.11",
23
23
  "@types/randomatic": "^3.1.5",
24
- "@types/react": "^19.1.7"
24
+ "@types/react": "^19.1.8"
25
25
  },
26
26
  "dependencies": {
27
- "@tanstack/react-query": "^5.80.6",
28
- "axios": "^1.9.0",
27
+ "@tanstack/react-query": "^5.81.2",
28
+ "axios": "^1.10.0",
29
29
  "class-validator": "^0.14.2",
30
30
  "classnames": "^2.5.1",
31
31
  "dayjs": "^1.11.13",
@@ -34,7 +34,7 @@
34
34
  "lodash": "^4.17.21",
35
35
  "pdfmake": "^0.2.20",
36
36
  "randomatic": "^3.1.1",
37
- "typeorm": "^0.3.24",
37
+ "typeorm": "^0.3.25",
38
38
  "typescript": "^5.8.3",
39
39
  "yup": "^1.6.1",
40
40
  "zustand": "^5.0.5"