mp-front-cli 0.0.1
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/README.md +1 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/rxSubjects/RxSubjectManager.d.ts +10 -0
- package/dist/core/rxSubjects/RxSubjectManager.d.ts.map +1 -0
- package/dist/core/rxSubjects/RxSubjectManager.js +19 -0
- package/dist/core/rxSubjects/subjectsManager.d.ts +4 -0
- package/dist/core/rxSubjects/subjectsManager.d.ts.map +1 -0
- package/dist/core/rxSubjects/subjectsManager.js +2 -0
- package/dist/core/services/ServiceToken.d.ts +13 -0
- package/dist/core/services/ServiceToken.d.ts.map +1 -0
- package/dist/core/services/ServiceToken.js +46 -0
- package/dist/core/utils/ApiMiddleware/index.d.ts +8 -0
- package/dist/core/utils/ApiMiddleware/index.d.ts.map +1 -0
- package/dist/core/utils/ApiMiddleware/index.js +27 -0
- package/dist/core/utils/CustomEncoder/index.d.ts +8 -0
- package/dist/core/utils/CustomEncoder/index.d.ts.map +1 -0
- package/dist/core/utils/CustomEncoder/index.js +32 -0
- package/dist/core/utils/CustomHeader/index.d.ts +232 -0
- package/dist/core/utils/CustomHeader/index.d.ts.map +1 -0
- package/dist/core/utils/CustomHeader/index.js +23 -0
- package/dist/core/utils/CustomLogger/index.d.ts +16 -0
- package/dist/core/utils/CustomLogger/index.d.ts.map +1 -0
- package/dist/core/utils/CustomLogger/index.js +63 -0
- package/dist/core/utils/CustomValidator/index.d.ts +7 -0
- package/dist/core/utils/CustomValidator/index.d.ts.map +1 -0
- package/dist/core/utils/CustomValidator/index.js +14 -0
- package/dist/core/utils/ErrorCatalog/index.d.ts +14 -0
- package/dist/core/utils/ErrorCatalog/index.d.ts.map +1 -0
- package/dist/core/utils/ErrorCatalog/index.js +122 -0
- package/dist/core/utils/MessageErrorBFF/index.d.ts +16 -0
- package/dist/core/utils/MessageErrorBFF/index.d.ts.map +1 -0
- package/dist/core/utils/MessageErrorBFF/index.js +21 -0
- package/dist/core/utils/apiRequest/FetchServiceBE.d.ts +14 -0
- package/dist/core/utils/apiRequest/FetchServiceBE.d.ts.map +1 -0
- package/dist/core/utils/apiRequest/FetchServiceBE.js +36 -0
- package/dist/core/utils/apiRequest/FetchServiceFE.d.ts +14 -0
- package/dist/core/utils/apiRequest/FetchServiceFE.d.ts.map +1 -0
- package/dist/core/utils/apiRequest/FetchServiceFE.js +38 -0
- package/dist/core/utils/index.d.ts +10 -0
- package/dist/core/utils/index.d.ts.map +1 -0
- package/dist/core/utils/index.js +9 -0
- package/dist/core/utils/interfaces/ApiResponse.d.ts +39 -0
- package/dist/core/utils/interfaces/ApiResponse.d.ts.map +1 -0
- package/dist/core/utils/interfaces/ApiResponse.js +1 -0
- package/dist/core/utils/interfaces/notifications.d.ts +14 -0
- package/dist/core/utils/interfaces/notifications.d.ts.map +1 -0
- package/dist/core/utils/interfaces/notifications.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/lang/common/errors/en_EN/index.d.ts +5 -0
- package/dist/lang/common/errors/en_EN/index.d.ts.map +1 -0
- package/dist/lang/common/errors/en_EN/index.js +4 -0
- package/dist/lang/common/errors/es_MX/index.d.ts +38 -0
- package/dist/lang/common/errors/es_MX/index.d.ts.map +1 -0
- package/dist/lang/common/errors/es_MX/index.js +37 -0
- package/dist/lang/common/errors/index.d.ts +3 -0
- package/dist/lang/common/errors/index.d.ts.map +1 -0
- package/dist/lang/common/errors/index.js +2 -0
- package/dist/lang/common/index.d.ts +2 -0
- package/dist/lang/common/index.d.ts.map +1 -0
- package/dist/lang/common/index.js +1 -0
- package/dist/lang/index.d.ts +3 -0
- package/dist/lang/index.d.ts.map +1 -0
- package/dist/lang/index.js +2 -0
- package/dist/lang/validator/en_EN/index.d.ts +5 -0
- package/dist/lang/validator/en_EN/index.d.ts.map +1 -0
- package/dist/lang/validator/en_EN/index.js +4 -0
- package/dist/lang/validator/es_MX/index.d.ts +41 -0
- package/dist/lang/validator/es_MX/index.d.ts.map +1 -0
- package/dist/lang/validator/es_MX/index.js +40 -0
- package/dist/lang/validator/index.d.ts +3 -0
- package/dist/lang/validator/index.d.ts.map +1 -0
- package/dist/lang/validator/index.js +2 -0
- package/package.json +31 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { t } from "i18next";
|
|
2
|
+
import { CustomLogger } from "../CustomLogger";
|
|
3
|
+
const errorCatalog = {
|
|
4
|
+
// EXAMPLE ERROR
|
|
5
|
+
"MP-001": {
|
|
6
|
+
code: 400,
|
|
7
|
+
type: "modal",
|
|
8
|
+
message: "errors.MP-001.message",
|
|
9
|
+
title: "errors.MP-001.title",
|
|
10
|
+
level: "info",
|
|
11
|
+
},
|
|
12
|
+
IS_BLACKLISTED: {
|
|
13
|
+
level: "error",
|
|
14
|
+
type: "modal",
|
|
15
|
+
message: "errors.isBlackListed.message",
|
|
16
|
+
title: "errors.isBlackListed.title",
|
|
17
|
+
code: 311,
|
|
18
|
+
},
|
|
19
|
+
IS_REJECTED: {
|
|
20
|
+
level: "error",
|
|
21
|
+
type: "modal",
|
|
22
|
+
message: "errors.isRejected.message",
|
|
23
|
+
title: "errors.isRejected.title",
|
|
24
|
+
code: 311,
|
|
25
|
+
},
|
|
26
|
+
IS_ACTIVE_PR: {
|
|
27
|
+
level: "info",
|
|
28
|
+
type: "modal",
|
|
29
|
+
message: "errors.IsActivePr.message",
|
|
30
|
+
title: "errors.IsActivePr.title",
|
|
31
|
+
code: 311,
|
|
32
|
+
},
|
|
33
|
+
IS_ACTIVE_SL: {
|
|
34
|
+
level: "info",
|
|
35
|
+
type: "modal",
|
|
36
|
+
message: "errors.IsActiveSL.message",
|
|
37
|
+
title: "errors.IsActiveSL.title",
|
|
38
|
+
code: 311,
|
|
39
|
+
},
|
|
40
|
+
IS_WHITELISTED: {
|
|
41
|
+
level: "success",
|
|
42
|
+
type: "modal",
|
|
43
|
+
message: "errors.IsWhiteListed.message",
|
|
44
|
+
title: "errors.IsWhiteListed.title",
|
|
45
|
+
code: 310,
|
|
46
|
+
},
|
|
47
|
+
UNAUTHORIZED: {
|
|
48
|
+
level: "error",
|
|
49
|
+
type: "modal",
|
|
50
|
+
message: "errors.UnAuthorized.message",
|
|
51
|
+
title: "errors.UnAuthorized.title",
|
|
52
|
+
code: 310,
|
|
53
|
+
},
|
|
54
|
+
INVALID_NUMBER: {
|
|
55
|
+
level: "warning",
|
|
56
|
+
type: "modal",
|
|
57
|
+
message: "errors.IsInvalidNumber.message",
|
|
58
|
+
title: "errors.IsInvalidNumber.title",
|
|
59
|
+
code: 400,
|
|
60
|
+
},
|
|
61
|
+
DELETED_USER: {
|
|
62
|
+
level: "warning",
|
|
63
|
+
type: "modal",
|
|
64
|
+
message: "errors.DeletedUser.message",
|
|
65
|
+
title: "errors.DeletedUser.title",
|
|
66
|
+
code: 310,
|
|
67
|
+
},
|
|
68
|
+
"ERR-GENERAL-01": {
|
|
69
|
+
level: "error",
|
|
70
|
+
type: "modal",
|
|
71
|
+
message: "errors.ERR-GENERAL-01.message",
|
|
72
|
+
title: "errors.ERR-GENERAL-01.title",
|
|
73
|
+
code: 400,
|
|
74
|
+
},
|
|
75
|
+
"CAMUS-00004-01": {
|
|
76
|
+
level: "info",
|
|
77
|
+
type: "modal",
|
|
78
|
+
message: "errors.CAMUS-00004-01.message",
|
|
79
|
+
title: "errors.CAMUS-00004-01.title",
|
|
80
|
+
code: 400,
|
|
81
|
+
},
|
|
82
|
+
"CAMUS-00004-02": {
|
|
83
|
+
level: "error",
|
|
84
|
+
type: "modal",
|
|
85
|
+
message: "errors.CAMUS-00004-02.message",
|
|
86
|
+
title: "errors.CAMUS-00004-02.title",
|
|
87
|
+
code: 400,
|
|
88
|
+
},
|
|
89
|
+
internalError: {
|
|
90
|
+
level: "error",
|
|
91
|
+
type: "modal",
|
|
92
|
+
message: "errors.internalError.message",
|
|
93
|
+
title: "errors.internalError.title",
|
|
94
|
+
code: 500,
|
|
95
|
+
},
|
|
96
|
+
default: {
|
|
97
|
+
code: 520,
|
|
98
|
+
type: "modal",
|
|
99
|
+
message: "errors.default.message",
|
|
100
|
+
title: "errors.default.title",
|
|
101
|
+
level: "warning",
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
export class ErrorCatalog extends CustomLogger {
|
|
105
|
+
get(error = "default") {
|
|
106
|
+
if (error instanceof Error) {
|
|
107
|
+
this.logError(error.message);
|
|
108
|
+
return {
|
|
109
|
+
...errorCatalog.internalError,
|
|
110
|
+
title: t(errorCatalog.internalError.title),
|
|
111
|
+
message: t(errorCatalog.internalError.message),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const statusCode = (typeof error === "string") ? error : error.code;
|
|
115
|
+
const payload = (typeof error === "string") ? {} : { ...error };
|
|
116
|
+
return {
|
|
117
|
+
...errorCatalog[statusCode] ?? errorCatalog.default,
|
|
118
|
+
title: t(errorCatalog[statusCode]?.title ?? errorCatalog.default.title, payload),
|
|
119
|
+
message: t(errorCatalog[statusCode]?.message ?? errorCatalog.default.message, payload),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CustomLogger } from "../CustomLogger";
|
|
2
|
+
import { ApiError } from "../interfaces/ApiResponse";
|
|
3
|
+
import { IMessageErrorBFF } from "../interfaces/notifications";
|
|
4
|
+
/**
|
|
5
|
+
* clase para manejar los errores de la aplicación
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class MessageErrorBFF
|
|
9
|
+
* @extends {Error}
|
|
10
|
+
*/
|
|
11
|
+
export default class MessageErrorBFF extends CustomLogger {
|
|
12
|
+
private messageError;
|
|
13
|
+
constructor(error?: string | Error | ApiError);
|
|
14
|
+
get(): IMessageErrorBFF;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/MessageErrorBFF/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D;;;;;;GAMG;AAEH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,YAAY;IACvD,OAAO,CAAC,YAAY,CAAkB;gBAE1B,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ;IAO7C,GAAG;CAGJ"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CustomLogger } from "../CustomLogger";
|
|
2
|
+
import { ErrorCatalog } from "../ErrorCatalog";
|
|
3
|
+
/**
|
|
4
|
+
* clase para manejar los errores de la aplicación
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class MessageErrorBFF
|
|
8
|
+
* @extends {Error}
|
|
9
|
+
*/
|
|
10
|
+
export default class MessageErrorBFF extends CustomLogger {
|
|
11
|
+
messageError;
|
|
12
|
+
constructor(error) {
|
|
13
|
+
super();
|
|
14
|
+
const errorCatalog = new ErrorCatalog();
|
|
15
|
+
this.messageError = errorCatalog.get(error);
|
|
16
|
+
this.logError("MessageErrorBFF", JSON.stringify(this.messageError));
|
|
17
|
+
}
|
|
18
|
+
get() {
|
|
19
|
+
return this.messageError;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { Method } from "../../../../types/types";
|
|
3
|
+
import { ApiResponse } from "../interfaces/ApiResponse";
|
|
4
|
+
import { CustomHeader } from "../CustomHeader";
|
|
5
|
+
export declare abstract class FetchServiceBE<TRes, TData = {}> extends CustomHeader {
|
|
6
|
+
private apiUrl;
|
|
7
|
+
private method;
|
|
8
|
+
constructor(apiUrl: string, method?: Method);
|
|
9
|
+
abstract cookieName(): string;
|
|
10
|
+
errorHandler(response: ApiResponse<TRes>): boolean;
|
|
11
|
+
customCatchError(error: Error): Observable<any>;
|
|
12
|
+
fetchData(params?: TData): Observable<ApiResponse<TRes>>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=FetchServiceBE.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchServiceBE.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/apiRequest/FetchServiceBE.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAA0B,MAAM,MAAM,CAAC;AAIrE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,8BAAsB,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAE,SAAQ,YAAY;IACzE,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAM3C,QAAQ,CAAC,UAAU,IAAI,MAAM;IAE7B,YAAY,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC;IAOxC,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAK7B,SAAS,CAAC,MAAM,GAAE,KAAmB,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;CAmBtE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { switchMap, of, catchError, filter } from "rxjs";
|
|
2
|
+
import { fromFetch } from "rxjs/fetch";
|
|
3
|
+
import MessageErrorBFF from "../MessageErrorBFF";
|
|
4
|
+
import { ErrorHandler } from "@/core/rxSubjects/subjectsManager";
|
|
5
|
+
import { CustomHeader } from "../CustomHeader";
|
|
6
|
+
export class FetchServiceBE extends CustomHeader {
|
|
7
|
+
apiUrl;
|
|
8
|
+
method;
|
|
9
|
+
constructor(apiUrl, method) {
|
|
10
|
+
super();
|
|
11
|
+
this.apiUrl = apiUrl;
|
|
12
|
+
this.method = method ?? "POST";
|
|
13
|
+
}
|
|
14
|
+
errorHandler(response) {
|
|
15
|
+
if (response.errors) {
|
|
16
|
+
ErrorHandler.setSubject(new MessageErrorBFF(response.errors[0]).get());
|
|
17
|
+
}
|
|
18
|
+
return !response.errors;
|
|
19
|
+
}
|
|
20
|
+
customCatchError(error) {
|
|
21
|
+
ErrorHandler.setSubject(new MessageErrorBFF(error).get());
|
|
22
|
+
return of({ error: true }).pipe(filter(({ error }) => !error));
|
|
23
|
+
}
|
|
24
|
+
fetchData(params = {}) {
|
|
25
|
+
this.logDebug("fetchData", JSON.stringify(params));
|
|
26
|
+
this.logDebug("cookieName", this.cookieName());
|
|
27
|
+
return of(params).pipe(switchMap((params) => this.getHeaders().pipe(switchMap((headers) => of({ params, headers })))), switchMap(({ params, headers }) => fromFetch(this.apiUrl, {
|
|
28
|
+
method: this.method,
|
|
29
|
+
headers: headers,
|
|
30
|
+
body: JSON.stringify(params),
|
|
31
|
+
}).pipe(switchMap((response) => response.json()), switchMap((data) => {
|
|
32
|
+
this.logDebug(`FetchServiceBE \x1b[37m <URL>: \x1b[33m ${this.apiUrl} \x1b[37m <HEADERS>: \x1b[33m ${JSON.stringify(headers)} \x1b[37m <BODY>: \x1b[33m ${JSON.stringify(params)} \x1b[37m <RESPONSE>: \x1b[33m ${JSON.stringify(data)} \x1b[33m`);
|
|
33
|
+
return of(data);
|
|
34
|
+
}))), filter(this.errorHandler), catchError(this.customCatchError));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { Method } from "../../../../types/types";
|
|
3
|
+
import { IMessageErrorBFF } from "../interfaces/notifications";
|
|
4
|
+
import { CustomValidator } from "../CustomValidator";
|
|
5
|
+
export declare class FetchServiceFE<TRes, TData = {}> extends CustomValidator {
|
|
6
|
+
private apiUrl;
|
|
7
|
+
private method;
|
|
8
|
+
private headers;
|
|
9
|
+
constructor(apiUrl: string, method?: Method);
|
|
10
|
+
errorHandler(data: TRes & IMessageErrorBFF): boolean;
|
|
11
|
+
customCatchError(error: Error): Observable<TRes>;
|
|
12
|
+
fetchData(params?: TData): Observable<TRes>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=FetchServiceFE.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchServiceFE.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/apiRequest/FetchServiceFE.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,UAAU,EAAE,MAAM,MAAM,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAE,SAAQ,eAAe;IACnE,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAc;gBAEjB,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAS3C,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,gBAAgB;IAK1C,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAK7B,SAAS,CAAC,MAAM,GAAE,KAAmB,GAAG,UAAU,CAAC,IAAI,CAAC;CAiBzD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { switchMap, catchError, of, filter } from "rxjs";
|
|
2
|
+
import { fromFetch } from "rxjs/fetch";
|
|
3
|
+
import { ErrorHandler } from "@/core/rxSubjects/subjectsManager";
|
|
4
|
+
import MessageErrorBFF from "../MessageErrorBFF";
|
|
5
|
+
import { CustomValidator } from "../CustomValidator";
|
|
6
|
+
export class FetchServiceFE extends CustomValidator {
|
|
7
|
+
apiUrl;
|
|
8
|
+
method;
|
|
9
|
+
headers;
|
|
10
|
+
constructor(apiUrl, method) {
|
|
11
|
+
super();
|
|
12
|
+
this.apiUrl = apiUrl;
|
|
13
|
+
this.method = method ?? "POST";
|
|
14
|
+
this.headers = {
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
errorHandler(data) {
|
|
19
|
+
if (data.code)
|
|
20
|
+
ErrorHandler.setSubject(data);
|
|
21
|
+
return !data.code;
|
|
22
|
+
}
|
|
23
|
+
customCatchError(error) {
|
|
24
|
+
ErrorHandler.setSubject(new MessageErrorBFF(error).get());
|
|
25
|
+
return of({ error: true }).pipe(filter(({ error }) => !error));
|
|
26
|
+
}
|
|
27
|
+
fetchData(params = {}) {
|
|
28
|
+
return fromFetch(this.apiUrl, {
|
|
29
|
+
method: this.method,
|
|
30
|
+
headers: this.headers,
|
|
31
|
+
body: this.encode(params),
|
|
32
|
+
})
|
|
33
|
+
.pipe(switchMap((response) => response.json()), switchMap((data) => {
|
|
34
|
+
this.logDebug(`FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <BODY>: ${JSON.stringify(data)}`);
|
|
35
|
+
return of(data);
|
|
36
|
+
}), filter(this.errorHandler), switchMap((data) => of(this.decode({ base64: data }))), catchError(this.customCatchError));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { ApiMiddleware } from "./ApiMiddleware";
|
|
2
|
+
export { FetchServiceBE } from "./apiRequest/FetchServiceBE";
|
|
3
|
+
export { FetchServiceFE } from "./apiRequest/FetchServiceFE";
|
|
4
|
+
export { CustomEncoder } from "./CustomEncoder";
|
|
5
|
+
export { CustomHeader } from "./CustomHeader";
|
|
6
|
+
export { CustomLogger } from "./CustomLogger";
|
|
7
|
+
export { CustomValidator } from "./CustomValidator";
|
|
8
|
+
export { ErrorCatalog } from "./ErrorCatalog";
|
|
9
|
+
export { default as MessageErrorBFF } from "./MessageErrorBFF";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { ApiMiddleware } from "./ApiMiddleware";
|
|
2
|
+
export { FetchServiceBE } from "./apiRequest/FetchServiceBE";
|
|
3
|
+
export { FetchServiceFE } from "./apiRequest/FetchServiceFE";
|
|
4
|
+
export { CustomEncoder } from "./CustomEncoder";
|
|
5
|
+
export { CustomHeader } from "./CustomHeader";
|
|
6
|
+
export { CustomLogger } from "./CustomLogger";
|
|
7
|
+
export { CustomValidator } from "./CustomValidator";
|
|
8
|
+
export { ErrorCatalog } from "./ErrorCatalog";
|
|
9
|
+
export { default as MessageErrorBFF } from "./MessageErrorBFF";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface ApiResponse<T> {
|
|
2
|
+
data: Data<T>[];
|
|
3
|
+
links?: Links;
|
|
4
|
+
errors?: ApiError[];
|
|
5
|
+
}
|
|
6
|
+
export interface Data<T> {
|
|
7
|
+
type: string;
|
|
8
|
+
id: string;
|
|
9
|
+
attributes: T;
|
|
10
|
+
relationships: Relationships;
|
|
11
|
+
links: Pick<Links, 'self'>;
|
|
12
|
+
}
|
|
13
|
+
export interface Relationships {
|
|
14
|
+
user: User;
|
|
15
|
+
}
|
|
16
|
+
export interface User {
|
|
17
|
+
data: UserData;
|
|
18
|
+
}
|
|
19
|
+
export interface UserData {
|
|
20
|
+
}
|
|
21
|
+
export interface ApiError {
|
|
22
|
+
code: string;
|
|
23
|
+
status: string;
|
|
24
|
+
source: Source;
|
|
25
|
+
title: string;
|
|
26
|
+
detail: string;
|
|
27
|
+
suggestedActions: string;
|
|
28
|
+
}
|
|
29
|
+
export interface Source {
|
|
30
|
+
pointer: string;
|
|
31
|
+
}
|
|
32
|
+
export interface Links {
|
|
33
|
+
self: string;
|
|
34
|
+
first: string;
|
|
35
|
+
prev: string;
|
|
36
|
+
next: string;
|
|
37
|
+
last: string;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ApiResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiResponse.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/interfaces/ApiResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,IAAI,CAAC,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,CAAC,CAAC;IACd,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;CAAG;AAE5B,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type MessageType = "modal" | "message";
|
|
2
|
+
type MessageLevel = "error" | "success" | "warning" | "info" | "confirm";
|
|
3
|
+
export interface IMessageErrorBFF {
|
|
4
|
+
code?: number;
|
|
5
|
+
message: string;
|
|
6
|
+
type: MessageType;
|
|
7
|
+
level: MessageLevel;
|
|
8
|
+
title: string;
|
|
9
|
+
payload?: {};
|
|
10
|
+
clearCookieSession?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type messageManagerFn = (type: MessageType, level: MessageLevel, message: string, title: string, onOk?: () => void) => void;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/interfaces/notifications.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,OAAO,GAAG,SAAS,CAAA;AACtC,KAAK,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;AAExE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,YAAY,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,EAAE,CAAA;IACZ,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED,MAAM,MAAM,gBAAgB,GAAG,CAC7B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,IAAI,KACd,IAAI,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lang/common/errors/en_EN/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW;;CAEhB,CAAC;AAEF,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare const translation: {
|
|
2
|
+
errors: {
|
|
3
|
+
default: {
|
|
4
|
+
title: string;
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
"MP-001": {
|
|
8
|
+
title: string;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
"ERR-GENERAL-01": {
|
|
12
|
+
title: string;
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
"CAMUS-00004-01": {
|
|
16
|
+
title: string;
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
"CAMUS-00004-02": {
|
|
20
|
+
title: string;
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
"CAMUS-00004-03": {
|
|
24
|
+
title: string;
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
UnAuthorized: {
|
|
28
|
+
title: string;
|
|
29
|
+
message: string;
|
|
30
|
+
};
|
|
31
|
+
ErrorGeneral: {
|
|
32
|
+
title: string;
|
|
33
|
+
message: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export default translation;
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lang/common/errors/es_MX/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuChB,CAAC;AAEF,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const translation = {
|
|
2
|
+
errors: {
|
|
3
|
+
default: {
|
|
4
|
+
title: "No pudimos cargar alguno de los datos solicitados.",
|
|
5
|
+
message: "Si continua apareciendo este mensaje por favor contacta a soporte.",
|
|
6
|
+
},
|
|
7
|
+
"MP-001": {
|
|
8
|
+
title: "Error",
|
|
9
|
+
message: "Se esperaban parámetros",
|
|
10
|
+
},
|
|
11
|
+
"ERR-GENERAL-01": {
|
|
12
|
+
title: "Error",
|
|
13
|
+
message: "No se obtuvieron la configuración del sistema",
|
|
14
|
+
},
|
|
15
|
+
"CAMUS-00004-01": {
|
|
16
|
+
title: "Envío de Código",
|
|
17
|
+
message: "Ya fue enviado un Código. Por favor Espera de 30 segundos a 1 minuto para continuar.",
|
|
18
|
+
},
|
|
19
|
+
"CAMUS-00004-02": {
|
|
20
|
+
title: "Error",
|
|
21
|
+
message: "Ocurrió un error con el proveedor por favor contacta al administrador.",
|
|
22
|
+
},
|
|
23
|
+
"CAMUS-00004-03": {
|
|
24
|
+
title: "Error",
|
|
25
|
+
message: "Ocurrió un error con el proveedor, por favor contacta al administrador.",
|
|
26
|
+
},
|
|
27
|
+
UnAuthorized: {
|
|
28
|
+
title: "La sesión a caducado",
|
|
29
|
+
message: "Inicia sesión nuevamente",
|
|
30
|
+
},
|
|
31
|
+
ErrorGeneral: {
|
|
32
|
+
title: "",
|
|
33
|
+
message: "{{ message }}",
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export default translation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lang/common/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lang/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./errors";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lang/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lang/validator/en_EN/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW;;CAEhB,CAAC;AAEF,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare const translation: {
|
|
2
|
+
validationMessages: {
|
|
3
|
+
mixed: {
|
|
4
|
+
required: string;
|
|
5
|
+
default: string;
|
|
6
|
+
notType: string;
|
|
7
|
+
min: string;
|
|
8
|
+
max: string;
|
|
9
|
+
matches: string;
|
|
10
|
+
};
|
|
11
|
+
number: {
|
|
12
|
+
min: string;
|
|
13
|
+
max: string;
|
|
14
|
+
lessThan: string;
|
|
15
|
+
moreThan: string;
|
|
16
|
+
positive: string;
|
|
17
|
+
negative: string;
|
|
18
|
+
integer: string;
|
|
19
|
+
};
|
|
20
|
+
string: {
|
|
21
|
+
length: string;
|
|
22
|
+
min: string;
|
|
23
|
+
max: string;
|
|
24
|
+
email: string;
|
|
25
|
+
url: string;
|
|
26
|
+
trim: string;
|
|
27
|
+
matches: string;
|
|
28
|
+
};
|
|
29
|
+
date: {
|
|
30
|
+
min: string;
|
|
31
|
+
max: string;
|
|
32
|
+
};
|
|
33
|
+
array: {
|
|
34
|
+
min: string;
|
|
35
|
+
max: string;
|
|
36
|
+
length: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export default translation;
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lang/validator/es_MX/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsChB,CAAC;AAEF,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const translation = {
|
|
2
|
+
validationMessages: {
|
|
3
|
+
mixed: {
|
|
4
|
+
required: 'Campo requerido',
|
|
5
|
+
default: 'Dato inválido',
|
|
6
|
+
notType: 'Ingresa un dato válido',
|
|
7
|
+
min: 'Debe tener al menos {{min}} caracteres',
|
|
8
|
+
max: 'Debe tener máximo {{max}} caracteres',
|
|
9
|
+
matches: 'Dato no válido',
|
|
10
|
+
},
|
|
11
|
+
number: {
|
|
12
|
+
min: 'Debe ser mayor que {{min}}',
|
|
13
|
+
max: 'Debe ser menor a {{max}}',
|
|
14
|
+
lessThan: 'Debe ser menor que {{less}}',
|
|
15
|
+
moreThan: 'Debe ser mayor que {{more}}',
|
|
16
|
+
positive: 'Debe ser un número positivo',
|
|
17
|
+
negative: 'Debe ser un número negativo',
|
|
18
|
+
integer: 'Debe ser un número entero',
|
|
19
|
+
},
|
|
20
|
+
string: {
|
|
21
|
+
length: 'Debe tener exactamente ${length} caracteres',
|
|
22
|
+
min: 'Debe tener al menos {{min}} caracteres',
|
|
23
|
+
max: 'Debe tener máximo {{max}} caracteres',
|
|
24
|
+
email: 'E-mail inválido',
|
|
25
|
+
url: 'Debe ter un formato de URL válida',
|
|
26
|
+
trim: 'No debe contener espacios no iniciar con uno.',
|
|
27
|
+
matches: 'Dato no válido',
|
|
28
|
+
},
|
|
29
|
+
date: {
|
|
30
|
+
min: 'Debe ser después de ${min}',
|
|
31
|
+
max: 'Debe ser antes de ${max}',
|
|
32
|
+
},
|
|
33
|
+
array: {
|
|
34
|
+
min: 'Debe tener mínimo ${min} items',
|
|
35
|
+
max: 'Debe tener máximo ${max} items',
|
|
36
|
+
length: 'Debe tener ${max} items',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export default translation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lang/validator/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|