asv-hlps 1.4.43 → 1.4.44

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,12 @@
1
+ import { SelectQueryBuilder } from "typeorm";
2
+ declare class HlpQuery {
3
+ where: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
4
+ opDate: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any) => void;
5
+ join: <T = any>(qb: SelectQueryBuilder<T>, key: string, rStr: string, status?: "lj" | "ljs") => void;
6
+ joker: <T = any>(qb: SelectQueryBuilder<T>, joker: {
7
+ qId: string;
8
+ qProp: string | number;
9
+ }) => void;
10
+ }
11
+ declare const _default: HlpQuery;
12
+ export default _default;
@@ -0,0 +1,33 @@
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.opDate = (qb, key, prm) => {
13
+ var _a, _b, _c;
14
+ if (prm === null || prm === void 0 ? void 0 : prm.opDate) {
15
+ (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);
16
+ }
17
+ };
18
+ this.join = (qb, key, rStr, status = "ljs") => {
19
+ if (status === "ljs") {
20
+ qb.leftJoinAndSelect(`${key}`, `${rStr}`);
21
+ }
22
+ else {
23
+ qb.leftJoin(`${key}`, `${rStr}`);
24
+ }
25
+ };
26
+ this.joker = (qb, joker) => {
27
+ if (joker) {
28
+ qb.andWhere(`${joker.qId} = :joker`, { joker: joker["qProp"] });
29
+ }
30
+ };
31
+ }
32
+ }
33
+ exports.default = new HlpQuery();
@@ -0,0 +1,12 @@
1
+ import { SelectQueryBuilder } from "typeorm";
2
+ declare class HlpQuery {
3
+ where: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any, qOn?: string) => void;
4
+ opDate: <T = any>(qb: SelectQueryBuilder<T>, key: string, prm: any) => void;
5
+ join: <T = any>(qb: SelectQueryBuilder<T>, key: string, rStr: string, status?: "lj" | "ljs") => void;
6
+ joker: <T = any>(qb: SelectQueryBuilder<T>, joker: {
7
+ qId: string;
8
+ qProp: string | number;
9
+ }) => void;
10
+ }
11
+ declare const _default: HlpQuery;
12
+ export default _default;
@@ -0,0 +1,31 @@
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.opDate = (qb, key, prm) => {
11
+ var _a, _b, _c;
12
+ if (prm === null || prm === void 0 ? void 0 : prm.opDate) {
13
+ 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);
14
+ }
15
+ };
16
+ this.join = (qb, key, rStr, status = "ljs") => {
17
+ if (status === "ljs") {
18
+ qb.leftJoinAndSelect(`${key}`, `${rStr}`);
19
+ }
20
+ else {
21
+ qb.leftJoin(`${key}`, `${rStr}`);
22
+ }
23
+ };
24
+ this.joker = (qb, joker) => {
25
+ if (joker) {
26
+ qb.andWhere(`${joker.qId} = :joker`, { joker: joker["qProp"] });
27
+ }
28
+ };
29
+ }
30
+ }
31
+ export default new HlpQuery();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.4.43",
3
+ "version": "1.4.44",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",