mp-front-cli 0.0.42 → 0.0.43
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 +3 -0
- package/dist/core/middleware/index.d.ts.map +1 -1
- package/dist/core/utils/api-request/fetch-service-fe.d.ts.map +1 -1
- package/dist/core/utils/custom-header.d.ts +0 -1
- package/dist/core/utils/custom-header.d.ts.map +1 -1
- package/dist/core/utils/custom-validator.d.ts +3 -3
- package/dist/core/utils/custom-validator.d.ts.map +1 -1
- package/dist/{custom-encrypter-53d456d5.js → custom-encrypter-6d8ba182.js} +3920 -3747
- package/dist/{custom-header-4f5b8f1b.js → custom-header-7dd638e5.js} +248 -263
- package/dist/custom-validator-49426b3d.js +14293 -0
- package/dist/mp-front-cli-all.es.js +4 -4
- package/dist/mp-front-cli-core.es.js +65 -61
- package/dist/mp-front-cli-encrypter.es.js +2 -2
- package/dist/mp-front-cli-header.es.js +4 -4
- package/dist/mp-front-cli-validator.es.js +4 -3
- package/package.json +1 -1
- package/dist/custom-validator-8a042f7f.js +0 -4683
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { E as c } from "./custom-validator-
|
|
1
|
+
import { E as c } from "./custom-validator-49426b3d.js";
|
|
2
2
|
import { ApiMiddleware as n, FetchServiceBE as x, FetchServiceFE as S } from "./mp-front-cli-core.es.js";
|
|
3
|
-
import { S as g } from "./custom-header-
|
|
3
|
+
import { S as g } from "./custom-header-7dd638e5.js";
|
|
4
4
|
import { LoadingHandler as s, MessageHandler as E, RxSubjectManager as v } from "./mp-front-cli-utils-rxjs.es.js";
|
|
5
5
|
import "./custom-encoder-70a77460.js";
|
|
6
6
|
import "./mp-front-cli-logger.es.js";
|
|
7
7
|
import "./index-df4e0539.js";
|
|
8
|
-
import "rxjs";
|
|
9
|
-
import "./custom-encrypter-53d456d5.js";
|
|
10
8
|
import "crypto";
|
|
9
|
+
import "rxjs";
|
|
10
|
+
import "./custom-encrypter-6d8ba182.js";
|
|
11
11
|
export {
|
|
12
12
|
n as ApiMiddleware,
|
|
13
13
|
c as ErrorCatalog,
|
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { E as
|
|
5
|
-
import { C as y, f as
|
|
6
|
-
import { S as
|
|
7
|
-
import { MessageHandler as
|
|
8
|
-
import { RxSubjectManager as
|
|
9
|
-
import { of as
|
|
10
|
-
import { C as
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var B = (c, n, t) => n in c ? E(c, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[n] = t;
|
|
3
|
+
var h = (c, n, t) => (B(c, typeof n != "symbol" ? n + "" : n, t), t);
|
|
4
|
+
import { E as m, C as O } from "./custom-validator-49426b3d.js";
|
|
5
|
+
import { C as y, f as p } from "./custom-header-7dd638e5.js";
|
|
6
|
+
import { S as F } from "./custom-header-7dd638e5.js";
|
|
7
|
+
import { MessageHandler as g, LoadingHandler as l } from "./mp-front-cli-utils-rxjs.es.js";
|
|
8
|
+
import { RxSubjectManager as Y } from "./mp-front-cli-utils-rxjs.es.js";
|
|
9
|
+
import { of as u, switchMap as o, catchError as f, EMPTY as b, filter as x } from "rxjs";
|
|
10
|
+
import { C as U, c as S } from "./custom-encrypter-6d8ba182.js";
|
|
11
11
|
import "./custom-encoder-70a77460.js";
|
|
12
12
|
import "./mp-front-cli-logger.es.js";
|
|
13
13
|
import "./index-df4e0539.js";
|
|
14
14
|
import "crypto";
|
|
15
|
-
class I extends
|
|
16
|
-
constructor() {
|
|
17
|
-
super(
|
|
18
|
-
|
|
15
|
+
class I extends U {
|
|
16
|
+
constructor(t) {
|
|
17
|
+
super();
|
|
18
|
+
h(this, "uuid", "");
|
|
19
|
+
h(this, "authOptions");
|
|
20
|
+
this.authOptions = t;
|
|
19
21
|
}
|
|
20
22
|
returnData(t, i, r) {
|
|
21
23
|
const s = this.encode(i, r);
|
|
22
24
|
t.status(200).json(s);
|
|
23
25
|
}
|
|
24
26
|
returnError(t, i) {
|
|
25
|
-
return i != null && i.uuid ? t.status(520).json(i) : t.status(520).json(new
|
|
27
|
+
return i != null && i.uuid ? t.status(520).json(i) : t.status(520).json(new m().get(i, this.uuid));
|
|
26
28
|
}
|
|
27
29
|
get(t) {
|
|
28
30
|
return this.logDebug("get ApiMiddleware"), (i, r) => {
|
|
29
31
|
var s;
|
|
30
|
-
this.logDebug("return ApiMiddleware"), this.uuid = (s = i == null ? void 0 : i.body) == null ? void 0 : s.uuid,
|
|
31
|
-
o((e) => this.validateTokenFront(e)),
|
|
32
|
-
o((e) =>
|
|
32
|
+
this.logDebug("return ApiMiddleware"), this.uuid = (s = i == null ? void 0 : i.body) == null ? void 0 : s.uuid, u(i).pipe(
|
|
33
|
+
o((e) => this.validateTokenFront(e, r, this.authOptions)),
|
|
34
|
+
o((e) => u(this.decode(e.body))),
|
|
33
35
|
o(
|
|
34
36
|
(e) => t(e, this.uuid).pipe(
|
|
35
|
-
o((
|
|
37
|
+
o((d) => u({ params: e, response: d }))
|
|
36
38
|
)
|
|
37
39
|
),
|
|
38
|
-
o(({ params: e, response:
|
|
39
|
-
`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(
|
|
40
|
-
),
|
|
41
|
-
|
|
42
|
-
var
|
|
40
|
+
o(({ params: e, response: d }) => (this.logDebug(
|
|
41
|
+
`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(d)}`
|
|
42
|
+
), u(d))),
|
|
43
|
+
f((e) => {
|
|
44
|
+
var d;
|
|
43
45
|
return this.logError(
|
|
44
|
-
`ApiMiddleware <URL>: ${i == null ? void 0 : i.url} <UUID> ${(
|
|
45
|
-
), this.returnError(r, e),
|
|
46
|
+
`ApiMiddleware <URL>: ${i == null ? void 0 : i.url} <UUID> ${(d = i == null ? void 0 : i.body) == null ? void 0 : d.uuid} <PARAMS> ${JSON.stringify(i == null ? void 0 : i.body)} <ERROR>: ${JSON.stringify(e)}`
|
|
47
|
+
), this.returnError(r, e), b;
|
|
46
48
|
})
|
|
47
49
|
).subscribe({
|
|
48
50
|
next: (e) => {
|
|
@@ -52,25 +54,25 @@ class I extends O {
|
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
|
-
class
|
|
57
|
+
class L extends y {
|
|
56
58
|
constructor(t, i) {
|
|
57
59
|
super();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
h(this, "apiUrl");
|
|
61
|
+
h(this, "method");
|
|
60
62
|
this.apiUrl = t, this.method = i ?? "POST";
|
|
61
63
|
}
|
|
62
64
|
errorHandler(t, i) {
|
|
63
65
|
if (t != null && t.errors)
|
|
64
|
-
throw new
|
|
66
|
+
throw new m().get(t.errors[0], i);
|
|
65
67
|
return !(t != null && t.errors);
|
|
66
68
|
}
|
|
67
69
|
fetchData(t = {}, i) {
|
|
68
|
-
return
|
|
70
|
+
return u(t).pipe(
|
|
69
71
|
o(
|
|
70
|
-
(r) => this.getHeaders().pipe(o((s) =>
|
|
72
|
+
(r) => this.getHeaders().pipe(o((s) => u({ params: r, headers: s })))
|
|
71
73
|
),
|
|
72
74
|
o(
|
|
73
|
-
({ params: r, headers: s }) =>
|
|
75
|
+
({ params: r, headers: s }) => p(this.apiUrl, {
|
|
74
76
|
method: this.method,
|
|
75
77
|
headers: s,
|
|
76
78
|
body: this.method === "GET" ? null : JSON.stringify(r),
|
|
@@ -82,20 +84,20 @@ class H extends y {
|
|
|
82
84
|
)} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
|
|
83
85
|
r
|
|
84
86
|
)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(e)} \x1B[33m`
|
|
85
|
-
),
|
|
87
|
+
), u(e)))
|
|
86
88
|
)
|
|
87
89
|
),
|
|
88
|
-
|
|
90
|
+
x((r) => this.errorHandler(r, i))
|
|
89
91
|
);
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
|
-
class
|
|
94
|
+
class H extends O {
|
|
93
95
|
constructor(t, i = "POST", r = {}) {
|
|
94
96
|
super();
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
h(this, "apiUrl");
|
|
98
|
+
h(this, "method");
|
|
99
|
+
h(this, "headers");
|
|
100
|
+
h(this, "isLoadingEnabled", !0);
|
|
99
101
|
this.apiUrl = t, this.method = i, this.headers = {
|
|
100
102
|
"Content-Type": "application/json",
|
|
101
103
|
...r
|
|
@@ -105,35 +107,37 @@ class L extends B {
|
|
|
105
107
|
this.isLoadingEnabled = t;
|
|
106
108
|
}
|
|
107
109
|
errorHandler(t) {
|
|
108
|
-
return t.code && (
|
|
110
|
+
return t.code && (g.getInstance().setSubject(t), l.getInstance().setSubject(!1)), !t.code;
|
|
109
111
|
}
|
|
110
112
|
fetchData(t = {}) {
|
|
111
|
-
const i = (/* @__PURE__ */ new Date()).toISOString(), r =
|
|
112
|
-
|
|
113
|
+
const i = (/* @__PURE__ */ new Date()).toISOString(), r = S.v5(i, S.v5.URL), s = this.encode({ ...t }, r);
|
|
114
|
+
l.getInstance().setSubject(this.isLoadingEnabled);
|
|
115
|
+
const d = new URLSearchParams(window.location.search).get("flow") || "N/A";
|
|
116
|
+
return p(this.apiUrl, {
|
|
113
117
|
method: this.method,
|
|
114
|
-
headers: this.headers,
|
|
118
|
+
headers: { ...this.headers, flow: d },
|
|
115
119
|
body: s,
|
|
116
|
-
selector: (
|
|
120
|
+
selector: (a) => a.json()
|
|
117
121
|
}).pipe(
|
|
118
|
-
o((
|
|
119
|
-
o((
|
|
120
|
-
`FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(t)} <BODY> ${s} <RESPONSE>: ${JSON.stringify(
|
|
121
|
-
), a
|
|
122
|
-
|
|
123
|
-
o((
|
|
124
|
-
|
|
125
|
-
new
|
|
126
|
-
),
|
|
122
|
+
o((a) => u(this.decode(a))),
|
|
123
|
+
o((a) => (this.logDebug(
|
|
124
|
+
`FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(t)} <BODY> ${s} <RESPONSE>: ${JSON.stringify(a)}`
|
|
125
|
+
), u(a))),
|
|
126
|
+
x(this.errorHandler),
|
|
127
|
+
o((a) => (l.getInstance().setSubject(!1), u(a))),
|
|
128
|
+
f((a) => (l.getInstance().setSubject(!1), g.getInstance().setSubject(
|
|
129
|
+
new m().get(a, r)
|
|
130
|
+
), b))
|
|
127
131
|
);
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
export {
|
|
131
135
|
I as ApiMiddleware,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
m as ErrorCatalog,
|
|
137
|
+
L as FetchServiceBE,
|
|
138
|
+
H as FetchServiceFE,
|
|
139
|
+
l as LoadingHandler,
|
|
140
|
+
g as MessageHandler,
|
|
141
|
+
Y as RxSubjectManager,
|
|
142
|
+
F as ServiceToken
|
|
139
143
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as s } from "./custom-encrypter-
|
|
1
|
+
import { C as s } from "./custom-encrypter-6d8ba182.js";
|
|
2
2
|
import "crypto";
|
|
3
|
-
import "./custom-validator-
|
|
3
|
+
import "./custom-validator-49426b3d.js";
|
|
4
4
|
import "./custom-encoder-70a77460.js";
|
|
5
5
|
import "./mp-front-cli-logger.es.js";
|
|
6
6
|
import "./index-df4e0539.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "rxjs";
|
|
2
|
-
import { C } from "./custom-header-
|
|
3
|
-
import "./custom-encrypter-
|
|
2
|
+
import { C } from "./custom-header-7dd638e5.js";
|
|
3
|
+
import "./custom-encrypter-6d8ba182.js";
|
|
4
4
|
import "./mp-front-cli-logger.es.js";
|
|
5
5
|
import "./custom-encoder-70a77460.js";
|
|
6
|
-
import "
|
|
7
|
-
import "./custom-validator-8a042f7f.js";
|
|
6
|
+
import "./custom-validator-49426b3d.js";
|
|
8
7
|
import "./index-df4e0539.js";
|
|
8
|
+
import "crypto";
|
|
9
9
|
export {
|
|
10
10
|
C as CustomHeader
|
|
11
11
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { C as p } from "./custom-validator-8a042f7f.js";
|
|
2
1
|
import "./custom-encoder-70a77460.js";
|
|
3
|
-
import "./
|
|
2
|
+
import { C as a } from "./custom-validator-49426b3d.js";
|
|
4
3
|
import "./mp-front-cli-logger.es.js";
|
|
4
|
+
import "./index-df4e0539.js";
|
|
5
|
+
import "crypto";
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
+
a as CustomValidator
|
|
7
8
|
};
|