mp-front-cli 2.3.2 → 2.3.3

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-encrypter.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-encrypter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGhD,qBAAa,eAAgB,SAAQ,aAAa;IAChD,OAAO,CAAC,YAAY,CAA8B;YAEpC,WAAW;cAgBT,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;cAgBrB,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM;cAU5B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAahD,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;CAIlC"}
1
+ {"version":3,"file":"custom-encrypter.d.ts","sourceRoot":"","sources":["../../../src/core/utils/custom-encrypter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGhD,qBAAa,eAAgB,SAAQ,aAAa;IAChD,OAAO,CAAC,YAAY,CAAoC;YAE1C,WAAW;cAgBT,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;cAarB,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM;cAQ5B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAahD,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;CAIlC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("./custom-redis-BaTLH6jE.cjs"),$=require("./stringify-BN6t_WDt.cjs");let w;const q=new Uint8Array(16);function G(){if(!w&&(w=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!w))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return w(q)}const H=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),E={randomUUID:H};function L(r,s,i){if(E.randomUUID&&!r)return E.randomUUID();r=r||{};const c=r.random||(r.rng||G)();return c[6]=c[6]&15|64,c[8]=c[8]&63|128,$.unsafeStringify(c)}const C=process.env.PREFIX_LOGIN,b=process.env.TIMEOUT_SESSION_MINUTES,A={baseKeyPrefix:`${C}:`,userKeyPrefix:"user:",accountKeyPrefix:"account:",accountByUserIdPrefix:"account:user:",sessionKeyPrefix:"session:",sessionByUserIdPrefix:"session:user:",userByEmailKeyPrefix:"user:email:",verificationKeyPrefix:"verification:",expire:b*60},z=r=>{for(const s in r)return!1;return!0},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));function W(r={expire:b*60}){const s=Z.CustomRedis,i={...A,...r},c=i.baseKeyPrefix||"",B=c+i.userKeyPrefix,T=c+i.userByEmailKeyPrefix,k=c+i.accountKeyPrefix,R=c+i.accountByUserIdPrefix,j=c+i.sessionKeyPrefix,D=c+i.sessionByUserIdPrefix,V=c+i.verificationKeyPrefix,x=e=>T+e,U=e=>B+e,g=e=>k+e,y=e=>R+e,K=(e,t)=>`${t}:${e}`,p=e=>j+e,f=e=>D+e,I=e=>V+e,l=async(e,t)=>{const n=Object.entries(t).reduce((o,[P,a])=>(o[P]=a instanceof Date?a.toISOString():a,o),{});await s.hset(e,n),await s.expire(e,i.expire)},d=async e=>{const t=await s.hgetall(e);return!t||z(t)?null:Object.entries(t).reduce((o,[P,a])=>(o[P]=Q(a)?new Date(a):a,o),{})},S=async(e,t)=>(await l(U(e),t),t.email&&await s.set(x(t.email),e,"EX",i.expire),t),u=async e=>{const t=await d(U(e));return t?{...t}:null},N=async(e,t)=>{const n=g(e);await l(n,t),await s.set(y(t.userId),n,"EX",i.expire)},h=async e=>{const t=await d(g(e));return t?{...t}:null},_=async e=>{const t=g(e),n=await d(t);if(!n)return null;await s.hdel(t),await s.del(y(n.userId))},O=async(e,t)=>{const n=p(e);return await l(n,t),await s.set(f(t.userId),n,"EX",i.expire),t},m=async e=>{const t=await d(p(e));return t?{id:t.id,...t}:null},M=async e=>{const t=await m(e);if(!t)return null;const n=p(e);await s.del(n),await s.del(f(t.userId))},X=async(e,t)=>{const n=I(e);return await l(n,t),t},v=async e=>{const t=I(e),n=await d(t);return n?{identifier:n.identifier,...n}:null},F=async e=>{const t=I(e);await s.del(t)};return{async createUser(e){const t=L();return await S(t,{...e,id:t})},getUser:u,async getUserByEmail(e){const t=await s.get(x(e));return t?await u(t):null},async getUserByAccount({providerAccountId:e,provider:t}){const n=await h(K(e,t));return n?await u(n.userId):null},async updateUser(e){const t=e.id,n=await u(t);return await S(t,{...n,...e})},async deleteUser(e){const t=await u(e);if(!t)return null;const n=await s.get(y(e)),o=await s.get(f(e));await s.del(x(t.email),y(e),f(e)),o&&await s.del(o),n&&await s.del(n),await s.del(U(e))},async linkAccount(e){const t=K(e.providerAccountId,e.provider);return await N(t,{...e,id:t})},async unlinkAccount({providerAccountId:e,provider:t}){const n=K(e,t);await _(n)},async createSession(e){const t=e.sessionToken;return await O(t,{...e,id:t})},async getSessionAndUser(e){const n=await m(e);if(!n)return null;const o=await u(n.userId);return o?{session:n,user:o}:null},async updateSession(e){const t=e.sessionToken,n=await m(t);return n?await O(t,{...n,...e}):null},deleteSession:M,async createVerificationToken(e){const t=e.identifier;return await X(t,e),e},async useVerificationToken(e){const t=e.identifier,n=await v(t);return!n||e.token!==n.token?null:(await F(t),n)}}}exports.IORedisAdapter=W;exports.defaultOptions=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./custom-redis-BaTLH6jE.cjs"),Z=require("./stringify-Ixz5_KTs.cjs"),$=new Uint8Array(16);function q(){return crypto.getRandomValues($)}function v(r,s,i){return crypto.randomUUID?crypto.randomUUID():G(r)}function G(r,s,i){var y;r=r||{};const c=r.random??((y=r.rng)==null?void 0:y.call(r))??q();if(c.length<16)throw new Error("Random bytes length must be >= 16");return c[6]=c[6]&15|64,c[8]=c[8]&63|128,Z.unsafeStringify(c)}const H=process.env.PREFIX_LOGIN,b=process.env.TIMEOUT_SESSION_MINUTES,p={baseKeyPrefix:`${H}:`,userKeyPrefix:"user:",accountKeyPrefix:"account:",accountByUserIdPrefix:"account:user:",sessionKeyPrefix:"session:",sessionByUserIdPrefix:"session:user:",userByEmailKeyPrefix:"user:email:",verificationKeyPrefix:"verification:",expire:b*60},L=r=>{for(const s in r)return!1;return!0},C=/(\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))/,z=r=>r&&C.test(r)&&!Number.isNaN(Date.parse(r));function J(r={expire:b*60}){const s=F.CustomRedis,i={...p,...r},c=i.baseKeyPrefix||"",y=c+i.userKeyPrefix,A=c+i.userByEmailKeyPrefix,B=c+i.accountKeyPrefix,T=c+i.accountByUserIdPrefix,k=c+i.sessionKeyPrefix,j=c+i.sessionByUserIdPrefix,N=c+i.verificationKeyPrefix,x=e=>A+e,K=e=>y+e,g=e=>B+e,f=e=>T+e,I=(e,t)=>`${t}:${e}`,P=e=>k+e,l=e=>j+e,U=e=>N+e,w=async(e,t)=>{const n=Object.entries(t).reduce((a,[S,o])=>(a[S]=o instanceof Date?o.toISOString():o,a),{});await s.hset(e,n),await s.expire(e,i.expire)},d=async e=>{const t=await s.hgetall(e);return!t||L(t)?null:Object.entries(t).reduce((a,[S,o])=>(a[S]=z(o)?new Date(o):o,a),{})},O=async(e,t)=>(await w(K(e),t),t.email&&await s.set(x(t.email),e,"EX",i.expire),t),u=async e=>{const t=await d(K(e));return t?{...t}:null},R=async(e,t)=>{const n=g(e);await w(n,t),await s.set(f(t.userId),n,"EX",i.expire)},h=async e=>{const t=await d(g(e));return t?{...t}:null},_=async e=>{const t=g(e),n=await d(t);if(!n)return null;await s.hdel(t),await s.del(f(n.userId))},E=async(e,t)=>{const n=P(e);return await w(n,t),await s.set(l(t.userId),n,"EX",i.expire),t},m=async e=>{const t=await d(P(e));return t?{id:t.id,...t}:null},D=async e=>{const t=await m(e);if(!t)return null;const n=P(e);await s.del(n),await s.del(l(t.userId))},V=async(e,t)=>{const n=U(e);return await w(n,t),t},M=async e=>{const t=U(e),n=await d(t);return n?{identifier:n.identifier,...n}:null},X=async e=>{const t=U(e);await s.del(t)};return{async createUser(e){const t=v();return await O(t,{...e,id:t})},getUser:u,async getUserByEmail(e){const t=await s.get(x(e));return t?await u(t):null},async getUserByAccount({providerAccountId:e,provider:t}){const n=await h(I(e,t));return n?await u(n.userId):null},async updateUser(e){const t=e.id,n=await u(t);return await O(t,{...n,...e})},async deleteUser(e){const t=await u(e);if(!t)return null;const n=await s.get(f(e)),a=await s.get(l(e));await s.del(x(t.email),f(e),l(e)),a&&await s.del(a),n&&await s.del(n),await s.del(K(e))},async linkAccount(e){const t=I(e.providerAccountId,e.provider);return await R(t,{...e,id:t})},async unlinkAccount({providerAccountId:e,provider:t}){const n=I(e,t);await _(n)},async createSession(e){const t=e.sessionToken;return await E(t,{...e,id:t})},async getSessionAndUser(e){const n=await m(e);if(!n)return null;const a=await u(n.userId);return a?{session:n,user:a}:null},async updateSession(e){const t=e.sessionToken,n=await m(t);return n?await E(t,{...n,...e}):null},deleteSession:D,async createVerificationToken(e){const t=e.identifier;return await V(t,e),e},async useVerificationToken(e){const t=e.identifier,n=await M(t);return!n||e.token!==n.token?null:(await X(t),n)}}}exports.IORedisAdapter=J;exports.defaultOptions=p;
@@ -1,24 +1,22 @@
1
- import { C as Z } from "./custom-redis-BMPP_XZi.js";
2
- import { u as $ } from "./stringify-93tp0umt.js";
3
- let w;
4
- const v = new Uint8Array(16);
5
- function C() {
6
- if (!w && (w = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !w))
7
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
8
- return w(v);
1
+ import { C as M } from "./custom-redis-BMPP_XZi.js";
2
+ import { u as F } from "./stringify-BbkhfUoJ.js";
3
+ const Z = new Uint8Array(16);
4
+ function $() {
5
+ return crypto.getRandomValues(Z);
9
6
  }
10
- const G = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), O = {
11
- randomUUID: G
12
- };
13
- function H(r, s, i) {
14
- if (O.randomUUID && !r)
15
- return O.randomUUID();
7
+ function C(r, s, i) {
8
+ return crypto.randomUUID ? crypto.randomUUID() : G(r);
9
+ }
10
+ function G(r, s, i) {
11
+ var y;
16
12
  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);
13
+ const c = r.random ?? ((y = r.rng) == null ? void 0 : y.call(r)) ?? $();
14
+ if (c.length < 16)
15
+ throw new Error("Random bytes length must be >= 16");
16
+ return c[6] = c[6] & 15 | 64, c[8] = c[8] & 63 | 128, F(c);
19
17
  }
20
- const L = process.env.PREFIX_LOGIN, b = process.env.TIMEOUT_SESSION_MINUTES, q = {
21
- baseKeyPrefix: `${L}:`,
18
+ const H = process.env.PREFIX_LOGIN, b = process.env.TIMEOUT_SESSION_MINUTES, L = {
19
+ baseKeyPrefix: `${H}:`,
22
20
  userKeyPrefix: "user:",
23
21
  accountKeyPrefix: "account:",
24
22
  accountByUserIdPrefix: "account:user:",
@@ -27,76 +25,76 @@ const L = process.env.PREFIX_LOGIN, b = process.env.TIMEOUT_SESSION_MINUTES, q =
27
25
  userByEmailKeyPrefix: "user:email:",
28
26
  verificationKeyPrefix: "verification:",
29
27
  expire: b * 60
30
- }, z = (r) => {
28
+ }, v = (r) => {
31
29
  for (const s in r)
32
30
  return !1;
33
31
  return !0;
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 = {
37
- ...q,
32
+ }, q = /(\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))/, z = (r) => r && q.test(r) && !Number.isNaN(Date.parse(r));
33
+ function W(r = { expire: b * 60 }) {
34
+ const s = M, i = {
35
+ ...L,
38
36
  ...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), {});
37
+ }, c = i.baseKeyPrefix || "", y = c + i.userKeyPrefix, p = c + i.userByEmailKeyPrefix, A = c + i.accountKeyPrefix, B = c + i.accountByUserIdPrefix, k = c + i.sessionKeyPrefix, T = c + i.sessionByUserIdPrefix, N = c + i.verificationKeyPrefix, x = (e) => p + e, K = (e) => y + e, I = (e) => A + e, f = (e) => B + e, U = (e, t) => `${t}:${e}`, g = (e) => k + e, l = (e) => T + e, P = (e) => N + e, w = async (e, t) => {
38
+ const n = Object.entries(t).reduce((a, [E, o]) => (a[E] = o instanceof Date ? o.toISOString() : o, a), {});
41
39
  await s.hset(e, n), await s.expire(e, i.expire);
42
40
  }, d = async (e) => {
43
41
  const t = await s.hgetall(e);
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(
42
+ return !t || v(t) ? null : Object.entries(t).reduce((a, [E, o]) => (a[E] = z(o) ? new Date(o) : o, a), {});
43
+ }, S = async (e, t) => (await w(K(e), t), t.email && await s.set(
46
44
  x(t.email),
47
45
  e,
48
46
  "EX",
49
47
  i.expire
50
48
  ), t), u = async (e) => {
51
- const t = await d(U(e));
49
+ const t = await d(K(e));
52
50
  return t ? { ...t } : null;
53
- }, N = async (e, t) => {
54
- const n = K(e);
55
- await l(n, t), await s.set(
56
- y(t.userId),
51
+ }, h = async (e, t) => {
52
+ const n = I(e);
53
+ await w(n, t), await s.set(
54
+ f(t.userId),
57
55
  n,
58
56
  "EX",
59
57
  i.expire
60
58
  );
61
- }, R = async (e) => {
62
- const t = await d(K(e));
59
+ }, j = async (e) => {
60
+ const t = await d(I(e));
63
61
  return t ? { ...t } : null;
64
- }, h = async (e) => {
65
- const t = K(e), n = await d(t);
62
+ }, _ = async (e) => {
63
+ const t = I(e), n = await d(t);
66
64
  if (!n) return null;
67
- await s.hdel(t), await s.del(y(n.userId));
68
- }, E = async (e, t) => {
69
- const n = I(e);
70
- return await l(n, t), await s.set(
71
- f(t.userId),
65
+ await s.hdel(t), await s.del(f(n.userId));
66
+ }, O = async (e, t) => {
67
+ const n = g(e);
68
+ return await w(n, t), await s.set(
69
+ l(t.userId),
72
70
  n,
73
71
  "EX",
74
72
  i.expire
75
73
  ), t;
76
74
  }, m = async (e) => {
77
- const t = await d(I(e));
75
+ const t = await d(g(e));
78
76
  return t ? {
79
77
  id: t.id,
80
78
  ...t
81
79
  } : null;
82
- }, _ = async (e) => {
80
+ }, D = async (e) => {
83
81
  const t = await m(e);
84
82
  if (!t) return null;
85
- const n = I(e);
86
- await s.del(n), await s.del(f(t.userId));
87
- }, X = async (e, t) => {
88
83
  const n = g(e);
89
- return await l(n, t), t;
90
- }, M = async (e) => {
91
- const t = g(e), n = await d(t);
84
+ await s.del(n), await s.del(l(t.userId));
85
+ }, R = async (e, t) => {
86
+ const n = P(e);
87
+ return await w(n, t), t;
88
+ }, V = async (e) => {
89
+ const t = P(e), n = await d(t);
92
90
  return n ? { identifier: n.identifier, ...n } : null;
93
- }, F = async (e) => {
94
- const t = g(e);
91
+ }, X = async (e) => {
92
+ const t = P(e);
95
93
  await s.del(t);
96
94
  };
97
95
  return {
98
96
  async createUser(e) {
99
- const t = H();
97
+ const t = C();
100
98
  return await S(t, { ...e, id: t });
101
99
  },
102
100
  getUser: u,
@@ -105,8 +103,8 @@ function ee(r = { expire: b * 60 }) {
105
103
  return t ? await u(t) : null;
106
104
  },
107
105
  async getUserByAccount({ providerAccountId: e, provider: t }) {
108
- const n = await R(
109
- p(e, t)
106
+ const n = await j(
107
+ U(e, t)
110
108
  );
111
109
  return n ? await u(n.userId) : null;
112
110
  },
@@ -117,27 +115,27 @@ function ee(r = { expire: b * 60 }) {
117
115
  async deleteUser(e) {
118
116
  const t = await u(e);
119
117
  if (!t) return null;
120
- const n = await s.get(y(e)), c = await s.get(f(e));
118
+ const n = await s.get(f(e)), a = await s.get(l(e));
121
119
  await s.del(
122
120
  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));
121
+ f(e),
122
+ l(e)
123
+ ), a && await s.del(a), n && await s.del(n), await s.del(K(e));
126
124
  },
127
125
  async linkAccount(e) {
128
- const t = p(e.providerAccountId, e.provider);
129
- return await N(t, { ...e, id: t });
126
+ const t = U(e.providerAccountId, e.provider);
127
+ return await h(t, { ...e, id: t });
130
128
  },
131
129
  async unlinkAccount({
132
130
  providerAccountId: e,
133
131
  provider: t
134
132
  }) {
135
- const n = p(e, t);
136
- await h(n);
133
+ const n = U(e, t);
134
+ await _(n);
137
135
  },
138
136
  async createSession(e) {
139
137
  const t = e.sessionToken;
140
- return await E(t, {
138
+ return await O(t, {
141
139
  ...e,
142
140
  id: t
143
141
  });
@@ -145,25 +143,25 @@ function ee(r = { expire: b * 60 }) {
145
143
  async getSessionAndUser(e) {
146
144
  const n = await m(e);
147
145
  if (!n) return null;
148
- const c = await u(n.userId);
149
- return c ? { session: n, user: c } : null;
146
+ const a = await u(n.userId);
147
+ return a ? { session: n, user: a } : null;
150
148
  },
151
149
  async updateSession(e) {
152
150
  const t = e.sessionToken, n = await m(t);
153
- return n ? await E(t, { ...n, ...e }) : null;
151
+ return n ? await O(t, { ...n, ...e }) : null;
154
152
  },
155
- deleteSession: _,
153
+ deleteSession: D,
156
154
  async createVerificationToken(e) {
157
155
  const t = e.identifier;
158
- return await X(t, e), e;
156
+ return await R(t, e), e;
159
157
  },
160
158
  async useVerificationToken(e) {
161
- const t = e.identifier, n = await M(t);
162
- return !n || e.token !== n.token ? null : (await F(t), n);
159
+ const t = e.identifier, n = await V(t);
160
+ return !n || e.token !== n.token ? null : (await X(t), n);
163
161
  }
164
162
  };
165
163
  }
166
164
  export {
167
- ee as IORedisAdapter,
168
- q as defaultOptions
165
+ W as IORedisAdapter,
166
+ L as defaultOptions
169
167
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./AuthEngine-DF2swG3Z.cjs"),r=require("./loading-handler-CVkAHN_A.cjs"),n=require("./service-token-CPZee3-I.cjs");exports.ApiMiddleware=e.ApiMiddleware;exports.AuthEngine=e.AuthEngine;exports.ErrorCatalog=e.ErrorCatalog;exports.Exception=e.Exception;exports.FetchServiceBE=e.FetchServiceBE;exports.FetchServiceFE=e.FetchServiceFE;exports.FetchServiceParentBE=e.FetchServiceParentBE;exports.LoadingHandler=r.LoadingHandler;exports.MessageHandler=r.MessageHandler;exports.RxSubjectManager=r.RxSubjectManager;exports.ServiceToken=n.ServiceToken;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./AuthEngine-CDNhQfnX.cjs"),r=require("./loading-handler-CVkAHN_A.cjs"),n=require("./service-token-CPZee3-I.cjs");exports.ApiMiddleware=e.ApiMiddleware;exports.AuthEngine=e.AuthEngine;exports.ErrorCatalog=e.ErrorCatalog;exports.Exception=e.Exception;exports.FetchServiceBE=e.FetchServiceBE;exports.FetchServiceFE=e.FetchServiceFE;exports.FetchServiceParentBE=e.FetchServiceParentBE;exports.LoadingHandler=r.LoadingHandler;exports.MessageHandler=r.MessageHandler;exports.RxSubjectManager=r.RxSubjectManager;exports.ServiceToken=n.ServiceToken;
@@ -1,4 +1,4 @@
1
- import { A as r, a as s, E as o, b as t, F as c, c as i, d as n } from "./AuthEngine-EDmxrdis.js";
1
+ import { A as r, a as s, E as o, b as t, F as c, c as i, d as n } from "./AuthEngine-T4Nti8Ya.js";
2
2
  import { L as d, M as S, R as g } from "./loading-handler-Br21zGTA.js";
3
3
  import { S as x } from "./service-token-BfQQMCM4.js";
4
4
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./AuthEngine-DF2swG3Z.cjs"),r=require("./loading-handler-CVkAHN_A.cjs"),n=require("./service-token-CPZee3-I.cjs");exports.ApiMiddleware=e.ApiMiddleware;exports.AuthEngine=e.AuthEngine;exports.ErrorCatalog=e.ErrorCatalog;exports.Exception=e.Exception;exports.FetchServiceBE=e.FetchServiceBE;exports.FetchServiceFE=e.FetchServiceFE;exports.FetchServiceParentBE=e.FetchServiceParentBE;exports.LoadingHandler=r.LoadingHandler;exports.MessageHandler=r.MessageHandler;exports.RxSubjectManager=r.RxSubjectManager;exports.ServiceToken=n.ServiceToken;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./AuthEngine-CDNhQfnX.cjs"),r=require("./loading-handler-CVkAHN_A.cjs"),n=require("./service-token-CPZee3-I.cjs");exports.ApiMiddleware=e.ApiMiddleware;exports.AuthEngine=e.AuthEngine;exports.ErrorCatalog=e.ErrorCatalog;exports.Exception=e.Exception;exports.FetchServiceBE=e.FetchServiceBE;exports.FetchServiceFE=e.FetchServiceFE;exports.FetchServiceParentBE=e.FetchServiceParentBE;exports.LoadingHandler=r.LoadingHandler;exports.MessageHandler=r.MessageHandler;exports.RxSubjectManager=r.RxSubjectManager;exports.ServiceToken=n.ServiceToken;
@@ -1,4 +1,4 @@
1
- import { A as r, a as s, E as o, b as t, F as c, c as i, d as n } from "./AuthEngine-EDmxrdis.js";
1
+ import { A as r, a as s, E as o, b as t, F as c, c as i, d as n } from "./AuthEngine-T4Nti8Ya.js";
2
2
  import { L as d, M as S, R as g } from "./loading-handler-Br21zGTA.js";
3
3
  import { S as x } from "./service-token-BfQQMCM4.js";
4
4
  export {
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var o=(r,t,e)=>t in r?c(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var i=(r,t,e)=>o(r,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("node-jose"),y=require("crypto"),E=require("./mp-front-cli-encoder.cjs"),u=r=>r.replace(/[\u00A0-\uffff]/gu,t=>"\\u"+("000"+t.charCodeAt(0).toString(16)).slice(-4));class g extends E.CustomEncoder{constructor(){super(...arguments);i(this,"signatureKey")}async generateKey(){const e=process.env.SECRET_SIGNATURE;if(!e)throw new Error("Define a SECRET_SIGNATURE from `.env`");this.signatureKey=await s.JWK.asKey({kty:"oct",k:s.util.base64url.encode(e)})}async encrypt(e){if(await this.generateKey(),!this.signatureKey)throw new Error("PLEASE CREATE A KEY TO ENCRYPT 🙂");const n=JSON.stringify(e),a=u(n);return await s.JWE.createEncrypt({format:"compact"},this.signatureKey).update(a).final()}async decrypt(e){if(await this.generateKey(),!this.signatureKey)throw new Error("PLEASE CREATE A KEY TO DECRYPT 🙂");const{payload:n}=await s.JWE.createDecrypt(this.signatureKey).decrypt(e);return JSON.parse(n.toString())}async isEncrypted(e){this.logInfo("EncryptionHandler",e);try{return await this.decrypt(e??""),this.logDebug("EncryptionHandler","IS ENCRYPTED 🥵"),!0}catch(n){return this.logWarn("EncryptionHandler",JSON.stringify(n)),this.logDebug("EncryptionHandler","IS NOT ENCRYPTED 🙂"),!1}}generateSHA(e){const n=JSON.stringify(e);return y.createHash("sha256").update(n).digest("hex")}}exports.CustomEncrypter=g;
1
+ "use strict";var o=Object.defineProperty;var a=(r,t,e)=>t in r?o(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var s=(r,t,e)=>a(r,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("jose"),E=require("crypto"),y=require("./mp-front-cli-encoder.cjs"),u=r=>r.replace(/[\u00A0-\uffff]/gu,t=>"\\u"+("000"+t.charCodeAt(0).toString(16)).slice(-4));class d extends y.CustomEncoder{constructor(){super(...arguments);s(this,"signatureKey")}async generateKey(){const e=process.env.SECRET_SIGNATURE;if(!e)throw new Error("Define a SECRET_SIGNATURE from `.env`");this.signatureKey=await c.importJWK({kty:"oct",k:c.base64url.encode(new TextEncoder().encode(e))})}async encrypt(e){if(await this.generateKey(),!this.signatureKey)throw new Error("PLEASE CREATE A KEY TO ENCRYPT 🙂");const n=JSON.stringify(e),i=u(n);return await new c.CompactEncrypt(new TextEncoder().encode(i)).setProtectedHeader({alg:"A256KW",enc:"A256GCM"}).encrypt(this.signatureKey)}async decrypt(e){if(await this.generateKey(),!this.signatureKey)throw new Error("PLEASE CREATE A KEY TO DECRYPT 🙂");const{plaintext:n}=await c.compactDecrypt(e,this.signatureKey);return JSON.parse(new TextDecoder().decode(n))}async isEncrypted(e){this.logInfo("EncryptionHandler",e);try{return await this.decrypt(e??""),this.logDebug("EncryptionHandler","IS ENCRYPTED 🥵"),!0}catch(n){return this.logWarn("EncryptionHandler",JSON.stringify(n)),this.logDebug("EncryptionHandler","IS NOT ENCRYPTED 🙂"),!1}}generateSHA(e){const n=JSON.stringify(e);return E.createHash("sha256").update(n).digest("hex")}}exports.CustomEncrypter=d;
@@ -1,52 +1,47 @@
1
- var o = Object.defineProperty;
2
- var c = (r, e, t) => e in r ? o(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var i = (r, e, t) => c(r, typeof e != "symbol" ? e + "" : e, t);
4
- import a from "node-jose";
5
- import { createHash as E } from "crypto";
6
- import { CustomEncoder as y } from "./mp-front-cli-encoder.js";
7
- const p = (r) => r.replace(/[\u00A0-\uffff]/gu, (e) => "\\u" + ("000" + e.charCodeAt(0).toString(16)).slice(-4));
8
- class S extends y {
1
+ var s = Object.defineProperty;
2
+ var a = (r, t, e) => t in r ? s(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var i = (r, t, e) => a(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { importJWK as c, base64url as E, CompactEncrypt as y, compactDecrypt as p } from "jose";
5
+ import { createHash as d } from "crypto";
6
+ import { CustomEncoder as g } from "./mp-front-cli-encoder.js";
7
+ const u = (r) => r.replace(/[\u00A0-\uffff]/gu, (t) => "\\u" + ("000" + t.charCodeAt(0).toString(16)).slice(-4));
8
+ class l extends g {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
  i(this, "signatureKey");
12
12
  }
13
13
  async generateKey() {
14
- const t = process.env.SECRET_SIGNATURE;
15
- if (!t)
14
+ const e = process.env.SECRET_SIGNATURE;
15
+ if (!e)
16
16
  throw new Error("Define a SECRET_SIGNATURE from `.env`");
17
- this.signatureKey = await a.JWK.asKey({
17
+ this.signatureKey = await c({
18
18
  kty: "oct",
19
- k: a.util.base64url.encode(t)
19
+ k: E.encode(new TextEncoder().encode(e))
20
20
  });
21
21
  }
22
- async encrypt(t) {
22
+ async encrypt(e) {
23
23
  if (await this.generateKey(), !this.signatureKey) throw new Error("PLEASE CREATE A KEY TO ENCRYPT 🙂");
24
- const n = JSON.stringify(t), s = p(n);
25
- return await a.JWE.createEncrypt(
26
- { format: "compact" },
27
- this.signatureKey
28
- ).update(s).final();
24
+ const n = JSON.stringify(e), o = u(n);
25
+ return await new y(new TextEncoder().encode(o)).setProtectedHeader({ alg: "A256KW", enc: "A256GCM" }).encrypt(this.signatureKey);
29
26
  }
30
- async decrypt(t) {
27
+ async decrypt(e) {
31
28
  if (await this.generateKey(), !this.signatureKey) throw new Error("PLEASE CREATE A KEY TO DECRYPT 🙂");
32
- const { payload: n } = await a.JWE.createDecrypt(
33
- this.signatureKey
34
- ).decrypt(t);
35
- return JSON.parse(n.toString());
29
+ const { plaintext: n } = await p(e, this.signatureKey);
30
+ return JSON.parse(new TextDecoder().decode(n));
36
31
  }
37
- async isEncrypted(t) {
38
- this.logInfo("EncryptionHandler", t);
32
+ async isEncrypted(e) {
33
+ this.logInfo("EncryptionHandler", e);
39
34
  try {
40
- return await this.decrypt(t ?? ""), this.logDebug("EncryptionHandler", "IS ENCRYPTED 🥵"), !0;
35
+ return await this.decrypt(e ?? ""), this.logDebug("EncryptionHandler", "IS ENCRYPTED 🥵"), !0;
41
36
  } catch (n) {
42
37
  return this.logWarn("EncryptionHandler", JSON.stringify(n)), this.logDebug("EncryptionHandler", "IS NOT ENCRYPTED 🙂"), !1;
43
38
  }
44
39
  }
45
- generateSHA(t) {
46
- const n = JSON.stringify(t);
47
- return E("sha256").update(n).digest("hex");
40
+ generateSHA(e) {
41
+ const n = JSON.stringify(e);
42
+ return d("sha256").update(n).digest("hex");
48
43
  }
49
44
  }
50
45
  export {
51
- S as CustomEncrypter
46
+ l as CustomEncrypter
52
47
  };
@@ -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]]).toLowerCase();
6
+ }
7
+ export {
8
+ c as u
9
+ };
@@ -1 +1 @@
1
- "use strict";const n=[];for(let i=0;i<256;++i)n.push((i+256).toString(16).slice(1));function c(i,u=0){return n[i[u+0]]+n[i[u+1]]+n[i[u+2]]+n[i[u+3]]+"-"+n[i[u+4]]+n[i[u+5]]+"-"+n[i[u+6]]+n[i[u+7]]+"-"+n[i[u+8]]+n[i[u+9]]+"-"+n[i[u+10]]+n[i[u+11]]+n[i[u+12]]+n[i[u+13]]+n[i[u+14]]+n[i[u+15]]}exports.unsafeStringify=c;
1
+ "use strict";const n=[];for(let i=0;i<256;++i)n.push((i+256).toString(16).slice(1));function c(i,u=0){return(n[i[u+0]]+n[i[u+1]]+n[i[u+2]]+n[i[u+3]]+"-"+n[i[u+4]]+n[i[u+5]]+"-"+n[i[u+6]]+n[i[u+7]]+"-"+n[i[u+8]]+n[i[u+9]]+"-"+n[i[u+10]]+n[i[u+11]]+n[i[u+12]]+n[i[u+13]]+n[i[u+14]]+n[i[u+15]]).toLowerCase()}exports.unsafeStringify=c;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-front-cli",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/mp-front-cli-all.cjs",
@@ -82,18 +82,17 @@
82
82
  "peerDependencies": {
83
83
  "i18next": "25.2.0",
84
84
  "ioredis": "5.3.2",
85
- "next-auth": "4.24.13",
86
- "node-jose": "2.2.0",
85
+ "jose": "6.2.2",
86
+ "next-auth": "4.24.14",
87
87
  "rxjs": "7.8.1"
88
88
  },
89
89
  "dependencies": {
90
- "uuid": "9.0.1"
90
+ "uuid": "14.0.0"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@eslint/eslintrc": "3.2.0",
94
94
  "@eslint/js": "9.19.0",
95
95
  "@types/node": "20.10.6",
96
- "@types/node-jose": "1.1.13",
97
96
  "@types/uuid": "10.0.0",
98
97
  "@typescript-eslint/eslint-plugin": "8.22.0",
99
98
  "eslint": "9.38.0",
@@ -102,7 +101,7 @@
102
101
  "globals": "15.14.0",
103
102
  "husky": "9.1.7",
104
103
  "typescript": "5.7.2",
105
- "vite": "6.4.1",
104
+ "vite": "6.4.2",
106
105
  "vite-plugin-dts": "4.5.0",
107
106
  "vite-tsconfig-paths": "5.1.4"
108
107
  }
@@ -1,9 +0,0 @@
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
- };