asv-hlps 1.4.57 → 1.4.59
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/queries/hlpQuery.d.ts +7 -7
- package/lib/cjs/queries/hlpQuery.js +20 -20
- package/lib/cjs/utils.d.ts +1 -0
- package/lib/cjs/utils.js +6 -2
- package/lib/esm/queries/hlpQuery.d.ts +7 -7
- package/lib/esm/queries/hlpQuery.js +20 -20
- package/lib/esm/utils.d.ts +1 -0
- package/lib/esm/utils.js +3 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SelectQueryBuilder } from "typeorm";
|
|
2
2
|
declare class HlpQuery {
|
|
3
|
-
where: <T = any>(qb: SelectQueryBuilder<T>,
|
|
4
|
-
whereBool: <T = any>(qb: SelectQueryBuilder<T>,
|
|
3
|
+
where: <T = any>(qb: SelectQueryBuilder<T>, column: string, prm: any, qOn?: string) => void;
|
|
4
|
+
whereBool: <T = any>(qb: SelectQueryBuilder<T>, column: string, active: "true" | "false", qOn?: string) => void;
|
|
5
5
|
whereCat: <T = any>(qb: SelectQueryBuilder<T>, prms: {
|
|
6
6
|
cat: {
|
|
7
7
|
id?: number;
|
|
@@ -9,12 +9,12 @@ declare class HlpQuery {
|
|
|
9
9
|
code?: string;
|
|
10
10
|
};
|
|
11
11
|
}) => void;
|
|
12
|
-
whereIn: <T = any>(qb: SelectQueryBuilder<T>,
|
|
13
|
-
whereNotIn: <T = any>(qb: SelectQueryBuilder<T>,
|
|
14
|
-
opDate: <T = any>(qb: SelectQueryBuilder<T>,
|
|
15
|
-
join: <T = any>(qb: SelectQueryBuilder<T>,
|
|
12
|
+
whereIn: <T = any>(qb: SelectQueryBuilder<T>, column: string, prm: any, qOn?: string) => void;
|
|
13
|
+
whereNotIn: <T = any>(qb: SelectQueryBuilder<T>, column: string, prm: any, qOn?: string) => void;
|
|
14
|
+
opDate: <T = any>(qb: SelectQueryBuilder<T>, column: string, prm: any) => void;
|
|
15
|
+
join: <T = any>(qb: SelectQueryBuilder<T>, column: string, rStr: string, status?: "lj" | "ljs") => void;
|
|
16
16
|
joker: <T = any>(qb: SelectQueryBuilder<T>, joker: {
|
|
17
|
-
|
|
17
|
+
column: string;
|
|
18
18
|
qProp: string | number;
|
|
19
19
|
qOn?: any;
|
|
20
20
|
}) => void;
|
|
@@ -3,20 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const typeorm_1 = require("../npms/typeorm");
|
|
4
4
|
class HlpQuery {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.where = (qb,
|
|
7
|
-
const qVar = !qOn ?
|
|
6
|
+
this.where = (qb, column, prm, qOn) => {
|
|
7
|
+
const qVar = !qOn ? column.substring(column.indexOf(".") + 1) : qOn;
|
|
8
8
|
if (prm) {
|
|
9
|
-
qb.andWhere(`${
|
|
9
|
+
qb.andWhere(`${column} = :${qVar}`, { [qVar]: prm });
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
this.whereBool = (qb,
|
|
13
|
-
const qVar = !qOn ?
|
|
12
|
+
this.whereBool = (qb, column, active, qOn) => {
|
|
13
|
+
const qVar = !qOn ? column.substring(column.indexOf(".") + 1) : qOn;
|
|
14
14
|
if (active) {
|
|
15
15
|
if (active === "true") {
|
|
16
|
-
qb.andWhere(`${
|
|
16
|
+
qb.andWhere(`${column} = :${qVar}`, { [qVar]: true });
|
|
17
17
|
}
|
|
18
18
|
if (active === "false") {
|
|
19
|
-
qb.andWhere(`${
|
|
19
|
+
qb.andWhere(`${column} = :${qVar}`, { [qVar]: false });
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
};
|
|
@@ -34,37 +34,37 @@ class HlpQuery {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
this.whereIn = (qb,
|
|
38
|
-
const qVar = !qOn ?
|
|
37
|
+
this.whereIn = (qb, column, prm, qOn) => {
|
|
38
|
+
const qVar = !qOn ? column.substring(column.indexOf(".") + 1) : qOn;
|
|
39
39
|
if (prm) {
|
|
40
|
-
qb.andWhere(`LOWER(${
|
|
40
|
+
qb.andWhere(`LOWER(${column}) IN (:...${qVar}) `, { [qVar]: prm });
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
this.whereNotIn = (qb,
|
|
44
|
-
const qVar = !qOn ?
|
|
43
|
+
this.whereNotIn = (qb, column, prm, qOn) => {
|
|
44
|
+
const qVar = !qOn ? column.substring(column.indexOf(".") + 1) : qOn;
|
|
45
45
|
if (prm) {
|
|
46
|
-
qb.andWhere(`LOWER(${
|
|
46
|
+
qb.andWhere(`LOWER(${column}) NOT IN (:...${qVar}) `, { [qVar]: prm });
|
|
47
47
|
// qb.andWhere("LOWER(role.code) IN (:...roleCodes)", { roleCodes: prms.roleCodes.ins });
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
this.opDate = (qb,
|
|
50
|
+
this.opDate = (qb, column, prm) => {
|
|
51
51
|
var _a, _b, _c;
|
|
52
52
|
if (prm === null || prm === void 0 ? void 0 : prm.opDate) {
|
|
53
|
-
(0, typeorm_1.tormDateParams)(qb, `${
|
|
53
|
+
(0, typeorm_1.tormDateParams)(qb, `${column}`, (_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);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
this.join = (qb,
|
|
56
|
+
this.join = (qb, column, rStr, status = "ljs") => {
|
|
57
57
|
if (status === "ljs") {
|
|
58
|
-
qb.leftJoinAndSelect(`${
|
|
58
|
+
qb.leftJoinAndSelect(`${column}`, `${rStr}`);
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
qb.leftJoin(`${
|
|
61
|
+
qb.leftJoin(`${column}`, `${rStr}`);
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
this.joker = (qb, joker) => {
|
|
65
|
-
const qVar = !(joker === null || joker === void 0 ? void 0 : joker.qOn) ? joker.
|
|
65
|
+
const qVar = !(joker === null || joker === void 0 ? void 0 : joker.qOn) ? joker.column.substring(joker.column.indexOf(".") + 1) : joker === null || joker === void 0 ? void 0 : joker.qOn;
|
|
66
66
|
if (joker) {
|
|
67
|
-
qb.andWhere(`${joker.
|
|
67
|
+
qb.andWhere(`${joker.column} = :${qVar}`, { [qVar]: joker["qProp"] });
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export declare const stringifyFormatter: (data: any, space?: string | number) =>
|
|
|
45
45
|
export declare const removeBackSlashOccurences: (text: string, toChar: string) => string;
|
|
46
46
|
export declare const removeAMPM: (ref: string) => string;
|
|
47
47
|
export declare const refGenerator: (char?: string, regex?: RegExp, toChar?: string) => string;
|
|
48
|
+
export declare const removeSpecialCharsAndSpaces: (input: string) => string;
|
|
48
49
|
export declare const genSequenceRef: (refs: any[], startChars: string, zeroFillWidth: number, dateFormat?: string) => string;
|
|
49
50
|
export declare const sesStorageSet: (key: string, val: any) => void;
|
|
50
51
|
export declare const sesStorageGet: (key: string) => any;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.nthIndexOf = exports.pathName = exports.checkObjInArray = exports.arraySome = exports.winMaxHeight = exports.toggleProp = exports.roundLastNDigits = exports.removeParamKeyName = exports.countryIsoToFlag = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceTimes = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.genRandomNumberArray = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = exports.unCheckedAll = exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = void 0;
|
|
6
|
+
exports.dateNth = exports.dateNthMonth = exports.dateNthDay = exports.dateNthWeek = exports.getNbOfDaysBetweenTwoDates = exports.displayDateRangeFr = exports.reformatDates = exports.firstDayOfDate = exports.dateToString = exports.dateDiff = exports.dateFormatter = exports.replaceSpacesWith = exports.replaceAllIn = exports.toPlural = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.removeSpecialCharsAndSpaces = exports.refGenerator = exports.removeAMPM = exports.removeBackSlashOccurences = exports.stringifyFormatter = exports.removeString = exports.diffArraysByProp = exports.diffArraysByFunc = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.removeAccent = exports.sequencesToNumbers = exports.notInSequence = exports.currencyFormatterCfa = exports.currencyFormatter = exports.checkAuth = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.duplicateObjectsGrouped = exports.duplicateObjects = exports.removeDuplicateValues = exports.removeDuplicateObjects = exports.getRandomColor = exports.calPercent = exports.percentOf = exports.genDateMinutesStep = exports.formatDateFirstDayFr = exports.isEmpty = void 0;
|
|
7
|
+
exports.nthIndexOf = exports.pathName = exports.checkObjInArray = exports.arraySome = exports.winMaxHeight = exports.toggleProp = exports.roundLastNDigits = exports.removeParamKeyName = exports.countryIsoToFlag = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceTimes = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.genRandomNumberArray = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = exports.unCheckedAll = exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = void 0;
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
9
|
const dayOfYear_1 = __importDefault(require("dayjs/plugin/dayOfYear"));
|
|
10
10
|
const isSameOrBefore_1 = __importDefault(require("dayjs/plugin/isSameOrBefore"));
|
|
@@ -286,6 +286,10 @@ const refGenerator = (char = "c", regex = /\/+/gi, toChar = "") => {
|
|
|
286
286
|
return (0, exports.removeAMPM)(ref);
|
|
287
287
|
};
|
|
288
288
|
exports.refGenerator = refGenerator;
|
|
289
|
+
const removeSpecialCharsAndSpaces = (input) => {
|
|
290
|
+
return input.replace(/[^a-zA-Z0-9]/g, "");
|
|
291
|
+
};
|
|
292
|
+
exports.removeSpecialCharsAndSpaces = removeSpecialCharsAndSpaces;
|
|
289
293
|
// export const refGenerator = (char: string = "c", regex: RegExp = /\/+/gi, toChar: string = "") => {
|
|
290
294
|
// let date = new Date();
|
|
291
295
|
// let nDate =
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SelectQueryBuilder } from "typeorm";
|
|
2
2
|
declare class HlpQuery {
|
|
3
|
-
where: <T = any>(qb: SelectQueryBuilder<T>,
|
|
4
|
-
whereBool: <T = any>(qb: SelectQueryBuilder<T>,
|
|
3
|
+
where: <T = any>(qb: SelectQueryBuilder<T>, column: string, prm: any, qOn?: string) => void;
|
|
4
|
+
whereBool: <T = any>(qb: SelectQueryBuilder<T>, column: string, active: "true" | "false", qOn?: string) => void;
|
|
5
5
|
whereCat: <T = any>(qb: SelectQueryBuilder<T>, prms: {
|
|
6
6
|
cat: {
|
|
7
7
|
id?: number;
|
|
@@ -9,12 +9,12 @@ declare class HlpQuery {
|
|
|
9
9
|
code?: string;
|
|
10
10
|
};
|
|
11
11
|
}) => void;
|
|
12
|
-
whereIn: <T = any>(qb: SelectQueryBuilder<T>,
|
|
13
|
-
whereNotIn: <T = any>(qb: SelectQueryBuilder<T>,
|
|
14
|
-
opDate: <T = any>(qb: SelectQueryBuilder<T>,
|
|
15
|
-
join: <T = any>(qb: SelectQueryBuilder<T>,
|
|
12
|
+
whereIn: <T = any>(qb: SelectQueryBuilder<T>, column: string, prm: any, qOn?: string) => void;
|
|
13
|
+
whereNotIn: <T = any>(qb: SelectQueryBuilder<T>, column: string, prm: any, qOn?: string) => void;
|
|
14
|
+
opDate: <T = any>(qb: SelectQueryBuilder<T>, column: string, prm: any) => void;
|
|
15
|
+
join: <T = any>(qb: SelectQueryBuilder<T>, column: string, rStr: string, status?: "lj" | "ljs") => void;
|
|
16
16
|
joker: <T = any>(qb: SelectQueryBuilder<T>, joker: {
|
|
17
|
-
|
|
17
|
+
column: string;
|
|
18
18
|
qProp: string | number;
|
|
19
19
|
qOn?: any;
|
|
20
20
|
}) => void;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { tormDateParams } from "../npms/typeorm";
|
|
2
2
|
class HlpQuery {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.where = (qb,
|
|
5
|
-
const qVar = !qOn ?
|
|
4
|
+
this.where = (qb, column, prm, qOn) => {
|
|
5
|
+
const qVar = !qOn ? column.substring(column.indexOf(".") + 1) : qOn;
|
|
6
6
|
if (prm) {
|
|
7
|
-
qb.andWhere(`${
|
|
7
|
+
qb.andWhere(`${column} = :${qVar}`, { [qVar]: prm });
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
|
-
this.whereBool = (qb,
|
|
11
|
-
const qVar = !qOn ?
|
|
10
|
+
this.whereBool = (qb, column, active, qOn) => {
|
|
11
|
+
const qVar = !qOn ? column.substring(column.indexOf(".") + 1) : qOn;
|
|
12
12
|
if (active) {
|
|
13
13
|
if (active === "true") {
|
|
14
|
-
qb.andWhere(`${
|
|
14
|
+
qb.andWhere(`${column} = :${qVar}`, { [qVar]: true });
|
|
15
15
|
}
|
|
16
16
|
if (active === "false") {
|
|
17
|
-
qb.andWhere(`${
|
|
17
|
+
qb.andWhere(`${column} = :${qVar}`, { [qVar]: false });
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
};
|
|
@@ -32,37 +32,37 @@ class HlpQuery {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
this.whereIn = (qb,
|
|
36
|
-
const qVar = !qOn ?
|
|
35
|
+
this.whereIn = (qb, column, prm, qOn) => {
|
|
36
|
+
const qVar = !qOn ? column.substring(column.indexOf(".") + 1) : qOn;
|
|
37
37
|
if (prm) {
|
|
38
|
-
qb.andWhere(`LOWER(${
|
|
38
|
+
qb.andWhere(`LOWER(${column}) IN (:...${qVar}) `, { [qVar]: prm });
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
this.whereNotIn = (qb,
|
|
42
|
-
const qVar = !qOn ?
|
|
41
|
+
this.whereNotIn = (qb, column, prm, qOn) => {
|
|
42
|
+
const qVar = !qOn ? column.substring(column.indexOf(".") + 1) : qOn;
|
|
43
43
|
if (prm) {
|
|
44
|
-
qb.andWhere(`LOWER(${
|
|
44
|
+
qb.andWhere(`LOWER(${column}) NOT IN (:...${qVar}) `, { [qVar]: prm });
|
|
45
45
|
// qb.andWhere("LOWER(role.code) IN (:...roleCodes)", { roleCodes: prms.roleCodes.ins });
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
this.opDate = (qb,
|
|
48
|
+
this.opDate = (qb, column, prm) => {
|
|
49
49
|
var _a, _b, _c;
|
|
50
50
|
if (prm === null || prm === void 0 ? void 0 : prm.opDate) {
|
|
51
|
-
tormDateParams(qb, `${
|
|
51
|
+
tormDateParams(qb, `${column}`, (_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);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
this.join = (qb,
|
|
54
|
+
this.join = (qb, column, rStr, status = "ljs") => {
|
|
55
55
|
if (status === "ljs") {
|
|
56
|
-
qb.leftJoinAndSelect(`${
|
|
56
|
+
qb.leftJoinAndSelect(`${column}`, `${rStr}`);
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
|
-
qb.leftJoin(`${
|
|
59
|
+
qb.leftJoin(`${column}`, `${rStr}`);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
this.joker = (qb, joker) => {
|
|
63
|
-
const qVar = !(joker === null || joker === void 0 ? void 0 : joker.qOn) ? joker.
|
|
63
|
+
const qVar = !(joker === null || joker === void 0 ? void 0 : joker.qOn) ? joker.column.substring(joker.column.indexOf(".") + 1) : joker === null || joker === void 0 ? void 0 : joker.qOn;
|
|
64
64
|
if (joker) {
|
|
65
|
-
qb.andWhere(`${joker.
|
|
65
|
+
qb.andWhere(`${joker.column} = :${qVar}`, { [qVar]: joker["qProp"] });
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
}
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export declare const stringifyFormatter: (data: any, space?: string | number) =>
|
|
|
45
45
|
export declare const removeBackSlashOccurences: (text: string, toChar: string) => string;
|
|
46
46
|
export declare const removeAMPM: (ref: string) => string;
|
|
47
47
|
export declare const refGenerator: (char?: string, regex?: RegExp, toChar?: string) => string;
|
|
48
|
+
export declare const removeSpecialCharsAndSpaces: (input: string) => string;
|
|
48
49
|
export declare const genSequenceRef: (refs: any[], startChars: string, zeroFillWidth: number, dateFormat?: string) => string;
|
|
49
50
|
export declare const sesStorageSet: (key: string, val: any) => void;
|
|
50
51
|
export declare const sesStorageGet: (key: string) => any;
|
package/lib/esm/utils.js
CHANGED
|
@@ -247,6 +247,9 @@ export const refGenerator = (char = "c", regex = /\/+/gi, toChar = "") => {
|
|
|
247
247
|
const ref = replaceAllIn(nDate, regex, toChar).toLocaleUpperCase();
|
|
248
248
|
return removeAMPM(ref);
|
|
249
249
|
};
|
|
250
|
+
export const removeSpecialCharsAndSpaces = (input) => {
|
|
251
|
+
return input.replace(/[^a-zA-Z0-9]/g, "");
|
|
252
|
+
};
|
|
250
253
|
// export const refGenerator = (char: string = "c", regex: RegExp = /\/+/gi, toChar: string = "") => {
|
|
251
254
|
// let date = new Date();
|
|
252
255
|
// let nDate =
|