mp-front-cli 0.0.102 → 0.0.103

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 +1 @@
1
- {"version":3,"file":"custom-adapter.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,OAAO,EAIR,MAAM,oBAAoB,CAAA;AAW3B,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,cAAc,EAAE,qBAU5B,CAAA;AAgBD,wBAAgB,cAAc,CAC5B,OAAO,GAAE,qBAAgE,GACxE,OAAO,CAmRT"}
1
+ {"version":3,"file":"custom-adapter.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,OAAO,EAIR,MAAM,oBAAoB,CAAA;AAW3B,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,cAAc,EAAE,qBAU5B,CAAA;AAgBD,wBAAgB,cAAc,CAC5B,OAAO,GAAE,qBAAgE,GACxE,OAAO,CAsRT"}
@@ -0,0 +1,11 @@
1
+ import s from "ioredis";
2
+ const o = process.env.REDIS_HOST, S = process.env.REDIS_PORT, e = process.env.REDIS_USER, R = process.env.REDIS_PASS, t = new s({
3
+ host: o,
4
+ port: S,
5
+ username: e,
6
+ password: R,
7
+ tls: {}
8
+ });
9
+ export {
10
+ t as C
11
+ };
@@ -1,67 +1,31 @@
1
- var W = Object.defineProperty;
2
- var Y = (a, s, r) => s in a ? W(a, s, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[s] = r;
3
- var A = (a, s, r) => (Y(a, typeof s != "symbol" ? s + "" : s, r), r);
4
- import { C as R, a as ee } from "./custom-cache-8c806250.js";
5
- import { CustomEncrypter as te } from "./mp-front-cli-encrypter.es.js";
6
- import { u as ne, a as se } from "./v5-cbd101aa.js";
1
+ import { C as Z } from "./custom-redis-bee66564.js";
2
+ import { u as $ } from "./stringify-788d71a0.js";
7
3
  import "ioredis";
8
- import "node-jose";
9
- import "crypto";
10
- import "./mp-front-cli-encoder.es.js";
11
- import "./mp-front-cli-logger.es.js";
12
- let K;
13
- const re = new Uint8Array(16);
14
- function ie() {
15
- if (!K && (K = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !K))
4
+ let x;
5
+ const v = new Uint8Array(16);
6
+ function C() {
7
+ if (!x && (x = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !x))
16
8
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
17
- return K(re);
9
+ return x(v);
18
10
  }
19
- const ae = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), B = {
20
- randomUUID: ae
11
+ const G = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), A = {
12
+ randomUUID: G
21
13
  };
22
- function oe(a, s, r) {
23
- if (B.randomUUID && !s && !a)
24
- return B.randomUUID();
25
- a = a || {};
26
- const i = a.random || (a.rng || ie)();
14
+ function H(c, s, r) {
15
+ if (A.randomUUID && !s && !c)
16
+ return A.randomUUID();
17
+ c = c || {};
18
+ const i = c.random || (c.rng || C)();
27
19
  if (i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, s) {
28
20
  r = r || 0;
29
- for (let y = 0; y < 16; ++y)
30
- s[r + y] = i[y];
21
+ for (let u = 0; u < 16; ++u)
22
+ s[r + u] = i[u];
31
23
  return s;
32
24
  }
33
- return ne(i);
25
+ return $(i);
34
26
  }
35
- const ce = process.env.TIMEOUT_SESSION_MINUTES, ue = "619abad7-0dea-46c5-aa49-fc1ec872a684", de = "PF:TERMINAL:", O = "TERMINAL";
36
- class ye extends te {
37
- constructor() {
38
- super(...arguments);
39
- A(this, "redisCacheHandler", new R());
40
- A(this, "getIdApi", (r) => {
41
- const i = se(r, ue);
42
- return `${de}${i}`;
43
- });
44
- }
45
- async saveTerminalData(r, i) {
46
- return this.redisCacheHandler.setRedisState({
47
- idApi: this.getIdApi(r),
48
- idData: O,
49
- body: i,
50
- expire: ce
51
- });
52
- }
53
- async getTerminalData(r) {
54
- return this.redisCacheHandler.getRedisState(this.getIdApi(r), O).then(({ data: i }) => (this.logDebug("getTerminal", JSON.stringify(i)), i)).catch((i) => (this.logError("Error getTerminal", JSON.stringify(i)), null));
55
- }
56
- async deleteTerminalData(r) {
57
- return this.redisCacheHandler.deleteRedisState(
58
- this.getIdApi(r),
59
- O
60
- );
61
- }
62
- }
63
- const d = process.env.PREFIX_LOGIN, b = process.env.TIMEOUT_SESSION_MINUTES, c = new R(), le = {
64
- baseKeyPrefix: `${d}:`,
27
+ const L = process.env.PREFIX_LOGIN, B = process.env.TIMEOUT_SESSION_MINUTES, q = {
28
+ baseKeyPrefix: `${L}:`,
65
29
  userKeyPrefix: "user:",
66
30
  accountKeyPrefix: "account:",
67
31
  accountByUserIdPrefix: "account:user:",
@@ -69,153 +33,145 @@ const d = process.env.PREFIX_LOGIN, b = process.env.TIMEOUT_SESSION_MINUTES, c =
69
33
  sessionByUserIdPrefix: "session:user:",
70
34
  userByEmailKeyPrefix: "user:email:",
71
35
  verificationKeyPrefix: "verification:",
72
- expire: b * 60
73
- }, fe = (a) => {
74
- for (const s in a)
36
+ expire: B * 60
37
+ }, z = (c) => {
38
+ for (const s in c)
75
39
  return !1;
76
40
  return !0;
77
- }, we = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/, me = (a) => a && we.test(a) && !Number.isNaN(Date.parse(a));
78
- function he(a = { expire: b * 60 }) {
79
- const s = ee, r = {
80
- ...le,
81
- ...a
82
- }, i = r.baseKeyPrefix || "", y = i + r.userKeyPrefix, k = i + r.userByEmailKeyPrefix, C = i + r.accountKeyPrefix, M = i + r.accountByUserIdPrefix, V = i + r.sessionKeyPrefix, _ = i + r.sessionByUserIdPrefix, j = i + r.verificationKeyPrefix, U = (e) => k + e, x = (e) => y + e, S = (e) => C + e, I = (e) => M + e, w = (e, t) => `${t}:${e}`, E = (e) => V + e, g = (e) => _ + e, P = (e) => j + e, p = async (e, t) => {
83
- const n = Object.entries(t).reduce((o, [f, u]) => (o[f] = u instanceof Date ? u.toISOString() : u, o), {});
41
+ }, J = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/, Q = (c) => c && J.test(c) && !Number.isNaN(Date.parse(c));
42
+ function te(c = { expire: B * 60 }) {
43
+ const s = Z, r = {
44
+ ...q,
45
+ ...c
46
+ }, i = r.baseKeyPrefix || "", u = i + r.userKeyPrefix, b = i + r.userByEmailKeyPrefix, k = i + r.accountKeyPrefix, T = i + r.accountByUserIdPrefix, D = i + r.sessionKeyPrefix, V = i + r.sessionByUserIdPrefix, j = i + r.verificationKeyPrefix, U = (e) => b + e, p = (e) => u + e, K = (e) => k + e, f = (e) => T + e, m = (e, t) => `${t}:${e}`, I = (e) => D + e, l = (e) => V + e, g = (e) => j + e, w = async (e, t) => {
47
+ const n = Object.entries(t).reduce((o, [S, a]) => (o[S] = a instanceof Date ? a.toISOString() : a, o), {});
84
48
  await s.hset(e, n), await s.expire(e, r.expire);
85
- }, m = async (e) => {
49
+ }, y = async (e) => {
86
50
  const t = await s.hgetall(e);
87
- return !t || fe(t) ? null : Object.entries(t).reduce((o, [f, u]) => (o[f] = me(u) ? new Date(u) : u, o), {});
88
- }, D = async (e, t) => (await p(x(e), t), t.email && await s.set(
51
+ return !t || z(t) ? null : Object.entries(t).reduce((o, [S, a]) => (o[S] = Q(a) ? new Date(a) : a, o), {});
52
+ }, E = async (e, t) => (await w(p(e), t), t.email && await s.set(
89
53
  U(t.email),
90
54
  e,
91
55
  "EX",
92
56
  r.expire
93
- ), t), l = async (e) => {
94
- const t = await m(x(e));
57
+ ), t), d = async (e) => {
58
+ const t = await y(p(e));
95
59
  return t ? { ...t } : null;
96
- }, H = async (e, t) => {
97
- const n = S(e);
98
- await p(n, t), await s.set(
99
- I(t.userId),
60
+ }, N = async (e, t) => {
61
+ const n = K(e);
62
+ await w(n, t), await s.set(
63
+ f(t.userId),
100
64
  n,
101
65
  "EX",
102
66
  r.expire
103
67
  );
104
- }, T = async (e) => {
105
- const t = await m(S(e));
68
+ }, R = async (e) => {
69
+ const t = await y(K(e));
106
70
  return t ? { ...t } : null;
107
- }, G = async (e) => {
108
- const t = S(e), n = await m(t);
71
+ }, h = async (e) => {
72
+ const t = K(e), n = await y(t);
109
73
  if (!n)
110
74
  return null;
111
- await s.hdel(t), await s.del(I(n.userId));
112
- }, N = async (e, t) => {
113
- const n = E(e);
114
- return await p(n, t), await s.set(
115
- g(t.userId),
75
+ await s.hdel(t), await s.del(f(n.userId));
76
+ }, O = async (e, t) => {
77
+ const n = I(e);
78
+ return await w(n, t), await s.set(
79
+ l(t.userId),
116
80
  n,
117
81
  "EX",
118
82
  r.expire
119
83
  ), t;
120
- }, h = async (e) => {
121
- const t = await m(E(e));
84
+ }, P = async (e) => {
85
+ const t = await y(I(e));
122
86
  return t ? {
123
87
  id: t.id,
124
88
  ...t
125
89
  } : null;
126
- }, X = async (e) => {
127
- const t = await h(e);
90
+ }, _ = async (e) => {
91
+ const t = await P(e);
128
92
  if (!t)
129
93
  return null;
130
- const n = E(e);
131
- await s.del(n), await s.del(g(t.userId));
132
- }, F = async (e, t) => {
133
- const n = P(e);
134
- return await p(n, t), t;
135
- }, L = async (e) => {
136
- const t = P(e), n = await m(t);
94
+ const n = I(e);
95
+ await s.del(n), await s.del(l(t.userId));
96
+ }, X = async (e, t) => {
97
+ const n = g(e);
98
+ return await w(n, t), t;
99
+ }, M = async (e) => {
100
+ const t = g(e), n = await y(t);
137
101
  return n ? { identifier: n.identifier, ...n } : null;
138
- }, Z = async (e) => {
139
- const t = P(e);
102
+ }, F = async (e) => {
103
+ const t = g(e);
140
104
  await s.del(t);
141
- }, v = async (e, t) => {
142
- const n = await T(w(e, t)), o = await c.simpleGet(
143
- `${d}:account:user:${n == null ? void 0 : n.userId}`
144
- ) ?? "", f = `${d}:user:${n == null ? void 0 : n.userId}`, u = await c.simpleHGet(f, "email") ?? "", $ = await c.simpleHGet(o, "cveUsuario") ?? "", J = `${d}:account:user:${n == null ? void 0 : n.userId}`, z = `${d}:session:user:${n == null ? void 0 : n.userId}`, q = await c.simpleGet(
145
- `${d}:session:user:${n == null ? void 0 : n.userId}`
146
- ) ?? "", Q = `${d}:user:email:${u}`;
147
- await c.deleteKey(o), await c.deleteKey(J), await c.deleteKey(z), await c.deleteKey(q), await c.deleteKey(Q), await c.deleteKey(f), await c.deleteKey($), await new ye().deleteTerminalData($);
148
105
  };
149
106
  return {
150
107
  async createUser(e) {
151
- const t = oe();
152
- return await D(t, { ...e, id: t });
108
+ const t = H();
109
+ return await E(t, { ...e, id: t });
153
110
  },
154
- getUser: l,
111
+ getUser: d,
155
112
  async getUserByEmail(e) {
156
113
  const t = await s.get(U(e));
157
- return t ? await l(t) : null;
114
+ return t ? await d(t) : null;
158
115
  },
159
116
  async getUserByAccount({ providerAccountId: e, provider: t }) {
160
- const n = await T(
161
- w(e, t)
117
+ const n = await R(
118
+ m(e, t)
162
119
  );
163
- console.log("🚀 ~ getUserByAccount ~ account:", n), n && await v(e, t);
164
- const o = await T(
165
- w(e, t)
166
- );
167
- return console.log("🚀 ~ getUserByAccount ~ account:", o), o ? await l(o.userId) : null;
120
+ return n ? await d(n.userId) : null;
168
121
  },
169
122
  async updateUser(e) {
170
- const t = e.id, n = await l(t);
171
- return await D(t, { ...n, ...e });
123
+ const t = e.id, n = await d(t);
124
+ return await E(t, { ...n, ...e });
172
125
  },
173
126
  async deleteUser(e) {
174
- const t = await l(e);
127
+ const t = await d(e);
175
128
  if (!t)
176
129
  return null;
177
- const n = await s.get(I(e)), o = await s.get(g(e));
130
+ const n = await s.get(f(e)), o = await s.get(l(e));
178
131
  await s.del(
179
132
  U(t.email),
180
- I(e),
181
- g(e)
182
- ), o && await s.del(o), n && await s.del(n), await s.del(x(e));
133
+ f(e),
134
+ l(e)
135
+ ), o && await s.del(o), n && await s.del(n), await s.del(p(e));
183
136
  },
184
137
  async linkAccount(e) {
185
- const t = w(e.providerAccountId, e.provider);
186
- return await H(t, { ...e, id: t });
138
+ const t = m(e.providerAccountId, e.provider);
139
+ return await N(t, { ...e, id: t });
187
140
  },
188
141
  async unlinkAccount({ providerAccountId: e, provider: t }) {
189
- const n = w(e, t);
190
- await G(n);
142
+ const n = m(e, t);
143
+ await h(n);
191
144
  },
192
145
  async createSession(e) {
193
146
  const t = e.sessionToken;
194
- return await N(t, { ...e, id: t });
147
+ return await O(t, {
148
+ ...e,
149
+ id: t
150
+ });
195
151
  },
196
152
  async getSessionAndUser(e) {
197
- const n = await h(e);
153
+ const n = await P(e);
198
154
  if (!n)
199
155
  return null;
200
- const o = await l(n.userId);
156
+ const o = await d(n.userId);
201
157
  return o ? { session: n, user: o } : null;
202
158
  },
203
159
  async updateSession(e) {
204
- const t = e.sessionToken, n = await h(t);
205
- return n ? await N(t, { ...n, ...e }) : null;
160
+ const t = e.sessionToken, n = await P(t);
161
+ return n ? await O(t, { ...n, ...e }) : null;
206
162
  },
207
- deleteSession: X,
163
+ deleteSession: _,
208
164
  async createVerificationToken(e) {
209
165
  const t = e.identifier;
210
- return await F(t, e), e;
166
+ return await X(t, e), e;
211
167
  },
212
168
  async useVerificationToken(e) {
213
- const t = e.identifier, n = await L(t);
214
- return !n || e.token !== n.token ? null : (await Z(t), n);
169
+ const t = e.identifier, n = await M(t);
170
+ return !n || e.token !== n.token ? null : (await F(t), n);
215
171
  }
216
172
  };
217
173
  }
218
174
  export {
219
- he as IORedisAdapter,
220
- le as defaultOptions
175
+ te as IORedisAdapter,
176
+ q as defaultOptions
221
177
  };
@@ -10,7 +10,7 @@ import "node-jose";
10
10
  import "crypto";
11
11
  import "./mp-front-cli-encoder.es.js";
12
12
  import "./mp-front-cli-header.es.js";
13
- import "./v5-cbd101aa.js";
13
+ import "./stringify-788d71a0.js";
14
14
  export {
15
15
  g as ApiMiddleware,
16
16
  l as ErrorCatalog,
@@ -1,11 +1,87 @@
1
- import "./mp-front-cli-encrypter.es.js";
2
- import { C as s, R as C } from "./custom-cache-8c806250.js";
1
+ var p = Object.defineProperty;
2
+ var S = (n, r, t) => r in n ? p(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
3
+ var E = (n, r, t) => (S(n, typeof r != "symbol" ? r + "" : r, t), t);
4
+ import { CustomEncrypter as m } from "./mp-front-cli-encrypter.es.js";
5
+ import { C as R } from "./custom-redis-bee66564.js";
3
6
  import "node-jose";
4
7
  import "crypto";
5
8
  import "./mp-front-cli-encoder.es.js";
6
9
  import "./mp-front-cli-logger.es.js";
7
10
  import "ioredis";
11
+ const a = process.env.TIMEOUT_SESSION_MINUTES;
12
+ var d = /* @__PURE__ */ ((n) => (n.NOT_REFRESH = "NOT_REFRESH", n.REFRESH = "REFRESH", n))(d || {});
13
+ class O extends m {
14
+ constructor() {
15
+ super(...arguments);
16
+ E(this, "initClient", R);
17
+ }
18
+ getRootNode(t) {
19
+ return this.initClient.get(t);
20
+ }
21
+ async getEntryPoint(t) {
22
+ try {
23
+ return await this.getRootNode(t);
24
+ } catch {
25
+ throw new Error("Not found entry point");
26
+ }
27
+ }
28
+ setEntryPoint(t, i, e) {
29
+ const s = typeof i == "string" ? i : JSON.stringify(i);
30
+ this.initClient.set(t, s, "EX", 60 * e);
31
+ }
32
+ async getRedisState(t, i) {
33
+ const e = `${t}:${this.generateSHA(i)}`, s = await this.getEntryPoint(e), c = await this.isEncrypted(s) ? await this.decrypt(s ?? "") : JSON.parse(s), o = Number(c == null ? void 0 : c.expires_in);
34
+ return o > 0 && this.ttl(e, o * 60), { sha: e, data: c };
35
+ }
36
+ async deleteRedisState(t, i) {
37
+ const e = `${t}:${this.generateSHA(i)}`;
38
+ this.initClient.del(e);
39
+ }
40
+ async setRedisState({
41
+ idApi: t,
42
+ idData: i,
43
+ body: e,
44
+ expire: s,
45
+ encrypted: h = !1,
46
+ refresh: c = "REFRESH"
47
+ /* REFRESH */
48
+ }) {
49
+ const o = `${t}:${this.generateSHA(i)}`, l = { expires_in: c === "REFRESH" ? s : 0, ...e };
50
+ if (h) {
51
+ const y = await this.encrypt(l);
52
+ return this.setEntryPoint(o, y, s), o;
53
+ }
54
+ return this.setEntryPoint(o, l, s), o;
55
+ }
56
+ async statusHost() {
57
+ return new Promise((t, i) => {
58
+ this.initClient.on("error", (e) => {
59
+ this.killRedis(), i(e);
60
+ }), this.initClient.on("connect", () => {
61
+ t("success");
62
+ });
63
+ });
64
+ }
65
+ killRedis() {
66
+ this.initClient.disconnect();
67
+ }
68
+ deleteKey(t) {
69
+ this.initClient.del(t);
70
+ }
71
+ ttl(t, i) {
72
+ this.initClient.expire(t, i);
73
+ }
74
+ simpleGet(t) {
75
+ return this.ttl(t, a * 60), this.initClient.get(t);
76
+ }
77
+ simpleHGet(t, i) {
78
+ return this.ttl(t, a * 60), this.initClient.hget(t, i);
79
+ }
80
+ simpleHSet(t, i, e) {
81
+ return this.initClient.hset(t, i, e);
82
+ }
83
+ }
8
84
  export {
9
- s as CustomCache,
10
- C as RefreshState
85
+ O as CustomCache,
86
+ d as RefreshState
11
87
  };
@@ -1,29 +1,29 @@
1
- var c = Object.defineProperty;
2
- var n = (N, s, e) => s in N ? c(N, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : N[s] = e;
3
- var R = (N, s, e) => (n(N, typeof s != "symbol" ? s + "" : s, e), e);
4
- import { LoadingHandler as i, MessageHandler as g } from "./mp-front-cli-utils-rxjs.es.js";
5
- import { RxSubjectManager as z } from "./mp-front-cli-utils-rxjs.es.js";
6
- import { f as C } from "./index-def0b487.js";
7
- import { S as ee } from "./index-def0b487.js";
8
- import d, { t as m } from "i18next";
9
- import { t as P } from "./index-6ac9fcde.js";
10
- import { CustomLogger as B } from "./mp-front-cli-logger.es.js";
11
- import { of as o, switchMap as T, forkJoin as S, catchError as I, EMPTY as U, filter as M } from "rxjs";
12
- import { CustomEncrypter as p } from "./mp-front-cli-encrypter.es.js";
13
- import { CustomHeader as u } from "./mp-front-cli-header.es.js";
14
- import { CustomEncoder as y } from "./mp-front-cli-encoder.es.js";
15
- import { a as D } from "./v5-cbd101aa.js";
1
+ var f = Object.defineProperty;
2
+ var y = (E, t, e) => t in E ? f(E, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : E[t] = e;
3
+ var L = (E, t, e) => (y(E, typeof t != "symbol" ? t + "" : t, e), e);
4
+ import { LoadingHandler as C, MessageHandler as B } from "./mp-front-cli-utils-rxjs.es.js";
5
+ import { RxSubjectManager as Ue } from "./mp-front-cli-utils-rxjs.es.js";
6
+ import { f as n } from "./index-def0b487.js";
7
+ import { S as ge } from "./index-def0b487.js";
8
+ import v, { t as g } from "i18next";
9
+ import { t as Q } from "./index-6ac9fcde.js";
10
+ import { CustomLogger as w } from "./mp-front-cli-logger.es.js";
11
+ import { of as N, switchMap as O, forkJoin as M, catchError as c, EMPTY as d, filter as h } from "rxjs";
12
+ import { CustomEncrypter as V } from "./mp-front-cli-encrypter.es.js";
13
+ import { CustomHeader as F } from "./mp-front-cli-header.es.js";
14
+ import { CustomEncoder as x } from "./mp-front-cli-encoder.es.js";
15
+ import { u as Y } from "./stringify-788d71a0.js";
16
16
  import "node-jose";
17
17
  import "crypto";
18
- const v = {
18
+ const G = {
19
19
  es: {
20
20
  translation: {
21
- ...P
21
+ ...Q
22
22
  }
23
23
  }
24
24
  };
25
- d.init({
26
- resources: v,
25
+ v.init({
26
+ resources: G,
27
27
  lng: "es",
28
28
  // language to use, more information here: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources
29
29
  // you can use the i18n.changeLanguage function to change the language manually: https://www.i18next.com/overview/api#changelanguage
@@ -35,7 +35,7 @@ d.init({
35
35
  },
36
36
  debug: !1
37
37
  });
38
- const Q = {
38
+ const H = {
39
39
  "ENROLLMENT-INVALIDCONFIGURATION-0000": {
40
40
  code: 400,
41
41
  type: "modal",
@@ -260,7 +260,7 @@ const Q = {
260
260
  title: "errors.ENROLLMENT-INVALIDTOKENTRUSTONICSUPPLIER-0031.title",
261
261
  level: "error"
262
262
  }
263
- }, L = {
263
+ }, m = {
264
264
  "MP-001": {
265
265
  code: 400,
266
266
  type: "modal",
@@ -1012,185 +1012,273 @@ const Q = {
1012
1012
  type: "modal",
1013
1013
  level: "warning"
1014
1014
  },
1015
- ...Q
1015
+ ...H
1016
1016
  };
1017
- class O extends B {
1018
- get(s = "default", e = "NOT_FOUND") {
1019
- var E, l;
1020
- if (s instanceof Error)
1021
- return this.logError(s.message), {
1022
- ...L.internalError,
1023
- title: m(L.internalError.title),
1024
- message: m(L.internalError.message),
1017
+ class I extends w {
1018
+ get(t = "default", e = "NOT_FOUND") {
1019
+ var s, A;
1020
+ if (t instanceof Error)
1021
+ return this.logError(t.message), {
1022
+ ...m.internalError,
1023
+ title: g(m.internalError.title),
1024
+ message: g(m.internalError.message),
1025
1025
  uuid: e
1026
1026
  };
1027
- const r = typeof s == "string" ? s : s.code ?? s.errorType;
1027
+ const r = typeof t == "string" ? t : t.code ?? t.errorType;
1028
1028
  this.logDebug("statusCode", r);
1029
- const t = typeof s == "string" ? {} : { ...s };
1029
+ const l = typeof t == "string" ? {} : { ...t };
1030
1030
  return {
1031
- ...L[r] ?? L.default,
1032
- title: m(
1033
- ((E = L[r]) == null ? void 0 : E.title) ?? L.default.title,
1034
- t
1031
+ ...m[r] ?? m.default,
1032
+ title: g(
1033
+ ((s = m[r]) == null ? void 0 : s.title) ?? m.default.title,
1034
+ l
1035
1035
  ),
1036
- message: m(
1037
- ((l = L[r]) == null ? void 0 : l.message) ?? L.default.message,
1038
- t
1036
+ message: g(
1037
+ ((A = m[r]) == null ? void 0 : A.message) ?? m.default.message,
1038
+ l
1039
1039
  ),
1040
1040
  uuid: e
1041
1041
  };
1042
1042
  }
1043
1043
  }
1044
- class b extends p {
1044
+ class Le extends V {
1045
1045
  constructor() {
1046
1046
  super(...arguments);
1047
- R(this, "uuid", "");
1048
- R(this, "session", null);
1047
+ L(this, "uuid", "");
1048
+ L(this, "session", null);
1049
1049
  }
1050
1050
  setSession(e) {
1051
1051
  this.session = e;
1052
1052
  }
1053
1053
  getSession() {
1054
1054
  if (!this.session)
1055
- throw new O().get("SESSION_NOT_FOUND");
1055
+ throw new I().get("SESSION_NOT_FOUND");
1056
1056
  return this.session;
1057
1057
  }
1058
- returnData(e, r, t) {
1059
- const E = this.encode(r, t);
1060
- e.status(200).json(E);
1058
+ returnData(e, r, l) {
1059
+ const s = this.encode(r, l);
1060
+ e.status(200).json(s);
1061
1061
  }
1062
1062
  returnError(e, r) {
1063
- return r != null && r.uuid ? e.status(520).json(r) : e.status(520).json(new O().get(r, this.uuid));
1063
+ return r != null && r.uuid ? e.status(520).json(r) : e.status(520).json(new I().get(r, this.uuid));
1064
1064
  }
1065
1065
  get(e) {
1066
- return this.logDebug("get ApiMiddleware"), (r, t) => {
1067
- var E;
1068
- this.logDebug("return ApiMiddleware"), this.uuid = (E = r == null ? void 0 : r.body) == null ? void 0 : E.uuid, o(r).pipe(
1069
- T(
1070
- (l) => S({
1071
- params: o(this.decode(l.body)),
1072
- headers: o(l.headers)
1066
+ return this.logDebug("get ApiMiddleware"), (r, l) => {
1067
+ var s;
1068
+ this.logDebug("return ApiMiddleware"), this.uuid = (s = r == null ? void 0 : r.body) == null ? void 0 : s.uuid, N(r).pipe(
1069
+ O(
1070
+ (A) => M({
1071
+ params: N(this.decode(A.body)),
1072
+ headers: N(A.headers)
1073
1073
  })
1074
1074
  ),
1075
- T(
1076
- ({ params: l, headers: a }) => S({
1077
- response: e(l, this.uuid, a),
1078
- headers: o(a),
1079
- params: o(l)
1075
+ O(
1076
+ ({ params: A, headers: a }) => M({
1077
+ response: e(A, this.uuid, a),
1078
+ headers: N(a),
1079
+ params: N(A)
1080
1080
  })
1081
1081
  ),
1082
- T(({ params: l, response: a, headers: A }) => (this.logDebug(
1083
- `ApiMiddleware \x1B[37m <URL>: \x1B[33m ${r.url} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(A)} \x1B[37m <UUID> \x1B[33m ${r.body.uuid} \x1B[37m <PARAMS> \x1B[33m ${JSON.stringify(l)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(a)}`
1084
- ), o(a))),
1085
- I((l) => {
1082
+ O(({ params: A, response: a, headers: o }) => (this.logDebug(
1083
+ `ApiMiddleware \x1B[37m <URL>: \x1B[33m ${r.url} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(o)} \x1B[37m <UUID> \x1B[33m ${r.body.uuid} \x1B[37m <PARAMS> \x1B[33m ${JSON.stringify(A)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(a)}`
1084
+ ), N(a))),
1085
+ c((A) => {
1086
1086
  var a;
1087
1087
  return this.logError(
1088
- `ApiMiddleware <URL>: ${r == null ? void 0 : r.url} <HEADERS>: ${JSON.stringify(r == null ? void 0 : r.headers)} <UUID> ${(a = r == null ? void 0 : r.body) == null ? void 0 : a.uuid} <PARAMS> ${JSON.stringify(r == null ? void 0 : r.body)} <ERROR>: ${JSON.stringify(l)}`
1089
- ), this.returnError(t, l), U;
1088
+ `ApiMiddleware <URL>: ${r == null ? void 0 : r.url} <HEADERS>: ${JSON.stringify(r == null ? void 0 : r.headers)} <UUID> ${(a = r == null ? void 0 : r.body) == null ? void 0 : a.uuid} <PARAMS> ${JSON.stringify(r == null ? void 0 : r.body)} <ERROR>: ${JSON.stringify(A)}`
1089
+ ), this.returnError(l, A), d;
1090
1090
  })
1091
1091
  ).subscribe({
1092
- next: (l) => {
1093
- this.logDebug("ApiMiddleware subscribe next", JSON.stringify(l)), this.returnData(t, l, this.uuid);
1092
+ next: (A) => {
1093
+ this.logDebug("ApiMiddleware subscribe next", JSON.stringify(A)), this.returnData(l, A, this.uuid);
1094
1094
  }
1095
1095
  });
1096
1096
  };
1097
1097
  }
1098
1098
  }
1099
- const V = process.env.ID_FRONT ?? "NOT_AVAILABLE";
1100
- class W extends u {
1101
- constructor(e, r, t = {}) {
1102
- super(t);
1103
- R(this, "apiUrl");
1104
- R(this, "method");
1099
+ const _ = process.env.ID_FRONT ?? "NOT_AVAILABLE";
1100
+ class Oe extends F {
1101
+ constructor(e, r, l = {}) {
1102
+ super(l);
1103
+ L(this, "apiUrl");
1104
+ L(this, "method");
1105
1105
  this.apiUrl = e, this.method = r ?? "POST";
1106
1106
  }
1107
1107
  errorHandler(e, r) {
1108
1108
  if (e != null && e.errors)
1109
- throw new O().get(e.errors[0], r);
1109
+ throw new I().get(e.errors[0], r);
1110
1110
  return !(e != null && e.errors);
1111
1111
  }
1112
1112
  formatParams(e) {
1113
1113
  return JSON.stringify({
1114
1114
  data: {
1115
- type: V,
1115
+ type: _,
1116
1116
  attributes: e
1117
1117
  }
1118
1118
  });
1119
1119
  }
1120
1120
  fetchData(e = {}, r) {
1121
1121
  return this.getHeaders().pipe(
1122
- T(
1123
- (t) => C(
1122
+ O(
1123
+ (l) => n(
1124
1124
  this.apiUrl,
1125
1125
  {
1126
1126
  method: "POST",
1127
- headers: t,
1127
+ headers: l,
1128
1128
  body: this.formatParams(e),
1129
- selector: (E) => E.json()
1129
+ selector: (s) => s.json()
1130
1130
  }
1131
1131
  ).pipe(
1132
- I((E) => {
1133
- throw this.logError(JSON.stringify(E)), this.logError(
1132
+ c((s) => {
1133
+ throw this.logError(JSON.stringify(s)), this.logError(
1134
1134
  `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1135
- t
1135
+ l
1136
1136
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1137
1137
  this.formatParams(e)
1138
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(E)} \x1B[33m`
1139
- ), new O().get("default", r);
1138
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(s)} \x1B[33m`
1139
+ ), new I().get("default", r);
1140
1140
  }),
1141
- T((E) => (this.logDebug(
1141
+ O((s) => (this.logDebug(
1142
1142
  `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1143
- t
1143
+ l
1144
1144
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1145
1145
  this.formatParams(e)
1146
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(E)} \x1B[33m`
1147
- ), o(E)))
1146
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(s)} \x1B[33m`
1147
+ ), N(s)))
1148
1148
  )
1149
1149
  ),
1150
- M((t) => this.errorHandler(t, r))
1150
+ h((l) => this.errorHandler(l, r))
1151
1151
  );
1152
1152
  }
1153
1153
  fetchCustomData(e = {}, r) {
1154
1154
  return this.getHeaders().pipe(
1155
- T(
1156
- (t) => C(this.apiUrl, {
1155
+ O(
1156
+ (l) => n(this.apiUrl, {
1157
1157
  method: this.method,
1158
- headers: t,
1158
+ headers: l,
1159
1159
  body: this.method === "GET" ? null : JSON.stringify(e),
1160
- selector: (E) => E.json()
1160
+ selector: (s) => s.json()
1161
1161
  }).pipe(
1162
- I((E) => {
1163
- throw this.logError(JSON.stringify(E)), this.logError(
1162
+ c((s) => {
1163
+ throw this.logError(JSON.stringify(s)), this.logError(
1164
1164
  `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1165
- t
1165
+ l
1166
1166
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1167
1167
  this.formatParams(e)
1168
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(E)} \x1B[33m`
1169
- ), new O().get("default", r);
1168
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(s)} \x1B[33m`
1169
+ ), new I().get("default", r);
1170
1170
  }),
1171
- T((E) => (this.logDebug(
1171
+ O((s) => (this.logDebug(
1172
1172
  `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m \x1B[37m <METHOD>: \x1B[33m ${this.method} <UUID>: \x1B[33m ${r} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
1173
- t
1173
+ l
1174
1174
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
1175
1175
  e
1176
- )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(E)} \x1B[33m`
1177
- ), o(E)))
1176
+ )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(s)} \x1B[33m`
1177
+ ), N(s)))
1178
1178
  )
1179
1179
  )
1180
1180
  );
1181
1181
  }
1182
1182
  }
1183
- class j extends y {
1184
- constructor(e, r = "POST", t = {}) {
1183
+ const J = /^(?:[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;
1184
+ function K(E) {
1185
+ return typeof E == "string" && J.test(E);
1186
+ }
1187
+ function $(E) {
1188
+ if (!K(E))
1189
+ throw TypeError("Invalid UUID");
1190
+ let t;
1191
+ const e = new Uint8Array(16);
1192
+ return e[0] = (t = parseInt(E.slice(0, 8), 16)) >>> 24, e[1] = t >>> 16 & 255, e[2] = t >>> 8 & 255, e[3] = t & 255, e[4] = (t = parseInt(E.slice(9, 13), 16)) >>> 8, e[5] = t & 255, e[6] = (t = parseInt(E.slice(14, 18), 16)) >>> 8, e[7] = t & 255, e[8] = (t = parseInt(E.slice(19, 23), 16)) >>> 8, e[9] = t & 255, e[10] = (t = parseInt(E.slice(24, 36), 16)) / 1099511627776 & 255, e[11] = t / 4294967296 & 255, e[12] = t >>> 24 & 255, e[13] = t >>> 16 & 255, e[14] = t >>> 8 & 255, e[15] = t & 255, e;
1193
+ }
1194
+ function X(E) {
1195
+ E = unescape(encodeURIComponent(E));
1196
+ const t = [];
1197
+ for (let e = 0; e < E.length; ++e)
1198
+ t.push(E.charCodeAt(e));
1199
+ return t;
1200
+ }
1201
+ const b = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", W = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
1202
+ function j(E, t, e) {
1203
+ function r(l, s, A, a) {
1204
+ var o;
1205
+ if (typeof l == "string" && (l = X(l)), typeof s == "string" && (s = $(s)), ((o = s) === null || o === void 0 ? void 0 : o.length) !== 16)
1206
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
1207
+ let T = new Uint8Array(16 + l.length);
1208
+ if (T.set(s), T.set(l, s.length), T = e(T), T[6] = T[6] & 15 | t, T[8] = T[8] & 63 | 128, A) {
1209
+ a = a || 0;
1210
+ for (let i = 0; i < 16; ++i)
1211
+ A[a + i] = T[i];
1212
+ return A;
1213
+ }
1214
+ return Y(T);
1215
+ }
1216
+ try {
1217
+ r.name = E;
1218
+ } catch {
1219
+ }
1220
+ return r.DNS = b, r.URL = W, r;
1221
+ }
1222
+ function Z(E, t, e, r) {
1223
+ switch (E) {
1224
+ case 0:
1225
+ return t & e ^ ~t & r;
1226
+ case 1:
1227
+ return t ^ e ^ r;
1228
+ case 2:
1229
+ return t & e ^ t & r ^ e & r;
1230
+ case 3:
1231
+ return t ^ e ^ r;
1232
+ }
1233
+ }
1234
+ function D(E, t) {
1235
+ return E << t | E >>> 32 - t;
1236
+ }
1237
+ function k(E) {
1238
+ const t = [1518500249, 1859775393, 2400959708, 3395469782], e = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
1239
+ if (typeof E == "string") {
1240
+ const A = unescape(encodeURIComponent(E));
1241
+ E = [];
1242
+ for (let a = 0; a < A.length; ++a)
1243
+ E.push(A.charCodeAt(a));
1244
+ } else
1245
+ Array.isArray(E) || (E = Array.prototype.slice.call(E));
1246
+ E.push(128);
1247
+ const r = E.length / 4 + 2, l = Math.ceil(r / 16), s = new Array(l);
1248
+ for (let A = 0; A < l; ++A) {
1249
+ const a = new Uint32Array(16);
1250
+ for (let o = 0; o < 16; ++o)
1251
+ a[o] = E[A * 64 + o * 4] << 24 | E[A * 64 + o * 4 + 1] << 16 | E[A * 64 + o * 4 + 2] << 8 | E[A * 64 + o * 4 + 3];
1252
+ s[A] = a;
1253
+ }
1254
+ s[l - 1][14] = (E.length - 1) * 8 / Math.pow(2, 32), s[l - 1][14] = Math.floor(s[l - 1][14]), s[l - 1][15] = (E.length - 1) * 8 & 4294967295;
1255
+ for (let A = 0; A < l; ++A) {
1256
+ const a = new Uint32Array(80);
1257
+ for (let R = 0; R < 16; ++R)
1258
+ a[R] = s[A][R];
1259
+ for (let R = 16; R < 80; ++R)
1260
+ a[R] = D(a[R - 3] ^ a[R - 8] ^ a[R - 14] ^ a[R - 16], 1);
1261
+ let o = e[0], T = e[1], i = e[2], U = e[3], S = e[4];
1262
+ for (let R = 0; R < 80; ++R) {
1263
+ const P = Math.floor(R / 20), u = D(o, 5) + Z(P, T, i, U) + S + t[P] + a[R] >>> 0;
1264
+ S = U, U = i, i = D(T, 30) >>> 0, T = o, o = u;
1265
+ }
1266
+ e[0] = e[0] + o >>> 0, e[1] = e[1] + T >>> 0, e[2] = e[2] + i >>> 0, e[3] = e[3] + U >>> 0, e[4] = e[4] + S >>> 0;
1267
+ }
1268
+ return [e[0] >> 24 & 255, e[0] >> 16 & 255, e[0] >> 8 & 255, e[0] & 255, e[1] >> 24 & 255, e[1] >> 16 & 255, e[1] >> 8 & 255, e[1] & 255, e[2] >> 24 & 255, e[2] >> 16 & 255, e[2] >> 8 & 255, e[2] & 255, e[3] >> 24 & 255, e[3] >> 16 & 255, e[3] >> 8 & 255, e[3] & 255, e[4] >> 24 & 255, e[4] >> 16 & 255, e[4] >> 8 & 255, e[4] & 255];
1269
+ }
1270
+ const z = j("v5", 80, k), p = z;
1271
+ class ie extends x {
1272
+ constructor(e, r = "POST", l = {}) {
1185
1273
  super();
1186
- R(this, "apiUrl");
1187
- R(this, "method");
1188
- R(this, "headers");
1189
- R(this, "isLoadingEnabled", !0);
1190
- R(this, "errorResponse");
1274
+ L(this, "apiUrl");
1275
+ L(this, "method");
1276
+ L(this, "headers");
1277
+ L(this, "isLoadingEnabled", !0);
1278
+ L(this, "errorResponse");
1191
1279
  this.apiUrl = e, this.method = r, this.headers = {
1192
1280
  "Content-Type": "application/json",
1193
- ...t
1281
+ ...l
1194
1282
  };
1195
1283
  }
1196
1284
  setIsLoadingEnabled(e) {
@@ -1200,37 +1288,37 @@ class j extends y {
1200
1288
  this.errorResponse = e;
1201
1289
  }
1202
1290
  fetchData(e = {}) {
1203
- const r = (/* @__PURE__ */ new Date()).toISOString(), t = D(r, D.URL), E = this.encode({ ...e }, t);
1204
- i.getInstance().setSubject(this.isLoadingEnabled);
1291
+ const r = (/* @__PURE__ */ new Date()).toISOString(), l = p(r, p.URL), s = this.encode({ ...e }, l);
1292
+ C.getInstance().setSubject(this.isLoadingEnabled);
1205
1293
  const a = new URLSearchParams(window.location.search).get("flow") ?? "N/A";
1206
- return C(this.apiUrl, {
1294
+ return n(this.apiUrl, {
1207
1295
  method: this.method,
1208
1296
  headers: { ...this.headers, flow: a },
1209
- body: E,
1210
- selector: (A) => A.json()
1297
+ body: s,
1298
+ selector: (o) => o.json()
1211
1299
  }).pipe(
1212
- T((A) => o(this.decode(A))),
1213
- T((A) => A.code && (A.type === "modal" || A.type === "message") ? (this.logError(
1214
- `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${E} <RESPONSE>: ${JSON.stringify(A)}`
1215
- ), i.getInstance().setSubject(!1), g.getInstance().setSubject(A), this.errorResponse ? o(this.errorResponse) : U) : o(A)),
1216
- T((A) => (i.getInstance().setSubject(!1), this.logDebug(
1217
- `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${E} <RESPONSE>: ${JSON.stringify(A)}`
1218
- ), o(A))),
1219
- I((A) => (this.logError(
1220
- `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${E} <RESPONSE>: ${JSON.stringify(A)}`
1221
- ), i.getInstance().setSubject(!1), g.getInstance().setSubject(
1222
- new O().get(A, t)
1223
- ), this.errorResponse ? o(this.errorResponse) : U))
1300
+ O((o) => N(this.decode(o))),
1301
+ O((o) => o.code && (o.type === "modal" || o.type === "message") ? (this.logError(
1302
+ `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${s} <RESPONSE>: ${JSON.stringify(o)}`
1303
+ ), C.getInstance().setSubject(!1), B.getInstance().setSubject(o), this.errorResponse ? N(this.errorResponse) : d) : N(o)),
1304
+ O((o) => (C.getInstance().setSubject(!1), this.logDebug(
1305
+ `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${s} <RESPONSE>: ${JSON.stringify(o)}`
1306
+ ), N(o))),
1307
+ c((o) => (this.logError(
1308
+ `FetchServiceFE <URL>: ${this.apiUrl} <HEADERS>: ${JSON.stringify(this.headers)} <PARAMS> ${JSON.stringify(e)} <BODY> ${s} <RESPONSE>: ${JSON.stringify(o)}`
1309
+ ), C.getInstance().setSubject(!1), B.getInstance().setSubject(
1310
+ new I().get(o, l)
1311
+ ), this.errorResponse ? N(this.errorResponse) : d))
1224
1312
  );
1225
1313
  }
1226
1314
  }
1227
1315
  export {
1228
- b as ApiMiddleware,
1229
- O as ErrorCatalog,
1230
- W as FetchServiceBE,
1231
- j as FetchServiceFE,
1232
- i as LoadingHandler,
1233
- g as MessageHandler,
1234
- z as RxSubjectManager,
1235
- ee as ServiceToken
1316
+ Le as ApiMiddleware,
1317
+ I as ErrorCatalog,
1318
+ Oe as FetchServiceBE,
1319
+ ie as FetchServiceFE,
1320
+ C as LoadingHandler,
1321
+ B as MessageHandler,
1322
+ Ue as RxSubjectManager,
1323
+ ge as ServiceToken
1236
1324
  };
@@ -0,0 +1,9 @@
1
+ const i = [];
2
+ for (let n = 0; n < 256; ++n)
3
+ i.push((n + 256).toString(16).slice(1));
4
+ function c(n, u = 0) {
5
+ return i[n[u + 0]] + i[n[u + 1]] + i[n[u + 2]] + i[n[u + 3]] + "-" + i[n[u + 4]] + i[n[u + 5]] + "-" + i[n[u + 6]] + i[n[u + 7]] + "-" + i[n[u + 8]] + i[n[u + 9]] + "-" + i[n[u + 10]] + i[n[u + 11]] + i[n[u + 12]] + i[n[u + 13]] + i[n[u + 14]] + i[n[u + 15]];
6
+ }
7
+ export {
8
+ c as u
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-front-cli",
3
- "version": "0.0.102",
3
+ "version": "0.0.103",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,89 +0,0 @@
1
- var a = Object.defineProperty;
2
- var p = (n, r, t) => r in n ? a(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
3
- var h = (n, r, t) => (p(n, typeof r != "symbol" ? r + "" : r, t), t);
4
- import { CustomEncrypter as y } from "./mp-front-cli-encrypter.es.js";
5
- import d from "ioredis";
6
- const u = process.env.REDIS_HOST, C = process.env.REDIS_PORT, m = process.env.REDIS_USER, _ = process.env.REDIS_PASS, H = new d({
7
- host: u,
8
- port: C,
9
- username: m,
10
- password: _,
11
- tls: {}
12
- }), R = process.env.TIMEOUT_SESSION_MINUTES;
13
- var T = /* @__PURE__ */ ((n) => (n.NOT_REFRESH = "NOT_REFRESH", n.REFRESH = "REFRESH", n))(T || {});
14
- class O extends y {
15
- constructor() {
16
- super(...arguments);
17
- h(this, "initClient", H);
18
- }
19
- getRootNode(t) {
20
- return this.initClient.get(t);
21
- }
22
- async getEntryPoint(t) {
23
- try {
24
- return await this.getRootNode(t);
25
- } catch {
26
- throw new Error("Not found entry point");
27
- }
28
- }
29
- setEntryPoint(t, e, s) {
30
- const i = typeof e == "string" ? e : JSON.stringify(e);
31
- this.initClient.set(t, i, "EX", 60 * s);
32
- }
33
- async getRedisState(t, e) {
34
- const s = `${t}:${this.generateSHA(e)}`, i = await this.getEntryPoint(s), c = await this.isEncrypted(i) ? await this.decrypt(i ?? "") : JSON.parse(i), o = Number(c == null ? void 0 : c.expires_in);
35
- return o > 0 && this.ttl(s, o * 60), { sha: s, data: c };
36
- }
37
- async deleteRedisState(t, e) {
38
- const s = `${t}:${this.generateSHA(e)}`;
39
- this.initClient.del(s);
40
- }
41
- async setRedisState({
42
- idApi: t,
43
- idData: e,
44
- body: s,
45
- expire: i,
46
- encrypted: E = !1,
47
- refresh: c = "REFRESH"
48
- /* REFRESH */
49
- }) {
50
- const o = `${t}:${this.generateSHA(e)}`, S = { expires_in: c === "REFRESH" ? i : 0, ...s };
51
- if (E) {
52
- const l = await this.encrypt(S);
53
- return this.setEntryPoint(o, l, i), o;
54
- }
55
- return this.setEntryPoint(o, S, i), o;
56
- }
57
- async statusHost() {
58
- return new Promise((t, e) => {
59
- this.initClient.on("error", (s) => {
60
- this.killRedis(), e(s);
61
- }), this.initClient.on("connect", () => {
62
- t("success");
63
- });
64
- });
65
- }
66
- killRedis() {
67
- this.initClient.disconnect();
68
- }
69
- deleteKey(t) {
70
- this.initClient.del(t);
71
- }
72
- ttl(t, e) {
73
- this.initClient.expire(t, e);
74
- }
75
- simpleGet(t) {
76
- return this.ttl(t, R * 60), this.initClient.get(t);
77
- }
78
- simpleHGet(t, e) {
79
- return this.ttl(t, R * 60), this.initClient.hget(t, e);
80
- }
81
- simpleHSet(t, e, s) {
82
- return this.initClient.hset(t, e, s);
83
- }
84
- }
85
- export {
86
- O as C,
87
- T as R,
88
- H as a
89
- };
@@ -1,98 +0,0 @@
1
- const A = /^(?:[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;
2
- function I(f) {
3
- return typeof f == "string" && A.test(f);
4
- }
5
- const o = [];
6
- for (let f = 0; f < 256; ++f)
7
- o.push((f + 256).toString(16).slice(1));
8
- function w(f, t = 0) {
9
- return o[f[t + 0]] + o[f[t + 1]] + o[f[t + 2]] + o[f[t + 3]] + "-" + o[f[t + 4]] + o[f[t + 5]] + "-" + o[f[t + 6]] + o[f[t + 7]] + "-" + o[f[t + 8]] + o[f[t + 9]] + "-" + o[f[t + 10]] + o[f[t + 11]] + o[f[t + 12]] + o[f[t + 13]] + o[f[t + 14]] + o[f[t + 15]];
10
- }
11
- function v(f) {
12
- if (!I(f))
13
- throw TypeError("Invalid UUID");
14
- let t;
15
- const n = new Uint8Array(16);
16
- return n[0] = (t = parseInt(f.slice(0, 8), 16)) >>> 24, n[1] = t >>> 16 & 255, n[2] = t >>> 8 & 255, n[3] = t & 255, n[4] = (t = parseInt(f.slice(9, 13), 16)) >>> 8, n[5] = t & 255, n[6] = (t = parseInt(f.slice(14, 18), 16)) >>> 8, n[7] = t & 255, n[8] = (t = parseInt(f.slice(19, 23), 16)) >>> 8, n[9] = t & 255, n[10] = (t = parseInt(f.slice(24, 36), 16)) / 1099511627776 & 255, n[11] = t / 4294967296 & 255, n[12] = t >>> 24 & 255, n[13] = t >>> 16 & 255, n[14] = t >>> 8 & 255, n[15] = t & 255, n;
17
- }
18
- function R(f) {
19
- f = unescape(encodeURIComponent(f));
20
- const t = [];
21
- for (let n = 0; n < f.length; ++n)
22
- t.push(f.charCodeAt(n));
23
- return t;
24
- }
25
- const T = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", M = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
26
- function y(f, t, n) {
27
- function s(l, a, e, r) {
28
- var i;
29
- if (typeof l == "string" && (l = R(l)), typeof a == "string" && (a = v(a)), ((i = a) === null || i === void 0 ? void 0 : i.length) !== 16)
30
- throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
31
- let x = new Uint8Array(16 + l.length);
32
- if (x.set(a), x.set(l, a.length), x = n(x), x[6] = x[6] & 15 | t, x[8] = x[8] & 63 | 128, e) {
33
- r = r || 0;
34
- for (let h = 0; h < 16; ++h)
35
- e[r + h] = x[h];
36
- return e;
37
- }
38
- return w(x);
39
- }
40
- try {
41
- s.name = f;
42
- } catch {
43
- }
44
- return s.DNS = T, s.URL = M, s;
45
- }
46
- function C(f, t, n, s) {
47
- switch (f) {
48
- case 0:
49
- return t & n ^ ~t & s;
50
- case 1:
51
- return t ^ n ^ s;
52
- case 2:
53
- return t & n ^ t & s ^ n & s;
54
- case 3:
55
- return t ^ n ^ s;
56
- }
57
- }
58
- function g(f, t) {
59
- return f << t | f >>> 32 - t;
60
- }
61
- function D(f) {
62
- const t = [1518500249, 1859775393, 2400959708, 3395469782], n = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
63
- if (typeof f == "string") {
64
- const e = unescape(encodeURIComponent(f));
65
- f = [];
66
- for (let r = 0; r < e.length; ++r)
67
- f.push(e.charCodeAt(r));
68
- } else
69
- Array.isArray(f) || (f = Array.prototype.slice.call(f));
70
- f.push(128);
71
- const s = f.length / 4 + 2, l = Math.ceil(s / 16), a = new Array(l);
72
- for (let e = 0; e < l; ++e) {
73
- const r = new Uint32Array(16);
74
- for (let i = 0; i < 16; ++i)
75
- r[i] = f[e * 64 + i * 4] << 24 | f[e * 64 + i * 4 + 1] << 16 | f[e * 64 + i * 4 + 2] << 8 | f[e * 64 + i * 4 + 3];
76
- a[e] = r;
77
- }
78
- a[l - 1][14] = (f.length - 1) * 8 / Math.pow(2, 32), a[l - 1][14] = Math.floor(a[l - 1][14]), a[l - 1][15] = (f.length - 1) * 8 & 4294967295;
79
- for (let e = 0; e < l; ++e) {
80
- const r = new Uint32Array(80);
81
- for (let c = 0; c < 16; ++c)
82
- r[c] = a[e][c];
83
- for (let c = 16; c < 80; ++c)
84
- r[c] = g(r[c - 3] ^ r[c - 8] ^ r[c - 14] ^ r[c - 16], 1);
85
- let i = n[0], x = n[1], h = n[2], p = n[3], d = n[4];
86
- for (let c = 0; c < 80; ++c) {
87
- const u = Math.floor(c / 20), U = g(i, 5) + C(u, x, h, p) + d + t[u] + r[c] >>> 0;
88
- d = p, p = h, h = g(x, 30) >>> 0, x = i, i = U;
89
- }
90
- n[0] = n[0] + i >>> 0, n[1] = n[1] + x >>> 0, n[2] = n[2] + h >>> 0, n[3] = n[3] + p >>> 0, n[4] = n[4] + d >>> 0;
91
- }
92
- return [n[0] >> 24 & 255, n[0] >> 16 & 255, n[0] >> 8 & 255, n[0] & 255, n[1] >> 24 & 255, n[1] >> 16 & 255, n[1] >> 8 & 255, n[1] & 255, n[2] >> 24 & 255, n[2] >> 16 & 255, n[2] >> 8 & 255, n[2] & 255, n[3] >> 24 & 255, n[3] >> 16 & 255, n[3] >> 8 & 255, n[3] & 255, n[4] >> 24 & 255, n[4] >> 16 & 255, n[4] >> 8 & 255, n[4] & 255];
93
- }
94
- const E = y("v5", 80, D), N = E;
95
- export {
96
- N as a,
97
- w as u
98
- };