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