mp-front-cli 0.0.31 → 0.0.33
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 +4 -3
- package/dist/core/errors/error-catalog.d.ts.map +1 -1
- package/dist/core/errors/message-error.d.ts +11 -6
- package/dist/core/errors/message-error.d.ts.map +1 -1
- package/dist/core/interfaces/message.d.ts +2 -3
- package/dist/core/interfaces/message.d.ts.map +1 -1
- package/dist/core/middleware/index.d.ts +3 -3
- package/dist/core/middleware/index.d.ts.map +1 -1
- package/dist/core/utils/api-request/fetch-service-be.d.ts +1 -4
- package/dist/core/utils/api-request/fetch-service-be.d.ts.map +1 -1
- package/dist/core/utils/api-request/fetch-service-fe.d.ts +3 -5
- package/dist/core/utils/api-request/fetch-service-fe.d.ts.map +1 -1
- package/dist/core/utils/custom-catch-error.d.ts +5 -0
- package/dist/core/utils/custom-catch-error.d.ts.map +1 -0
- package/dist/core/utils/custom-header.d.ts +3 -115
- package/dist/core/utils/custom-header.d.ts.map +1 -1
- package/dist/custom-header-bb082c8e.js +878 -0
- package/dist/{custom-validator-16ec563a.js → custom-validator-185d0ac8.js} +391 -387
- package/dist/message-handler-d90f2bb6.js +35 -0
- package/dist/mp-front-cli-all.es.js +15 -13
- package/dist/mp-front-cli-catch-error.es.js +14 -0
- package/dist/mp-front-cli-core.es.js +55 -59
- package/dist/mp-front-cli-header.es.js +5 -3
- package/dist/mp-front-cli-utils-rxjs.es.js +11 -36
- package/dist/mp-front-cli-validator.es.js +2 -2
- package/package.json +5 -1
- package/dist/custom-header-9a9c64e2.js +0 -878
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var i = Object.defineProperty;
|
|
2
|
+
var r = (c, e, t) => e in c ? i(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
|
|
3
|
+
var u = (c, e, t) => (r(c, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { Observable as j, Subject as n } from "rxjs";
|
|
5
|
+
class a extends j {
|
|
6
|
+
constructor() {
|
|
7
|
+
super((t) => {
|
|
8
|
+
this.subject$.subscribe(t);
|
|
9
|
+
});
|
|
10
|
+
u(this, "subject$", new n());
|
|
11
|
+
}
|
|
12
|
+
setSubject(t) {
|
|
13
|
+
this.subject$.next(t);
|
|
14
|
+
}
|
|
15
|
+
completeSubject() {
|
|
16
|
+
this.subject$.complete();
|
|
17
|
+
}
|
|
18
|
+
unsubscribeSubject() {
|
|
19
|
+
return this.subject$.unsubscribe(), this.subject$ = new n(), this.subject$;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const s = class s extends a {
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
}
|
|
26
|
+
static getInstance() {
|
|
27
|
+
return s.instance || (s.instance = new s()), s.instance;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
u(s, "instance");
|
|
31
|
+
let b = s;
|
|
32
|
+
export {
|
|
33
|
+
b as M,
|
|
34
|
+
a as R
|
|
35
|
+
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import { ApiMiddleware as
|
|
3
|
-
import { S as
|
|
4
|
-
import {
|
|
1
|
+
import { E as m, M as s } from "./custom-validator-185d0ac8.js";
|
|
2
|
+
import { ApiMiddleware as x, FetchServiceBE as M, FetchServiceFE as d } from "./mp-front-cli-core.es.js";
|
|
3
|
+
import { S as g } from "./custom-header-bb082c8e.js";
|
|
4
|
+
import { M as E, R as F } from "./message-handler-d90f2bb6.js";
|
|
5
|
+
import { LoadingHandler as l } from "./mp-front-cli-utils-rxjs.es.js";
|
|
5
6
|
import "./custom-encoder-b2078b5c.js";
|
|
6
7
|
import "./mp-front-cli-logger.es.js";
|
|
7
8
|
import "./index-6f6eb615.js";
|
|
8
9
|
import "rxjs";
|
|
10
|
+
import "./mp-front-cli-catch-error.es.js";
|
|
9
11
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
x as ApiMiddleware,
|
|
13
|
+
m as ErrorCatalog,
|
|
14
|
+
M as FetchServiceBE,
|
|
15
|
+
d as FetchServiceFE,
|
|
16
|
+
l as LoadingHandler,
|
|
17
|
+
s as MessageErrorBFF,
|
|
18
|
+
E as MessageHandler,
|
|
19
|
+
F as RxSubjectManager,
|
|
20
|
+
g as ServiceToken
|
|
19
21
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EMPTY as t } from "rxjs";
|
|
2
|
+
import { C as o, M as e } from "./custom-validator-185d0ac8.js";
|
|
3
|
+
import { M as s } from "./message-handler-d90f2bb6.js";
|
|
4
|
+
import "./custom-encoder-b2078b5c.js";
|
|
5
|
+
import "./mp-front-cli-logger.es.js";
|
|
6
|
+
import "./index-6f6eb615.js";
|
|
7
|
+
class u extends o {
|
|
8
|
+
catch(r) {
|
|
9
|
+
return s.getInstance().setSubject(new e(r)), t;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
u as CustomCatchError
|
|
14
|
+
};
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import { E as
|
|
6
|
-
import { C as
|
|
7
|
-
import { S as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var p = (o, s, t) => s in o ? f(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
|
|
3
|
+
var n = (o, s, t) => (p(o, typeof s != "symbol" ? s + "" : s, t), t);
|
|
4
|
+
import { M as S } from "./custom-validator-185d0ac8.js";
|
|
5
|
+
import { E as R } from "./custom-validator-185d0ac8.js";
|
|
6
|
+
import { C as b, f as m } from "./custom-header-bb082c8e.js";
|
|
7
|
+
import { S as w } from "./custom-header-bb082c8e.js";
|
|
8
|
+
import { M as c } from "./message-handler-d90f2bb6.js";
|
|
9
|
+
import { R as C } from "./message-handler-d90f2bb6.js";
|
|
10
|
+
import { LoadingHandler as u } from "./mp-front-cli-utils-rxjs.es.js";
|
|
11
|
+
import { of as a, switchMap as i, catchError as d, filter as g } from "rxjs";
|
|
12
|
+
import { CustomCatchError as l } from "./mp-front-cli-catch-error.es.js";
|
|
11
13
|
import "./custom-encoder-b2078b5c.js";
|
|
12
14
|
import "./mp-front-cli-logger.es.js";
|
|
13
15
|
import "./index-6f6eb615.js";
|
|
14
|
-
class
|
|
16
|
+
class U extends l {
|
|
15
17
|
returnData(s, t) {
|
|
16
|
-
|
|
18
|
+
c.getInstance().unsubscribeSubject();
|
|
17
19
|
const e = this.encode(t);
|
|
18
20
|
s.status(200).json(e);
|
|
19
21
|
}
|
|
20
22
|
get(s) {
|
|
21
23
|
return this.logDebug("get ApiMiddleware"), (t, e) => {
|
|
22
|
-
this.logDebug("return ApiMiddleware"),
|
|
24
|
+
this.logDebug("return ApiMiddleware"), c.getInstance().subscribe({
|
|
23
25
|
next: (r) => (this.logError(
|
|
24
26
|
`ApiMiddleware MessageHandler ${JSON.stringify(r)}`
|
|
25
|
-
),
|
|
26
|
-
}),
|
|
27
|
+
), c.getInstance().unsubscribeSubject(), e.status(r.code ?? 520).json(r))
|
|
28
|
+
}), a(t).pipe(
|
|
27
29
|
i((r) => this.validateTokenFront(r)),
|
|
28
|
-
i((r) =>
|
|
30
|
+
i((r) => a(this.decode(r.body))),
|
|
29
31
|
i((r) => s(r)),
|
|
30
|
-
|
|
32
|
+
d(this.catch)
|
|
31
33
|
).subscribe({
|
|
32
34
|
next: (r) => {
|
|
33
35
|
this.returnData(e, r);
|
|
@@ -36,28 +38,26 @@ class H extends l {
|
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
class
|
|
41
|
+
class I extends b {
|
|
40
42
|
constructor(t, e) {
|
|
41
43
|
super();
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
n(this, "apiUrl");
|
|
45
|
+
n(this, "method");
|
|
44
46
|
this.apiUrl = t, this.method = e ?? "POST";
|
|
45
47
|
}
|
|
46
48
|
errorHandler(t) {
|
|
47
|
-
return t != null && t.errors &&
|
|
48
|
-
new
|
|
49
|
+
return t != null && t.errors && c.getInstance().setSubject(
|
|
50
|
+
new S(t.errors[0])
|
|
49
51
|
), !(t != null && t.errors);
|
|
50
52
|
}
|
|
51
|
-
customCatchError(t) {
|
|
52
|
-
return n.getInstance().setSubject(new g(t).get()), o({ error: !0 }).pipe(d(({ error: e }) => !e));
|
|
53
|
-
}
|
|
54
53
|
fetchData(t = {}) {
|
|
55
|
-
return this.logDebug("fetchData", JSON.stringify(t)),
|
|
54
|
+
return this.logDebug("fetchData", JSON.stringify(t)), a(t).pipe(
|
|
55
|
+
d(this.catch),
|
|
56
56
|
i(
|
|
57
|
-
(e) => this.getHeaders().pipe(i((r) =>
|
|
57
|
+
(e) => this.getHeaders().pipe(i((r) => a({ params: e, headers: r })))
|
|
58
58
|
),
|
|
59
59
|
i(
|
|
60
|
-
({ params: e, headers: r }) =>
|
|
60
|
+
({ params: e, headers: r }) => m(this.apiUrl, {
|
|
61
61
|
method: this.method,
|
|
62
62
|
headers: r,
|
|
63
63
|
body: this.method === "GET" ? null : JSON.stringify(e)
|
|
@@ -69,58 +69,54 @@ class C extends f {
|
|
|
69
69
|
)} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
|
|
70
70
|
e
|
|
71
71
|
)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(h)} \x1B[33m`
|
|
72
|
-
),
|
|
72
|
+
), a(h)))
|
|
73
73
|
)
|
|
74
74
|
),
|
|
75
|
-
|
|
76
|
-
d(this.errorHandler)
|
|
75
|
+
g(this.errorHandler)
|
|
77
76
|
);
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
|
-
class
|
|
79
|
+
class N extends l {
|
|
81
80
|
constructor(t, e = "POST", r = {}) {
|
|
82
81
|
super();
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
n(this, "apiUrl");
|
|
83
|
+
n(this, "method");
|
|
84
|
+
n(this, "headers");
|
|
86
85
|
this.apiUrl = t, this.method = e, this.headers = {
|
|
87
86
|
"Content-Type": "application/json",
|
|
88
87
|
...r
|
|
89
88
|
};
|
|
90
89
|
}
|
|
91
90
|
errorHandler(t) {
|
|
92
|
-
return t.code && (
|
|
93
|
-
}
|
|
94
|
-
customCatchError(t) {
|
|
95
|
-
return n.getInstance().setSubject(new g(t).get()), u.getInstance().setSubject(!1), o({ error: !0 }).pipe(
|
|
96
|
-
d(({ error: e }) => !e)
|
|
97
|
-
);
|
|
91
|
+
return t.code && (c.getInstance().setSubject(t), u.getInstance().setSubject(!1)), !t.code;
|
|
98
92
|
}
|
|
99
93
|
fetchData(t = {}) {
|
|
100
|
-
return u.getInstance().setSubject(!0),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
94
|
+
return u.getInstance().setSubject(!0), a(t).pipe(
|
|
95
|
+
d((e) => (u.getInstance().setSubject(!1), this.catch(e))),
|
|
96
|
+
i((e) => this.encode(e)),
|
|
97
|
+
i((e) => m(this.apiUrl, {
|
|
98
|
+
method: this.method,
|
|
99
|
+
headers: this.headers,
|
|
100
|
+
body: e
|
|
101
|
+
})),
|
|
105
102
|
i((e) => e.json()),
|
|
106
103
|
i((e) => (this.logDebug(
|
|
107
104
|
`FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <BODY>: ${JSON.stringify(e)}`
|
|
108
|
-
),
|
|
109
|
-
|
|
110
|
-
i((e) =>
|
|
111
|
-
i((e) => (u.getInstance().setSubject(!1),
|
|
112
|
-
m(this.customCatchError)
|
|
105
|
+
), a(e))),
|
|
106
|
+
g(this.errorHandler),
|
|
107
|
+
i((e) => a(this.decode(e))),
|
|
108
|
+
i((e) => (u.getInstance().setSubject(!1), a(e)))
|
|
113
109
|
);
|
|
114
110
|
}
|
|
115
111
|
}
|
|
116
112
|
export {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
U as ApiMiddleware,
|
|
114
|
+
R as ErrorCatalog,
|
|
115
|
+
I as FetchServiceBE,
|
|
116
|
+
N as FetchServiceFE,
|
|
121
117
|
u as LoadingHandler,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
S as MessageErrorBFF,
|
|
119
|
+
c as MessageHandler,
|
|
120
|
+
C as RxSubjectManager,
|
|
121
|
+
w as ServiceToken
|
|
126
122
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import "rxjs";
|
|
2
|
-
import { C
|
|
3
|
-
import "./
|
|
2
|
+
import { C } from "./custom-header-bb082c8e.js";
|
|
3
|
+
import "./mp-front-cli-catch-error.es.js";
|
|
4
4
|
import "./mp-front-cli-logger.es.js";
|
|
5
|
+
import "./custom-validator-185d0ac8.js";
|
|
5
6
|
import "./custom-encoder-b2078b5c.js";
|
|
6
7
|
import "./index-6f6eb615.js";
|
|
8
|
+
import "./message-handler-d90f2bb6.js";
|
|
7
9
|
export {
|
|
8
|
-
|
|
10
|
+
C as CustomHeader
|
|
9
11
|
};
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.subject$.subscribe(t);
|
|
9
|
-
});
|
|
10
|
-
u(this, "subject$", new i());
|
|
11
|
-
}
|
|
12
|
-
setSubject(t) {
|
|
13
|
-
this.subject$.next(t);
|
|
14
|
-
}
|
|
15
|
-
completeSubject() {
|
|
16
|
-
this.subject$.complete();
|
|
17
|
-
}
|
|
18
|
-
unsubscribeSubject() {
|
|
19
|
-
return this.subject$.unsubscribe(), this.subject$ = new i(), this.subject$;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const e = class e extends a {
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var i = (s, t, n) => t in s ? a(s, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : s[t] = n;
|
|
3
|
+
var c = (s, t, n) => (i(s, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
+
import { R as o } from "./message-handler-d90f2bb6.js";
|
|
5
|
+
import { M } from "./message-handler-d90f2bb6.js";
|
|
6
|
+
import "rxjs";
|
|
7
|
+
const e = class e extends o {
|
|
23
8
|
constructor() {
|
|
24
9
|
super();
|
|
25
10
|
}
|
|
@@ -27,20 +12,10 @@ const e = class e extends a {
|
|
|
27
12
|
return e.instance || (e.instance = new e()), e.instance;
|
|
28
13
|
}
|
|
29
14
|
};
|
|
30
|
-
|
|
31
|
-
let
|
|
32
|
-
const c = class c extends a {
|
|
33
|
-
constructor() {
|
|
34
|
-
super();
|
|
35
|
-
}
|
|
36
|
-
static getInstance() {
|
|
37
|
-
return c.instance || (c.instance = new c()), c.instance;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
u(c, "instance");
|
|
41
|
-
let r = c;
|
|
15
|
+
c(e, "instance");
|
|
16
|
+
let r = e;
|
|
42
17
|
export {
|
|
43
18
|
r as LoadingHandler,
|
|
44
|
-
|
|
45
|
-
|
|
19
|
+
M as MessageHandler,
|
|
20
|
+
o as RxSubjectManager
|
|
46
21
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as p } from "./custom-validator-
|
|
1
|
+
import { C as p } from "./custom-validator-185d0ac8.js";
|
|
2
2
|
import "./custom-encoder-b2078b5c.js";
|
|
3
|
-
import "./mp-front-cli-logger.es.js";
|
|
4
3
|
import "./index-6f6eb615.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.33",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
"types": "./dist/core/utils/custom-logger.d.ts",
|
|
39
39
|
"import": "./dist/mp-front-cli-logger.es.js"
|
|
40
40
|
},
|
|
41
|
+
"./core/catch-error": {
|
|
42
|
+
"types": "./dist/core/utils/custom-catch-error.d.ts",
|
|
43
|
+
"import": "./dist/mp-front-cli-catch-error.es.js"
|
|
44
|
+
},
|
|
41
45
|
"./core/validator": {
|
|
42
46
|
"types": "./dist/core/utils/custom-validator.d.ts",
|
|
43
47
|
"import": "./dist/mp-front-cli-validator.es.js"
|