@m4l/core 2.0.31 → 2.0.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.
- package/contexts/AuthContext/types.d.ts +5 -0
- package/contexts/AuthContext/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/test/utils.d.ts +2 -2
- package/test/utils.d.ts.map +1 -1
- package/types/index.d.ts +19 -13
- package/types/index.d.ts.map +1 -1
- package/utils/axiosOperation/index.d.ts +2 -2
- package/utils/axiosOperation/index.d.ts.map +1 -1
- package/utils/axiosOperation/index.js +62 -50
|
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { DomainCountry } from '../DomainCountryContext/types';
|
|
3
3
|
import { Maybe } from '../../types';
|
|
4
4
|
import { EnumTypes } from './constants';
|
|
5
|
+
export type User_Db_Type = 'dt_main' | 'dt_admin' | 'dt_operative';
|
|
5
6
|
export interface UserAuth {
|
|
6
7
|
email: string;
|
|
7
8
|
id: number;
|
|
@@ -18,6 +19,10 @@ export interface UserAuth {
|
|
|
18
19
|
* sessionId: id de la sesión del usuario, puede o no retornala el backend en gclick (si)
|
|
19
20
|
*/
|
|
20
21
|
sessionId?: string;
|
|
22
|
+
/**
|
|
23
|
+
* dbType: tipo de base de datos del usuario
|
|
24
|
+
*/
|
|
25
|
+
dbType?: User_Db_Type;
|
|
21
26
|
}
|
|
22
27
|
export type AuthUserType = Maybe<UserAuth>;
|
|
23
28
|
export type AuthProviderProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/contexts/AuthContext/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/contexts/AuthContext/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,cAAc,CAAC;AACnE,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC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AC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;IAClF,MAAM,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.32",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"react": "^19.0.0",
|
|
36
36
|
"zustand": "4.3.6",
|
|
37
37
|
"fast-equals": "^5.0.1",
|
|
38
|
-
"axios": "
|
|
38
|
+
"axios": "1.13.2",
|
|
39
39
|
"qs": "^6.0.0",
|
|
40
40
|
"camelcase-keys": "^9.1.3",
|
|
41
41
|
"snakecase-keys": "^8.0.1",
|
package/test/utils.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { cleanup, screen, renderHook } from '@testing-library/react';
|
|
1
|
+
import { cleanup, screen, renderHook, waitFor } from '@testing-library/react';
|
|
2
2
|
import { default as React, act } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* customRender
|
|
5
5
|
*/
|
|
6
6
|
declare const customRender: (ui: React.ReactElement, options?: {}) => import('@testing-library/react').RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|
|
7
7
|
export { default as userEvent } from '@testing-library/user-event';
|
|
8
|
-
export { customRender as render, renderHook, screen, cleanup, act };
|
|
8
|
+
export { customRender as render, renderHook, screen, cleanup, act, waitFor };
|
|
9
9
|
//# sourceMappingURL=utils.d.ts.map
|
package/test/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/test/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/test/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AASnC;;GAEG;AACH,QAAA,MAAM,YAAY,GAAI,IAAI,KAAK,CAAC,YAAY,EAAE,YAAY,iIASzD,CAAC;AACF,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC"}
|
package/types/index.d.ts
CHANGED
|
@@ -11,34 +11,39 @@ type MFProps = {
|
|
|
11
11
|
};
|
|
12
12
|
export type EnvironmentType = {
|
|
13
13
|
/**
|
|
14
|
-
* "isIsolatation"
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* "isIsolatation" indicates whether the application is running standalone without the host.
|
|
15
|
+
* Defaults to false.
|
|
16
|
+
* The ByIsolation component applies this configuration.
|
|
17
17
|
*/
|
|
18
18
|
isIsolatation?: boolean;
|
|
19
19
|
isMicroFrontend?: boolean;
|
|
20
20
|
mfProps?: MFProps;
|
|
21
21
|
/**
|
|
22
|
-
* "isLocalhost"
|
|
23
|
-
*
|
|
22
|
+
* "isLocalhost" indicates whether the application is running on localhost.
|
|
23
|
+
* It is resolved from window.host.
|
|
24
24
|
*/
|
|
25
25
|
isLocalhost: boolean;
|
|
26
26
|
host: string;
|
|
27
27
|
/**
|
|
28
|
-
* @deprecated
|
|
28
|
+
* @deprecated use "environment" instead. "domain_token" identifies the domain
|
|
29
|
+
* the application is connected to. It is resolved from the host or can be
|
|
30
|
+
* configured through an environment variable. For example: domain-1, domain-2.
|
|
29
31
|
*/
|
|
30
32
|
domain_token: string;
|
|
31
33
|
/**
|
|
32
|
-
* "env"
|
|
33
|
-
*
|
|
34
|
+
* "env" indicates the environment where the application runs.
|
|
35
|
+
* It is resolved from the host or can be configured through an environment
|
|
36
|
+
* variable. For example: dev1, dev2, stage, production.
|
|
34
37
|
*/
|
|
35
38
|
env?: string;
|
|
36
39
|
/**
|
|
37
|
-
* "mr"
|
|
40
|
+
* "mr" indicates the merge request context where the application runs.
|
|
41
|
+
* It is resolved from the host or can be configured through an environment
|
|
42
|
+
* variable. For example: local, mr-1234.
|
|
38
43
|
*/
|
|
39
44
|
mr?: string;
|
|
40
45
|
/**
|
|
41
|
-
*
|
|
46
|
+
* Database the platform connects to.
|
|
42
47
|
*/
|
|
43
48
|
database: string;
|
|
44
49
|
host_api_remote: string;
|
|
@@ -52,9 +57,10 @@ export declare type NetworkProps = {
|
|
|
52
57
|
method: any;
|
|
53
58
|
endPoint: string;
|
|
54
59
|
/**
|
|
55
|
-
* "database"
|
|
56
|
-
*
|
|
57
|
-
*
|
|
60
|
+
* "database" indicates the database that will be used for the request. When
|
|
61
|
+
* axiosOperation is instantiated it receives the default value automatically.
|
|
62
|
+
* For made4Labs this is `domain`.
|
|
63
|
+
* For Guardian this is `operative`.
|
|
58
64
|
*/
|
|
59
65
|
database?: string;
|
|
60
66
|
timeout?: number;
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO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|
4
4
|
*/
|
|
5
|
-
export declare const axiosOperation: <T =
|
|
5
|
+
export declare const axiosOperation: <T = unknown>(props: NetworkProps, enviroment: EnvironmentType, hostTools: HostToolsType) => Promise<T>;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/utils/axiosOperation/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/core/src/utils/axiosOperation/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAkJhF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAU,CAAC,GAAG,OAAO,EAC9C,OAAO,YAAY,EACnB,YAAY,eAAe,EAC3B,WAAW,aAAa,KACvB,OAAO,CAAC,CAAC,CAmEX,CAAC"}
|
|
@@ -1,76 +1,88 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import v from "axios";
|
|
2
|
+
import C from "qs";
|
|
3
|
+
import R from "camelcase-keys";
|
|
4
|
+
import b from "snakecase-keys";
|
|
5
5
|
import { EmmitEvents as h } from "../../types/index.js";
|
|
6
|
-
function x(
|
|
7
|
-
const { toast:
|
|
8
|
-
return
|
|
6
|
+
function x(s, t, r, n, i, e) {
|
|
7
|
+
const { toast: a } = r, o = t.data && typeof t.data == "object" ? t.data : void 0;
|
|
8
|
+
return n === "json" ? o ? o.error && o.error?.code && o.error?.msg !== void 0 ? Promise.reject({ ...o.error, status: t.status }) : (o.message && i && a({ title: o.message }, { type: "success", autoClose: 1e4 }), e ? R(o, { deep: !0 }) : o) : Promise.reject({
|
|
9
9
|
code: 1,
|
|
10
|
-
msg: `Incorrect endpoint: ${
|
|
11
|
-
status:
|
|
12
|
-
}) :
|
|
10
|
+
msg: `Incorrect endpoint: ${s}`,
|
|
11
|
+
status: t.status
|
|
12
|
+
}) : t.data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const { toast:
|
|
16
|
-
let
|
|
14
|
+
function D(s, t, r = !0, n = !0) {
|
|
15
|
+
const { toast: i } = t;
|
|
16
|
+
let e = {
|
|
17
17
|
message: "",
|
|
18
18
|
status: 1,
|
|
19
19
|
code: 0
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
s?.code !== void 0 && e.status !== void 0 && s.message !== void 0 && (e = { ...e, ...s });
|
|
22
|
+
const a = s?.response?.data && typeof s.response.data == "object" ? s.response.data : void 0;
|
|
23
|
+
if (s?.response ? a?.error && a.error?.code && a.error?.message !== void 0 ? e = {
|
|
24
|
+
...e,
|
|
25
|
+
...a.error,
|
|
26
|
+
message: a.error.message ?? e.message,
|
|
27
|
+
status: s.response.status ?? e.status
|
|
28
|
+
} : (e.message = s.message ?? e.message, e.status = s.response.status ?? e.status, e.code = 0) : s?.request ? (e.message = `${s?.code} ${s.message}`, e.code = -1) : (e.message = `${s?.code} ${s.message}`, e.status = 0, e.code = -2), r && s?.response?.status === 401 && t.events_emit(h.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, {}), a?.error?.message && (e.message = a.error.message), r) {
|
|
29
|
+
if (e.message.indexOf("ERR_CANCELED") > -1)
|
|
30
|
+
return e;
|
|
31
|
+
n && i(
|
|
32
|
+
{ title: `${e.message} - status: ${e.status} - code: ${e.code}` },
|
|
33
|
+
{
|
|
34
|
+
type: "error"
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return e;
|
|
27
39
|
}
|
|
28
|
-
const L = async (
|
|
40
|
+
const L = async (s, t, r) => {
|
|
29
41
|
const {
|
|
30
|
-
method:
|
|
31
|
-
endPoint:
|
|
32
|
-
database:
|
|
33
|
-
timeout:
|
|
34
|
-
parms:
|
|
35
|
-
data:
|
|
36
|
-
isRemote:
|
|
37
|
-
checkUnAuthorized:
|
|
38
|
-
headers:
|
|
42
|
+
method: n,
|
|
43
|
+
endPoint: i,
|
|
44
|
+
database: e = t.database,
|
|
45
|
+
timeout: a = 6e4,
|
|
46
|
+
parms: o = {},
|
|
47
|
+
data: d = {},
|
|
48
|
+
isRemote: c = !0,
|
|
49
|
+
checkUnAuthorized: p = !0,
|
|
50
|
+
headers: l,
|
|
39
51
|
onDownloadProgress: E,
|
|
40
|
-
isExternalUrl:
|
|
52
|
+
isExternalUrl: g,
|
|
41
53
|
responseType: f = "json",
|
|
42
54
|
signal: y,
|
|
43
55
|
toastSuccess: _ = !0,
|
|
44
56
|
toastError: P = !0,
|
|
45
57
|
bodyToSnakeCase: $ = !1,
|
|
46
|
-
responseToCamelCase:
|
|
47
|
-
} =
|
|
48
|
-
let
|
|
49
|
-
return
|
|
50
|
-
baseURL:
|
|
51
|
-
withCredentials:
|
|
52
|
-
method:
|
|
53
|
-
url:
|
|
54
|
-
data: $ ?
|
|
58
|
+
responseToCamelCase: j = !1
|
|
59
|
+
} = s;
|
|
60
|
+
let m;
|
|
61
|
+
return c ? m = t.host_api_remote : m = t.host_api_local, m = m + "/" + e, s?.options?.startProgress && s?.options?.startProgress(), v({
|
|
62
|
+
baseURL: g ? void 0 : m,
|
|
63
|
+
withCredentials: c,
|
|
64
|
+
method: n,
|
|
65
|
+
url: g ? i : `/${i}`,
|
|
66
|
+
data: $ ? b(d, { deep: !0 }) : d,
|
|
55
67
|
params: {},
|
|
56
68
|
/**
|
|
57
|
-
* paramsSerializer
|
|
69
|
+
* `paramsSerializer` is an optional function that serializes URL params.
|
|
58
70
|
*/
|
|
59
|
-
paramsSerializer: () =>
|
|
60
|
-
headers:
|
|
61
|
-
timeout:
|
|
71
|
+
paramsSerializer: () => C.stringify(o, { encode: !0 }),
|
|
72
|
+
headers: l,
|
|
73
|
+
timeout: a,
|
|
62
74
|
onDownloadProgress: E,
|
|
63
75
|
responseType: f,
|
|
64
76
|
signal: y
|
|
65
|
-
}).then((
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
}).then((u) => x(
|
|
78
|
+
i,
|
|
79
|
+
u,
|
|
80
|
+
r,
|
|
69
81
|
f,
|
|
70
82
|
_,
|
|
71
|
-
|
|
72
|
-
)).catch((
|
|
73
|
-
|
|
83
|
+
j
|
|
84
|
+
)).catch((u) => Promise.reject(D(u, r, p, P))).finally(() => {
|
|
85
|
+
s?.options?.stopProgress && s?.options?.stopProgress();
|
|
74
86
|
});
|
|
75
87
|
};
|
|
76
88
|
export {
|