asv-hlps 1.4.9 → 1.4.10
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/auth/auth.d.ts +1 -1
- package/lib/cjs/auth/auth.js +12 -18
- package/lib/cjs/auth/authService.js +0 -13
- package/lib/cjs/auth/models/AuthTag.d.ts +0 -2
- package/lib/cjs/auth/models/index.d.ts +0 -1
- package/lib/cjs/cashs/models/index.d.ts +0 -1
- package/lib/cjs/users/models/User.d.ts +1 -1
- package/lib/cjs/users/models/UserAbs.d.ts +1 -1
- package/lib/cjs/users/models/UserBase.d.ts +14 -14
- package/lib/cjs/utils.d.ts +0 -1
- package/lib/cjs/utils.js +0 -5
- package/lib/esm/auth/auth.d.ts +1 -1
- package/lib/esm/auth/auth.js +12 -18
- package/lib/esm/auth/authService.js +0 -13
- package/lib/esm/auth/models/AuthTag.d.ts +0 -2
- package/lib/esm/auth/models/index.d.ts +0 -1
- package/lib/esm/cashs/models/index.d.ts +0 -1
- package/lib/esm/users/models/User.d.ts +1 -1
- package/lib/esm/users/models/UserAbs.d.ts +1 -1
- package/lib/esm/users/models/UserBase.d.ts +14 -14
- package/lib/esm/utils.d.ts +0 -1
- package/lib/esm/utils.js +0 -4
- package/package.json +4 -3
- package/lib/cjs/auth/models/AuthTagGrp.d.ts +0 -3
- package/lib/cjs/auth/models/AuthTagGrp.js +0 -2
- package/lib/cjs/auth/models/AuthTagSub.d.ts +0 -3
- package/lib/cjs/auth/models/AuthTagSub.js +0 -2
- package/lib/cjs/bootstrap.d.ts +0 -1
- package/lib/cjs/bootstrap.js +0 -2
- package/lib/cjs/cashs/models/PaymentMode.d.ts +0 -5
- package/lib/cjs/cashs/models/PaymentMode.js +0 -2
- package/lib/cjs/markets/index.d.ts +0 -2
- package/lib/cjs/markets/index.js +0 -18
- package/lib/cjs/markets/models/Market.d.ts +0 -8
- package/lib/cjs/markets/models/Market.js +0 -2
- package/lib/cjs/markets/models/UMarket.d.ts +0 -11
- package/lib/cjs/markets/models/UMarket.js +0 -2
- package/lib/cjs/markets/models/index.d.ts +0 -2
- package/lib/cjs/markets/models/index.js +0 -18
- package/lib/cjs/markets/products/hlpProduct.d.ts +0 -13
- package/lib/cjs/markets/products/hlpProduct.js +0 -49
- package/lib/cjs/markets/products/index.d.ts +0 -2
- package/lib/cjs/markets/products/index.js +0 -23
- package/lib/cjs/markets/products/models/Product.d.ts +0 -39
- package/lib/cjs/markets/products/models/Product.js +0 -2
- package/lib/cjs/markets/products/models/ProductAsset.d.ts +0 -8
- package/lib/cjs/markets/products/models/ProductAsset.js +0 -2
- package/lib/cjs/markets/products/models/ProductCat.d.ts +0 -3
- package/lib/cjs/markets/products/models/ProductCat.js +0 -2
- package/lib/cjs/markets/products/models/ProductCollection.d.ts +0 -3
- package/lib/cjs/markets/products/models/ProductCollection.js +0 -2
- package/lib/cjs/markets/products/models/ProductDepot.d.ts +0 -11
- package/lib/cjs/markets/products/models/ProductDepot.js +0 -2
- package/lib/cjs/markets/products/models/ProductElt.d.ts +0 -3
- package/lib/cjs/markets/products/models/ProductElt.js +0 -2
- package/lib/cjs/markets/products/models/ProductGrp.d.ts +0 -3
- package/lib/cjs/markets/products/models/ProductGrp.js +0 -2
- package/lib/cjs/markets/products/models/ProductImage.d.ts +0 -5
- package/lib/cjs/markets/products/models/ProductImage.js +0 -2
- package/lib/cjs/markets/products/models/ProductIn.d.ts +0 -42
- package/lib/cjs/markets/products/models/ProductIn.js +0 -2
- package/lib/cjs/markets/products/models/ProductState.d.ts +0 -3
- package/lib/cjs/markets/products/models/ProductState.js +0 -2
- package/lib/cjs/markets/products/models/ProductStock.d.ts +0 -6
- package/lib/cjs/markets/products/models/ProductStock.js +0 -2
- package/lib/cjs/markets/products/models/ProductTag.d.ts +0 -3
- package/lib/cjs/markets/products/models/ProductTag.js +0 -2
- package/lib/cjs/markets/products/models/ProductVariant.d.ts +0 -6
- package/lib/cjs/markets/products/models/ProductVariant.js +0 -2
- package/lib/cjs/markets/products/models/index.d.ts +0 -13
- package/lib/cjs/markets/products/models/index.js +0 -29
- package/lib/cjs/markets/sales/index.d.ts +0 -1
- package/lib/cjs/markets/sales/index.js +0 -17
- package/lib/cjs/markets/sales/models/Sale.d.ts +0 -8
- package/lib/cjs/markets/sales/models/Sale.js +0 -2
- package/lib/cjs/markets/sales/models/SalePayment.d.ts +0 -23
- package/lib/cjs/markets/sales/models/SalePayment.js +0 -2
- package/lib/cjs/markets/sales/models/SaleProduct.d.ts +0 -8
- package/lib/cjs/markets/sales/models/SaleProduct.js +0 -2
- package/lib/cjs/markets/sales/models/index.d.ts +0 -3
- package/lib/cjs/markets/sales/models/index.js +0 -19
- package/lib/cjs/markets/shops/index.d.ts +0 -1
- package/lib/cjs/markets/shops/index.js +0 -17
- package/lib/cjs/markets/shops/models/Shop.d.ts +0 -13
- package/lib/cjs/markets/shops/models/Shop.js +0 -2
- package/lib/cjs/markets/users/models/User.d.ts +0 -7
- package/lib/cjs/markets/users/models/User.js +0 -2
- package/lib/cjs/shared/models/IIcon.d.ts +0 -4
- package/lib/cjs/shared/models/IIcon.js +0 -6
- package/lib/cjs/shared/models/NaAcIc.d.ts +0 -7
- package/lib/cjs/shared/models/NaAcIc.js +0 -7
- package/lib/cjs/shared/models/NaCoAcIc.d.ts +0 -4
- package/lib/cjs/shared/models/NaCoAcIc.js +0 -7
- package/lib/cjs/users/models/EUserTag.d.ts +0 -14
- package/lib/cjs/users/models/EUserTag.js +0 -2
- package/lib/esm/auth/models/AuthTagGrp.d.ts +0 -3
- package/lib/esm/auth/models/AuthTagGrp.js +0 -1
- package/lib/esm/auth/models/AuthTagSub.d.ts +0 -3
- package/lib/esm/auth/models/AuthTagSub.js +0 -1
- package/lib/esm/bootstrap.d.ts +0 -1
- package/lib/esm/bootstrap.js +0 -1
- package/lib/esm/cashs/models/PaymentMode.d.ts +0 -5
- package/lib/esm/cashs/models/PaymentMode.js +0 -1
- package/lib/esm/markets/index.d.ts +0 -2
- package/lib/esm/markets/index.js +0 -2
- package/lib/esm/markets/models/Market.d.ts +0 -8
- package/lib/esm/markets/models/Market.js +0 -1
- package/lib/esm/markets/models/UMarket.d.ts +0 -11
- package/lib/esm/markets/models/UMarket.js +0 -1
- package/lib/esm/markets/models/index.d.ts +0 -2
- package/lib/esm/markets/models/index.js +0 -2
- package/lib/esm/markets/products/hlpProduct.d.ts +0 -13
- package/lib/esm/markets/products/hlpProduct.js +0 -47
- package/lib/esm/markets/products/index.d.ts +0 -2
- package/lib/esm/markets/products/index.js +0 -2
- package/lib/esm/markets/products/models/Product.d.ts +0 -39
- package/lib/esm/markets/products/models/Product.js +0 -1
- package/lib/esm/markets/products/models/ProductAsset.d.ts +0 -8
- package/lib/esm/markets/products/models/ProductAsset.js +0 -1
- package/lib/esm/markets/products/models/ProductCat.d.ts +0 -3
- package/lib/esm/markets/products/models/ProductCat.js +0 -1
- package/lib/esm/markets/products/models/ProductCollection.d.ts +0 -3
- package/lib/esm/markets/products/models/ProductCollection.js +0 -1
- package/lib/esm/markets/products/models/ProductDepot.d.ts +0 -11
- package/lib/esm/markets/products/models/ProductDepot.js +0 -1
- package/lib/esm/markets/products/models/ProductElt.d.ts +0 -3
- package/lib/esm/markets/products/models/ProductElt.js +0 -1
- package/lib/esm/markets/products/models/ProductGrp.d.ts +0 -3
- package/lib/esm/markets/products/models/ProductGrp.js +0 -1
- package/lib/esm/markets/products/models/ProductImage.d.ts +0 -5
- package/lib/esm/markets/products/models/ProductImage.js +0 -1
- package/lib/esm/markets/products/models/ProductIn.d.ts +0 -42
- package/lib/esm/markets/products/models/ProductIn.js +0 -1
- package/lib/esm/markets/products/models/ProductState.d.ts +0 -3
- package/lib/esm/markets/products/models/ProductState.js +0 -1
- package/lib/esm/markets/products/models/ProductStock.d.ts +0 -6
- package/lib/esm/markets/products/models/ProductStock.js +0 -1
- package/lib/esm/markets/products/models/ProductTag.d.ts +0 -3
- package/lib/esm/markets/products/models/ProductTag.js +0 -1
- package/lib/esm/markets/products/models/ProductVariant.d.ts +0 -6
- package/lib/esm/markets/products/models/ProductVariant.js +0 -1
- package/lib/esm/markets/products/models/index.d.ts +0 -13
- package/lib/esm/markets/products/models/index.js +0 -13
- package/lib/esm/markets/sales/index.d.ts +0 -1
- package/lib/esm/markets/sales/index.js +0 -1
- package/lib/esm/markets/sales/models/Sale.d.ts +0 -8
- package/lib/esm/markets/sales/models/Sale.js +0 -1
- package/lib/esm/markets/sales/models/SalePayment.d.ts +0 -23
- package/lib/esm/markets/sales/models/SalePayment.js +0 -1
- package/lib/esm/markets/sales/models/SaleProduct.d.ts +0 -8
- package/lib/esm/markets/sales/models/SaleProduct.js +0 -1
- package/lib/esm/markets/sales/models/index.d.ts +0 -3
- package/lib/esm/markets/sales/models/index.js +0 -3
- package/lib/esm/markets/shops/index.d.ts +0 -1
- package/lib/esm/markets/shops/index.js +0 -1
- package/lib/esm/markets/shops/models/Shop.d.ts +0 -13
- package/lib/esm/markets/shops/models/Shop.js +0 -1
- package/lib/esm/markets/users/models/User.d.ts +0 -7
- package/lib/esm/markets/users/models/User.js +0 -1
- package/lib/esm/shared/models/IIcon.d.ts +0 -4
- package/lib/esm/shared/models/IIcon.js +0 -2
- package/lib/esm/shared/models/NaAcIc.d.ts +0 -7
- package/lib/esm/shared/models/NaAcIc.js +0 -3
- package/lib/esm/shared/models/NaCoAcIc.d.ts +0 -4
- package/lib/esm/shared/models/NaCoAcIc.js +0 -3
- package/lib/esm/users/models/EUserTag.d.ts +0 -14
- package/lib/esm/users/models/EUserTag.js +0 -1
package/lib/cjs/auth/auth.d.ts
CHANGED
package/lib/cjs/auth/auth.js
CHANGED
|
@@ -2,28 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAuth = void 0;
|
|
4
4
|
const user_1 = require("../users/user");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
5
|
const arraySome = (arr1, arr2) => {
|
|
7
6
|
return arr1.some((x) => arr2.includes(x));
|
|
8
7
|
};
|
|
9
8
|
const getAuth = (authUser, authSte, param) => {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f
|
|
11
|
-
if ((param === null || param === void 0 ? void 0 : param.tag) && (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
tags
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
if ((param === null || param === void 0 ? void 0 : param.tag) && (authUser === null || authUser === void 0 ? void 0 : authUser.tags.length)) {
|
|
11
|
+
const tags = [];
|
|
12
|
+
for (const tag of authUser.tags) {
|
|
13
|
+
tags.push(tag.code.toLowerCase());
|
|
15
14
|
}
|
|
16
|
-
|
|
17
|
-
for (const tag of authUser.tags) {
|
|
18
|
-
tags.push((_b = tag === null || tag === void 0 ? void 0 : tag.code) === null || _b === void 0 ? void 0 : _b.toLowerCase());
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const authIn = tags === null || tags === void 0 ? void 0 : tags.includes((_c = param === null || param === void 0 ? void 0 : param.tag) === null || _c === void 0 ? void 0 : _c.toLowerCase());
|
|
15
|
+
const authIn = tags.includes(param.tag.toLowerCase());
|
|
22
16
|
if (authIn) {
|
|
23
17
|
return true;
|
|
24
18
|
}
|
|
25
19
|
}
|
|
26
|
-
if (((
|
|
20
|
+
if (((_a = param === null || param === void 0 ? void 0 : param.roles) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
27
21
|
/* if (isStaffSte(authSte, authUser.ste.name) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
28
22
|
return true;
|
|
29
23
|
} */
|
|
@@ -33,7 +27,7 @@ const getAuth = (authUser, authSte, param) => {
|
|
|
33
27
|
}
|
|
34
28
|
// ------ staff ------
|
|
35
29
|
if (param === null || param === void 0 ? void 0 : param.staff) {
|
|
36
|
-
if (((
|
|
30
|
+
if (((_b = param === null || param === void 0 ? void 0 : param.staff.roles) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
|
37
31
|
(0, user_1.isStaffSte)(authSte, authUser.ste.name) &&
|
|
38
32
|
["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
39
33
|
return true;
|
|
@@ -54,7 +48,7 @@ const getAuth = (authUser, authSte, param) => {
|
|
|
54
48
|
param.client.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
|
|
55
49
|
return true;
|
|
56
50
|
}
|
|
57
|
-
if (((
|
|
51
|
+
if (((_c = param === null || param === void 0 ? void 0 : param.client.roles) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
58
52
|
(param === null || param === void 0 ? void 0 : param.client.steGrps.length) &&
|
|
59
53
|
["ceo", ...param === null || param === void 0 ? void 0 : param.client.roles].includes(authUser.role.code.toLowerCase()) &&
|
|
60
54
|
(param === null || param === void 0 ? void 0 : param.client.steGrps).includes(authUser.ste.grp.code.toLowerCase())) {
|
|
@@ -63,13 +57,13 @@ const getAuth = (authUser, authSte, param) => {
|
|
|
63
57
|
}
|
|
64
58
|
}
|
|
65
59
|
// ------ ste grps ------
|
|
66
|
-
if (((
|
|
60
|
+
if (((_d = param === null || param === void 0 ? void 0 : param.steGrps) === null || _d === void 0 ? void 0 : _d.length) > 0 && param.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
|
|
67
61
|
return true;
|
|
68
62
|
}
|
|
69
|
-
if (((
|
|
63
|
+
if (((_e = param === null || param === void 0 ? void 0 : param.grps) === null || _e === void 0 ? void 0 : _e.length) && param.grps.includes(authUser.grp.code.toLowerCase())) {
|
|
70
64
|
return true;
|
|
71
65
|
}
|
|
72
|
-
if (((
|
|
66
|
+
if (((_f = param === null || param === void 0 ? void 0 : param.steNames) === null || _f === void 0 ? void 0 : _f.length) > 0 && param.steNames.includes(authUser.ste.name.toLowerCase())) {
|
|
73
67
|
return true;
|
|
74
68
|
}
|
|
75
69
|
return false;
|
|
@@ -53,15 +53,6 @@ class AuthService {
|
|
|
53
53
|
return false;
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
/* login = async (tob: LoginType, httpService: any) => {
|
|
57
|
-
try {
|
|
58
|
-
const { data: jwt } = await httpService.post("auth/login", tob);
|
|
59
|
-
this.setStorageToken(jwt.token);
|
|
60
|
-
return true;
|
|
61
|
-
} catch (error) {
|
|
62
|
-
console.log(error);
|
|
63
|
-
}
|
|
64
|
-
}; */
|
|
65
56
|
this.logout = () => {
|
|
66
57
|
this.removeStorageToken();
|
|
67
58
|
// userAuthNavigate("/");
|
|
@@ -78,9 +69,6 @@ class AuthService {
|
|
|
78
69
|
return null;
|
|
79
70
|
}
|
|
80
71
|
};
|
|
81
|
-
/* getAuth = (authUser: User | UserNotarial, authSte: string[], param?: AuthParam) => {
|
|
82
|
-
return getAuth(authUser, authSte, param);
|
|
83
|
-
}; */
|
|
84
72
|
this.getAuth = (param) => {
|
|
85
73
|
return (0, auth_1.getAuth)(this.authUser(), this.authStes, param);
|
|
86
74
|
};
|
|
@@ -92,4 +80,3 @@ class AuthService {
|
|
|
92
80
|
}
|
|
93
81
|
}
|
|
94
82
|
exports.AuthService = AuthService;
|
|
95
|
-
// export default new AuthService("awPharma");
|
|
@@ -3,5 +3,4 @@ export { default as BankAccount } from "./BankAccount";
|
|
|
3
3
|
export { default as Currency } from "./Currency";
|
|
4
4
|
export { default as Deposit } from "./Deposit";
|
|
5
5
|
export { default as Feed } from "./Feed";
|
|
6
|
-
export { default as PaymentMode } from "./PaymentMode";
|
|
7
6
|
export { default as Spent } from "./Spent";
|
|
@@ -7,25 +7,25 @@ import UserRole from "./UserRole";
|
|
|
7
7
|
import UserTitr from "./UserTitr";
|
|
8
8
|
export default interface UserBase extends Address {
|
|
9
9
|
id: number;
|
|
10
|
-
codeCompta?: string | number;
|
|
11
|
-
firstname: string;
|
|
12
|
-
lastname: string;
|
|
13
|
-
username?: string;
|
|
14
10
|
birthday?: Date | string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
isActive: boolean;
|
|
18
|
-
isValided?: boolean;
|
|
11
|
+
clp?: string;
|
|
12
|
+
codeCompta?: string | number;
|
|
19
13
|
disabled?: boolean;
|
|
20
|
-
|
|
14
|
+
firstname: string;
|
|
21
15
|
foto?: string;
|
|
22
|
-
|
|
16
|
+
fullname?: string;
|
|
23
17
|
gender?: Gender;
|
|
24
|
-
titr?: UserTitr;
|
|
25
18
|
grp?: UserGrp;
|
|
26
|
-
|
|
19
|
+
ip?: string;
|
|
20
|
+
isActive: boolean;
|
|
21
|
+
isBadPayer?: boolean;
|
|
22
|
+
isValided?: boolean;
|
|
23
|
+
lastname: string;
|
|
24
|
+
password?: string;
|
|
27
25
|
role?: UserRole;
|
|
28
|
-
roles?:
|
|
26
|
+
roles?: string[];
|
|
29
27
|
ste?: Ste;
|
|
30
|
-
|
|
28
|
+
tags?: AuthTag[];
|
|
29
|
+
titr?: UserTitr;
|
|
30
|
+
username?: string;
|
|
31
31
|
}
|
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -108,4 +108,3 @@ export declare const toggleProp: (tob: any, propToToggle: string) => any;
|
|
|
108
108
|
export declare const winMaxHeight: (step?: 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9) => number;
|
|
109
109
|
export declare const arraySome: (arr1: any[], arr2: any[]) => boolean;
|
|
110
110
|
export declare const checkObjInArray: (objs: any[], checkProp: string | number, prop?: string) => boolean;
|
|
111
|
-
export declare function checkIsStringOfArray(array: unknown[]): array is string[];
|
package/lib/cjs/utils.js
CHANGED
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.unCheckedAll = exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = 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.refGenerator = exports.removeBackSlashOccurences = exports.stringifyFormatter = exports.removeString = exports.diffArraysByProp = exports.diffArraysByFunc = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.sequencesToNumbers = exports.notInSequence = exports.currencyFormatterCfa = exports.formatToStringCfa = exports.currencyFormatter = exports.formatToString = exports.checkAuth = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.duplicateObjects = exports.removeDuplicateObjects = exports.getRandomColor = exports.calPercent = exports.percentOf = exports.genDateMinutesStep = exports.formatDateFirstDayFr = exports.isEmpty = void 0;
|
|
7
7
|
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.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = void 0;
|
|
8
|
-
exports.checkIsStringOfArray = checkIsStringOfArray;
|
|
9
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
10
9
|
const relativeTime_1 = __importDefault(require("dayjs/plugin/relativeTime"));
|
|
11
10
|
const lodash_1 = __importDefault(require("lodash"));
|
|
@@ -775,7 +774,3 @@ const checkObjInArray = (objs, checkProp, prop = "id") => {
|
|
|
775
774
|
});
|
|
776
775
|
};
|
|
777
776
|
exports.checkObjInArray = checkObjInArray;
|
|
778
|
-
function checkIsStringOfArray(array) {
|
|
779
|
-
// return array.every((element) => typeof element === "string");
|
|
780
|
-
return array.some((element) => typeof element === "string");
|
|
781
|
-
}
|
package/lib/esm/auth/auth.d.ts
CHANGED
package/lib/esm/auth/auth.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import { isStaffSte } from "../users/user";
|
|
2
|
-
import { checkIsStringOfArray } from "../utils";
|
|
3
2
|
const arraySome = (arr1, arr2) => {
|
|
4
3
|
return arr1.some((x) => arr2.includes(x));
|
|
5
4
|
};
|
|
6
5
|
const getAuth = (authUser, authSte, param) => {
|
|
7
|
-
var _a, _b, _c, _d, _e, _f
|
|
8
|
-
if ((param === null || param === void 0 ? void 0 : param.tag) && (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
tags
|
|
6
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7
|
+
if ((param === null || param === void 0 ? void 0 : param.tag) && (authUser === null || authUser === void 0 ? void 0 : authUser.tags.length)) {
|
|
8
|
+
const tags = [];
|
|
9
|
+
for (const tag of authUser.tags) {
|
|
10
|
+
tags.push(tag.code.toLowerCase());
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
for (const tag of authUser.tags) {
|
|
15
|
-
tags.push((_b = tag === null || tag === void 0 ? void 0 : tag.code) === null || _b === void 0 ? void 0 : _b.toLowerCase());
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
const authIn = tags === null || tags === void 0 ? void 0 : tags.includes((_c = param === null || param === void 0 ? void 0 : param.tag) === null || _c === void 0 ? void 0 : _c.toLowerCase());
|
|
12
|
+
const authIn = tags.includes(param.tag.toLowerCase());
|
|
19
13
|
if (authIn) {
|
|
20
14
|
return true;
|
|
21
15
|
}
|
|
22
16
|
}
|
|
23
|
-
if (((
|
|
17
|
+
if (((_a = param === null || param === void 0 ? void 0 : param.roles) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
24
18
|
/* if (isStaffSte(authSte, authUser.ste.name) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
25
19
|
return true;
|
|
26
20
|
} */
|
|
@@ -30,7 +24,7 @@ const getAuth = (authUser, authSte, param) => {
|
|
|
30
24
|
}
|
|
31
25
|
// ------ staff ------
|
|
32
26
|
if (param === null || param === void 0 ? void 0 : param.staff) {
|
|
33
|
-
if (((
|
|
27
|
+
if (((_b = param === null || param === void 0 ? void 0 : param.staff.roles) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
|
|
34
28
|
isStaffSte(authSte, authUser.ste.name) &&
|
|
35
29
|
["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
|
|
36
30
|
return true;
|
|
@@ -51,7 +45,7 @@ const getAuth = (authUser, authSte, param) => {
|
|
|
51
45
|
param.client.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
|
|
52
46
|
return true;
|
|
53
47
|
}
|
|
54
|
-
if (((
|
|
48
|
+
if (((_c = param === null || param === void 0 ? void 0 : param.client.roles) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
55
49
|
(param === null || param === void 0 ? void 0 : param.client.steGrps.length) &&
|
|
56
50
|
["ceo", ...param === null || param === void 0 ? void 0 : param.client.roles].includes(authUser.role.code.toLowerCase()) &&
|
|
57
51
|
(param === null || param === void 0 ? void 0 : param.client.steGrps).includes(authUser.ste.grp.code.toLowerCase())) {
|
|
@@ -60,13 +54,13 @@ const getAuth = (authUser, authSte, param) => {
|
|
|
60
54
|
}
|
|
61
55
|
}
|
|
62
56
|
// ------ ste grps ------
|
|
63
|
-
if (((
|
|
57
|
+
if (((_d = param === null || param === void 0 ? void 0 : param.steGrps) === null || _d === void 0 ? void 0 : _d.length) > 0 && param.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
|
|
64
58
|
return true;
|
|
65
59
|
}
|
|
66
|
-
if (((
|
|
60
|
+
if (((_e = param === null || param === void 0 ? void 0 : param.grps) === null || _e === void 0 ? void 0 : _e.length) && param.grps.includes(authUser.grp.code.toLowerCase())) {
|
|
67
61
|
return true;
|
|
68
62
|
}
|
|
69
|
-
if (((
|
|
63
|
+
if (((_f = param === null || param === void 0 ? void 0 : param.steNames) === null || _f === void 0 ? void 0 : _f.length) > 0 && param.steNames.includes(authUser.ste.name.toLowerCase())) {
|
|
70
64
|
return true;
|
|
71
65
|
}
|
|
72
66
|
return false;
|
|
@@ -47,15 +47,6 @@ export class AuthService {
|
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
/* login = async (tob: LoginType, httpService: any) => {
|
|
51
|
-
try {
|
|
52
|
-
const { data: jwt } = await httpService.post("auth/login", tob);
|
|
53
|
-
this.setStorageToken(jwt.token);
|
|
54
|
-
return true;
|
|
55
|
-
} catch (error) {
|
|
56
|
-
console.log(error);
|
|
57
|
-
}
|
|
58
|
-
}; */
|
|
59
50
|
this.logout = () => {
|
|
60
51
|
this.removeStorageToken();
|
|
61
52
|
// userAuthNavigate("/");
|
|
@@ -72,9 +63,6 @@ export class AuthService {
|
|
|
72
63
|
return null;
|
|
73
64
|
}
|
|
74
65
|
};
|
|
75
|
-
/* getAuth = (authUser: User | UserNotarial, authSte: string[], param?: AuthParam) => {
|
|
76
|
-
return getAuth(authUser, authSte, param);
|
|
77
|
-
}; */
|
|
78
66
|
this.getAuth = (param) => {
|
|
79
67
|
return getAuth(this.authUser(), this.authStes, param);
|
|
80
68
|
};
|
|
@@ -85,4 +73,3 @@ export class AuthService {
|
|
|
85
73
|
this.authStes = authStes;
|
|
86
74
|
}
|
|
87
75
|
}
|
|
88
|
-
// export default new AuthService("awPharma");
|
|
@@ -3,5 +3,4 @@ export { default as BankAccount } from "./BankAccount";
|
|
|
3
3
|
export { default as Currency } from "./Currency";
|
|
4
4
|
export { default as Deposit } from "./Deposit";
|
|
5
5
|
export { default as Feed } from "./Feed";
|
|
6
|
-
export { default as PaymentMode } from "./PaymentMode";
|
|
7
6
|
export { default as Spent } from "./Spent";
|
|
@@ -7,25 +7,25 @@ import UserRole from "./UserRole";
|
|
|
7
7
|
import UserTitr from "./UserTitr";
|
|
8
8
|
export default interface UserBase extends Address {
|
|
9
9
|
id: number;
|
|
10
|
-
codeCompta?: string | number;
|
|
11
|
-
firstname: string;
|
|
12
|
-
lastname: string;
|
|
13
|
-
username?: string;
|
|
14
10
|
birthday?: Date | string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
isActive: boolean;
|
|
18
|
-
isValided?: boolean;
|
|
11
|
+
clp?: string;
|
|
12
|
+
codeCompta?: string | number;
|
|
19
13
|
disabled?: boolean;
|
|
20
|
-
|
|
14
|
+
firstname: string;
|
|
21
15
|
foto?: string;
|
|
22
|
-
|
|
16
|
+
fullname?: string;
|
|
23
17
|
gender?: Gender;
|
|
24
|
-
titr?: UserTitr;
|
|
25
18
|
grp?: UserGrp;
|
|
26
|
-
|
|
19
|
+
ip?: string;
|
|
20
|
+
isActive: boolean;
|
|
21
|
+
isBadPayer?: boolean;
|
|
22
|
+
isValided?: boolean;
|
|
23
|
+
lastname: string;
|
|
24
|
+
password?: string;
|
|
27
25
|
role?: UserRole;
|
|
28
|
-
roles?:
|
|
26
|
+
roles?: string[];
|
|
29
27
|
ste?: Ste;
|
|
30
|
-
|
|
28
|
+
tags?: AuthTag[];
|
|
29
|
+
titr?: UserTitr;
|
|
30
|
+
username?: string;
|
|
31
31
|
}
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -108,4 +108,3 @@ export declare const toggleProp: (tob: any, propToToggle: string) => any;
|
|
|
108
108
|
export declare const winMaxHeight: (step?: 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9) => number;
|
|
109
109
|
export declare const arraySome: (arr1: any[], arr2: any[]) => boolean;
|
|
110
110
|
export declare const checkObjInArray: (objs: any[], checkProp: string | number, prop?: string) => boolean;
|
|
111
|
-
export declare function checkIsStringOfArray(array: unknown[]): array is string[];
|
package/lib/esm/utils.js
CHANGED
|
@@ -685,7 +685,3 @@ export const checkObjInArray = (objs, checkProp, prop = "id") => {
|
|
|
685
685
|
return x[prop] === checkProp;
|
|
686
686
|
});
|
|
687
687
|
};
|
|
688
|
-
export function checkIsStringOfArray(array) {
|
|
689
|
-
// return array.every((element) => typeof element === "string");
|
|
690
|
-
return array.some((element) => typeof element === "string");
|
|
691
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asv-hlps",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.10",
|
|
4
4
|
"description": "helpers",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -18,10 +18,11 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/bcryptjs": "^2.4.6",
|
|
20
20
|
"@types/express": "^5.0.0",
|
|
21
|
-
"@types/
|
|
21
|
+
"@types/jwt-decode": "^3.1.0",
|
|
22
|
+
"@types/lodash": "^4.17.15",
|
|
22
23
|
"@types/pdfmake": "^0.2.11",
|
|
23
24
|
"@types/randomatic": "^3.1.5",
|
|
24
|
-
"@types/react": "^19.0.
|
|
25
|
+
"@types/react": "^19.0.8"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"axios": "^1.7.9",
|
package/lib/cjs/bootstrap.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type VariantType = "warning" | "purple" | "secondary" | "pink" | "primary" | "success" | "danger" | "light" | "white" | "info" | "link" | string;
|
package/lib/cjs/bootstrap.js
DELETED
package/lib/cjs/markets/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./models"), exports);
|
|
18
|
-
__exportStar(require("./products/models"), exports);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Market"), exports);
|
|
18
|
-
__exportStar(require("./UMarket"), exports);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import Product from "./models/Product";
|
|
2
|
-
import { ProductStock } from "./models/ProductStock";
|
|
3
|
-
declare class HlpProduct {
|
|
4
|
-
qtityInAllDepots(stock: ProductStock, prms?: {
|
|
5
|
-
exceptDepots?: string[];
|
|
6
|
-
main?: "master" | "slave";
|
|
7
|
-
}): number;
|
|
8
|
-
getStockSalable(product: Product): number;
|
|
9
|
-
stock: (product: Product, param: "salable" | "packs" | "units") => number;
|
|
10
|
-
extraFiilters: (row: Product) => string;
|
|
11
|
-
}
|
|
12
|
-
declare const _default: HlpProduct;
|
|
13
|
-
export default _default;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class HlpProduct {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.stock = (product, param) => {
|
|
6
|
-
const salable = (+product.stock.sumIns || 0) - (+product.stock.sumOuts || 0);
|
|
7
|
-
const packs = Math.trunc(salable / product.stock.qtityPerPackaging || 0);
|
|
8
|
-
const units = salable % product.stock.qtityPerPackaging || 0;
|
|
9
|
-
switch (param) {
|
|
10
|
-
case "salable":
|
|
11
|
-
return salable;
|
|
12
|
-
case "packs":
|
|
13
|
-
return packs;
|
|
14
|
-
case "units":
|
|
15
|
-
return units;
|
|
16
|
-
default:
|
|
17
|
-
return salable;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
this.extraFiilters = (row) => row.designation; /* +
|
|
21
|
-
row.codeCompta +
|
|
22
|
-
(row.tva > 0 ? "@tva" : "") +
|
|
23
|
-
(row.isAvailable ? "@dispo" : "") +
|
|
24
|
-
(!row.isAvailable ? "@indispo" : "") +
|
|
25
|
-
(row.isActive ? "@actif" : "") +
|
|
26
|
-
(!row.isActive ? "@inactif" : "") +
|
|
27
|
-
(row.isPrivate ? "@private" : "") +
|
|
28
|
-
(!row.isPrivate ? "@noprivate" : ""); */
|
|
29
|
-
}
|
|
30
|
-
qtityInAllDepots(stock, prms) {
|
|
31
|
-
const ins = stock.sumIns - stock.sumOuts;
|
|
32
|
-
return ins <= 0 ? 0 : ins;
|
|
33
|
-
}
|
|
34
|
-
getStockSalable(product) {
|
|
35
|
-
const stockAllSalable = +this.qtityInAllDepots(product.stock);
|
|
36
|
-
const stockProduct = Math.trunc(stockAllSalable / product.qtityUnit);
|
|
37
|
-
/* let stockSalable: number = 0;
|
|
38
|
-
|
|
39
|
-
if (stockAllSalable <= stockStore) {
|
|
40
|
-
stockSalable = stockAllSalable;
|
|
41
|
-
}
|
|
42
|
-
if (stockAllSalable > stockStore) {
|
|
43
|
-
stockSalable = stockStore;
|
|
44
|
-
} */
|
|
45
|
-
// return stockSalable || 0;
|
|
46
|
-
return stockProduct || 0;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.default = new HlpProduct();
|