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