mp-front-cli 0.0.14 → 0.0.16
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/dist/core/{utils/ErrorCatalog/index.d.ts → errors/error-catalog.d.ts} +4 -5
- package/dist/core/errors/error-catalog.d.ts.map +1 -0
- package/dist/core/errors/index.d.ts +3 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/errors/message-error.d.ts +16 -0
- package/dist/core/errors/message-error.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/{types/ApiResponse.d.ts → core/interfaces/api-response.d.ts} +1 -1
- package/dist/core/interfaces/api-response.d.ts.map +1 -0
- package/dist/{types/messageError.d.ts → core/interfaces/errors.d.ts} +1 -1
- package/dist/core/interfaces/errors.d.ts.map +1 -0
- package/dist/core/interfaces/index.d.ts +3 -0
- package/dist/core/interfaces/index.d.ts.map +1 -0
- package/dist/core/interfaces/method.d.ts.map +1 -0
- package/dist/core/middleware/index.d.ts +8 -0
- package/dist/core/middleware/index.d.ts.map +1 -0
- package/dist/core/services/index.d.ts +1 -1
- package/dist/core/services/index.d.ts.map +1 -1
- package/dist/core/services/{ServiceToken/index.d.ts → service-token.d.ts} +3 -4
- package/dist/core/services/service-token.d.ts.map +1 -0
- package/dist/core/utils/{apiRequest/FetchServiceBE.d.ts → api-request/fetch-service-be.d.ts} +5 -6
- package/dist/core/utils/api-request/fetch-service-be.d.ts.map +1 -0
- package/dist/core/utils/api-request/fetch-service-fe.d.ts +14 -0
- package/dist/core/utils/api-request/fetch-service-fe.d.ts.map +1 -0
- package/dist/core/utils/api-request/index.d.ts +3 -0
- package/dist/core/utils/api-request/index.d.ts.map +1 -0
- package/dist/core/utils/custom-encoder.d.ts +8 -0
- package/dist/core/utils/custom-encoder.d.ts.map +1 -0
- package/dist/core/utils/{CustomHeader/index.d.ts → custom-header.d.ts} +3 -4
- package/dist/core/utils/custom-header.d.ts.map +1 -0
- package/dist/core/utils/{CustomLogger/index.d.ts → custom-logger.d.ts} +2 -3
- package/dist/core/utils/custom-logger.d.ts.map +1 -0
- package/dist/core/utils/{CustomValidator/index.d.ts → custom-validator.d.ts} +3 -4
- package/dist/core/utils/custom-validator.d.ts.map +1 -0
- package/dist/core/utils/index.d.ts +6 -10
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core/utils/rxjs/ErrorHandler.d.ts +8 -0
- package/dist/core/utils/rxjs/ErrorHandler.d.ts.map +1 -0
- package/dist/core/utils/rxjs/RxSubjectManager.d.ts +9 -0
- package/dist/core/utils/rxjs/RxSubjectManager.d.ts.map +1 -0
- package/dist/core/utils/rxjs/index.d.ts +3 -0
- package/dist/core/utils/rxjs/index.d.ts.map +1 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/lang/common/errors/en_EN/index.d.ts.map +1 -1
- package/dist/lang/common/errors/es_MX/index.d.ts.map +1 -1
- package/dist/lang/validator/en_EN/index.d.ts.map +1 -1
- package/dist/lang/validator/es_MX/index.d.ts.map +1 -1
- package/dist/mp-front-cli.es.js +9435 -0
- package/package.json +28 -19
- package/dist/core/index.js +0 -2
- package/dist/core/services/ServiceToken/index.d.ts.map +0 -1
- package/dist/core/services/ServiceToken/index.js +0 -47
- package/dist/core/services/index.js +0 -1
- package/dist/core/utils/ApiMiddleware/index.d.ts +0 -9
- package/dist/core/utils/ApiMiddleware/index.d.ts.map +0 -1
- package/dist/core/utils/ApiMiddleware/index.js +0 -29
- package/dist/core/utils/CustomEncoder/index.d.ts +0 -9
- package/dist/core/utils/CustomEncoder/index.d.ts.map +0 -1
- package/dist/core/utils/CustomEncoder/index.js +0 -33
- package/dist/core/utils/CustomHeader/index.d.ts.map +0 -1
- package/dist/core/utils/CustomHeader/index.js +0 -25
- package/dist/core/utils/CustomLogger/index.d.ts.map +0 -1
- package/dist/core/utils/CustomLogger/index.js +0 -65
- package/dist/core/utils/CustomValidator/index.d.ts.map +0 -1
- package/dist/core/utils/CustomValidator/index.js +0 -14
- package/dist/core/utils/ErrorCatalog/index.d.ts.map +0 -1
- package/dist/core/utils/ErrorCatalog/index.js +0 -60
- package/dist/core/utils/MessageErrorBFF/index.d.ts +0 -17
- package/dist/core/utils/MessageErrorBFF/index.d.ts.map +0 -1
- package/dist/core/utils/MessageErrorBFF/index.js +0 -22
- package/dist/core/utils/apiRequest/FetchServiceBE.d.ts.map +0 -1
- package/dist/core/utils/apiRequest/FetchServiceBE.js +0 -35
- package/dist/core/utils/apiRequest/FetchServiceFE.d.ts +0 -15
- package/dist/core/utils/apiRequest/FetchServiceFE.d.ts.map +0 -1
- package/dist/core/utils/apiRequest/FetchServiceFE.js +0 -36
- package/dist/core/utils/index.js +0 -10
- package/dist/core/utils/rxSubjects/ErrorHandler/index.d.ts +0 -9
- package/dist/core/utils/rxSubjects/ErrorHandler/index.d.ts.map +0 -1
- package/dist/core/utils/rxSubjects/ErrorHandler/index.js +0 -14
- package/dist/core/utils/rxSubjects/RxSubjectManager/index.d.ts +0 -10
- package/dist/core/utils/rxSubjects/RxSubjectManager/index.d.ts.map +0 -1
- package/dist/core/utils/rxSubjects/RxSubjectManager/index.js +0 -21
- package/dist/core/utils/rxSubjects/index.d.ts +0 -3
- package/dist/core/utils/rxSubjects/index.d.ts.map +0 -1
- package/dist/core/utils/rxSubjects/index.js +0 -2
- package/dist/index.js +0 -2
- package/dist/lang/common/errors/en_EN/index.js +0 -4
- package/dist/lang/common/errors/es_MX/index.js +0 -25
- package/dist/lang/common/errors/index.js +0 -2
- package/dist/lang/common/index.js +0 -1
- package/dist/lang/index.js +0 -2
- package/dist/lang/validator/en_EN/index.js +0 -4
- package/dist/lang/validator/es_MX/index.js +0 -40
- package/dist/lang/validator/index.js +0 -2
- package/dist/types/ApiResponse.d.ts.map +0 -1
- package/dist/types/ApiResponse.js +0 -1
- package/dist/types/messageError.d.ts.map +0 -1
- package/dist/types/messageError.js +0 -1
- package/dist/types/method.d.ts.map +0 -1
- package/dist/types/method.js +0 -1
- /package/dist/{types → core/interfaces}/method.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mp-front-cli",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
3
|
+
"version": "0.0.16",
|
|
4
|
+
"private": false,
|
|
7
5
|
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc && vite build",
|
|
8
|
+
"package": "npm pack"
|
|
9
|
+
},
|
|
8
10
|
"files": [
|
|
9
|
-
"
|
|
11
|
+
"dist"
|
|
10
12
|
],
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20.0.0"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/mp-front-cli.es.js"
|
|
20
|
+
}
|
|
13
21
|
},
|
|
14
|
-
"author": "",
|
|
15
|
-
"license": "ISC",
|
|
16
22
|
"dependencies": {
|
|
17
|
-
"i18next": "23.7.
|
|
23
|
+
"i18next": "23.7.20",
|
|
18
24
|
"lodash": "^4.17.21",
|
|
19
|
-
"next": "14.0
|
|
25
|
+
"next": "14.1.0",
|
|
20
26
|
"next-auth": "^4.24.5",
|
|
21
|
-
"rxjs": "^7.8.1"
|
|
22
|
-
"uuid": "^9.0.1"
|
|
27
|
+
"rxjs": "^7.8.1"
|
|
23
28
|
},
|
|
24
29
|
"devDependencies": {
|
|
25
30
|
"@types/lodash": "^4.14.202",
|
|
26
|
-
"@types/node": "
|
|
27
|
-
"@
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
+
"@types/node": "20.10.6",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
33
|
+
"eslint": "8.56.0",
|
|
34
|
+
"eslint-config-prettier": "^9.1.0",
|
|
35
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
36
|
+
"typescript": "5.3.3",
|
|
37
|
+
"vite": "4.5.2",
|
|
38
|
+
"vite-plugin-dts": "3.7.1",
|
|
39
|
+
"vite-tsconfig-paths": "4.2.2"
|
|
31
40
|
}
|
|
32
|
-
}
|
|
41
|
+
}
|
package/dist/core/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/services/ServiceToken/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,cAAM,YAAa,SAAQ,YAAY;IACrC,OAAO,CAAC,iBAAiB,CAAQ;IACjC,OAAO,CAAC,2BAA2B,CAAQ;IAC3C,OAAO,CAAC,2BAA2B,CAAQ;IAC3C,OAAO,CAAC,kBAAkB,CAAQ;IAClC,OAAO,CAAC,mBAAmB,CAAQ;IACnC,OAAO,CAAC,sBAAsB,CAAQ;IACtC,OAAO,CAAC,OAAO,CAAa;;IAqB5B,GAAG;CAsBJ;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { catchError, of, switchMap } from "rxjs";
|
|
2
|
-
import { fromFetch } from "rxjs/fetch";
|
|
3
|
-
import { CustomLogger } from "../../../core";
|
|
4
|
-
class ServiceToken extends CustomLogger {
|
|
5
|
-
API_AUTH_BACK_URL;
|
|
6
|
-
API_AUTH_BACK_USERNAME_AUTH;
|
|
7
|
-
API_AUTH_BACK_PASSWORD_AUTH;
|
|
8
|
-
API_AUTH_BACK_USER;
|
|
9
|
-
API_AUTH_BACK_SCOPE;
|
|
10
|
-
API_AUTH_BACK_PASSWORD;
|
|
11
|
-
headers;
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
this.API_AUTH_BACK_URL = process.env.API_AUTH_BACK_URL;
|
|
15
|
-
this.API_AUTH_BACK_USERNAME_AUTH = process.env.API_AUTH_BACK_USERNAME_AUTH;
|
|
16
|
-
this.API_AUTH_BACK_PASSWORD_AUTH = process.env.API_AUTH_BACK_PASSWORD_AUTH;
|
|
17
|
-
this.API_AUTH_BACK_USER = process.env.API_AUTH_BACK_USER;
|
|
18
|
-
this.API_AUTH_BACK_SCOPE = process.env.API_AUTH_BACK_SCOPE;
|
|
19
|
-
this.API_AUTH_BACK_PASSWORD = process.env.API_AUTH_BACK_PASSWORD;
|
|
20
|
-
const authString = `${this.API_AUTH_BACK_USERNAME_AUTH}:${this.API_AUTH_BACK_PASSWORD_AUTH}`;
|
|
21
|
-
const encodedAuthString = Buffer.from(authString).toString("base64");
|
|
22
|
-
this.headers = {
|
|
23
|
-
Accept: "application/json",
|
|
24
|
-
"Content-Type": "application/json;charset=UTF-8",
|
|
25
|
-
Authorization: `Basic ${encodedAuthString}`,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
get() {
|
|
29
|
-
this.logDebug("get ServiceToken");
|
|
30
|
-
return fromFetch(this.API_AUTH_BACK_URL, {
|
|
31
|
-
method: "POST",
|
|
32
|
-
headers: this.headers,
|
|
33
|
-
body: JSON.stringify({
|
|
34
|
-
user: this.API_AUTH_BACK_USER,
|
|
35
|
-
scope: this.API_AUTH_BACK_SCOPE,
|
|
36
|
-
password: this.API_AUTH_BACK_PASSWORD,
|
|
37
|
-
}),
|
|
38
|
-
}).pipe(switchMap((response) => response.json()), switchMap((data) => {
|
|
39
|
-
this.logDebug(`ServiceToken <URL>: \x1b[33m ${this.API_AUTH_BACK_URL} \x1b[37m <HEADERS>: \x1b[33m ${JSON.stringify(this.headers)} \x1b[37m <BODY>: \x1b[33m ${JSON.stringify(data)} \x1b[37m`);
|
|
40
|
-
return of(data?.data?.Token || "");
|
|
41
|
-
}), catchError((error) => {
|
|
42
|
-
this.logError(`ServiceToken ${error}`);
|
|
43
|
-
return of("");
|
|
44
|
-
}));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export default ServiceToken;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ServiceToken } from "./ServiceToken";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Observable } from "rxjs";
|
|
2
|
-
import type { NextApiRequest, NextApiResponse } from "next";
|
|
3
|
-
import { CustomValidator } from "../../../core";
|
|
4
|
-
import type { ApiResponse } from "../../../types/ApiResponse";
|
|
5
|
-
declare class ApiMiddleware<TRes, TData> extends CustomValidator {
|
|
6
|
-
get(handle: (params: TData) => Observable<ApiResponse<TRes>>): (req: NextApiRequest, res: NextApiResponse) => void;
|
|
7
|
-
}
|
|
8
|
-
export default ApiMiddleware;
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/ApiMiddleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA6B,MAAM,MAAM,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAgB,MAAM,UAAU,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,cAAM,aAAa,CAAC,IAAI,EAAE,KAAK,CAAE,SAAQ,eAAe;IACtD,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,KAAK,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,SAG7C,cAAc,OAAO,eAAe;CA+BpD;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { catchError, of, switchMap } from "rxjs";
|
|
2
|
-
import { CustomValidator, ErrorHandler } from "../../../core";
|
|
3
|
-
class ApiMiddleware extends CustomValidator {
|
|
4
|
-
get(handle) {
|
|
5
|
-
this.logDebug("get ApiMiddleware");
|
|
6
|
-
return (req, res) => {
|
|
7
|
-
this.logDebug("return ApiMiddleware");
|
|
8
|
-
ErrorHandler.getInstance().subscribe({
|
|
9
|
-
next: response => {
|
|
10
|
-
this.logError(`ApiMiddleware ErrorHandler ${JSON.stringify(response)}`);
|
|
11
|
-
ErrorHandler.getInstance().unsubscribeSubject();
|
|
12
|
-
return res.status(response.code ?? 520).json(response);
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
of(req)
|
|
16
|
-
.pipe(switchMap(req => this.validateTokenFront(req)), switchMap(req => of(this.decode(req.body))), switchMap(params => handle(params)), catchError(error => {
|
|
17
|
-
ErrorHandler.getInstance().setSubject(error);
|
|
18
|
-
return of({});
|
|
19
|
-
}))
|
|
20
|
-
.subscribe({
|
|
21
|
-
next: Resp => {
|
|
22
|
-
ErrorHandler.getInstance().unsubscribeSubject();
|
|
23
|
-
res.status(200).json(Resp);
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export default ApiMiddleware;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CustomLogger } from '../../../core';
|
|
2
|
-
declare class CustomEncoder extends CustomLogger {
|
|
3
|
-
encode<T>(data: T): string;
|
|
4
|
-
decode<T>(data: {
|
|
5
|
-
base64: string | T | Record<string, unknown>;
|
|
6
|
-
}): T;
|
|
7
|
-
}
|
|
8
|
-
export default CustomEncoder;
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/CustomEncoder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,cAAM,aAAc,SAAQ,YAAY;IACtC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IAajB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE;CAiBjE;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CustomLogger } from '../../../core';
|
|
2
|
-
import { isString } from 'lodash';
|
|
3
|
-
class CustomEncoder extends CustomLogger {
|
|
4
|
-
encode(data) {
|
|
5
|
-
try {
|
|
6
|
-
this.logDebug('encode CustomEncoder', JSON.stringify(data));
|
|
7
|
-
const json = JSON.stringify(data);
|
|
8
|
-
const base64 = Buffer.from(json).toString('base64');
|
|
9
|
-
return JSON.stringify({ base64 });
|
|
10
|
-
}
|
|
11
|
-
catch (error) {
|
|
12
|
-
this.logError('error convert to base64');
|
|
13
|
-
}
|
|
14
|
-
return JSON.stringify(data);
|
|
15
|
-
}
|
|
16
|
-
decode(data) {
|
|
17
|
-
const { base64 } = data;
|
|
18
|
-
try {
|
|
19
|
-
this.logDebug('decode CustomEncoder', JSON.stringify(base64));
|
|
20
|
-
const regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
21
|
-
if (isString(base64) && regex.test(base64)) {
|
|
22
|
-
const json = Buffer.from(base64, 'base64').toString();
|
|
23
|
-
const data = JSON.parse(json);
|
|
24
|
-
return data;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
this.logError('error convert to base64');
|
|
29
|
-
}
|
|
30
|
-
return base64;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export default CustomEncoder;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/CustomHeader/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,eAAe,EAAE,MAAM,UAAU,CAAA;AAExD,cAAM,YAAa,SAAQ,eAAe;IACxC,OAAO,CAAC,OAAO,CAAa;;IAU5B,eAAe,CAAC,OAAO,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASpC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMX;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { of, switchMap } from "rxjs";
|
|
2
|
-
import { ServiceToken, CustomValidator } from "../../../core";
|
|
3
|
-
class CustomHeader extends CustomValidator {
|
|
4
|
-
headers;
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
|
-
this.headers = {
|
|
8
|
-
Accept: "application/json",
|
|
9
|
-
"Content-Type": "application/json",
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
addTokenBackend(headers) {
|
|
13
|
-
this.logDebug("addTokenBackend CustomHeader", JSON.stringify(headers));
|
|
14
|
-
return new ServiceToken()
|
|
15
|
-
.get()
|
|
16
|
-
.pipe(switchMap(token => of({ ...headers, Authorization: `Bearer ${token}` })));
|
|
17
|
-
}
|
|
18
|
-
getHeaders() {
|
|
19
|
-
this.logDebug("getHeaders CustomHeader");
|
|
20
|
-
return of({
|
|
21
|
-
...this.headers,
|
|
22
|
-
}).pipe(switchMap(headers => this.addTokenBackend(headers)));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export default CustomHeader;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/CustomLogger/index.ts"],"names":[],"mappings":"AAoBA,cAAM,YAAY;IAChB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,UAAU,CAAS;;IAQ3B,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,GAAG;IASX,QAAQ,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAIpC,OAAO,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAInC,OAAO,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAInC,OAAO,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAInC,UAAU,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAItC,QAAQ,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAIpC,QAAQ,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;CAGrC;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var Level;
|
|
2
|
-
(function (Level) {
|
|
3
|
-
Level[Level["error"] = 0] = "error";
|
|
4
|
-
Level[Level["warn"] = 1] = "warn";
|
|
5
|
-
Level[Level["info"] = 2] = "info";
|
|
6
|
-
Level[Level["http"] = 3] = "http";
|
|
7
|
-
Level[Level["verbose"] = 4] = "verbose";
|
|
8
|
-
Level[Level["debug"] = 5] = "debug";
|
|
9
|
-
Level[Level["silly"] = 6] = "silly";
|
|
10
|
-
})(Level || (Level = {}));
|
|
11
|
-
const colors = {
|
|
12
|
-
error: "\x1b[31m",
|
|
13
|
-
warn: "\x1b[33m",
|
|
14
|
-
info: "\x1b[34m",
|
|
15
|
-
http: "\x1b[35m",
|
|
16
|
-
verbose: "\x1b[32m",
|
|
17
|
-
debug: "\x1b[37m",
|
|
18
|
-
silly: "\x1b[37m",
|
|
19
|
-
};
|
|
20
|
-
class CustomLogger {
|
|
21
|
-
appName;
|
|
22
|
-
logsLevel;
|
|
23
|
-
silentLogs;
|
|
24
|
-
constructor() {
|
|
25
|
-
this.appName = process.env.APP_LOGS_NAME;
|
|
26
|
-
this.logsLevel = process.env.LOGS_LEVEL;
|
|
27
|
-
this.silentLogs = process.env.SILENT_LOGS === "true";
|
|
28
|
-
}
|
|
29
|
-
consoleFormat(level, message) {
|
|
30
|
-
try {
|
|
31
|
-
return `${colors[level]} ${this.appName} [${new Date().toISOString()}] [${level.toUpperCase()}]: ${message.toString()} \x1b[37m`;
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
return message;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
log(level, message) {
|
|
38
|
-
if (level <= Level[this.logsLevel] &&
|
|
39
|
-
!this.silentLogs) {
|
|
40
|
-
console.log(this.consoleFormat(Level[level], message));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
logError(...message) {
|
|
44
|
-
this.log(Level.error, message);
|
|
45
|
-
}
|
|
46
|
-
logWarn(...message) {
|
|
47
|
-
this.log(Level.warn, message);
|
|
48
|
-
}
|
|
49
|
-
logInfo(...message) {
|
|
50
|
-
this.log(Level.info, message);
|
|
51
|
-
}
|
|
52
|
-
logHttp(...message) {
|
|
53
|
-
this.log(Level.http, message);
|
|
54
|
-
}
|
|
55
|
-
logVerbose(...message) {
|
|
56
|
-
this.log(Level.verbose, message);
|
|
57
|
-
}
|
|
58
|
-
logDebug(...message) {
|
|
59
|
-
this.log(Level.debug, message);
|
|
60
|
-
}
|
|
61
|
-
logSilly(...message) {
|
|
62
|
-
this.log(Level.silly, message);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export default CustomLogger;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/CustomValidator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAmB,MAAM,UAAU,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,cAAM,eAAgB,SAAQ,aAAa;IACnC,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,WAAW;CAS3D;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CustomEncoder, MessageErrorBFF } from "../../../core";
|
|
2
|
-
import { getToken } from "next-auth/jwt";
|
|
3
|
-
class CustomValidator extends CustomEncoder {
|
|
4
|
-
async validateTokenFront(req) {
|
|
5
|
-
this.logDebug("entra validate Token Front");
|
|
6
|
-
const token = await getToken({ req: req });
|
|
7
|
-
this.logDebug("Token Front", JSON.stringify(token));
|
|
8
|
-
if (!token) {
|
|
9
|
-
throw new MessageErrorBFF("UNAUTHORIZED").get();
|
|
10
|
-
}
|
|
11
|
-
return req;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export default CustomValidator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/ErrorCatalog/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AA2CvC,cAAM,YAAa,SAAQ,YAAY;IACrC,GAAG,CAAC,KAAK,GAAE,MAAM,GAAG,KAAK,GAAG,QAAoB;;;;;;;;;CA0BjD;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { t } from "i18next";
|
|
2
|
-
import { CustomLogger } from "../../../core";
|
|
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
|
-
UNAUTHORIZED: {
|
|
13
|
-
level: "error",
|
|
14
|
-
type: "modal",
|
|
15
|
-
message: "errors.UnAuthorized.message",
|
|
16
|
-
title: "errors.UnAuthorized.title",
|
|
17
|
-
code: 310,
|
|
18
|
-
},
|
|
19
|
-
"ERR-GENERAL-01": {
|
|
20
|
-
level: "error",
|
|
21
|
-
type: "modal",
|
|
22
|
-
message: "errors.ERR-GENERAL-01.message",
|
|
23
|
-
title: "errors.ERR-GENERAL-01.title",
|
|
24
|
-
code: 400,
|
|
25
|
-
},
|
|
26
|
-
internalError: {
|
|
27
|
-
level: "error",
|
|
28
|
-
type: "modal",
|
|
29
|
-
message: "errors.internalError.message",
|
|
30
|
-
title: "errors.internalError.title",
|
|
31
|
-
code: 500,
|
|
32
|
-
},
|
|
33
|
-
default: {
|
|
34
|
-
code: 520,
|
|
35
|
-
type: "modal",
|
|
36
|
-
message: "errors.default.message",
|
|
37
|
-
title: "errors.default.title",
|
|
38
|
-
level: "warning",
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
class ErrorCatalog extends CustomLogger {
|
|
42
|
-
get(error = "default") {
|
|
43
|
-
if (error instanceof Error) {
|
|
44
|
-
this.logError(error.message);
|
|
45
|
-
return {
|
|
46
|
-
...errorCatalog.internalError,
|
|
47
|
-
title: t(errorCatalog.internalError.title),
|
|
48
|
-
message: t(errorCatalog.internalError.message),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
const statusCode = typeof error === "string" ? error : error.code;
|
|
52
|
-
const payload = typeof error === "string" ? {} : { ...error };
|
|
53
|
-
return {
|
|
54
|
-
...(errorCatalog[statusCode] ?? errorCatalog.default),
|
|
55
|
-
title: t(errorCatalog[statusCode]?.title ?? errorCatalog.default.title, payload),
|
|
56
|
-
message: t(errorCatalog[statusCode]?.message ?? errorCatalog.default.message, payload),
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export default ErrorCatalog;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ApiError } from "../../../types/ApiResponse";
|
|
2
|
-
import type { IMessageErrorBFF } from "../../../types/messageError";
|
|
3
|
-
import CustomLogger from "../CustomLogger";
|
|
4
|
-
/**
|
|
5
|
-
* clase para manejar los errores de la aplicación
|
|
6
|
-
*
|
|
7
|
-
* @export
|
|
8
|
-
* @class MessageErrorBFF
|
|
9
|
-
* @extends {Error}
|
|
10
|
-
*/
|
|
11
|
-
declare class MessageErrorBFF extends CustomLogger {
|
|
12
|
-
private messageError;
|
|
13
|
-
constructor(error?: string | Error | ApiError);
|
|
14
|
-
get(): IMessageErrorBFF;
|
|
15
|
-
}
|
|
16
|
-
export default MessageErrorBFF;
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/MessageErrorBFF/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAG1C;;;;;;GAMG;AAEH,cAAM,eAAgB,SAAQ,YAAY;IACxC,OAAO,CAAC,YAAY,CAAkB;gBAE1B,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ;IAO7C,GAAG;CAGJ;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import CustomLogger from "../CustomLogger";
|
|
2
|
-
import { ErrorCatalog } from "../../../core";
|
|
3
|
-
/**
|
|
4
|
-
* clase para manejar los errores de la aplicación
|
|
5
|
-
*
|
|
6
|
-
* @export
|
|
7
|
-
* @class MessageErrorBFF
|
|
8
|
-
* @extends {Error}
|
|
9
|
-
*/
|
|
10
|
-
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
|
-
}
|
|
22
|
-
export default MessageErrorBFF;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FetchServiceBE.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/apiRequest/FetchServiceBE.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiC,MAAM,UAAU,CAAA;AACtE,OAAO,EAAa,UAAU,EAA0B,MAAM,MAAM,CAAA;AAEpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,uBAAe,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAE,SAAQ,YAAY;IAClE,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAQ;gBAEV,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAM3C,QAAQ,CAAC,UAAU,IAAI,MAAM;IAE7B,YAAY,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC;IASxC,gBAAgB,CAAC,KAAK,EAAE,KAAK;;;IAK7B,SAAS,CAAC,MAAM,GAAE,KAAmB,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;CA0BtE;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { CustomHeader, ErrorHandler, MessageErrorBFF } from "../../../core";
|
|
2
|
-
import { switchMap, of, catchError, filter } from "rxjs";
|
|
3
|
-
import { fromFetch } from "rxjs/fetch";
|
|
4
|
-
class FetchServiceBE extends CustomHeader {
|
|
5
|
-
apiUrl;
|
|
6
|
-
method;
|
|
7
|
-
constructor(apiUrl, method) {
|
|
8
|
-
super();
|
|
9
|
-
this.apiUrl = apiUrl;
|
|
10
|
-
this.method = method ?? "POST";
|
|
11
|
-
}
|
|
12
|
-
errorHandler(response) {
|
|
13
|
-
if (response?.errors) {
|
|
14
|
-
ErrorHandler.getInstance().setSubject(new MessageErrorBFF(response.errors[0]).get());
|
|
15
|
-
}
|
|
16
|
-
return !response?.errors;
|
|
17
|
-
}
|
|
18
|
-
customCatchError(error) {
|
|
19
|
-
ErrorHandler.getInstance().setSubject(new MessageErrorBFF(error).get());
|
|
20
|
-
return of({ error: true }).pipe(filter(({ error }) => !error));
|
|
21
|
-
}
|
|
22
|
-
fetchData(params = {}) {
|
|
23
|
-
this.logDebug("fetchData", JSON.stringify(params));
|
|
24
|
-
this.logDebug("cookieName", this.cookieName());
|
|
25
|
-
return of(params).pipe(switchMap(params => this.getHeaders().pipe(switchMap(headers => of({ params, headers })))), switchMap(({ params, headers }) => fromFetch(this.apiUrl, {
|
|
26
|
-
method: this.method,
|
|
27
|
-
headers: headers,
|
|
28
|
-
body: JSON.stringify(params),
|
|
29
|
-
}).pipe(switchMap(response => response.json()), switchMap(data => {
|
|
30
|
-
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`);
|
|
31
|
-
return of(data);
|
|
32
|
-
}))), catchError(this.customCatchError), filter(this.errorHandler));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export default FetchServiceBE;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CustomValidator } from "../../../core";
|
|
2
|
-
import { Observable } from "rxjs";
|
|
3
|
-
import type { Method } from "../../../types/method";
|
|
4
|
-
import type { IMessageErrorBFF } from "../../../types/messageError";
|
|
5
|
-
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
|
-
export default FetchServiceFE;
|
|
15
|
-
//# sourceMappingURL=FetchServiceFE.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FetchServiceFE.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/apiRequest/FetchServiceFE.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiC,MAAM,UAAU,CAAA;AACzE,OAAO,EAAqC,UAAU,EAAE,MAAM,MAAM,CAAA;AAEpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,cAAM,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAE,SAAQ,eAAe;IAC5D,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,OAAO,CAAa;gBAEhB,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAS3C,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,gBAAgB;IAK1C,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAO7B,SAAS,CAAC,MAAM,GAAE,KAAmB,GAAG,UAAU,CAAC,IAAI,CAAC;CAkBzD;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { CustomValidator, ErrorHandler, MessageErrorBFF } from "../../../core";
|
|
2
|
-
import { switchMap, catchError, of, filter } from "rxjs";
|
|
3
|
-
import { fromFetch } from "rxjs/fetch";
|
|
4
|
-
class FetchServiceFE extends CustomValidator {
|
|
5
|
-
apiUrl;
|
|
6
|
-
method;
|
|
7
|
-
headers;
|
|
8
|
-
constructor(apiUrl, method) {
|
|
9
|
-
super();
|
|
10
|
-
this.apiUrl = apiUrl;
|
|
11
|
-
this.method = method ?? "POST";
|
|
12
|
-
this.headers = {
|
|
13
|
-
"Content-Type": "application/json",
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
errorHandler(data) {
|
|
17
|
-
if (data.code)
|
|
18
|
-
ErrorHandler.getInstance().setSubject(data);
|
|
19
|
-
return !data.code;
|
|
20
|
-
}
|
|
21
|
-
customCatchError(error) {
|
|
22
|
-
ErrorHandler.getInstance().setSubject(new MessageErrorBFF(error).get());
|
|
23
|
-
return of({ error: true }).pipe(filter(({ error }) => !error));
|
|
24
|
-
}
|
|
25
|
-
fetchData(params = {}) {
|
|
26
|
-
return fromFetch(this.apiUrl, {
|
|
27
|
-
method: this.method,
|
|
28
|
-
headers: this.headers,
|
|
29
|
-
body: this.encode(params),
|
|
30
|
-
}).pipe(switchMap(response => response.json()), switchMap(data => {
|
|
31
|
-
this.logDebug(`FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <BODY>: ${JSON.stringify(data)}`);
|
|
32
|
-
return of(data);
|
|
33
|
-
}), filter(this.errorHandler), switchMap(data => of(this.decode({ base64: data }))), catchError(this.customCatchError));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export default FetchServiceFE;
|
package/dist/core/utils/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { default as ApiMiddleware } from "./ApiMiddleware";
|
|
2
|
-
export { default as FetchServiceBE } from "./apiRequest/FetchServiceBE";
|
|
3
|
-
export { default as FetchServiceFE } from "./apiRequest/FetchServiceFE";
|
|
4
|
-
export { default as CustomEncoder } from "./CustomEncoder";
|
|
5
|
-
export { default as CustomHeader } from "./CustomHeader";
|
|
6
|
-
export { default as CustomLogger } from "./CustomLogger";
|
|
7
|
-
export { default as CustomValidator } from "./CustomValidator";
|
|
8
|
-
export { default as ErrorCatalog } from "./ErrorCatalog";
|
|
9
|
-
export { default as MessageErrorBFF } from "./MessageErrorBFF";
|
|
10
|
-
export * from "./rxSubjects";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { IMessageErrorBFF } from "../../../../types/messageError";
|
|
2
|
-
import { RxSubjectManager } from "../../../../core";
|
|
3
|
-
declare class ErrorHandler extends RxSubjectManager<IMessageErrorBFF> {
|
|
4
|
-
private static instance;
|
|
5
|
-
private constructor();
|
|
6
|
-
static getInstance(): ErrorHandler;
|
|
7
|
-
}
|
|
8
|
-
export default ErrorHandler;
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/utils/rxSubjects/ErrorHandler/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG3C,cAAM,YAAa,SAAQ,gBAAgB,CAAC,gBAAgB,CAAC;IAC3D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IAErC,OAAO;IAIP,MAAM,CAAC,WAAW;CAMnB;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { RxSubjectManager } from "../../../../core";
|
|
2
|
-
class ErrorHandler extends RxSubjectManager {
|
|
3
|
-
static instance;
|
|
4
|
-
constructor() {
|
|
5
|
-
super();
|
|
6
|
-
}
|
|
7
|
-
static getInstance() {
|
|
8
|
-
if (!ErrorHandler.instance) {
|
|
9
|
-
ErrorHandler.instance = new ErrorHandler();
|
|
10
|
-
}
|
|
11
|
-
return ErrorHandler.instance;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export default ErrorHandler;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Subject, Observable } from "rxjs";
|
|
2
|
-
declare class RxSubjectManager<T> extends Observable<T> {
|
|
3
|
-
private subject$;
|
|
4
|
-
constructor();
|
|
5
|
-
setSubject(data: T): void;
|
|
6
|
-
completeSubject(): void;
|
|
7
|
-
unsubscribeSubject(): Subject<T>;
|
|
8
|
-
}
|
|
9
|
-
export default RxSubjectManager;
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/utils/rxSubjects/RxSubjectManager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAE1C,cAAM,gBAAgB,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,QAAQ,CAAmB;;IAQnC,UAAU,CAAC,IAAI,EAAE,CAAC;IAIlB,eAAe;IAIf,kBAAkB;CAKnB;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Subject, Observable } from "rxjs";
|
|
2
|
-
class RxSubjectManager extends Observable {
|
|
3
|
-
subject$ = new Subject();
|
|
4
|
-
constructor() {
|
|
5
|
-
super(subscriber => {
|
|
6
|
-
this.subject$.subscribe(subscriber);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
setSubject(data) {
|
|
10
|
-
this.subject$.next(data);
|
|
11
|
-
}
|
|
12
|
-
completeSubject() {
|
|
13
|
-
this.subject$.complete();
|
|
14
|
-
}
|
|
15
|
-
unsubscribeSubject() {
|
|
16
|
-
this.subject$.unsubscribe();
|
|
17
|
-
this.subject$ = new Subject();
|
|
18
|
-
return this.subject$;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export default RxSubjectManager;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/rxSubjects/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
DELETED