mp-front-cli 0.0.30 → 0.0.31

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