asv-hlps 1.2.26 → 1.2.27

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.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { User } from "./models/entities/users/User";
2
+ import { UserNotarial } from "./models/entities/users/UserNotatial";
2
3
  export interface AuthParam {
3
4
  tag?: string;
4
5
  roles?: string[];
@@ -11,4 +12,4 @@ export interface AuthParam {
11
12
  steNames?: string[];
12
13
  url?: string;
13
14
  }
14
- export declare const getAuth: (authUser: User, authSte: string[], param?: AuthParam) => boolean;
15
+ export declare const getAuth: (authUser: User | UserNotarial, authSte: string[], param?: AuthParam) => boolean;
@@ -1,8 +1,9 @@
1
- import { User } from './User';
1
+ import { User } from "./User";
2
+ import { UserNotarial } from "./UserNotatial";
2
3
  export interface UserOnline {
3
4
  id: number;
4
5
  date: Date;
5
6
  logged: string;
6
7
  logout: string;
7
- user: User;
8
+ user: User | UserNotarial;
8
9
  }
@@ -53,10 +53,10 @@ export declare type HeaderTableColumnType = {
53
53
  export declare const colNa: HeaderTableColumnType[];
54
54
  export declare const colNaCo: HeaderTableColumnType[];
55
55
  export declare const colNaCoSh: HeaderTableColumnType[];
56
- export declare type FormPropsType = {
56
+ export declare type FormPropsType<T> = {
57
57
  onSubmitForm?: (value: any) => any;
58
58
  onCancelForm?: (value: any) => any;
59
- tob?: any;
59
+ tob?: T;
60
60
  url?: string;
61
61
  };
62
62
  export interface TabContentType {
@@ -1,4 +1,5 @@
1
1
  import { User } from "../../models/entities/users/User";
2
+ import { UserNotarial } from "../../models/entities/users/UserNotatial";
2
3
  export declare const displayPdfDate: (label: string, fromDate: string, toDate: string) => string;
3
4
  export declare const displayTitle: (title: string) => {
4
5
  width: string;
@@ -8,7 +9,7 @@ export declare const displayTitle: (title: string) => {
8
9
  margin: number[];
9
10
  fontSize: number;
10
11
  };
11
- export declare const displayClient: (user: User) => {
12
+ export declare const displayClient: (user: User | UserNotarial) => {
12
13
  absolutePosition: {
13
14
  x: number;
14
15
  y: number;
@@ -1,3 +1,6 @@
1
+ import { AuthParam } from "../auth";
2
+ import { User } from "../models/entities/users/User";
3
+ import { UserNotarial } from "../models/entities/users/UserNotatial";
1
4
  export declare class AuthService {
2
5
  tokenKey: string;
3
6
  constructor(tokenkey: string);
@@ -8,6 +11,7 @@ export declare class AuthService {
8
11
  login: (tob: LoginType, httpService: any) => Promise<boolean>;
9
12
  logout: () => boolean;
10
13
  authUser: () => unknown;
14
+ getAuth: (authUser: User | UserNotarial, authSte: string[], param?: AuthParam) => boolean;
11
15
  }
12
16
  declare type LoginType = {
13
17
  username: string;
@@ -14,16 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.AuthService = void 0;
16
16
  const jwt_decode_1 = __importDefault(require("jwt-decode"));
17
+ const auth_1 = require("../auth");
17
18
  const storageService_1 = __importDefault(require("./storageService"));
18
19
  class AuthService {
19
20
  constructor(tokenkey) {
20
- this.tokenKey = "awPharma";
21
+ this.tokenKey = "";
21
22
  // getStorageToken = (tokenKey, local = false) => {
22
23
  this.getStorageToken = (local = false) => {
23
24
  if (!this.tokenKey) {
24
25
  return null;
25
26
  }
26
- return storageService_1.default.getStorage(this.tokenKey);
27
+ return storageService_1.default.getStorage(this.tokenKey, local);
27
28
  };
28
29
  // setStorageToken = (tokenKey, jwt) => {
29
30
  this.setStorageToken = (jwt) => {
@@ -67,6 +68,9 @@ class AuthService {
67
68
  return null;
68
69
  }
69
70
  };
71
+ this.getAuth = (authUser, authSte, param) => {
72
+ return (0, auth_1.getAuth)(authUser, authSte, param);
73
+ };
70
74
  this.tokenKey = tokenkey;
71
75
  }
72
76
  }
package/lib/cjs/user.d.ts CHANGED
@@ -1,15 +1,16 @@
1
1
  import { Ste } from "./models/entities/users/Ste";
2
2
  import { User } from "./models/entities/users/User";
3
- export declare const inGrp: (grps: string[], user: User) => boolean;
4
- export declare const inSteGrp: (grps: string[], user: User) => boolean;
5
- export declare const hasRole: (roles: string[], user: User) => boolean;
6
- export declare const isBillPeriod: (user: User, period: string) => boolean;
7
- export declare const isStaffSte: (steNames: string[], user: User) => boolean;
8
- export declare const getFullname: (user: User) => string;
9
- export declare const entryDesignationUser: (user: User) => string;
3
+ import { UserNotarial } from "./models/entities/users/UserNotatial";
4
+ export declare const inGrp: (grps: string[], user: User | UserNotarial) => boolean;
5
+ export declare const inSteGrp: (grps: string[], user: User | UserNotarial) => boolean;
6
+ export declare const hasRole: (roles: string[], user: User | UserNotarial) => boolean;
7
+ export declare const isBillPeriod: (user: User | UserNotarial, period: string) => boolean;
8
+ export declare const isStaffSte: (steNames: string[], user: User | UserNotarial) => boolean;
9
+ export declare const getFullname: (user: User | UserNotarial) => string;
10
+ export declare const entryDesignationUser: (user: User | UserNotarial) => string;
10
11
  export declare const secureUser: (user: any, username: string, heads: any) => void;
11
12
  export declare const secureUserPassword: (user: any, heads: any) => void;
12
- export declare const userGrpCode: (user: User) => string;
13
- export declare const userCoef: (user: User) => number;
13
+ export declare const userGrpCode: (user: User | UserNotarial) => string;
14
+ export declare const userCoef: (user: User | UserNotarial) => number;
14
15
  export declare const labelSteName: (ste: Ste, size?: number, tabs?: string[]) => string;
15
16
  export declare const getSteShortname: (ste: Ste, steGrpNames: string[]) => string;
package/lib/cjs/user.js CHANGED
@@ -49,7 +49,7 @@ const isBillPeriod = (user, period) => {
49
49
  return user.periodBill.toLowerCase() === period ? true : false;
50
50
  };
51
51
  exports.isBillPeriod = isBillPeriod;
52
- // export const isStaffSte = (user: User, steNames: string|string[]) => {
52
+ // export const isStaffSte = (user: User | UserNotarial, steNames: string|string[]) => {
53
53
  const isStaffSte = (steNames, user) => {
54
54
  /* if(!Array.isArray(steNames)) {
55
55
  return (user.ste.name.toLowerCase() === steNames.toLowerCase());
package/lib/esm/auth.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { User } from "./models/entities/users/User";
2
+ import { UserNotarial } from "./models/entities/users/UserNotatial";
2
3
  export interface AuthParam {
3
4
  tag?: string;
4
5
  roles?: string[];
@@ -11,4 +12,4 @@ export interface AuthParam {
11
12
  steNames?: string[];
12
13
  url?: string;
13
14
  }
14
- export declare const getAuth: (authUser: User, authSte: string[], param?: AuthParam) => boolean;
15
+ export declare const getAuth: (authUser: User | UserNotarial, authSte: string[], param?: AuthParam) => boolean;
@@ -1,8 +1,9 @@
1
- import { User } from './User';
1
+ import { User } from "./User";
2
+ import { UserNotarial } from "./UserNotatial";
2
3
  export interface UserOnline {
3
4
  id: number;
4
5
  date: Date;
5
6
  logged: string;
6
7
  logout: string;
7
- user: User;
8
+ user: User | UserNotarial;
8
9
  }
@@ -53,10 +53,10 @@ export declare type HeaderTableColumnType = {
53
53
  export declare const colNa: HeaderTableColumnType[];
54
54
  export declare const colNaCo: HeaderTableColumnType[];
55
55
  export declare const colNaCoSh: HeaderTableColumnType[];
56
- export declare type FormPropsType = {
56
+ export declare type FormPropsType<T> = {
57
57
  onSubmitForm?: (value: any) => any;
58
58
  onCancelForm?: (value: any) => any;
59
- tob?: any;
59
+ tob?: T;
60
60
  url?: string;
61
61
  };
62
62
  export interface TabContentType {
@@ -1,4 +1,5 @@
1
1
  import { User } from "../../models/entities/users/User";
2
+ import { UserNotarial } from "../../models/entities/users/UserNotatial";
2
3
  export declare const displayPdfDate: (label: string, fromDate: string, toDate: string) => string;
3
4
  export declare const displayTitle: (title: string) => {
4
5
  width: string;
@@ -8,7 +9,7 @@ export declare const displayTitle: (title: string) => {
8
9
  margin: number[];
9
10
  fontSize: number;
10
11
  };
11
- export declare const displayClient: (user: User) => {
12
+ export declare const displayClient: (user: User | UserNotarial) => {
12
13
  absolutePosition: {
13
14
  x: number;
14
15
  y: number;
@@ -1,3 +1,6 @@
1
+ import { AuthParam } from "../auth";
2
+ import { User } from "../models/entities/users/User";
3
+ import { UserNotarial } from "../models/entities/users/UserNotatial";
1
4
  export declare class AuthService {
2
5
  tokenKey: string;
3
6
  constructor(tokenkey: string);
@@ -8,6 +11,7 @@ export declare class AuthService {
8
11
  login: (tob: LoginType, httpService: any) => Promise<boolean>;
9
12
  logout: () => boolean;
10
13
  authUser: () => unknown;
14
+ getAuth: (authUser: User | UserNotarial, authSte: string[], param?: AuthParam) => boolean;
11
15
  }
12
16
  declare type LoginType = {
13
17
  username: string;
@@ -8,16 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import jwtDecode from "jwt-decode";
11
+ import { getAuth } from "../auth";
11
12
  import storageService from "./storageService";
12
13
  export class AuthService {
13
14
  constructor(tokenkey) {
14
- this.tokenKey = "awPharma";
15
+ this.tokenKey = "";
15
16
  // getStorageToken = (tokenKey, local = false) => {
16
17
  this.getStorageToken = (local = false) => {
17
18
  if (!this.tokenKey) {
18
19
  return null;
19
20
  }
20
- return storageService.getStorage(this.tokenKey);
21
+ return storageService.getStorage(this.tokenKey, local);
21
22
  };
22
23
  // setStorageToken = (tokenKey, jwt) => {
23
24
  this.setStorageToken = (jwt) => {
@@ -61,6 +62,9 @@ export class AuthService {
61
62
  return null;
62
63
  }
63
64
  };
65
+ this.getAuth = (authUser, authSte, param) => {
66
+ return getAuth(authUser, authSte, param);
67
+ };
64
68
  this.tokenKey = tokenkey;
65
69
  }
66
70
  }
package/lib/esm/user.d.ts CHANGED
@@ -1,15 +1,16 @@
1
1
  import { Ste } from "./models/entities/users/Ste";
2
2
  import { User } from "./models/entities/users/User";
3
- export declare const inGrp: (grps: string[], user: User) => boolean;
4
- export declare const inSteGrp: (grps: string[], user: User) => boolean;
5
- export declare const hasRole: (roles: string[], user: User) => boolean;
6
- export declare const isBillPeriod: (user: User, period: string) => boolean;
7
- export declare const isStaffSte: (steNames: string[], user: User) => boolean;
8
- export declare const getFullname: (user: User) => string;
9
- export declare const entryDesignationUser: (user: User) => string;
3
+ import { UserNotarial } from "./models/entities/users/UserNotatial";
4
+ export declare const inGrp: (grps: string[], user: User | UserNotarial) => boolean;
5
+ export declare const inSteGrp: (grps: string[], user: User | UserNotarial) => boolean;
6
+ export declare const hasRole: (roles: string[], user: User | UserNotarial) => boolean;
7
+ export declare const isBillPeriod: (user: User | UserNotarial, period: string) => boolean;
8
+ export declare const isStaffSte: (steNames: string[], user: User | UserNotarial) => boolean;
9
+ export declare const getFullname: (user: User | UserNotarial) => string;
10
+ export declare const entryDesignationUser: (user: User | UserNotarial) => string;
10
11
  export declare const secureUser: (user: any, username: string, heads: any) => void;
11
12
  export declare const secureUserPassword: (user: any, heads: any) => void;
12
- export declare const userGrpCode: (user: User) => string;
13
- export declare const userCoef: (user: User) => number;
13
+ export declare const userGrpCode: (user: User | UserNotarial) => string;
14
+ export declare const userCoef: (user: User | UserNotarial) => number;
14
15
  export declare const labelSteName: (ste: Ste, size?: number, tabs?: string[]) => string;
15
16
  export declare const getSteShortname: (ste: Ste, steGrpNames: string[]) => string;
package/lib/esm/user.js CHANGED
@@ -16,7 +16,7 @@ export const hasRole = (roles, user) => {
16
16
  export const isBillPeriod = (user, period) => {
17
17
  return user.periodBill.toLowerCase() === period ? true : false;
18
18
  };
19
- // export const isStaffSte = (user: User, steNames: string|string[]) => {
19
+ // export const isStaffSte = (user: User | UserNotarial, steNames: string|string[]) => {
20
20
  export const isStaffSte = (steNames, user) => {
21
21
  /* if(!Array.isArray(steNames)) {
22
22
  return (user.ste.name.toLowerCase() === steNames.toLowerCase());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.2.26",
3
+ "version": "1.2.27",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",