mp-front-cli 0.0.31 → 0.0.32

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