mp-front-cli 1.0.0 → 2.0.0-canary.2

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.
Files changed (36) hide show
  1. package/dist/core/errors/error-catalog.d.ts +4 -18
  2. package/dist/core/errors/error-catalog.d.ts.map +1 -1
  3. package/dist/core/interfaces/api-response.d.ts +4 -5
  4. package/dist/core/interfaces/api-response.d.ts.map +1 -1
  5. package/dist/core/interfaces/message.d.ts +1 -1
  6. package/dist/core/interfaces/message.d.ts.map +1 -1
  7. package/dist/core/middleware/index.d.ts +1 -1
  8. package/dist/core/middleware/index.d.ts.map +1 -1
  9. package/dist/core/utils/Terminal/constants/index.d.ts +1 -1
  10. package/dist/core/utils/Terminal/index.d.ts +1 -1
  11. package/dist/core/utils/api-request/fetch-service-be.d.ts +1 -1
  12. package/dist/core/utils/api-request/fetch-service-be.d.ts.map +1 -1
  13. package/dist/core/utils/api-request/fetch-service-fe.d.ts +1 -1
  14. package/dist/core/utils/api-request/fetch-service-fe.d.ts.map +1 -1
  15. package/dist/core/utils/custom-adapter.d.ts.map +1 -1
  16. package/dist/core/utils/custom-cache.d.ts +2 -2
  17. package/dist/core/utils/custom-cache.d.ts.map +1 -1
  18. package/dist/fetch-service-fe-Bn43l_lH.js +1574 -0
  19. package/dist/loading-handler-Br21zGTA.js +46 -0
  20. package/dist/mp-front-cli-adapter.es.js +73 -84
  21. package/dist/mp-front-cli-all.es.js +11 -22
  22. package/dist/mp-front-cli-cache.es.js +33 -38
  23. package/dist/mp-front-cli-core.es.js +11 -1582
  24. package/dist/mp-front-cli-encoder.es.js +3535 -3537
  25. package/dist/mp-front-cli-encrypter.es.js +11 -14
  26. package/dist/mp-front-cli-header.es.js +13 -17
  27. package/dist/mp-front-cli-locale.es.js +1 -1
  28. package/dist/mp-front-cli-logger.es.js +3 -3
  29. package/dist/mp-front-cli-services.es.js +2 -4
  30. package/dist/mp-front-cli-utils-rxjs.es.js +3 -43
  31. package/dist/service-token-D8bum6H0.js +811 -0
  32. package/package.json +20 -16
  33. package/dist/index-a6a5a26e.js +0 -849
  34. /package/dist/{custom-redis-bee66564.js → custom-redis-BMPP_XZi.js} +0 -0
  35. /package/dist/{i18n-3dcfe704.js → i18n-CniHhItS.js} +0 -0
  36. /package/dist/{stringify-788d71a0.js → stringify-93tp0umt.js} +0 -0
@@ -0,0 +1,46 @@
1
+ var j = Object.defineProperty;
2
+ var o = (n, t, s) => t in n ? j(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s;
3
+ var u = (n, t, s) => o(n, typeof t != "symbol" ? t + "" : t, s);
4
+ import { Observable as p, Subject as i } from "rxjs";
5
+ class a extends p {
6
+ constructor() {
7
+ super((s) => {
8
+ this.subject$.subscribe(s);
9
+ });
10
+ u(this, "subject$", new i());
11
+ }
12
+ setSubject(s) {
13
+ this.subject$.next(s);
14
+ }
15
+ completeSubject() {
16
+ this.subject$.complete();
17
+ }
18
+ unsubscribeSubject() {
19
+ return this.subject$.unsubscribe(), this.subject$ = new i(), this.subject$;
20
+ }
21
+ }
22
+ const e = class e extends a {
23
+ constructor() {
24
+ super();
25
+ }
26
+ static getInstance() {
27
+ return e.instance || (e.instance = new e()), e.instance;
28
+ }
29
+ };
30
+ u(e, "instance");
31
+ let b = e;
32
+ const c = class c extends a {
33
+ constructor() {
34
+ super();
35
+ }
36
+ static getInstance() {
37
+ return c.instance || (c.instance = new c()), c.instance;
38
+ }
39
+ };
40
+ u(c, "instance");
41
+ let r = c;
42
+ export {
43
+ r as L,
44
+ b as M,
45
+ a as R
46
+ };
@@ -1,30 +1,23 @@
1
- import { C as Z } from "./custom-redis-bee66564.js";
2
- import { u as $ } from "./stringify-788d71a0.js";
3
- import "ioredis";
4
- let x;
1
+ import { C as Z } from "./custom-redis-BMPP_XZi.js";
2
+ import { u as $ } from "./stringify-93tp0umt.js";
3
+ let w;
5
4
  const v = new Uint8Array(16);
6
5
  function C() {
7
- if (!x && (x = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !x))
6
+ if (!w && (w = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !w))
8
7
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
9
- return x(v);
8
+ return w(v);
10
9
  }
11
- const G = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), A = {
10
+ const G = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), O = {
12
11
  randomUUID: G
13
12
  };
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)();
19
- if (i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, s) {
20
- r = r || 0;
21
- for (let u = 0; u < 16; ++u)
22
- s[r + u] = i[u];
23
- return s;
24
- }
25
- return $(i);
13
+ function H(r, s, i) {
14
+ if (O.randomUUID && !r)
15
+ return O.randomUUID();
16
+ r = r || {};
17
+ const o = r.random || (r.rng || C)();
18
+ return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, $(o);
26
19
  }
27
- const L = process.env.PREFIX_LOGIN, B = process.env.TIMEOUT_SESSION_MINUTES, q = {
20
+ const L = process.env.PREFIX_LOGIN, b = process.env.TIMEOUT_SESSION_MINUTES, q = {
28
21
  baseKeyPrefix: `${L}:`,
29
22
  userKeyPrefix: "user:",
30
23
  accountKeyPrefix: "account:",
@@ -33,71 +26,69 @@ const L = process.env.PREFIX_LOGIN, B = process.env.TIMEOUT_SESSION_MINUTES, q =
33
26
  sessionByUserIdPrefix: "session:user:",
34
27
  userByEmailKeyPrefix: "user:email:",
35
28
  verificationKeyPrefix: "verification:",
36
- expire: B * 60
37
- }, z = (c) => {
38
- for (const s in c)
29
+ expire: b * 60
30
+ }, z = (r) => {
31
+ for (const s in r)
39
32
  return !1;
40
33
  return !0;
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 = {
34
+ }, 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 = (r) => r && J.test(r) && !Number.isNaN(Date.parse(r));
35
+ function ee(r = { expire: b * 60 }) {
36
+ const s = Z, i = {
44
37
  ...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), {});
48
- await s.hset(e, n), await s.expire(e, r.expire);
49
- }, y = async (e) => {
38
+ ...r
39
+ }, o = i.baseKeyPrefix || "", A = o + i.userKeyPrefix, B = o + i.userByEmailKeyPrefix, k = o + i.accountKeyPrefix, T = o + i.accountByUserIdPrefix, D = o + i.sessionKeyPrefix, V = o + i.sessionByUserIdPrefix, j = o + i.verificationKeyPrefix, x = (e) => B + e, U = (e) => A + e, K = (e) => k + e, y = (e) => T + e, p = (e, t) => `${t}:${e}`, I = (e) => D + e, f = (e) => V + e, g = (e) => j + e, l = async (e, t) => {
40
+ const n = Object.entries(t).reduce((c, [P, a]) => (c[P] = a instanceof Date ? a.toISOString() : a, c), {});
41
+ await s.hset(e, n), await s.expire(e, i.expire);
42
+ }, d = async (e) => {
50
43
  const t = await s.hgetall(e);
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(
53
- U(t.email),
44
+ return !t || z(t) ? null : Object.entries(t).reduce((c, [P, a]) => (c[P] = Q(a) ? new Date(a) : a, c), {});
45
+ }, S = async (e, t) => (await l(U(e), t), t.email && await s.set(
46
+ x(t.email),
54
47
  e,
55
48
  "EX",
56
- r.expire
57
- ), t), d = async (e) => {
58
- const t = await y(p(e));
49
+ i.expire
50
+ ), t), u = async (e) => {
51
+ const t = await d(U(e));
59
52
  return t ? { ...t } : null;
60
53
  }, N = async (e, t) => {
61
54
  const n = K(e);
62
- await w(n, t), await s.set(
63
- f(t.userId),
55
+ await l(n, t), await s.set(
56
+ y(t.userId),
64
57
  n,
65
58
  "EX",
66
- r.expire
59
+ i.expire
67
60
  );
68
61
  }, R = async (e) => {
69
- const t = await y(K(e));
62
+ const t = await d(K(e));
70
63
  return t ? { ...t } : null;
71
64
  }, h = async (e) => {
72
- const t = K(e), n = await y(t);
73
- if (!n)
74
- return null;
75
- await s.hdel(t), await s.del(f(n.userId));
76
- }, O = async (e, t) => {
65
+ const t = K(e), n = await d(t);
66
+ if (!n) return null;
67
+ await s.hdel(t), await s.del(y(n.userId));
68
+ }, E = async (e, t) => {
77
69
  const n = I(e);
78
- return await w(n, t), await s.set(
79
- l(t.userId),
70
+ return await l(n, t), await s.set(
71
+ f(t.userId),
80
72
  n,
81
73
  "EX",
82
- r.expire
74
+ i.expire
83
75
  ), t;
84
- }, P = async (e) => {
85
- const t = await y(I(e));
76
+ }, m = async (e) => {
77
+ const t = await d(I(e));
86
78
  return t ? {
87
79
  id: t.id,
88
80
  ...t
89
81
  } : null;
90
82
  }, _ = async (e) => {
91
- const t = await P(e);
92
- if (!t)
93
- return null;
83
+ const t = await m(e);
84
+ if (!t) return null;
94
85
  const n = I(e);
95
- await s.del(n), await s.del(l(t.userId));
86
+ await s.del(n), await s.del(f(t.userId));
96
87
  }, X = async (e, t) => {
97
88
  const n = g(e);
98
- return await w(n, t), t;
89
+ return await l(n, t), t;
99
90
  }, M = async (e) => {
100
- const t = g(e), n = await y(t);
91
+ const t = g(e), n = await d(t);
101
92
  return n ? { identifier: n.identifier, ...n } : null;
102
93
  }, F = async (e) => {
103
94
  const t = g(e);
@@ -106,62 +97,60 @@ function te(c = { expire: B * 60 }) {
106
97
  return {
107
98
  async createUser(e) {
108
99
  const t = H();
109
- return await E(t, { ...e, id: t });
100
+ return await S(t, { ...e, id: t });
110
101
  },
111
- getUser: d,
102
+ getUser: u,
112
103
  async getUserByEmail(e) {
113
- const t = await s.get(U(e));
114
- return t ? await d(t) : null;
104
+ const t = await s.get(x(e));
105
+ return t ? await u(t) : null;
115
106
  },
116
107
  async getUserByAccount({ providerAccountId: e, provider: t }) {
117
108
  const n = await R(
118
- m(e, t)
109
+ p(e, t)
119
110
  );
120
- return n ? await d(n.userId) : null;
111
+ return n ? await u(n.userId) : null;
121
112
  },
122
113
  async updateUser(e) {
123
- const t = e.id, n = await d(t);
124
- return await E(t, { ...n, ...e });
114
+ const t = e.id, n = await u(t);
115
+ return await S(t, { ...n, ...e });
125
116
  },
126
117
  async deleteUser(e) {
127
- const t = await d(e);
128
- if (!t)
129
- return null;
130
- const n = await s.get(f(e)), o = await s.get(l(e));
118
+ const t = await u(e);
119
+ if (!t) return null;
120
+ const n = await s.get(y(e)), c = await s.get(f(e));
131
121
  await s.del(
132
- U(t.email),
133
- f(e),
134
- l(e)
135
- ), o && await s.del(o), n && await s.del(n), await s.del(p(e));
122
+ x(t.email),
123
+ y(e),
124
+ f(e)
125
+ ), c && await s.del(c), n && await s.del(n), await s.del(U(e));
136
126
  },
137
127
  async linkAccount(e) {
138
- const t = m(e.providerAccountId, e.provider);
128
+ const t = p(e.providerAccountId, e.provider);
139
129
  return await N(t, { ...e, id: t });
140
130
  },
141
131
  async unlinkAccount({
142
132
  providerAccountId: e,
143
133
  provider: t
144
134
  }) {
145
- const n = m(e, t);
135
+ const n = p(e, t);
146
136
  await h(n);
147
137
  },
148
138
  async createSession(e) {
149
139
  const t = e.sessionToken;
150
- return await O(t, {
140
+ return await E(t, {
151
141
  ...e,
152
142
  id: t
153
143
  });
154
144
  },
155
145
  async getSessionAndUser(e) {
156
- const n = await P(e);
157
- if (!n)
158
- return null;
159
- const o = await d(n.userId);
160
- return o ? { session: n, user: o } : null;
146
+ const n = await m(e);
147
+ if (!n) return null;
148
+ const c = await u(n.userId);
149
+ return c ? { session: n, user: c } : null;
161
150
  },
162
151
  async updateSession(e) {
163
- const t = e.sessionToken, n = await P(t);
164
- return n ? await O(t, { ...n, ...e }) : null;
152
+ const t = e.sessionToken, n = await m(t);
153
+ return n ? await E(t, { ...n, ...e }) : null;
165
154
  },
166
155
  deleteSession: _,
167
156
  async createVerificationToken(e) {
@@ -175,6 +164,6 @@ function te(c = { expire: B * 60 }) {
175
164
  };
176
165
  }
177
166
  export {
178
- te as IORedisAdapter,
167
+ ee as IORedisAdapter,
179
168
  q as defaultOptions
180
169
  };
@@ -1,24 +1,13 @@
1
- import { ApiMiddleware as l, ErrorCatalog as x, FetchServiceBE as f, FetchServiceFE as s } from "./mp-front-cli-core.es.js";
2
- import { LoadingHandler as E, MessageHandler as F, RxSubjectManager as M } from "./mp-front-cli-utils-rxjs.es.js";
3
- import { S as H } from "./index-a6a5a26e.js";
4
- import "./i18n-3dcfe704.js";
5
- import "i18next";
6
- import "./mp-front-cli-logger.es.js";
7
- import "rxjs";
8
- import "./mp-front-cli-encrypter.es.js";
9
- import "node-jose";
10
- import "crypto";
11
- import "./mp-front-cli-encoder.es.js";
12
- import "./mp-front-cli-header.es.js";
13
- import "querystring";
14
- import "./stringify-788d71a0.js";
1
+ import { A as r, E as o, F as s, a as t } from "./fetch-service-fe-Bn43l_lH.js";
2
+ import { L as i, M as d, R as n } from "./loading-handler-Br21zGTA.js";
3
+ import { S as g } from "./service-token-D8bum6H0.js";
15
4
  export {
16
- l as ApiMiddleware,
17
- x as ErrorCatalog,
18
- f as FetchServiceBE,
19
- s as FetchServiceFE,
20
- E as LoadingHandler,
21
- F as MessageHandler,
22
- M as RxSubjectManager,
23
- H as ServiceToken
5
+ r as ApiMiddleware,
6
+ o as ErrorCatalog,
7
+ s as FetchServiceBE,
8
+ t as FetchServiceFE,
9
+ i as LoadingHandler,
10
+ d as MessageHandler,
11
+ n as RxSubjectManager,
12
+ g as ServiceToken
24
13
  };
@@ -1,19 +1,14 @@
1
- var y = Object.defineProperty;
2
- var S = (n, r, t) => r in n ? y(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 u } from "./custom-redis-bee66564.js";
6
- import "node-jose";
7
- import "crypto";
8
- import "./mp-front-cli-encoder.es.js";
9
- import "./mp-front-cli-logger.es.js";
10
- import "ioredis";
1
+ var S = Object.defineProperty;
2
+ var p = (n, r, t) => r in n ? S(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
3
+ var E = (n, r, t) => p(n, typeof r != "symbol" ? r + "" : r, t);
4
+ import { CustomEncrypter as u } from "./mp-front-cli-encrypter.es.js";
5
+ import { C as R } from "./custom-redis-BMPP_XZi.js";
11
6
  const a = process.env.TIMEOUT_SESSION_MINUTES;
12
- var R = /* @__PURE__ */ ((n) => (n.NOT_REFRESH = "NOT_REFRESH", n.REFRESH = "REFRESH", n))(R || {});
13
- class O extends m {
7
+ var d = /* @__PURE__ */ ((n) => (n.NOT_REFRESH = "NOT_REFRESH", n.REFRESH = "REFRESH", n))(d || {});
8
+ class N extends u {
14
9
  constructor() {
15
10
  super(...arguments);
16
- E(this, "initClient", u);
11
+ E(this, "initClient", R);
17
12
  }
18
13
  getRootNode(t) {
19
14
  return this.initClient.get(t);
@@ -25,38 +20,38 @@ class O extends m {
25
20
  throw new Error("Not found entry point");
26
21
  }
27
22
  }
28
- setEntryPoint(t, i, e) {
29
- const s = typeof i == "string" ? i : JSON.stringify(i);
30
- this.initClient.set(t, s, "EX", 60 * e);
23
+ setEntryPoint(t, e, i) {
24
+ const s = typeof e == "string" ? e : JSON.stringify(e);
25
+ this.initClient.set(t, s, "EX", 60 * i);
31
26
  }
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 };
27
+ async getRedisState(t, e) {
28
+ const i = `${t}:${this.generateSHA(e)}`, s = await this.getEntryPoint(i), c = await this.isEncrypted(s) ? await this.decrypt(s ?? "") : JSON.parse(s), o = Number(c == null ? void 0 : c.expires_in);
29
+ return o && this.ttl(i, o * 60), { sha: i, data: c };
35
30
  }
36
- async deleteRedisState(t, i) {
37
- const e = `${t}:${this.generateSHA(i)}`;
38
- this.initClient.del(e);
31
+ async deleteRedisState(t, e) {
32
+ const i = `${t}:${this.generateSHA(e)}`;
33
+ this.initClient.del(i);
39
34
  }
40
35
  async setRedisState({
41
36
  idApi: t,
42
- idData: i,
43
- body: e,
37
+ idData: e,
38
+ body: i,
44
39
  expire: s,
45
40
  encrypted: l = !1,
46
41
  refresh: c = "REFRESH"
47
42
  /* REFRESH */
48
43
  }) {
49
- const o = `${t}:${this.generateSHA(i)}`, h = { expires_in: c === "REFRESH" ? s : 0, ...e };
44
+ const o = `${t}:${this.generateSHA(e)}`, h = { expires_in: c === "REFRESH" ? s : 0, ...i };
50
45
  if (l) {
51
- const p = await this.encrypt(h);
52
- return this.setEntryPoint(o, p, s), o;
46
+ const y = await this.encrypt(h);
47
+ return this.setEntryPoint(o, y, s), o;
53
48
  }
54
49
  return this.setEntryPoint(o, h, s), o;
55
50
  }
56
51
  async statusHost() {
57
- return new Promise((t, i) => {
58
- this.initClient.on("error", (e) => {
59
- this.killRedis(), i(e);
52
+ return new Promise((t, e) => {
53
+ this.initClient.on("error", (i) => {
54
+ this.killRedis(), e(i);
60
55
  }), this.initClient.on("connect", () => {
61
56
  t("success");
62
57
  });
@@ -68,23 +63,23 @@ class O extends m {
68
63
  deleteKey(t) {
69
64
  this.initClient.del(t);
70
65
  }
71
- ttl(t, i) {
72
- this.initClient.expire(t, i);
66
+ ttl(t, e) {
67
+ this.initClient.expire(t, e);
73
68
  }
74
69
  simpleGet(t) {
75
70
  return this.ttl(t, a * 60), this.initClient.get(t);
76
71
  }
77
- simpleHGet(t, i) {
78
- return this.ttl(t, a * 60), this.initClient.hget(t, i);
72
+ simpleHGet(t, e) {
73
+ return this.ttl(t, a * 60), this.initClient.hget(t, e);
79
74
  }
80
- simpleHSet(t, i, e) {
81
- return this.initClient.hset(t, i, e);
75
+ simpleHSet(t, e, i) {
76
+ return this.initClient.hset(t, e, i);
82
77
  }
83
78
  simpleHGetAll(t) {
84
79
  return this.initClient.hgetall(t);
85
80
  }
86
81
  }
87
82
  export {
88
- O as CustomCache,
89
- R as RefreshState
83
+ N as CustomCache,
84
+ d as RefreshState
90
85
  };