mp-front-cli 0.0.56 → 0.0.57

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,5 +1,5 @@
1
1
  import { ApiMiddleware as S, ErrorCatalog as g, FetchServiceBE as l, FetchServiceFE as x } from "./mp-front-cli-core.es.js";
2
- import { S as s } from "./custom-header-3ba5652e.js";
2
+ import { S as s } from "./custom-header-596dcd13.js";
3
3
  import { LoadingHandler as E, MessageHandler as F, RxSubjectManager as M } from "./mp-front-cli-utils-rxjs.es.js";
4
4
  import "i18next";
5
5
  import "./index-df4e0539.js";
@@ -1,17 +1,18 @@
1
- var a = Object.defineProperty;
2
- var m = (o, s, t) => s in o ? a(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
- var l = (o, s, t) => (m(o, typeof s != "symbol" ? s + "" : s, t), t);
4
- import { CustomEncrypter as u } from "./mp-front-cli-encrypter.es.js";
5
- import { C as d } from "./custom-redis-bee66564.js";
1
+ var E = Object.defineProperty;
2
+ var m = (o, s, t) => s in o ? E(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
+ var y = (o, s, t) => (m(o, typeof s != "symbol" ? s + "" : s, t), t);
4
+ import { CustomEncrypter as S } from "./mp-front-cli-encrypter.es.js";
5
+ import { C as u } from "./custom-redis-bee66564.js";
6
6
  import "node-jose";
7
7
  import "crypto";
8
8
  import "./mp-front-cli-encoder.es.js";
9
9
  import "./mp-front-cli-logger.es.js";
10
10
  import "ioredis";
11
- class N extends u {
11
+ const p = process.env.TIMEOUT_SESSION_MINUTES;
12
+ class H extends S {
12
13
  constructor() {
13
14
  super(...arguments);
14
- l(this, "initClient", d);
15
+ y(this, "initClient", u);
15
16
  }
16
17
  getRootNode(t) {
17
18
  return this.initClient.get(t);
@@ -40,12 +41,12 @@ class N extends u {
40
41
  refresh: c = "REFRESH"
41
42
  /* REFRESH */
42
43
  }) {
43
- const r = `${t}:${this.generateSHA(i)}`, y = { expires_in: c === "REFRESH" ? n : 0, ...e };
44
+ const r = `${t}:${this.generateSHA(i)}`, l = { expires_in: c === "REFRESH" ? n : 0, ...e };
44
45
  if (h) {
45
- const p = await this.encrypt(y);
46
- return this.setEntryPoint(r, p, n), r;
46
+ const a = await this.encrypt(l);
47
+ return this.setEntryPoint(r, a, n), r;
47
48
  }
48
- return this.setEntryPoint(r, y, n), r;
49
+ return this.setEntryPoint(r, l, n), r;
49
50
  }
50
51
  async statusHost() {
51
52
  return new Promise((t, i) => {
@@ -66,12 +67,12 @@ class N extends u {
66
67
  this.initClient.expire(t, i);
67
68
  }
68
69
  simpleGet(t) {
69
- return this.initClient.get(t);
70
+ return this.ttl(t, p * 60), this.initClient.get(t);
70
71
  }
71
72
  simpleHGet(t, i) {
72
- return this.initClient.hget(t, i);
73
+ return this.ttl(t, p * 60), this.initClient.hget(t, i);
73
74
  }
74
75
  }
75
76
  export {
76
- N as CustomCache
77
+ H as CustomCache
77
78
  };
@@ -1,8 +1,8 @@
1
1
  var I = Object.defineProperty;
2
2
  var L = (s, r, t) => r in s ? I(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t;
3
- var g = (s, r, t) => (L(s, typeof r != "symbol" ? r + "" : r, t), t);
4
- import { C as M, f as y } from "./custom-header-3ba5652e.js";
5
- import { S as ht } from "./custom-header-3ba5652e.js";
3
+ var u = (s, r, t) => (L(s, typeof r != "symbol" ? r + "" : r, t), t);
4
+ import { C as M, f as B } from "./custom-header-596dcd13.js";
5
+ import { S as ht } from "./custom-header-596dcd13.js";
6
6
  import { MessageHandler as A, LoadingHandler as p } from "./mp-front-cli-utils-rxjs.es.js";
7
7
  import { RxSubjectManager as pt } from "./mp-front-cli-utils-rxjs.es.js";
8
8
  import P, { t as E } from "i18next";
@@ -74,7 +74,7 @@ const h = {
74
74
  };
75
75
  class U extends J {
76
76
  get(r = "default", t) {
77
- var o, i;
77
+ var o, n;
78
78
  if (r instanceof Error)
79
79
  return this.logError(r.message), {
80
80
  ...h.internalError,
@@ -82,16 +82,16 @@ class U extends J {
82
82
  message: E(h.internalError.message),
83
83
  uuid: t
84
84
  };
85
- const e = typeof r == "string" ? r : r.code ?? r.errorType, n = typeof r == "string" ? {} : { ...r };
85
+ const e = typeof r == "string" ? r : r.code ?? r.errorType, i = typeof r == "string" ? {} : { ...r };
86
86
  return {
87
87
  ...h[e] ?? h.default,
88
88
  title: E(
89
89
  ((o = h[e]) == null ? void 0 : o.title) ?? h.default.title,
90
- n
90
+ i
91
91
  ),
92
92
  message: E(
93
- ((i = h[e]) == null ? void 0 : i.message) ?? h.default.message,
94
- n
93
+ ((n = h[e]) == null ? void 0 : n.message) ?? h.default.message,
94
+ i
95
95
  ),
96
96
  uuid: t
97
97
  };
@@ -100,8 +100,8 @@ class U extends J {
100
100
  class ct extends H {
101
101
  constructor() {
102
102
  super(...arguments);
103
- g(this, "uuid", "");
104
- g(this, "session", null);
103
+ u(this, "uuid", "");
104
+ u(this, "session", null);
105
105
  }
106
106
  setSession(t) {
107
107
  this.session = t;
@@ -109,42 +109,42 @@ class ct extends H {
109
109
  getSession() {
110
110
  return this.session;
111
111
  }
112
- returnData(t, e, n) {
113
- const o = this.encode(e, n);
112
+ returnData(t, e, i) {
113
+ const o = this.encode(e, i);
114
114
  t.status(200).json(o);
115
115
  }
116
116
  returnError(t, e) {
117
117
  return e != null && e.uuid ? t.status(520).json(e) : t.status(520).json(new U().get(e, this.uuid));
118
118
  }
119
119
  get(t) {
120
- return this.logDebug("get ApiMiddleware"), (e, n) => {
120
+ return this.logDebug("get ApiMiddleware"), (e, i) => {
121
121
  var o;
122
122
  this.logDebug("return ApiMiddleware"), this.uuid = (o = e == null ? void 0 : e.body) == null ? void 0 : o.uuid, d(e).pipe(
123
123
  m(
124
- (i) => O({
125
- params: d(this.decode(i.body)),
126
- headers: d(i.headers)
124
+ (n) => O({
125
+ params: d(this.decode(n.body)),
126
+ headers: d(n.headers)
127
127
  })
128
128
  ),
129
129
  m(
130
- ({ params: i, headers: a }) => O({
131
- response: t(i, this.uuid, a),
130
+ ({ params: n, headers: a }) => O({
131
+ response: t(n, this.uuid, a),
132
132
  headers: d(a),
133
- params: d(i)
133
+ params: d(n)
134
134
  })
135
135
  ),
136
- m(({ params: i, response: a, headers: f }) => (this.logDebug(
137
- `ApiMiddleware \x1B[37m <URL>: \x1B[33m ${e.url} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(f)} \x1B[37m <UUID> \x1B[33m ${e.body.uuid} \x1B[37m <PARAMS> \x1B[33m ${JSON.stringify(i)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(a)}`
136
+ m(({ params: n, response: a, headers: f }) => (this.logDebug(
137
+ `ApiMiddleware \x1B[37m <URL>: \x1B[33m ${e.url} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(f)} \x1B[37m <UUID> \x1B[33m ${e.body.uuid} \x1B[37m <PARAMS> \x1B[33m ${JSON.stringify(n)} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(a)}`
138
138
  ), d(a))),
139
- D((i) => {
139
+ D((n) => {
140
140
  var a;
141
141
  return this.logError(
142
- `ApiMiddleware <URL>: ${e == null ? void 0 : e.url} <HEADERS>: ${JSON.stringify(e == null ? void 0 : e.headers)} <UUID> ${(a = e == null ? void 0 : e.body) == null ? void 0 : a.uuid} <PARAMS> ${JSON.stringify(e == null ? void 0 : e.body)} <ERROR>: ${JSON.stringify(i)}`
143
- ), this.returnError(n, i), N;
142
+ `ApiMiddleware <URL>: ${e == null ? void 0 : e.url} <HEADERS>: ${JSON.stringify(e == null ? void 0 : e.headers)} <UUID> ${(a = e == null ? void 0 : e.body) == null ? void 0 : a.uuid} <PARAMS> ${JSON.stringify(e == null ? void 0 : e.body)} <ERROR>: ${JSON.stringify(n)}`
143
+ ), this.returnError(i, n), N;
144
144
  })
145
145
  ).subscribe({
146
- next: (i) => {
147
- this.logDebug("ApiMiddleware subscribe next", JSON.stringify(i)), this.returnData(n, i, this.uuid);
146
+ next: (n) => {
147
+ this.logDebug("ApiMiddleware subscribe next", JSON.stringify(n)), this.returnData(i, n, this.uuid);
148
148
  }
149
149
  });
150
150
  };
@@ -152,10 +152,10 @@ class ct extends H {
152
152
  }
153
153
  const F = process.env.ID_FRONT ?? "NOT_AVAILABLE";
154
154
  class dt extends M {
155
- constructor(t, e) {
156
- super();
157
- g(this, "apiUrl");
158
- g(this, "method");
155
+ constructor(t, e, i = {}) {
156
+ super(i);
157
+ u(this, "apiUrl");
158
+ u(this, "method");
159
159
  this.apiUrl = t, this.method = e ?? "POST";
160
160
  }
161
161
  errorHandler(t, e) {
@@ -174,36 +174,36 @@ class dt extends M {
174
174
  fetchData(t = {}, e) {
175
175
  return this.getHeaders().pipe(
176
176
  m(
177
- (n) => y(this.apiUrl, {
177
+ (i) => B(this.apiUrl, {
178
178
  method: "POST",
179
- headers: n,
179
+ headers: i,
180
180
  body: this.formatParams(t),
181
181
  selector: (o) => o.json()
182
182
  }).pipe(
183
183
  m((o) => (this.logDebug(
184
184
  `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m <UUID>: \x1B[33m ${e} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
185
- n
185
+ i
186
186
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
187
187
  this.formatParams(t)
188
188
  )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(o)} \x1B[33m`
189
189
  ), d(o)))
190
190
  )
191
191
  ),
192
- $((n) => this.errorHandler(n, e))
192
+ $((i) => this.errorHandler(i, e))
193
193
  );
194
194
  }
195
195
  fetchCustomData(t = {}, e) {
196
196
  return this.getHeaders().pipe(
197
197
  m(
198
- (n) => y(this.apiUrl, {
198
+ (i) => B(this.apiUrl, {
199
199
  method: this.method,
200
- headers: n,
200
+ headers: i,
201
201
  body: this.method === "GET" ? null : JSON.stringify(t),
202
202
  selector: (o) => o.json()
203
203
  }).pipe(
204
204
  m((o) => (this.logDebug(
205
205
  `FetchServiceBE \x1B[37m <URL>: \x1B[33m ${this.apiUrl} \x1B[37m \x1B[37m <METHOD>: \x1B[33m ${this.method} <UUID>: \x1B[33m ${e} \x1B[37m <HEADERS>: \x1B[33m ${JSON.stringify(
206
- n
206
+ i
207
207
  )} \x1B[37m <BODY>: \x1B[33m ${JSON.stringify(
208
208
  t
209
209
  )} \x1B[37m <RESPONSE>: \x1B[33m ${JSON.stringify(o)} \x1B[33m`
@@ -233,16 +233,16 @@ function _(s) {
233
233
  }
234
234
  const V = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", K = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
235
235
  function W(s, r, t) {
236
- function e(n, o, i, a) {
236
+ function e(i, o, n, a) {
237
237
  var f;
238
- if (typeof n == "string" && (n = _(n)), typeof o == "string" && (o = k(o)), ((f = o) === null || f === void 0 ? void 0 : f.length) !== 16)
238
+ if (typeof i == "string" && (i = _(i)), typeof o == "string" && (o = k(o)), ((f = o) === null || f === void 0 ? void 0 : f.length) !== 16)
239
239
  throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
240
- let c = new Uint8Array(16 + n.length);
241
- if (c.set(o), c.set(n, o.length), c = t(c), c[6] = c[6] & 15 | r, c[8] = c[8] & 63 | 128, i) {
240
+ let c = new Uint8Array(16 + i.length);
241
+ if (c.set(o), c.set(i, o.length), c = t(c), c[6] = c[6] & 15 | r, c[8] = c[8] & 63 | 128, n) {
242
242
  a = a || 0;
243
- for (let u = 0; u < 16; ++u)
244
- i[a + u] = c[u];
245
- return i;
243
+ for (let g = 0; g < 16; ++g)
244
+ n[a + g] = c[g];
245
+ return n;
246
246
  }
247
247
  return j(c);
248
248
  }
@@ -264,66 +264,66 @@ function X(s, r, t, e) {
264
264
  return r ^ t ^ e;
265
265
  }
266
266
  }
267
- function B(s, r) {
267
+ function y(s, r) {
268
268
  return s << r | s >>> 32 - r;
269
269
  }
270
270
  function Z(s) {
271
271
  const r = [1518500249, 1859775393, 2400959708, 3395469782], t = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
272
272
  if (typeof s == "string") {
273
- const i = unescape(encodeURIComponent(s));
273
+ const n = unescape(encodeURIComponent(s));
274
274
  s = [];
275
- for (let a = 0; a < i.length; ++a)
276
- s.push(i.charCodeAt(a));
275
+ for (let a = 0; a < n.length; ++a)
276
+ s.push(n.charCodeAt(a));
277
277
  } else
278
278
  Array.isArray(s) || (s = Array.prototype.slice.call(s));
279
279
  s.push(128);
280
- const e = s.length / 4 + 2, n = Math.ceil(e / 16), o = new Array(n);
281
- for (let i = 0; i < n; ++i) {
280
+ const e = s.length / 4 + 2, i = Math.ceil(e / 16), o = new Array(i);
281
+ for (let n = 0; n < i; ++n) {
282
282
  const a = new Uint32Array(16);
283
283
  for (let f = 0; f < 16; ++f)
284
- a[f] = s[i * 64 + f * 4] << 24 | s[i * 64 + f * 4 + 1] << 16 | s[i * 64 + f * 4 + 2] << 8 | s[i * 64 + f * 4 + 3];
285
- o[i] = a;
284
+ a[f] = s[n * 64 + f * 4] << 24 | s[n * 64 + f * 4 + 1] << 16 | s[n * 64 + f * 4 + 2] << 8 | s[n * 64 + f * 4 + 3];
285
+ o[n] = a;
286
286
  }
287
- o[n - 1][14] = (s.length - 1) * 8 / Math.pow(2, 32), o[n - 1][14] = Math.floor(o[n - 1][14]), o[n - 1][15] = (s.length - 1) * 8 & 4294967295;
288
- for (let i = 0; i < n; ++i) {
287
+ o[i - 1][14] = (s.length - 1) * 8 / Math.pow(2, 32), o[i - 1][14] = Math.floor(o[i - 1][14]), o[i - 1][15] = (s.length - 1) * 8 & 4294967295;
288
+ for (let n = 0; n < i; ++n) {
289
289
  const a = new Uint32Array(80);
290
290
  for (let l = 0; l < 16; ++l)
291
- a[l] = o[i][l];
291
+ a[l] = o[n][l];
292
292
  for (let l = 16; l < 80; ++l)
293
- a[l] = B(a[l - 3] ^ a[l - 8] ^ a[l - 14] ^ a[l - 16], 1);
294
- let f = t[0], c = t[1], u = t[2], x = t[3], S = t[4];
293
+ a[l] = y(a[l - 3] ^ a[l - 8] ^ a[l - 14] ^ a[l - 16], 1);
294
+ let f = t[0], c = t[1], g = t[2], x = t[3], S = t[4];
295
295
  for (let l = 0; l < 80; ++l) {
296
- const R = Math.floor(l / 20), w = B(f, 5) + X(R, c, u, x) + S + r[R] + a[l] >>> 0;
297
- S = x, x = u, u = B(c, 30) >>> 0, c = f, f = w;
296
+ const R = Math.floor(l / 20), w = y(f, 5) + X(R, c, g, x) + S + r[R] + a[l] >>> 0;
297
+ S = x, x = g, g = y(c, 30) >>> 0, c = f, f = w;
298
298
  }
299
- t[0] = t[0] + f >>> 0, t[1] = t[1] + c >>> 0, t[2] = t[2] + u >>> 0, t[3] = t[3] + x >>> 0, t[4] = t[4] + S >>> 0;
299
+ t[0] = t[0] + f >>> 0, t[1] = t[1] + c >>> 0, t[2] = t[2] + g >>> 0, t[3] = t[3] + x >>> 0, t[4] = t[4] + S >>> 0;
300
300
  }
301
301
  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];
302
302
  }
303
303
  const Q = W("v5", 80, Z), b = Q;
304
304
  class mt extends T {
305
- constructor(t, e = "POST", n = {}) {
305
+ constructor(t, e = "POST", i = {}) {
306
306
  super();
307
- g(this, "apiUrl");
308
- g(this, "method");
309
- g(this, "headers");
310
- g(this, "isLoadingEnabled", !0);
307
+ u(this, "apiUrl");
308
+ u(this, "method");
309
+ u(this, "headers");
310
+ u(this, "isLoadingEnabled", !0);
311
311
  this.apiUrl = t, this.method = e, this.headers = {
312
312
  "Content-Type": "application/json",
313
- ...n
313
+ ...i
314
314
  };
315
315
  }
316
316
  setIsLoadingEnabled(t) {
317
317
  this.isLoadingEnabled = t;
318
318
  }
319
319
  errorHandler(t) {
320
- return t.code && (A.getInstance().setSubject(t), p.getInstance().setSubject(!1)), !t.code;
320
+ return t.code && (t.type === "modal" || t.type === "message") && (A.getInstance().setSubject(t), p.getInstance().setSubject(!1)), !t.code;
321
321
  }
322
322
  fetchData(t = {}) {
323
- const e = (/* @__PURE__ */ new Date()).toISOString(), n = b(e, b.URL), o = this.encode({ ...t }, n);
323
+ const e = (/* @__PURE__ */ new Date()).toISOString(), i = b(e, b.URL), o = this.encode({ ...t }, i);
324
324
  p.getInstance().setSubject(this.isLoadingEnabled);
325
325
  const a = new URLSearchParams(window.location.search).get("flow") ?? "N/A";
326
- return y(this.apiUrl, {
326
+ return B(this.apiUrl, {
327
327
  method: this.method,
328
328
  headers: { ...this.headers, flow: a },
329
329
  body: o,
@@ -336,7 +336,7 @@ class mt extends T {
336
336
  $(this.errorHandler),
337
337
  m((f) => (p.getInstance().setSubject(!1), d(f))),
338
338
  D((f) => (p.getInstance().setSubject(!1), A.getInstance().setSubject(
339
- new U().get(f, n)
339
+ new U().get(f, i)
340
340
  ), N))
341
341
  );
342
342
  }
@@ -1,5 +1,5 @@
1
1
  import "rxjs";
2
- import { C as s } from "./custom-header-3ba5652e.js";
2
+ import { C as s } from "./custom-header-596dcd13.js";
3
3
  import "./mp-front-cli-encrypter.es.js";
4
4
  import "./mp-front-cli-logger.es.js";
5
5
  import "node-jose";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-front-cli",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {