asv-hlps 1.4.55 → 1.4.56
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/lib/cjs/bills/models/BillPayment.d.ts +1 -0
- package/lib/cjs/queries/hlpQuery.d.ts +10 -1
- package/lib/cjs/queries/hlpQuery.js +27 -1
- package/lib/cjs/utils.js +1 -1
- package/lib/esm/bills/models/BillPayment.d.ts +1 -0
- package/lib/esm/queries/hlpQuery.d.ts +10 -1
- package/lib/esm/queries/hlpQuery.js +27 -1
- package/lib/esm/utils.js +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { SelectQueryBuilder } from "typeorm";
|
|
2
2
|
declare class HlpQuery {
|
|
3
3
|
where: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
|
|
4
|
+
whereBool: <T = any>(qb: SelectQueryBuilder<T>, qKey: string, active: "true" | "false", qOn?: string) => void;
|
|
5
|
+
whereCat: <T = any>(qb: SelectQueryBuilder<T>, prms: {
|
|
6
|
+
cat: {
|
|
7
|
+
id?: number;
|
|
8
|
+
name?: string;
|
|
9
|
+
code?: string;
|
|
10
|
+
};
|
|
11
|
+
}) => void;
|
|
4
12
|
whereIn: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
|
|
5
13
|
whereNotIn: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
|
|
6
14
|
opDate: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any) => void;
|
|
7
15
|
join: <T = any>(qb: SelectQueryBuilder<T>, key: string, rStr: string, status?: "lj" | "ljs") => void;
|
|
8
16
|
joker: <T = any>(qb: SelectQueryBuilder<T>, joker: {
|
|
9
|
-
|
|
17
|
+
qKey: string;
|
|
10
18
|
qProp: string | number;
|
|
19
|
+
qOn?: any;
|
|
11
20
|
}) => void;
|
|
12
21
|
}
|
|
13
22
|
declare const _default: HlpQuery;
|
|
@@ -9,6 +9,31 @@ class HlpQuery {
|
|
|
9
9
|
qb.andWhere(`${key} = :${qVar}`, { [qVar]: prm });
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
+
this.whereBool = (qb, qKey, active, qOn) => {
|
|
13
|
+
const qVar = !qOn ? qKey.substring(qKey.indexOf(".") + 1) : qOn;
|
|
14
|
+
if (active) {
|
|
15
|
+
if (active === "true") {
|
|
16
|
+
qb.andWhere(`${qKey} = :${qVar}`, { [qVar]: true });
|
|
17
|
+
}
|
|
18
|
+
if (active === "false") {
|
|
19
|
+
qb.andWhere(`${qKey} = :${qVar}`, { [qVar]: false });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
this.whereCat = (qb, prms) => {
|
|
24
|
+
var _a, _b, _c;
|
|
25
|
+
if (prms === null || prms === void 0 ? void 0 : prms.cat) {
|
|
26
|
+
if ((_a = prms === null || prms === void 0 ? void 0 : prms.cat) === null || _a === void 0 ? void 0 : _a.code) {
|
|
27
|
+
qb.andWhere("cat.code = :code", { code: prms.cat.code });
|
|
28
|
+
}
|
|
29
|
+
if ((_b = prms === null || prms === void 0 ? void 0 : prms.cat) === null || _b === void 0 ? void 0 : _b.id) {
|
|
30
|
+
qb.andWhere("cat.id = :id", { id: prms.cat.id });
|
|
31
|
+
}
|
|
32
|
+
if ((_c = prms === null || prms === void 0 ? void 0 : prms.cat) === null || _c === void 0 ? void 0 : _c.name) {
|
|
33
|
+
qb.andWhere("cat.name = :name", { id: prms.cat.name });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
12
37
|
this.whereIn = (qb, key, prm, qOn) => {
|
|
13
38
|
const qVar = !qOn ? key.substring(key.indexOf(".") + 1) : qOn;
|
|
14
39
|
if (prm) {
|
|
@@ -37,8 +62,9 @@ class HlpQuery {
|
|
|
37
62
|
}
|
|
38
63
|
};
|
|
39
64
|
this.joker = (qb, joker) => {
|
|
65
|
+
const qVar = !(joker === null || joker === void 0 ? void 0 : joker.qOn) ? joker.qKey.substring(joker.qKey.indexOf(".") + 1) : joker === null || joker === void 0 ? void 0 : joker.qOn;
|
|
40
66
|
if (joker) {
|
|
41
|
-
qb.andWhere(`${joker.
|
|
67
|
+
qb.andWhere(`${joker.qKey} = :${qVar}`, { [qVar]: joker["qProp"] });
|
|
42
68
|
}
|
|
43
69
|
};
|
|
44
70
|
}
|
package/lib/cjs/utils.js
CHANGED
|
@@ -276,7 +276,7 @@ const removeBackSlashOccurences = (text, toChar) => {
|
|
|
276
276
|
};
|
|
277
277
|
exports.removeBackSlashOccurences = removeBackSlashOccurences;
|
|
278
278
|
const removeAMPM = (ref) => {
|
|
279
|
-
return ref.indexOf(" ") ? ref.substring(0, ref.indexOf(" ")).trim() : ref;
|
|
279
|
+
return (ref === null || ref === void 0 ? void 0 : ref.indexOf(" ")) ? ref.substring(0, ref.indexOf(" ")).trim() : ref;
|
|
280
280
|
};
|
|
281
281
|
exports.removeAMPM = removeAMPM;
|
|
282
282
|
const refGenerator = (char = "c", regex = /\/+/gi, toChar = "") => {
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { SelectQueryBuilder } from "typeorm";
|
|
2
2
|
declare class HlpQuery {
|
|
3
3
|
where: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
|
|
4
|
+
whereBool: <T = any>(qb: SelectQueryBuilder<T>, qKey: string, active: "true" | "false", qOn?: string) => void;
|
|
5
|
+
whereCat: <T = any>(qb: SelectQueryBuilder<T>, prms: {
|
|
6
|
+
cat: {
|
|
7
|
+
id?: number;
|
|
8
|
+
name?: string;
|
|
9
|
+
code?: string;
|
|
10
|
+
};
|
|
11
|
+
}) => void;
|
|
4
12
|
whereIn: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
|
|
5
13
|
whereNotIn: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
|
|
6
14
|
opDate: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any) => void;
|
|
7
15
|
join: <T = any>(qb: SelectQueryBuilder<T>, key: string, rStr: string, status?: "lj" | "ljs") => void;
|
|
8
16
|
joker: <T = any>(qb: SelectQueryBuilder<T>, joker: {
|
|
9
|
-
|
|
17
|
+
qKey: string;
|
|
10
18
|
qProp: string | number;
|
|
19
|
+
qOn?: any;
|
|
11
20
|
}) => void;
|
|
12
21
|
}
|
|
13
22
|
declare const _default: HlpQuery;
|
|
@@ -7,6 +7,31 @@ class HlpQuery {
|
|
|
7
7
|
qb.andWhere(`${key} = :${qVar}`, { [qVar]: prm });
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
|
+
this.whereBool = (qb, qKey, active, qOn) => {
|
|
11
|
+
const qVar = !qOn ? qKey.substring(qKey.indexOf(".") + 1) : qOn;
|
|
12
|
+
if (active) {
|
|
13
|
+
if (active === "true") {
|
|
14
|
+
qb.andWhere(`${qKey} = :${qVar}`, { [qVar]: true });
|
|
15
|
+
}
|
|
16
|
+
if (active === "false") {
|
|
17
|
+
qb.andWhere(`${qKey} = :${qVar}`, { [qVar]: false });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
this.whereCat = (qb, prms) => {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
if (prms === null || prms === void 0 ? void 0 : prms.cat) {
|
|
24
|
+
if ((_a = prms === null || prms === void 0 ? void 0 : prms.cat) === null || _a === void 0 ? void 0 : _a.code) {
|
|
25
|
+
qb.andWhere("cat.code = :code", { code: prms.cat.code });
|
|
26
|
+
}
|
|
27
|
+
if ((_b = prms === null || prms === void 0 ? void 0 : prms.cat) === null || _b === void 0 ? void 0 : _b.id) {
|
|
28
|
+
qb.andWhere("cat.id = :id", { id: prms.cat.id });
|
|
29
|
+
}
|
|
30
|
+
if ((_c = prms === null || prms === void 0 ? void 0 : prms.cat) === null || _c === void 0 ? void 0 : _c.name) {
|
|
31
|
+
qb.andWhere("cat.name = :name", { id: prms.cat.name });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
10
35
|
this.whereIn = (qb, key, prm, qOn) => {
|
|
11
36
|
const qVar = !qOn ? key.substring(key.indexOf(".") + 1) : qOn;
|
|
12
37
|
if (prm) {
|
|
@@ -35,8 +60,9 @@ class HlpQuery {
|
|
|
35
60
|
}
|
|
36
61
|
};
|
|
37
62
|
this.joker = (qb, joker) => {
|
|
63
|
+
const qVar = !(joker === null || joker === void 0 ? void 0 : joker.qOn) ? joker.qKey.substring(joker.qKey.indexOf(".") + 1) : joker === null || joker === void 0 ? void 0 : joker.qOn;
|
|
38
64
|
if (joker) {
|
|
39
|
-
qb.andWhere(`${joker.
|
|
65
|
+
qb.andWhere(`${joker.qKey} = :${qVar}`, { [qVar]: joker["qProp"] });
|
|
40
66
|
}
|
|
41
67
|
};
|
|
42
68
|
}
|
package/lib/esm/utils.js
CHANGED
|
@@ -239,7 +239,7 @@ export const removeBackSlashOccurences = (text, toChar) => {
|
|
|
239
239
|
return String(text).toLowerCase().replace(regex, toChar) || text;
|
|
240
240
|
};
|
|
241
241
|
export const removeAMPM = (ref) => {
|
|
242
|
-
return ref.indexOf(" ") ? ref.substring(0, ref.indexOf(" ")).trim() : ref;
|
|
242
|
+
return (ref === null || ref === void 0 ? void 0 : ref.indexOf(" ")) ? ref.substring(0, ref.indexOf(" ")).trim() : ref;
|
|
243
243
|
};
|
|
244
244
|
export const refGenerator = (char = "c", regex = /\/+/gi, toChar = "") => {
|
|
245
245
|
let date = new Date();
|