asv-hlps 1.4.30 → 1.4.32

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.
Files changed (33) hide show
  1. package/lib/cjs/cashs/models/index.d.ts +1 -0
  2. package/lib/cjs/forms/AdditFormType.d.ts +1 -1
  3. package/lib/cjs/react-query/OptionsQueries.d.ts +23 -0
  4. package/lib/cjs/react-query/OptionsQueries.js +2 -0
  5. package/lib/cjs/react-query/OptionsType.d.ts +4 -0
  6. package/lib/cjs/react-query/OptionsType.js +2 -0
  7. package/lib/cjs/react-query/index.d.ts +3 -0
  8. package/lib/cjs/react-query/index.js +23 -0
  9. package/lib/cjs/react-query/useQueryFn.d.ts +4 -0
  10. package/lib/cjs/react-query/useQueryFn.js +8 -0
  11. package/lib/cjs/react-query/useQueryGet.d.ts +11 -0
  12. package/lib/cjs/react-query/useQueryGet.js +16 -0
  13. package/lib/cjs/react-query/useQueryPost.d.ts +10 -0
  14. package/lib/cjs/react-query/useQueryPost.js +9 -0
  15. package/lib/cjs/users/user.d.ts +2 -2
  16. package/lib/cjs/users/user.js +5 -36
  17. package/lib/esm/cashs/models/index.d.ts +1 -0
  18. package/lib/esm/forms/AdditFormType.d.ts +1 -1
  19. package/lib/esm/react-query/OptionsQueries.d.ts +23 -0
  20. package/lib/esm/react-query/OptionsQueries.js +1 -0
  21. package/lib/esm/react-query/OptionsType.d.ts +4 -0
  22. package/lib/esm/react-query/OptionsType.js +1 -0
  23. package/lib/esm/react-query/index.d.ts +3 -0
  24. package/lib/esm/react-query/index.js +14 -0
  25. package/lib/esm/react-query/useQueryFn.d.ts +4 -0
  26. package/lib/esm/react-query/useQueryFn.js +6 -0
  27. package/lib/esm/react-query/useQueryGet.d.ts +11 -0
  28. package/lib/esm/react-query/useQueryGet.js +14 -0
  29. package/lib/esm/react-query/useQueryPost.d.ts +10 -0
  30. package/lib/esm/react-query/useQueryPost.js +7 -0
  31. package/lib/esm/users/user.d.ts +2 -2
  32. package/lib/esm/users/user.js +5 -3
  33. package/package.json +2 -2
@@ -3,4 +3,5 @@ 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";
6
7
  export { default as Spent } from "./Spent";
@@ -1,5 +1,5 @@
1
1
  type AdditFormType<T = any> = {
2
- onSubmitForm?: (value: any) => any;
2
+ onSubmitForm?: (value: any) => void;
3
3
  onCancelForm?: any;
4
4
  tob?: T;
5
5
  url?: string;
@@ -0,0 +1,23 @@
1
+ export interface OptionsQueries {
2
+ gcTime?: any;
3
+ enabled?: any;
4
+ networkMode?: any;
5
+ initialData?: any;
6
+ initialDataUpdatedAt?: any;
7
+ meta?: any;
8
+ notifyOnChangeProps?: any;
9
+ placeholderData?: any;
10
+ queryKeyHashFn?: any;
11
+ refetchInterval?: any;
12
+ refetchIntervalInBackground?: any;
13
+ refetchOnMount?: any;
14
+ refetchOnReconnect?: any;
15
+ refetchOnWindowFocus?: any;
16
+ retry?: any;
17
+ retryOnMount?: any;
18
+ retryDelay?: any;
19
+ select?: any;
20
+ staleTime?: any;
21
+ structuralSharing?: any;
22
+ throwOnError?: any;
23
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type OptionsType = {
2
+ propId?: string;
3
+ invalidate?: boolean;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export { default as useQueryFn } from "./useQueryFn";
2
+ export { default as useQueryGet } from "./useQueryGet";
3
+ export { default as useQueryPost } from "./useQueryPost";
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useQueryPost = exports.useQueryGet = exports.useQueryFn = void 0;
7
+ // export { default as hlpQuery } from "./hlpQuery";
8
+ // export { default as useQueryAdd } from "./useQueryAdd";
9
+ // export { default as useQueryAddOpti } from "./useQueryAddOpti";
10
+ // export { default as useQueryAddit } from "./useQueryAddit";
11
+ // export { default as useQueryAdditOpti } from "./useQueryAdditOpti";
12
+ // export { default as useQueryCrud } from "./useQueryCrud";
13
+ // export { default as useQueryDel } from "./useQueryDel";
14
+ var useQueryFn_1 = require("./useQueryFn");
15
+ Object.defineProperty(exports, "useQueryFn", { enumerable: true, get: function () { return __importDefault(useQueryFn_1).default; } });
16
+ var useQueryGet_1 = require("./useQueryGet");
17
+ Object.defineProperty(exports, "useQueryGet", { enumerable: true, get: function () { return __importDefault(useQueryGet_1).default; } });
18
+ // export { default as useQueryMutatePost } from "./useQueryMutatePost";
19
+ var useQueryPost_1 = require("./useQueryPost");
20
+ Object.defineProperty(exports, "useQueryPost", { enumerable: true, get: function () { return __importDefault(useQueryPost_1).default; } });
21
+ // export { default as useQueryToggle } from "./useQueryToggle";
22
+ // export { default as useQueryUpdate } from "./useQueryUpdate";
23
+ // export { default as useQueryUpdateOpti } from "./useQueryUpdateOpti";
@@ -0,0 +1,4 @@
1
+ import { QueryFunction } from "@tanstack/react-query";
2
+ import { OptionsQueries } from "./OptionsQueries";
3
+ declare const useQueryFn: (keys: any[], fetchData: QueryFunction, queryOptions?: OptionsQueries) => import("@tanstack/react-query").UseQueryResult<any, any>;
4
+ export default useQueryFn;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_query_1 = require("@tanstack/react-query");
4
+ // const useQueryFn = (keys: any[], fetchData: QueryFunction, options?:{queryConfigs: UseQueryOptions}) => {
5
+ const useQueryFn = (keys, fetchData, queryOptions) => {
6
+ return (0, react_query_1.useQuery)(Object.assign({ queryKey: keys, queryFn: fetchData }, queryOptions));
7
+ };
8
+ exports.default = useQueryFn;
@@ -0,0 +1,11 @@
1
+ import { OptionsQueries } from "./OptionsQueries";
2
+ type CrudProps = {
3
+ httpService: any;
4
+ keys: any[];
5
+ queryOptions?: OptionsQueries;
6
+ getByParam?: string | number;
7
+ getByQueryParam?: any;
8
+ url: string;
9
+ };
10
+ declare const useQueryGet: <T = any>(crud: CrudProps) => import("@tanstack/react-query").UseQueryResult<any, any>;
11
+ export default useQueryGet;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_query_1 = require("@tanstack/react-query");
4
+ const useQueryGet = (crud) => {
5
+ const fetchDatas = () => {
6
+ if (crud.getByParam) {
7
+ return crud.httpService.getByParam(crud.getByParam, crud.url).then((res) => res.data);
8
+ }
9
+ if (crud.getByQueryParam) {
10
+ return crud.httpService.getByQueryParam(crud.url, crud.getByQueryParam).then((res) => res.data);
11
+ }
12
+ return crud.httpService.get(crud.url).then((res) => res.data);
13
+ };
14
+ return (0, react_query_1.useQuery)(Object.assign({ queryKey: crud === null || crud === void 0 ? void 0 : crud.keys, queryFn: fetchDatas }, crud === null || crud === void 0 ? void 0 : crud.queryOptions));
15
+ };
16
+ exports.default = useQueryGet;
@@ -0,0 +1,10 @@
1
+ import { OptionsQueries } from "./OptionsQueries";
2
+ type CrudProps = {
3
+ httpService: any;
4
+ keys: any[];
5
+ url: string;
6
+ postParam?: any;
7
+ queryOptions?: OptionsQueries;
8
+ };
9
+ declare const useQueryPost: <T = any>(crud: CrudProps) => import("@tanstack/react-query").UseQueryResult<any, any>;
10
+ export default useQueryPost;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_query_1 = require("@tanstack/react-query");
4
+ // const useQueryPost = <T = any>(crud: CrudProps, queryOptions?: OptionsQueries) => {
5
+ const useQueryPost = (crud) => {
6
+ const fetchDatas = () => crud.httpService.postBody(crud.postParam, crud.url).then((res) => res.data);
7
+ return (0, react_query_1.useQuery)(Object.assign({ queryKey: crud === null || crud === void 0 ? void 0 : crud.keys, queryFn: fetchDatas }, crud === null || crud === void 0 ? void 0 : crud.queryOptions));
8
+ };
9
+ exports.default = useQueryPost;
@@ -38,8 +38,8 @@ export declare const entryDesignationUser: <T extends {
38
38
  username: string;
39
39
  fullname: string;
40
40
  }>(user: T) => string;
41
- export declare const secureUser: (user: any, username: string, heads: any) => void;
42
- export declare const secureUserPassword: (user: any, heads?: any) => void;
41
+ export declare const secureUser: (user: any, username: string, bcrypt: any, heads: any) => void;
42
+ export declare const secureUserPassword: (user: any, bcrypt: any, heads?: any) => void;
43
43
  export declare const userGrpCode: <T extends {
44
44
  ste?: Ste;
45
45
  grp?: UserGrp;
@@ -1,43 +1,10 @@
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
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
38
5
  Object.defineProperty(exports, "__esModule", { value: true });
39
6
  exports.getSteShortname = exports.labelSteName = exports.userCoef = exports.userGrpCode = exports.secureUserPassword = exports.secureUser = exports.entryDesignationUser = exports.getFullname = exports.isStaffSte = exports.isBillPeriod = exports.hasRoles = exports.hasRole = exports.inSteGrp = exports.displaySteOrFullname = exports.displaySteOrStaff = exports.inGrp = void 0;
40
- const bcrypt = __importStar(require("bcryptjs"));
7
+ // import * as bcrypt from "bcryptjs";
41
8
  const randomatic_1 = __importDefault(require("randomatic"));
42
9
  const utils_1 = require("../utils");
43
10
  // export const inGrp = (grps: string[], user: User | UserNotarial) => {
@@ -121,7 +88,8 @@ const entryDesignationUser = (user) => {
121
88
  return user.username.toUpperCase();
122
89
  };
123
90
  exports.entryDesignationUser = entryDesignationUser;
124
- const secureUser = (user, username, heads) => {
91
+ const secureUser = (user, username, bcrypt, heads) => {
92
+ // const bcrypt = require("bcryptjs");
125
93
  user.password = (0, randomatic_1.default)("Aa0", 8);
126
94
  user.dns = heads.host;
127
95
  user.clp = user.password;
@@ -130,7 +98,8 @@ const secureUser = (user, username, heads) => {
130
98
  user.username = username;
131
99
  };
132
100
  exports.secureUser = secureUser;
133
- const secureUserPassword = (user, heads) => {
101
+ const secureUserPassword = (user, bcrypt, heads) => {
102
+ // const bcrypt = require("bcryptjs");
134
103
  user.password = !user.password ? (0, randomatic_1.default)("Aa0", 8) : user.password;
135
104
  if (heads) {
136
105
  user.dns = heads.host;
@@ -3,4 +3,5 @@ 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";
6
7
  export { default as Spent } from "./Spent";
@@ -1,5 +1,5 @@
1
1
  type AdditFormType<T = any> = {
2
- onSubmitForm?: (value: any) => any;
2
+ onSubmitForm?: (value: any) => void;
3
3
  onCancelForm?: any;
4
4
  tob?: T;
5
5
  url?: string;
@@ -0,0 +1,23 @@
1
+ export interface OptionsQueries {
2
+ gcTime?: any;
3
+ enabled?: any;
4
+ networkMode?: any;
5
+ initialData?: any;
6
+ initialDataUpdatedAt?: any;
7
+ meta?: any;
8
+ notifyOnChangeProps?: any;
9
+ placeholderData?: any;
10
+ queryKeyHashFn?: any;
11
+ refetchInterval?: any;
12
+ refetchIntervalInBackground?: any;
13
+ refetchOnMount?: any;
14
+ refetchOnReconnect?: any;
15
+ refetchOnWindowFocus?: any;
16
+ retry?: any;
17
+ retryOnMount?: any;
18
+ retryDelay?: any;
19
+ select?: any;
20
+ staleTime?: any;
21
+ structuralSharing?: any;
22
+ throwOnError?: any;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export type OptionsType = {
2
+ propId?: string;
3
+ invalidate?: boolean;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export { default as useQueryFn } from "./useQueryFn";
2
+ export { default as useQueryGet } from "./useQueryGet";
3
+ export { default as useQueryPost } from "./useQueryPost";
@@ -0,0 +1,14 @@
1
+ // export { default as hlpQuery } from "./hlpQuery";
2
+ // export { default as useQueryAdd } from "./useQueryAdd";
3
+ // export { default as useQueryAddOpti } from "./useQueryAddOpti";
4
+ // export { default as useQueryAddit } from "./useQueryAddit";
5
+ // export { default as useQueryAdditOpti } from "./useQueryAdditOpti";
6
+ // export { default as useQueryCrud } from "./useQueryCrud";
7
+ // export { default as useQueryDel } from "./useQueryDel";
8
+ export { default as useQueryFn } from "./useQueryFn";
9
+ export { default as useQueryGet } from "./useQueryGet";
10
+ // export { default as useQueryMutatePost } from "./useQueryMutatePost";
11
+ export { default as useQueryPost } from "./useQueryPost";
12
+ // export { default as useQueryToggle } from "./useQueryToggle";
13
+ // export { default as useQueryUpdate } from "./useQueryUpdate";
14
+ // export { default as useQueryUpdateOpti } from "./useQueryUpdateOpti";
@@ -0,0 +1,4 @@
1
+ import { QueryFunction } from "@tanstack/react-query";
2
+ import { OptionsQueries } from "./OptionsQueries";
3
+ declare const useQueryFn: (keys: any[], fetchData: QueryFunction, queryOptions?: OptionsQueries) => import("@tanstack/react-query").UseQueryResult<any, any>;
4
+ export default useQueryFn;
@@ -0,0 +1,6 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ // const useQueryFn = (keys: any[], fetchData: QueryFunction, options?:{queryConfigs: UseQueryOptions}) => {
3
+ const useQueryFn = (keys, fetchData, queryOptions) => {
4
+ return useQuery(Object.assign({ queryKey: keys, queryFn: fetchData }, queryOptions));
5
+ };
6
+ export default useQueryFn;
@@ -0,0 +1,11 @@
1
+ import { OptionsQueries } from "./OptionsQueries";
2
+ type CrudProps = {
3
+ httpService: any;
4
+ keys: any[];
5
+ queryOptions?: OptionsQueries;
6
+ getByParam?: string | number;
7
+ getByQueryParam?: any;
8
+ url: string;
9
+ };
10
+ declare const useQueryGet: <T = any>(crud: CrudProps) => import("@tanstack/react-query").UseQueryResult<any, any>;
11
+ export default useQueryGet;
@@ -0,0 +1,14 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ const useQueryGet = (crud) => {
3
+ const fetchDatas = () => {
4
+ if (crud.getByParam) {
5
+ return crud.httpService.getByParam(crud.getByParam, crud.url).then((res) => res.data);
6
+ }
7
+ if (crud.getByQueryParam) {
8
+ return crud.httpService.getByQueryParam(crud.url, crud.getByQueryParam).then((res) => res.data);
9
+ }
10
+ return crud.httpService.get(crud.url).then((res) => res.data);
11
+ };
12
+ return useQuery(Object.assign({ queryKey: crud === null || crud === void 0 ? void 0 : crud.keys, queryFn: fetchDatas }, crud === null || crud === void 0 ? void 0 : crud.queryOptions));
13
+ };
14
+ export default useQueryGet;
@@ -0,0 +1,10 @@
1
+ import { OptionsQueries } from "./OptionsQueries";
2
+ type CrudProps = {
3
+ httpService: any;
4
+ keys: any[];
5
+ url: string;
6
+ postParam?: any;
7
+ queryOptions?: OptionsQueries;
8
+ };
9
+ declare const useQueryPost: <T = any>(crud: CrudProps) => import("@tanstack/react-query").UseQueryResult<any, any>;
10
+ export default useQueryPost;
@@ -0,0 +1,7 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ // const useQueryPost = <T = any>(crud: CrudProps, queryOptions?: OptionsQueries) => {
3
+ const useQueryPost = (crud) => {
4
+ const fetchDatas = () => crud.httpService.postBody(crud.postParam, crud.url).then((res) => res.data);
5
+ return useQuery(Object.assign({ queryKey: crud === null || crud === void 0 ? void 0 : crud.keys, queryFn: fetchDatas }, crud === null || crud === void 0 ? void 0 : crud.queryOptions));
6
+ };
7
+ export default useQueryPost;
@@ -38,8 +38,8 @@ export declare const entryDesignationUser: <T extends {
38
38
  username: string;
39
39
  fullname: string;
40
40
  }>(user: T) => string;
41
- export declare const secureUser: (user: any, username: string, heads: any) => void;
42
- export declare const secureUserPassword: (user: any, heads?: any) => void;
41
+ export declare const secureUser: (user: any, username: string, bcrypt: any, heads: any) => void;
42
+ export declare const secureUserPassword: (user: any, bcrypt: any, heads?: any) => void;
43
43
  export declare const userGrpCode: <T extends {
44
44
  ste?: Ste;
45
45
  grp?: UserGrp;
@@ -1,4 +1,4 @@
1
- import * as bcrypt from "bcryptjs";
1
+ // import * as bcrypt from "bcryptjs";
2
2
  import randomatic from "randomatic";
3
3
  import { arraySome, limitTo, titleCase } from "../utils";
4
4
  // export const inGrp = (grps: string[], user: User | UserNotarial) => {
@@ -72,7 +72,8 @@ export const entryDesignationUser = (user) => {
72
72
  }
73
73
  return user.username.toUpperCase();
74
74
  };
75
- export const secureUser = (user, username, heads) => {
75
+ export const secureUser = (user, username, bcrypt, heads) => {
76
+ // const bcrypt = require("bcryptjs");
76
77
  user.password = randomatic("Aa0", 8);
77
78
  user.dns = heads.host;
78
79
  user.clp = user.password;
@@ -80,7 +81,8 @@ export const secureUser = (user, username, heads) => {
80
81
  // user.password = crypto.hashSync(user.password, 8);
81
82
  user.username = username;
82
83
  };
83
- export const secureUserPassword = (user, heads) => {
84
+ export const secureUserPassword = (user, bcrypt, heads) => {
85
+ // const bcrypt = require("bcryptjs");
84
86
  user.password = !user.password ? randomatic("Aa0", 8) : user.password;
85
87
  if (heads) {
86
88
  user.dns = heads.host;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.4.30",
3
+ "version": "1.4.32",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -24,8 +24,8 @@
24
24
  "@types/react": "^19.0.12"
25
25
  },
26
26
  "dependencies": {
27
+ "@tanstack/react-query": "^5.71.0",
27
28
  "axios": "^1.8.4",
28
- "bcryptjs": "^3.0.2",
29
29
  "class-validator": "^0.14.1",
30
30
  "classnames": "^2.5.1",
31
31
  "dayjs": "^1.11.13",