asv-hlps 1.4.24 → 1.4.26

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,5 @@
1
+ declare const useLinkParams: () => {
2
+ linkParams: any;
3
+ setLinkParams: (tob: any) => void;
4
+ };
5
+ export default useLinkParams;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const zustand_1 = require("zustand");
4
+ const linkParamsStore = (0, zustand_1.create)((set) => ({
5
+ linkParams: null,
6
+ setLinkParams: (params) => set(() => ({ linkParams: params })),
7
+ }));
8
+ const useLinkParams = () => {
9
+ const setLinkParams = linkParamsStore((s) => s.setLinkParams);
10
+ const linkParams = linkParamsStore((s) => s.linkParams);
11
+ return { linkParams, setLinkParams };
12
+ };
13
+ exports.default = useLinkParams;
@@ -1,13 +1,45 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.getSteShortname = exports.labelSteName = exports.userCoef = exports.userGrpCode = exports.secureUserPassword = exports.secureUser = exports.entryDesignationUser = exports.getFullname = exports.isStaffSte = exports.isBillPeriod = exports.hasRole = exports.inSteGrp = exports.displaySteOrFullname = exports.displaySteOrStaff = exports.inGrp = void 0;
7
- // import * as bcrypt from "bcryptjs";
40
+ const bcrypt = __importStar(require("bcryptjs"));
8
41
  const randomatic_1 = __importDefault(require("randomatic"));
9
42
  const utils_1 = require("../utils");
10
- const crypto = require("crypto-js");
11
43
  // export const inGrp = (grps: string[], user: User | UserNotarial) => {
12
44
  const inGrp = (grps, user) => {
13
45
  return [...grps].includes(user.grp.code.toLowerCase()) ? true : false;
@@ -88,8 +120,8 @@ const secureUser = (user, username, heads) => {
88
120
  user.password = (0, randomatic_1.default)("Aa0", 8);
89
121
  user.dns = heads.host;
90
122
  user.clp = user.password;
91
- // user.password = bcrypt.hashSync(user.password, 8);
92
- user.password = crypto.hashSync(user.password, 8);
123
+ user.password = bcrypt.hashSync(user.password, 8);
124
+ // user.password = crypto.hashSync(user.password, 8);
93
125
  user.username = username;
94
126
  };
95
127
  exports.secureUser = secureUser;
@@ -99,8 +131,8 @@ const secureUserPassword = (user, heads) => {
99
131
  user.dns = heads.host;
100
132
  }
101
133
  user.clp = user.password;
102
- // user.password = bcrypt.hashSync(user.password, 8);
103
- user.password = crypto.hashSync(user.password, 8);
134
+ user.password = bcrypt.hashSync(user.password, 8);
135
+ // user.password = crypto.hashSync(user.password, 8);
104
136
  };
105
137
  exports.secureUserPassword = secureUserPassword;
106
138
  const userGrpCode = (user) => {
@@ -0,0 +1,5 @@
1
+ declare const useLinkParams: () => {
2
+ linkParams: any;
3
+ setLinkParams: (tob: any) => void;
4
+ };
5
+ export default useLinkParams;
@@ -0,0 +1,11 @@
1
+ import { create } from "zustand";
2
+ const linkParamsStore = create((set) => ({
3
+ linkParams: null,
4
+ setLinkParams: (params) => set(() => ({ linkParams: params })),
5
+ }));
6
+ const useLinkParams = () => {
7
+ const setLinkParams = linkParamsStore((s) => s.setLinkParams);
8
+ const linkParams = linkParamsStore((s) => s.linkParams);
9
+ return { linkParams, setLinkParams };
10
+ };
11
+ export default useLinkParams;
@@ -1,7 +1,6 @@
1
- // import * as bcrypt from "bcryptjs";
1
+ import * as bcrypt from "bcryptjs";
2
2
  import randomatic from "randomatic";
3
3
  import { limitTo, titleCase } from "../utils";
4
- const crypto = require("crypto-js");
5
4
  // export const inGrp = (grps: string[], user: User | UserNotarial) => {
6
5
  export const inGrp = (grps, user) => {
7
6
  return [...grps].includes(user.grp.code.toLowerCase()) ? true : false;
@@ -73,8 +72,8 @@ export const secureUser = (user, username, heads) => {
73
72
  user.password = randomatic("Aa0", 8);
74
73
  user.dns = heads.host;
75
74
  user.clp = user.password;
76
- // user.password = bcrypt.hashSync(user.password, 8);
77
- user.password = crypto.hashSync(user.password, 8);
75
+ user.password = bcrypt.hashSync(user.password, 8);
76
+ // user.password = crypto.hashSync(user.password, 8);
78
77
  user.username = username;
79
78
  };
80
79
  export const secureUserPassword = (user, heads) => {
@@ -83,8 +82,8 @@ export const secureUserPassword = (user, heads) => {
83
82
  user.dns = heads.host;
84
83
  }
85
84
  user.clp = user.password;
86
- // user.password = bcrypt.hashSync(user.password, 8);
87
- user.password = crypto.hashSync(user.password, 8);
85
+ user.password = bcrypt.hashSync(user.password, 8);
86
+ // user.password = crypto.hashSync(user.password, 8);
88
87
  };
89
88
  export const userGrpCode = (user) => {
90
89
  return user.grp.code.toLowerCase() === "st" ? user.ste.grp.code.toLowerCase() : user.grp.code.toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.4.24",
3
+ "version": "1.4.26",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -16,15 +16,16 @@
16
16
  "author": "Aril Vignon",
17
17
  "license": "ISC",
18
18
  "devDependencies": {
19
- "@types/express": "^5.0.0",
19
+ "@types/express": "^5.0.1",
20
20
  "@types/jwt-decode": "^3.1.0",
21
21
  "@types/lodash": "^4.17.16",
22
22
  "@types/pdfmake": "^0.2.11",
23
23
  "@types/randomatic": "^3.1.5",
24
- "@types/react": "^19.0.11"
24
+ "@types/react": "^19.0.12"
25
25
  },
26
26
  "dependencies": {
27
- "axios": "^1.8.3",
27
+ "axios": "^1.8.4",
28
+ "bcryptjs": "^3.0.2",
28
29
  "class-validator": "^0.14.1",
29
30
  "classnames": "^2.5.1",
30
31
  "dayjs": "^1.11.13",
@@ -35,6 +36,7 @@
35
36
  "randomatic": "^3.1.1",
36
37
  "typeorm": "^0.3.21",
37
38
  "typescript": "^5.8.2",
38
- "yup": "^1.6.1"
39
+ "yup": "^1.6.1",
40
+ "zustand": "^5.0.3"
39
41
  }
40
42
  }