mp-front-cli 0.0.43 → 0.0.44

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