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