mp-front-cli 0.0.61 → 0.0.63
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/errors/error-catalog.d.ts +1 -2
- package/dist/core/errors/error-catalog.d.ts.map +1 -1
- package/dist/core/interfaces/message.d.ts +1 -2
- package/dist/core/interfaces/message.d.ts.map +1 -1
- package/dist/core/interfaces/session.d.ts +19 -0
- package/dist/core/interfaces/session.d.ts.map +1 -0
- package/dist/core/middleware/index.d.ts +1 -1
- package/dist/core/middleware/index.d.ts.map +1 -1
- package/dist/core/utils/custom-logger.d.ts.map +1 -1
- package/dist/mp-front-cli-encrypter.es.js +10 -10
- package/dist/mp-front-cli-logger.es.js +1 -1
- package/package.json +2 -2
|
@@ -5,12 +5,11 @@ export declare class ErrorCatalog extends CustomLogger {
|
|
|
5
5
|
title: string;
|
|
6
6
|
message: string;
|
|
7
7
|
uuid: string | undefined;
|
|
8
|
+
code?: number | undefined;
|
|
8
9
|
type: "modal" | "message";
|
|
9
10
|
level: "error" | "success" | "warning" | "info";
|
|
10
|
-
code?: number | undefined;
|
|
11
11
|
payload?: {} | undefined;
|
|
12
12
|
clearCookieSession?: boolean | undefined;
|
|
13
|
-
onOk?: (() => void) | undefined;
|
|
14
13
|
};
|
|
15
14
|
}
|
|
16
15
|
//# sourceMappingURL=error-catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-catalog.d.ts","sourceRoot":"","sources":["../../../src/core/errors/error-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AA2CrD,qBAAa,YAAa,SAAQ,YAAY;IAC5C,GAAG,CAAC,KAAK,GAAE,MAAM,GAAG,KAAK,GAAG,QAAoB,EAAE,IAAI,CAAC,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"error-catalog.d.ts","sourceRoot":"","sources":["../../../src/core/errors/error-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AA2CrD,qBAAa,YAAa,SAAQ,YAAY;IAC5C,GAAG,CAAC,KAAK,GAAE,MAAM,GAAG,KAAK,GAAG,QAAoB,EAAE,IAAI,CAAC,EAAE,MAAM;;;;;;;;;;CA6BhE"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
type MessageType = "modal" | "message";
|
|
2
2
|
type MessageLevel = "error" | "success" | "warning" | "info";
|
|
3
3
|
export interface IMessage {
|
|
4
|
+
code?: number;
|
|
4
5
|
message: string;
|
|
5
6
|
type: MessageType;
|
|
6
7
|
level: MessageLevel;
|
|
7
8
|
title: string;
|
|
8
|
-
code?: number;
|
|
9
9
|
payload?: {};
|
|
10
10
|
clearCookieSession?: boolean;
|
|
11
11
|
uuid?: string;
|
|
12
|
-
onOk?: () => void;
|
|
13
12
|
}
|
|
14
13
|
export type messageManagerFn = (type: MessageType, level: MessageLevel, message: string, title: string, onOk?: () => void) => void;
|
|
15
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces/message.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,OAAO,GAAG,SAAS,CAAA;AACtC,KAAK,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;AAE5D,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,YAAY,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces/message.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,OAAO,GAAG,SAAS,CAAA;AACtC,KAAK,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;AAE5D,MAAM,WAAW,QAAQ;IACvB,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;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;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,19 @@
|
|
|
1
|
+
export interface Session {
|
|
2
|
+
user: {
|
|
3
|
+
name: string;
|
|
4
|
+
email: string;
|
|
5
|
+
image: string;
|
|
6
|
+
burks: string;
|
|
7
|
+
correo_electronico: string;
|
|
8
|
+
cve_usuario: string;
|
|
9
|
+
cve_empleado: string;
|
|
10
|
+
estatus: string;
|
|
11
|
+
grupo: string;
|
|
12
|
+
id_usuario: string;
|
|
13
|
+
nombre_usuario: string;
|
|
14
|
+
numero_telefono: string;
|
|
15
|
+
rol: string;
|
|
16
|
+
centros: string[];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces/session.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,CAAA;QACb,kBAAkB,EAAE,MAAM,CAAA;QAC1B,WAAW,EAAE,MAAM,CAAA;QACnB,YAAY,EAAE,MAAM,CAAA;QACpB,OAAO,EAAE,MAAM,CAAA;QACf,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;QAClB,cAAc,EAAE,MAAM,CAAA;QACtB,eAAe,EAAE,MAAM,CAAA;QACvB,GAAG,EAAE,MAAM,CAAA;QACX,OAAO,EAAE,MAAM,EAAE,CAAA;KAClB,CAAA;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Observable } from "rxjs";
|
|
2
2
|
import type { NextApiRequest, NextApiResponse } from "next";
|
|
3
3
|
import { CustomEncrypter } from "../utils/custom-encrypter";
|
|
4
|
-
import
|
|
4
|
+
import { Session } from "../interfaces/session";
|
|
5
5
|
export declare class ApiMiddleware<TRes, TData = {}> extends CustomEncrypter {
|
|
6
6
|
private uuid;
|
|
7
7
|
private session;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAuC,MAAM,MAAM,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAG3D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAuC,MAAM,MAAM,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAG3D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C,qBAAa,aAAa,CAAC,IAAI,EAAE,KAAK,GAAG,EAAE,CAAE,SAAQ,eAAe;IAClE,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,OAAO,CAAuB;IAE/B,UAAU,CAAC,OAAO,EAAE,OAAO;IAI3B,UAAU;IAKjB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,WAAW;IAKnB,GAAG,CACD,MAAM,EAAE,CACN,MAAM,EAAE,KAAK,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;KAAE,KACpE,UAAU,CAAC,IAAI,CAAC,SAIR,cAAc,OAAO,eAAe;CA0CpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-logger.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-logger.ts"],"names":[],"mappings":"AAoBA,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,UAAU,CAAS;;
|
|
1
|
+
{"version":3,"file":"custom-logger.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-logger.ts"],"names":[],"mappings":"AAoBA,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,UAAU,CAAS;;IAS3B,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var o = Object.defineProperty;
|
|
2
|
-
var s = (n,
|
|
3
|
-
var i = (n,
|
|
2
|
+
var s = (n, r, t) => r in n ? o(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
|
|
3
|
+
var i = (n, r, t) => (s(n, typeof r != "symbol" ? r + "" : r, t), t);
|
|
4
4
|
import a from "node-jose";
|
|
5
5
|
import { createHash as E } from "crypto";
|
|
6
6
|
import { CustomEncoder as c } from "./mp-front-cli-encoder.es.js";
|
|
@@ -22,31 +22,31 @@ class f extends c {
|
|
|
22
22
|
async encrypt(t) {
|
|
23
23
|
if (await this.generateKey(), !this.signatureKey)
|
|
24
24
|
throw new Error("PLEASE CREATE A KEY TO ENCRYPT 🙂");
|
|
25
|
-
const
|
|
25
|
+
const e = JSON.stringify(t).normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
26
26
|
return await a.JWE.createEncrypt(
|
|
27
27
|
{ format: "compact" },
|
|
28
28
|
this.signatureKey
|
|
29
|
-
).update(
|
|
29
|
+
).update(e).final();
|
|
30
30
|
}
|
|
31
31
|
async decrypt(t) {
|
|
32
32
|
if (await this.generateKey(), !this.signatureKey)
|
|
33
33
|
throw new Error("PLEASE CREATE A KEY TO DECRYPT 🙂");
|
|
34
|
-
const { payload:
|
|
34
|
+
const { payload: e } = await a.JWE.createDecrypt(
|
|
35
35
|
this.signatureKey
|
|
36
36
|
).decrypt(t);
|
|
37
|
-
return JSON.parse(
|
|
37
|
+
return JSON.parse(e.toString());
|
|
38
38
|
}
|
|
39
39
|
async isEncrypted(t) {
|
|
40
40
|
this.logInfo("EncryptionHandler", t);
|
|
41
41
|
try {
|
|
42
42
|
return await this.decrypt(t ?? ""), this.logInfo("EncryptionHandler", "IS ENCRYPTED 🥵"), !0;
|
|
43
|
-
} catch (
|
|
44
|
-
return this.
|
|
43
|
+
} catch (e) {
|
|
44
|
+
return this.logError("EncryptionHandler", JSON.stringify(e)), this.logInfo("EncryptionHandler", "IS NOT ENCRYPTED 🙂"), !1;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
generateSHA(t) {
|
|
48
|
-
const
|
|
49
|
-
return E("sha256").update(
|
|
48
|
+
const e = JSON.stringify(t);
|
|
49
|
+
return E("sha256").update(e).digest("hex");
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
export {
|
|
@@ -16,7 +16,7 @@ class p {
|
|
|
16
16
|
t(this, "appName");
|
|
17
17
|
t(this, "logsLevel");
|
|
18
18
|
t(this, "silentLogs");
|
|
19
|
-
this.appName = process.env.
|
|
19
|
+
this.appName = process.env.APP_LOGS_NAME || "", this.logsLevel = process.env.NODE_ENV == "development" ? "debug" : process.env.LOGS_LEVEL, this.silentLogs = process.env.SILENT_LOGS === "true";
|
|
20
20
|
}
|
|
21
21
|
consoleFormat(o, s) {
|
|
22
22
|
try {
|
package/package.json
CHANGED