mp-front-cli 0.0.38 → 0.0.40
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/middleware/index.d.ts +2 -2
- package/dist/core/utils/custom-encoder.d.ts +2 -2
- package/dist/core/utils/custom-encoder.d.ts.map +1 -1
- package/dist/core/utils/custom-encrypter.d.ts +2 -2
- package/dist/core/utils/custom-encrypter.d.ts.map +1 -1
- package/dist/core/utils/custom-header.d.ts +2 -2
- package/dist/custom-encoder-70a77460.js +3734 -0
- package/dist/custom-header-1fcfa265.js +21025 -0
- package/dist/{custom-validator-9ec2d3d0.js → custom-validator-8a042f7f.js} +512 -512
- package/dist/mp-front-cli-all.es.js +15 -14
- package/dist/mp-front-cli-core.es.js +31 -30
- package/dist/mp-front-cli-encoder.es.js +2 -2
- package/dist/mp-front-cli-header.es.js +6 -5
- package/dist/mp-front-cli-logger.es.js +53 -2
- package/dist/mp-front-cli-validator.es.js +3 -3
- package/package.json +2 -3
- package/dist/custom-encoder-50b5eb15.js +0 -43094
- package/dist/custom-header-ef367c86.js +0 -882
- package/dist/custom-logger-a671be8b.js +0 -171
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import { ApiMiddleware as
|
|
3
|
-
import { S } from "./custom-header-
|
|
4
|
-
import { LoadingHandler as
|
|
5
|
-
import "./custom-
|
|
6
|
-
import "./
|
|
1
|
+
import { E as m } from "./custom-validator-8a042f7f.js";
|
|
2
|
+
import { ApiMiddleware as d, FetchServiceBE as n, FetchServiceFE as x } from "./mp-front-cli-core.es.js";
|
|
3
|
+
import { S as f } from "./custom-header-1fcfa265.js";
|
|
4
|
+
import { LoadingHandler as l, MessageHandler as s, RxSubjectManager as E } from "./mp-front-cli-utils-rxjs.es.js";
|
|
5
|
+
import "./custom-encoder-70a77460.js";
|
|
6
|
+
import "./mp-front-cli-logger.es.js";
|
|
7
7
|
import "./index-df4e0539.js";
|
|
8
8
|
import "rxjs";
|
|
9
|
+
import "crypto";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
d as ApiMiddleware,
|
|
12
|
+
m as ErrorCatalog,
|
|
13
|
+
n as FetchServiceBE,
|
|
14
|
+
x as FetchServiceFE,
|
|
15
|
+
l as LoadingHandler,
|
|
16
|
+
s as MessageHandler,
|
|
17
|
+
E as RxSubjectManager,
|
|
18
|
+
f as ServiceToken
|
|
18
19
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (d, n, t) => (
|
|
4
|
-
import {
|
|
5
|
-
import { C as O, f } from "./custom-header-
|
|
6
|
-
import { S as
|
|
7
|
-
import { MessageHandler as
|
|
8
|
-
import { RxSubjectManager as
|
|
9
|
-
import { of as a, switchMap as o, catchError as
|
|
10
|
-
import
|
|
11
|
-
import "./
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var E = (d, n, t) => n in d ? x(d, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[n] = t;
|
|
3
|
+
var u = (d, n, t) => (E(d, typeof n != "symbol" ? n + "" : n, t), t);
|
|
4
|
+
import { E as l, C as B } from "./custom-validator-8a042f7f.js";
|
|
5
|
+
import { C as y, a as O, f as S, v as g } from "./custom-header-1fcfa265.js";
|
|
6
|
+
import { S as v } from "./custom-header-1fcfa265.js";
|
|
7
|
+
import { MessageHandler as m, LoadingHandler as c } from "./mp-front-cli-utils-rxjs.es.js";
|
|
8
|
+
import { RxSubjectManager as C } from "./mp-front-cli-utils-rxjs.es.js";
|
|
9
|
+
import { of as a, switchMap as o, catchError as p, EMPTY as f, filter as b } from "rxjs";
|
|
10
|
+
import "./custom-encoder-70a77460.js";
|
|
11
|
+
import "./mp-front-cli-logger.es.js";
|
|
12
12
|
import "./index-df4e0539.js";
|
|
13
|
-
|
|
13
|
+
import "crypto";
|
|
14
|
+
class J extends y {
|
|
14
15
|
constructor() {
|
|
15
16
|
super(...arguments);
|
|
16
17
|
u(this, "uuid", "");
|
|
@@ -36,11 +37,11 @@ class M extends S {
|
|
|
36
37
|
o(({ params: e, response: h }) => (this.logDebug(
|
|
37
38
|
`ApiMiddleware \x1B[37m <URL>: \x1B[33m ${i.url} \x1B[37m <UUID> \x1B[33m ${i.body.uuid} \x1B[37m <PARAMS> \x1B[33m ${JSON.stringify(e)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(h)}`
|
|
38
39
|
), a(h))),
|
|
39
|
-
|
|
40
|
+
p((e) => {
|
|
40
41
|
var h;
|
|
41
42
|
return this.logError(
|
|
42
43
|
`ApiMiddleware <URL>: ${i == null ? void 0 : i.url} <UUID> ${(h = i == null ? void 0 : i.body) == null ? void 0 : h.uuid} <PARAMS> ${JSON.stringify(i == null ? void 0 : i.body)} <ERROR>: ${JSON.stringify(e)}`
|
|
43
|
-
), this.returnError(r, e),
|
|
44
|
+
), this.returnError(r, e), f;
|
|
44
45
|
})
|
|
45
46
|
).subscribe({
|
|
46
47
|
next: (e) => {
|
|
@@ -50,7 +51,7 @@ class M extends S {
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
|
-
class
|
|
54
|
+
class I extends O {
|
|
54
55
|
constructor(t, i) {
|
|
55
56
|
super();
|
|
56
57
|
u(this, "apiUrl");
|
|
@@ -68,7 +69,7 @@ class w extends O {
|
|
|
68
69
|
(r) => this.getHeaders().pipe(o((s) => a({ params: r, headers: s })))
|
|
69
70
|
),
|
|
70
71
|
o(
|
|
71
|
-
({ params: r, headers: s }) =>
|
|
72
|
+
({ params: r, headers: s }) => S(this.apiUrl, {
|
|
72
73
|
method: this.method,
|
|
73
74
|
headers: s,
|
|
74
75
|
body: this.method === "GET" ? null : JSON.stringify(r),
|
|
@@ -83,11 +84,11 @@ class w extends O {
|
|
|
83
84
|
), a(e)))
|
|
84
85
|
)
|
|
85
86
|
),
|
|
86
|
-
|
|
87
|
+
b((r) => this.errorHandler(r, i))
|
|
87
88
|
);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
class
|
|
91
|
+
class H extends B {
|
|
91
92
|
constructor(t, i = "POST", r = {}) {
|
|
92
93
|
super();
|
|
93
94
|
u(this, "apiUrl");
|
|
@@ -103,11 +104,11 @@ class J extends S {
|
|
|
103
104
|
this.isLoadingEnabled = t;
|
|
104
105
|
}
|
|
105
106
|
errorHandler(t) {
|
|
106
|
-
return t.code && (
|
|
107
|
+
return t.code && (m.getInstance().setSubject(t), c.getInstance().setSubject(!1)), !t.code;
|
|
107
108
|
}
|
|
108
109
|
fetchData(t = {}) {
|
|
109
|
-
const i = (/* @__PURE__ */ new Date()).toISOString(), r =
|
|
110
|
-
return c.getInstance().setSubject(this.isLoadingEnabled),
|
|
110
|
+
const i = (/* @__PURE__ */ new Date()).toISOString(), r = g(i, g.URL), s = this.encode({ ...t }, r);
|
|
111
|
+
return c.getInstance().setSubject(this.isLoadingEnabled), S(this.apiUrl, {
|
|
111
112
|
method: this.method,
|
|
112
113
|
headers: this.headers,
|
|
113
114
|
body: s,
|
|
@@ -117,21 +118,21 @@ class J extends S {
|
|
|
117
118
|
o((e) => (this.logDebug(
|
|
118
119
|
`FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(t)} <BODY> ${s} <RESPONSE>: ${JSON.stringify(e)}`
|
|
119
120
|
), a(e))),
|
|
120
|
-
|
|
121
|
+
b(this.errorHandler),
|
|
121
122
|
o((e) => (c.getInstance().setSubject(!1), a(e))),
|
|
122
|
-
|
|
123
|
+
p((e) => (c.getInstance().setSubject(!1), m.getInstance().setSubject(
|
|
123
124
|
new l().get(e, r)
|
|
124
|
-
),
|
|
125
|
+
), f))
|
|
125
126
|
);
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
export {
|
|
129
|
-
|
|
130
|
+
J as ApiMiddleware,
|
|
130
131
|
l as ErrorCatalog,
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
I as FetchServiceBE,
|
|
133
|
+
H as FetchServiceFE,
|
|
133
134
|
c as LoadingHandler,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
m as MessageHandler,
|
|
136
|
+
C as RxSubjectManager,
|
|
137
|
+
v as ServiceToken
|
|
137
138
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import "./custom-logger-a671be8b.js";
|
|
2
1
|
import "rxjs";
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import "./custom-encoder-
|
|
2
|
+
import { a as s } from "./custom-header-1fcfa265.js";
|
|
3
|
+
import "./mp-front-cli-logger.es.js";
|
|
4
|
+
import "./custom-encoder-70a77460.js";
|
|
5
|
+
import "crypto";
|
|
6
|
+
import "./custom-validator-8a042f7f.js";
|
|
6
7
|
import "./index-df4e0539.js";
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
+
s as CustomHeader
|
|
9
10
|
};
|
|
@@ -1,4 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
var i = Object.defineProperty;
|
|
2
|
+
var n = (r, o, s) => o in r ? i(r, o, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[o] = s;
|
|
3
|
+
var t = (r, o, s) => (n(r, typeof o != "symbol" ? o + "" : o, s), s);
|
|
4
|
+
var g = /* @__PURE__ */ ((r) => (r[r.error = 0] = "error", r[r.warn = 1] = "warn", r[r.info = 2] = "info", r[r.http = 3] = "http", r[r.verbose = 4] = "verbose", r[r.debug = 5] = "debug", r[r.silly = 6] = "silly", r))(g || {});
|
|
5
|
+
const l = {
|
|
6
|
+
error: "\x1B[31m",
|
|
7
|
+
warn: "\x1B[33m",
|
|
8
|
+
info: "\x1B[34m",
|
|
9
|
+
http: "\x1B[35m",
|
|
10
|
+
verbose: "\x1B[32m",
|
|
11
|
+
debug: "\x1B[37m",
|
|
12
|
+
silly: "\x1B[37m"
|
|
13
|
+
};
|
|
14
|
+
class p {
|
|
15
|
+
constructor() {
|
|
16
|
+
t(this, "appName");
|
|
17
|
+
t(this, "logsLevel");
|
|
18
|
+
t(this, "silentLogs");
|
|
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
|
+
}
|
|
21
|
+
consoleFormat(o, s) {
|
|
22
|
+
try {
|
|
23
|
+
return `${l[o]} ${this.appName} [${(/* @__PURE__ */ new Date()).toISOString()}] [${o.toUpperCase()}]: ${s.toString()} \x1B[37m`;
|
|
24
|
+
} catch {
|
|
25
|
+
return s;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
log(o, s) {
|
|
29
|
+
o <= g[this.logsLevel] && !this.silentLogs && console.log(this.consoleFormat(g[o], s));
|
|
30
|
+
}
|
|
31
|
+
logError(...o) {
|
|
32
|
+
this.log(0, o);
|
|
33
|
+
}
|
|
34
|
+
logWarn(...o) {
|
|
35
|
+
this.log(1, o);
|
|
36
|
+
}
|
|
37
|
+
logInfo(...o) {
|
|
38
|
+
this.log(2, o);
|
|
39
|
+
}
|
|
40
|
+
logHttp(...o) {
|
|
41
|
+
this.log(3, o);
|
|
42
|
+
}
|
|
43
|
+
logVerbose(...o) {
|
|
44
|
+
this.log(4, o);
|
|
45
|
+
}
|
|
46
|
+
logDebug(...o) {
|
|
47
|
+
this.log(5, o);
|
|
48
|
+
}
|
|
49
|
+
logSilly(...o) {
|
|
50
|
+
this.log(6, o);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
2
53
|
export {
|
|
3
|
-
|
|
54
|
+
p as CustomLogger
|
|
4
55
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as p } from "./custom-validator-
|
|
2
|
-
import "./custom-encoder-
|
|
3
|
-
import "./custom-logger-a671be8b.js";
|
|
1
|
+
import { C as p } from "./custom-validator-8a042f7f.js";
|
|
2
|
+
import "./custom-encoder-70a77460.js";
|
|
4
3
|
import "./index-df4e0539.js";
|
|
4
|
+
import "./mp-front-cli-logger.es.js";
|
|
5
5
|
export {
|
|
6
6
|
p as CustomValidator
|
|
7
7
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mp-front-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -72,7 +72,6 @@
|
|
|
72
72
|
"typescript": "5.3.3",
|
|
73
73
|
"vite": "4.5.2",
|
|
74
74
|
"vite-plugin-dts": "3.7.1",
|
|
75
|
-
"vite-plugin-node-polyfills": "^0.21.0",
|
|
76
75
|
"vite-tsconfig-paths": "4.2.2"
|
|
77
76
|
}
|
|
78
|
-
}
|
|
77
|
+
}
|