mp-front-cli 0.0.44 → 0.0.45

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,20 +1,22 @@
1
- import { E as c } from "./custom-validator-49426b3d.js";
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-30dbd365.js";
4
- import { LoadingHandler as s, MessageHandler as E, RxSubjectManager as v } from "./mp-front-cli-utils-rxjs.es.js";
5
- import "./custom-encoder-70a77460.js";
1
+ import { E as n } from "./custom-validator-74fcaf87.js";
2
+ import { ApiMiddleware as S, FetchServiceBE as f, FetchServiceFE as g } from "./mp-front-cli-core.es.js";
3
+ import { S as s } from "./custom-header-3ba5652e.js";
4
+ import { LoadingHandler as v, MessageHandler as F, RxSubjectManager as M } from "./mp-front-cli-utils-rxjs.es.js";
5
+ import "./mp-front-cli-encoder.es.js";
6
6
  import "./mp-front-cli-logger.es.js";
7
7
  import "./index-df4e0539.js";
8
- import "crypto";
8
+ import "next-auth";
9
9
  import "rxjs";
10
- import "./custom-encrypter-8fbfd246.js";
10
+ import "./mp-front-cli-encrypter.es.js";
11
+ import "node-jose";
12
+ import "crypto";
11
13
  export {
12
- n as ApiMiddleware,
13
- c as ErrorCatalog,
14
- x as FetchServiceBE,
15
- S as FetchServiceFE,
16
- s as LoadingHandler,
17
- E as MessageHandler,
18
- v as RxSubjectManager,
19
- g as ServiceToken
14
+ S as ApiMiddleware,
15
+ n as ErrorCatalog,
16
+ f as FetchServiceBE,
17
+ g as FetchServiceFE,
18
+ v as LoadingHandler,
19
+ F as MessageHandler,
20
+ M as RxSubjectManager,
21
+ s as ServiceToken
20
22
  };
@@ -1,150 +1,246 @@
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
- import "./custom-encoder-70a77460.js";
1
+ var I = Object.defineProperty;
2
+ var N = (e, i, t) => i in e ? I(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
3
+ var g = (e, i, t) => (N(e, typeof i != "symbol" ? i + "" : i, t), t);
4
+ import { E as U, C as M } from "./custom-validator-74fcaf87.js";
5
+ import { C as j, f as R } from "./custom-header-3ba5652e.js";
6
+ import { S as ct } from "./custom-header-3ba5652e.js";
7
+ import { MessageHandler as A, LoadingHandler as m } from "./mp-front-cli-utils-rxjs.es.js";
8
+ import { RxSubjectManager as ht } from "./mp-front-cli-utils-rxjs.es.js";
9
+ import { of as d, switchMap as u, forkJoin as w, catchError as y, EMPTY as O, filter as D } from "rxjs";
10
+ import { CustomEncrypter as H } from "./mp-front-cli-encrypter.es.js";
11
+ import "./mp-front-cli-encoder.es.js";
12
12
  import "./mp-front-cli-logger.es.js";
13
13
  import "./index-df4e0539.js";
14
+ import "next-auth";
15
+ import "node-jose";
14
16
  import "crypto";
15
- class I extends R {
17
+ class rt extends H {
16
18
  constructor(t) {
17
19
  super();
18
- h(this, "uuid", "");
19
- h(this, "authOptions");
20
+ g(this, "uuid", "");
21
+ g(this, "authOptions");
20
22
  this.authOptions = t;
21
23
  }
22
- returnData(t, i, s) {
23
- const r = this.encode(i, s);
24
- t.status(200).json(r);
24
+ returnData(t, n, o) {
25
+ const f = this.encode(n, o);
26
+ t.status(200).json(f);
25
27
  }
26
- returnError(t, i) {
27
- return i != null && i.uuid ? t.status(520).json(i) : t.status(520).json(new l().get(i, this.uuid));
28
+ returnError(t, n) {
29
+ return n != null && n.uuid ? t.status(520).json(n) : t.status(520).json(new U().get(n, this.uuid));
28
30
  }
29
31
  get(t) {
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)
32
+ return this.logDebug("get ApiMiddleware"), (n, o) => {
33
+ var f;
34
+ this.logDebug("return ApiMiddleware"), this.uuid = (f = n == null ? void 0 : n.body) == null ? void 0 : f.uuid, d(n).pipe(
35
+ u((r) => this.validateTokenFront(r, o, this.authOptions)),
36
+ u(
37
+ (r) => w({
38
+ params: d(this.decode(r.body)),
39
+ headers: d(r.headers)
38
40
  })
39
41
  ),
40
- n(
41
- ({ params: e, headers: u }) => S({
42
- response: t(e, this.uuid, u),
43
- headers: a(u),
44
- params: a(e)
42
+ u(
43
+ ({ params: r, headers: s }) => w({
44
+ response: t(r, this.uuid, s),
45
+ headers: d(s),
46
+ params: d(r)
45
47
  })
46
48
  ),
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;
49
+ u(({ params: r, response: s, headers: a }) => (this.logDebug(
50
+ `ApiMiddleware \x1B[37m <URL>: \x1B[33m ${n.url} \x1B[37m <HEADERS>: \x1B[33m ${a} \x1B[37m <UUID> \x1B[33m ${n.body.uuid} \x1B[37m <PARAMS> \x1B[33m ${JSON.stringify(r)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(s)}`
51
+ ), d(s))),
52
+ y((r) => {
53
+ var s;
52
54
  return this.logError(
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;
55
+ `ApiMiddleware <URL>: ${n == null ? void 0 : n.url} <HEADERS>: ${n == null ? void 0 : n.headers} <UUID> ${(s = n == null ? void 0 : n.body) == null ? void 0 : s.uuid} <PARAMS> ${JSON.stringify(n == null ? void 0 : n.body)} <ERROR>: ${JSON.stringify(r)}`
56
+ ), this.returnError(o, r), O;
55
57
  })
56
58
  ).subscribe({
57
- next: (e) => {
58
- this.logDebug("ApiMiddleware subscribe next", JSON.stringify(e)), this.returnData(s, e, this.uuid);
59
+ next: (r) => {
60
+ this.logDebug("ApiMiddleware subscribe next", JSON.stringify(r)), this.returnData(o, r, this.uuid);
59
61
  }
60
62
  });
61
63
  };
62
64
  }
63
65
  }
64
- class L extends D {
65
- constructor(t, i) {
66
+ class ot extends j {
67
+ constructor(t, n) {
66
68
  super();
67
- h(this, "apiUrl");
68
- h(this, "method");
69
- this.apiUrl = t, this.method = i ?? "POST";
69
+ g(this, "apiUrl");
70
+ g(this, "method");
71
+ this.apiUrl = t, this.method = n ?? "POST";
70
72
  }
71
- errorHandler(t, i) {
73
+ errorHandler(t, n) {
72
74
  if (t != null && t.errors)
73
- throw new l().get(t.errors[0], i);
75
+ throw new U().get(t.errors[0], n);
74
76
  return !(t != null && t.errors);
75
77
  }
76
- fetchData(t = {}, i) {
77
- return a(t).pipe(
78
- n(
79
- (s) => this.getHeaders().pipe(n((r) => a({ params: s, headers: r })))
78
+ fetchData(t = {}, n) {
79
+ return d(t).pipe(
80
+ u(
81
+ (o) => this.getHeaders().pipe(u((f) => d({ params: o, headers: f })))
80
82
  ),
81
- n(
82
- ({ params: s, headers: r }) => f(this.apiUrl, {
83
+ u(
84
+ ({ params: o, headers: f }) => R(this.apiUrl, {
83
85
  method: this.method,
84
- headers: r,
85
- body: this.method === "GET" ? null : JSON.stringify(s),
86
- selector: (e) => e.json()
86
+ headers: f,
87
+ body: this.method === "GET" ? null : JSON.stringify(o),
88
+ selector: (r) => r.json()
87
89
  }).pipe(
88
- n((e) => (this.logDebug(
89
- `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${i} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
90
- r
90
+ u((r) => (this.logDebug(
91
+ `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${n} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
92
+ f
91
93
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
92
- s
93
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(e)} \x1B[33m`
94
- ), a(e)))
94
+ o
95
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(r)} \x1B[33m`
96
+ ), d(r)))
95
97
  )
96
98
  ),
97
- b((s) => this.errorHandler(s, i))
99
+ D((o) => this.errorHandler(o, n))
98
100
  );
99
101
  }
100
102
  }
101
- class v extends y {
102
- constructor(t, i = "POST", s = {}) {
103
+ const L = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
104
+ function v(e) {
105
+ return typeof e == "string" && L.test(e);
106
+ }
107
+ const l = [];
108
+ for (let e = 0; e < 256; ++e)
109
+ l.push((e + 256).toString(16).slice(1));
110
+ function J(e, i = 0) {
111
+ return l[e[i + 0]] + l[e[i + 1]] + l[e[i + 2]] + l[e[i + 3]] + "-" + l[e[i + 4]] + l[e[i + 5]] + "-" + l[e[i + 6]] + l[e[i + 7]] + "-" + l[e[i + 8]] + l[e[i + 9]] + "-" + l[e[i + 10]] + l[e[i + 11]] + l[e[i + 12]] + l[e[i + 13]] + l[e[i + 14]] + l[e[i + 15]];
112
+ }
113
+ function T(e) {
114
+ if (!v(e))
115
+ throw TypeError("Invalid UUID");
116
+ let i;
117
+ const t = new Uint8Array(16);
118
+ return t[0] = (i = parseInt(e.slice(0, 8), 16)) >>> 24, t[1] = i >>> 16 & 255, t[2] = i >>> 8 & 255, t[3] = i & 255, t[4] = (i = parseInt(e.slice(9, 13), 16)) >>> 8, t[5] = i & 255, t[6] = (i = parseInt(e.slice(14, 18), 16)) >>> 8, t[7] = i & 255, t[8] = (i = parseInt(e.slice(19, 23), 16)) >>> 8, t[9] = i & 255, t[10] = (i = parseInt(e.slice(24, 36), 16)) / 1099511627776 & 255, t[11] = i / 4294967296 & 255, t[12] = i >>> 24 & 255, t[13] = i >>> 16 & 255, t[14] = i >>> 8 & 255, t[15] = i & 255, t;
119
+ }
120
+ function P(e) {
121
+ e = unescape(encodeURIComponent(e));
122
+ const i = [];
123
+ for (let t = 0; t < e.length; ++t)
124
+ i.push(e.charCodeAt(t));
125
+ return i;
126
+ }
127
+ const C = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", F = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
128
+ function k(e, i, t) {
129
+ function n(o, f, r, s) {
130
+ var a;
131
+ if (typeof o == "string" && (o = P(o)), typeof f == "string" && (f = T(f)), ((a = f) === null || a === void 0 ? void 0 : a.length) !== 16)
132
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
133
+ let h = new Uint8Array(16 + o.length);
134
+ if (h.set(f), h.set(o, f.length), h = t(h), h[6] = h[6] & 15 | i, h[8] = h[8] & 63 | 128, r) {
135
+ s = s || 0;
136
+ for (let x = 0; x < 16; ++x)
137
+ r[s + x] = h[x];
138
+ return r;
139
+ }
140
+ return J(h);
141
+ }
142
+ try {
143
+ n.name = e;
144
+ } catch {
145
+ }
146
+ return n.DNS = C, n.URL = F, n;
147
+ }
148
+ function Y(e, i, t, n) {
149
+ switch (e) {
150
+ case 0:
151
+ return i & t ^ ~i & n;
152
+ case 1:
153
+ return i ^ t ^ n;
154
+ case 2:
155
+ return i & t ^ i & n ^ t & n;
156
+ case 3:
157
+ return i ^ t ^ n;
158
+ }
159
+ }
160
+ function E(e, i) {
161
+ return e << i | e >>> 32 - i;
162
+ }
163
+ function G(e) {
164
+ const i = [1518500249, 1859775393, 2400959708, 3395469782], t = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
165
+ if (typeof e == "string") {
166
+ const r = unescape(encodeURIComponent(e));
167
+ e = [];
168
+ for (let s = 0; s < r.length; ++s)
169
+ e.push(r.charCodeAt(s));
170
+ } else
171
+ Array.isArray(e) || (e = Array.prototype.slice.call(e));
172
+ e.push(128);
173
+ const n = e.length / 4 + 2, o = Math.ceil(n / 16), f = new Array(o);
174
+ for (let r = 0; r < o; ++r) {
175
+ const s = new Uint32Array(16);
176
+ for (let a = 0; a < 16; ++a)
177
+ s[a] = e[r * 64 + a * 4] << 24 | e[r * 64 + a * 4 + 1] << 16 | e[r * 64 + a * 4 + 2] << 8 | e[r * 64 + a * 4 + 3];
178
+ f[r] = s;
179
+ }
180
+ f[o - 1][14] = (e.length - 1) * 8 / Math.pow(2, 32), f[o - 1][14] = Math.floor(f[o - 1][14]), f[o - 1][15] = (e.length - 1) * 8 & 4294967295;
181
+ for (let r = 0; r < o; ++r) {
182
+ const s = new Uint32Array(80);
183
+ for (let c = 0; c < 16; ++c)
184
+ s[c] = f[r][c];
185
+ for (let c = 16; c < 80; ++c)
186
+ s[c] = E(s[c - 3] ^ s[c - 8] ^ s[c - 14] ^ s[c - 16], 1);
187
+ let a = t[0], h = t[1], x = t[2], p = t[3], S = t[4];
188
+ for (let c = 0; c < 80; ++c) {
189
+ const b = Math.floor(c / 20), $ = E(a, 5) + Y(b, h, x, p) + S + i[b] + s[c] >>> 0;
190
+ S = p, p = x, x = E(h, 30) >>> 0, h = a, a = $;
191
+ }
192
+ t[0] = t[0] + a >>> 0, t[1] = t[1] + h >>> 0, t[2] = t[2] + x >>> 0, t[3] = t[3] + p >>> 0, t[4] = t[4] + S >>> 0;
193
+ }
194
+ return [t[0] >> 24 & 255, t[0] >> 16 & 255, t[0] >> 8 & 255, t[0] & 255, t[1] >> 24 & 255, t[1] >> 16 & 255, t[1] >> 8 & 255, t[1] & 255, t[2] >> 24 & 255, t[2] >> 16 & 255, t[2] >> 8 & 255, t[2] & 255, t[3] >> 24 & 255, t[3] >> 16 & 255, t[3] >> 8 & 255, t[3] & 255, t[4] >> 24 & 255, t[4] >> 16 & 255, t[4] >> 8 & 255, t[4] & 255];
195
+ }
196
+ const K = k("v5", 80, G), B = K;
197
+ class st extends M {
198
+ constructor(t, n = "POST", o = {}) {
103
199
  super();
104
- h(this, "apiUrl");
105
- h(this, "method");
106
- h(this, "headers");
107
- h(this, "isLoadingEnabled", !0);
108
- this.apiUrl = t, this.method = i, this.headers = {
200
+ g(this, "apiUrl");
201
+ g(this, "method");
202
+ g(this, "headers");
203
+ g(this, "isLoadingEnabled", !0);
204
+ this.apiUrl = t, this.method = n, this.headers = {
109
205
  "Content-Type": "application/json",
110
- ...s
206
+ ...o
111
207
  };
112
208
  }
113
209
  setIsLoadingEnabled(t) {
114
210
  this.isLoadingEnabled = t;
115
211
  }
116
212
  errorHandler(t) {
117
- return t.code && (g.getInstance().setSubject(t), m.getInstance().setSubject(!1)), !t.code;
213
+ return t.code && (A.getInstance().setSubject(t), m.getInstance().setSubject(!1)), !t.code;
118
214
  }
119
215
  fetchData(t = {}) {
120
- const i = (/* @__PURE__ */ new Date()).toISOString(), s = p(i, p.URL), r = this.encode({ ...t }, s);
216
+ const n = (/* @__PURE__ */ new Date()).toISOString(), o = B(n, B.URL), f = this.encode({ ...t }, o);
121
217
  m.getInstance().setSubject(this.isLoadingEnabled);
122
- const u = new URLSearchParams(window.location.search).get("flow") || "N/A";
123
- return f(this.apiUrl, {
218
+ const s = new URLSearchParams(window.location.search).get("flow") || "N/A";
219
+ return R(this.apiUrl, {
124
220
  method: this.method,
125
- headers: { ...this.headers, flow: u },
126
- body: r,
127
- selector: (o) => o.json()
221
+ headers: { ...this.headers, flow: s },
222
+ body: f,
223
+ selector: (a) => a.json()
128
224
  }).pipe(
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))
225
+ u((a) => d(this.decode(a))),
226
+ u((a) => (this.logDebug(
227
+ `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(t)} <BODY> ${f} <RESPONSE>: ${JSON.stringify(a)}`
228
+ ), d(a))),
229
+ D(this.errorHandler),
230
+ u((a) => (m.getInstance().setSubject(!1), d(a))),
231
+ y((a) => (m.getInstance().setSubject(!1), A.getInstance().setSubject(
232
+ new U().get(a, o)
233
+ ), O))
138
234
  );
139
235
  }
140
236
  }
141
237
  export {
142
- I as ApiMiddleware,
143
- l as ErrorCatalog,
144
- L as FetchServiceBE,
145
- v as FetchServiceFE,
238
+ rt as ApiMiddleware,
239
+ U as ErrorCatalog,
240
+ ot as FetchServiceBE,
241
+ st as FetchServiceFE,
146
242
  m as LoadingHandler,
147
- g as MessageHandler,
148
- Y as RxSubjectManager,
149
- T as ServiceToken
243
+ A as MessageHandler,
244
+ ht as RxSubjectManager,
245
+ ct as ServiceToken
150
246
  };