@hostlink/light 1.2.5 → 2.0.0
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/auth.d.ts +14 -11
- package/dist/config.d.ts +4 -0
- package/dist/createClient.d.ts +28 -0
- package/dist/fs.d.ts +19 -10
- package/dist/gqlBuilder.d.ts +2 -1
- package/dist/index.d.ts +1 -8
- package/dist/light.js +449 -433
- package/dist/light.umd.cjs +1 -1
- package/dist/mail.d.ts +5 -0
- package/dist/model.d.ts +6 -8
- package/dist/models.d.ts +8 -0
- package/dist/mutation.d.ts +2 -1
- package/dist/query.d.ts +2 -1
- package/dist/roles.d.ts +5 -0
- package/dist/roles.test.d.ts +1 -0
- package/dist/toQuery.d.ts +1 -1
- package/dist/users.d.ts +5 -0
- package/dist/webauthn.d.ts +6 -0
- package/package.json +4 -3
- package/dist/apiUrl.d.ts +0 -2
- package/dist/axios.d.ts +0 -4
- package/dist/getConfig.d.ts +0 -2
- package/dist/granted.d.ts +0 -1
- package/dist/sendMail.d.ts +0 -2
- package/dist/uploadFile.d.ts +0 -1
- package/dist/webauthnLogin.d.ts +0 -1
- package/dist/webauthnRegister.d.ts +0 -1
- /package/dist/{login.test.d.ts → auth.test.d.ts} +0 -0
package/dist/light.js
CHANGED
|
@@ -1,249 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
old_password: e,
|
|
9
|
-
new_password: t
|
|
10
|
-
}), ie = (e, t, r) => u("resetPassword", {
|
|
11
|
-
email: e,
|
|
12
|
-
password: t,
|
|
13
|
-
code: r
|
|
14
|
-
}), ae = (e) => u("forgetPassword", {
|
|
15
|
-
email: e
|
|
16
|
-
});
|
|
17
|
-
let O;
|
|
18
|
-
const oe = (e) => {
|
|
19
|
-
O = e;
|
|
20
|
-
}, E = () => (O || (O = T.create({
|
|
21
|
-
withCredentials: !0
|
|
22
|
-
})), O), ce = async (e) => (await b({
|
|
23
|
-
granted: {
|
|
24
|
-
__args: {
|
|
25
|
-
rights: e
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
})).granted, C = {}, le = (e, t) => {
|
|
29
|
-
C[e] = {};
|
|
30
|
-
for (const r of Object.entries(t)) {
|
|
31
|
-
const [s, n] = r;
|
|
32
|
-
C[e][s] = () => ({
|
|
33
|
-
name: n.name ? n.name : s,
|
|
34
|
-
raw: n,
|
|
35
|
-
getName: () => n.name ? n.name : s,
|
|
36
|
-
getGQLField: () => n.gqlField !== void 0 ? n.gqlField : n.name || s,
|
|
37
|
-
getRaw() {
|
|
38
|
-
return n;
|
|
39
|
-
},
|
|
40
|
-
getValue(a) {
|
|
41
|
-
return n.field && typeof n.field == "function" ? n.field(a) : n.field && typeof n.field == "string" ? a[n.field] : a[this.getName()];
|
|
42
|
-
},
|
|
43
|
-
getFormattedValue(a) {
|
|
44
|
-
const l = this.getValue(a);
|
|
45
|
-
return n.format ? n.format(l) : l;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}, L = (e, t) => !C[e] || !C[e][t] ? null : C[e][t](), ue = (e, t) => {
|
|
50
|
-
const r = [];
|
|
51
|
-
for (const s of t)
|
|
52
|
-
if (typeof s == "string") {
|
|
53
|
-
const n = L(e, s);
|
|
54
|
-
n && r.push(n.getGQLField());
|
|
55
|
-
} else
|
|
56
|
-
typeof s == "object" && r.push(s);
|
|
57
|
-
return r;
|
|
58
|
-
}, fe = (e) => {
|
|
59
|
-
const t = e;
|
|
60
|
-
return {
|
|
61
|
-
name: t,
|
|
62
|
-
$fields: C[e],
|
|
63
|
-
async update(r, s) {
|
|
64
|
-
return await u("update" + t, { id: r, data: s });
|
|
65
|
-
},
|
|
66
|
-
async delete(r) {
|
|
67
|
-
return await u("delete" + t, { id: r });
|
|
68
|
-
},
|
|
69
|
-
async add(r) {
|
|
70
|
-
return await u("add" + t, { data: r });
|
|
71
|
-
},
|
|
72
|
-
fields(r) {
|
|
73
|
-
let s = [];
|
|
74
|
-
for (let n of r) {
|
|
75
|
-
const a = L(t, n);
|
|
76
|
-
a && s.push(a);
|
|
77
|
-
}
|
|
78
|
-
return s;
|
|
79
|
-
},
|
|
80
|
-
async get(r, s) {
|
|
81
|
-
return (await b({
|
|
82
|
-
["list" + t]: {
|
|
83
|
-
__args: {
|
|
84
|
-
filters: r
|
|
85
|
-
},
|
|
86
|
-
data: {
|
|
87
|
-
__args: {
|
|
88
|
-
limit: 1
|
|
89
|
-
},
|
|
90
|
-
...S(s)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}))["list" + t].data[0];
|
|
94
|
-
},
|
|
95
|
-
async list(r, s) {
|
|
96
|
-
return (await b({
|
|
97
|
-
["list" + t]: {
|
|
98
|
-
__args: {
|
|
99
|
-
filters: r
|
|
100
|
-
},
|
|
101
|
-
data: {
|
|
102
|
-
...S(s)
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}))["list" + t].data;
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
function M(e) {
|
|
110
|
-
e = "<~" + e + "~>";
|
|
111
|
-
var t, r, s, n, a, l = String, p = 255;
|
|
112
|
-
for (e.slice(0, 2) === "<~" && e.slice(-2), e = e.slice(2, -2).replace(/\s/g, "").replace("z", "!!!!!"), t = "uuuuu".slice(e.length % 5 || 5), e += t, s = [], n = 0, a = e.length; a > n; n += 5)
|
|
113
|
-
r = 52200625 * (e.charCodeAt(n) - 33) + 614125 * (e.charCodeAt(n + 1) - 33) + 7225 * (e.charCodeAt(n + 2) - 33) + 85 * (e.charCodeAt(n + 3) - 33) + (e.charCodeAt(n + 4) - 33), s.push(p & r >> 24, p & r >> 16, p & r >> 8, p & r);
|
|
114
|
-
return function(g, m) {
|
|
115
|
-
for (var _ = m; _ > 0; _--)
|
|
116
|
-
g.pop();
|
|
117
|
-
}(s, t.length), l.fromCharCode.apply(l, s);
|
|
1
|
+
import { jsonToGraphQLQuery as E, VariableType as S } from "json-to-graphql-query";
|
|
2
|
+
import L from "axios";
|
|
3
|
+
function j(e) {
|
|
4
|
+
const t = "==".slice(0, (4 - e.length % 4) % 4), r = e.replace(/-/g, "+").replace(/_/g, "/") + t, n = atob(r), s = new ArrayBuffer(n.length), a = new Uint8Array(s);
|
|
5
|
+
for (let o = 0; o < n.length; o++)
|
|
6
|
+
a[o] = n.charCodeAt(o);
|
|
7
|
+
return s;
|
|
118
8
|
}
|
|
119
|
-
|
|
120
|
-
const t = e, r = (s = "application/octet-stream") => {
|
|
121
|
-
const n = new Uint8Array(t.length);
|
|
122
|
-
for (let p = 0; p < t.length; p++)
|
|
123
|
-
n[p] = t.charCodeAt(p);
|
|
124
|
-
const a = new Blob([n], { type: s });
|
|
125
|
-
return URL.createObjectURL(a);
|
|
126
|
-
};
|
|
127
|
-
return {
|
|
128
|
-
getContent: () => t,
|
|
129
|
-
getURL: r,
|
|
130
|
-
download: (s) => {
|
|
131
|
-
const n = document.createElement("a");
|
|
132
|
-
n.download = s, n.href = r(), document.body.appendChild(n), n.click(), document.body.removeChild(n);
|
|
133
|
-
},
|
|
134
|
-
open: (s) => {
|
|
135
|
-
window.open(r(s), "_blank");
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}, de = {
|
|
139
|
-
fromBase85: (e) => v(M(e)),
|
|
140
|
-
fromBase64: (e) => v(atob(e)),
|
|
141
|
-
fromString: (e) => v(e)
|
|
142
|
-
}, j = (e) => {
|
|
143
|
-
let t = {};
|
|
144
|
-
return typeof e == "string" ? (t[e] = !0, t) : e instanceof Array ? (e.forEach((r) => {
|
|
145
|
-
Object.entries(j(r)).forEach(([s, n]) => {
|
|
146
|
-
t[s] = n;
|
|
147
|
-
});
|
|
148
|
-
}), t) : (Object.entries(e).forEach(([r, s]) => {
|
|
149
|
-
if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
|
|
150
|
-
t[r] = s;
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
if (typeof s == "boolean") {
|
|
154
|
-
t[r] = s;
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
t[r] = j(s);
|
|
158
|
-
}), t);
|
|
159
|
-
}, S = (e) => j(e), b = async (e) => {
|
|
160
|
-
let t = N(S(e));
|
|
161
|
-
const r = await E().post(q(), {
|
|
162
|
-
query: `{ ${t} }`
|
|
163
|
-
});
|
|
164
|
-
if (r.data.errors)
|
|
165
|
-
throw new Error(r.data.errors[0].message);
|
|
166
|
-
return r.data.data;
|
|
167
|
-
};
|
|
168
|
-
function B(e) {
|
|
169
|
-
for (let t = 0; t < e.length; t++)
|
|
170
|
-
if (e[t] instanceof File)
|
|
171
|
-
return !0;
|
|
172
|
-
return !1;
|
|
173
|
-
}
|
|
174
|
-
function Q(e) {
|
|
175
|
-
for (let t in e)
|
|
176
|
-
if (e[t] instanceof File)
|
|
177
|
-
return !0;
|
|
178
|
-
return !1;
|
|
179
|
-
}
|
|
180
|
-
const u = async (e, t = null, r = []) => {
|
|
181
|
-
let s = {
|
|
182
|
-
[e]: {}
|
|
183
|
-
};
|
|
184
|
-
const n = new FormData();
|
|
185
|
-
let a = !1;
|
|
186
|
-
if (t) {
|
|
187
|
-
const g = {}, m = {}, _ = {};
|
|
188
|
-
let w = 0;
|
|
189
|
-
Object.entries(t).forEach(([f, h]) => {
|
|
190
|
-
if (h instanceof Array && B(h)) {
|
|
191
|
-
a = !0;
|
|
192
|
-
let F = 0;
|
|
193
|
-
h.forEach((y) => {
|
|
194
|
-
y instanceof File && (g[f] = new R(f), m[w] = ["variables." + f + "." + F], n.append(w.toString(), y), w++);
|
|
195
|
-
}), _[f] = "[Upload!]!";
|
|
196
|
-
} else
|
|
197
|
-
h instanceof File ? (a = !0, g[f] = new R(f), m[w] = ["variables." + f], n.append(w.toString(), h), _[f] = "Upload!", w++) : h instanceof Object && Q(h) ? (a = !0, g[f] === void 0 && (g[f] = {}), Object.entries(h).forEach(([F, y]) => {
|
|
198
|
-
y instanceof File ? (g[f][F] = new R(F), m[w] = ["variables." + F], n.append(w.toString(), y), _[F] = "Upload!", w++) : g[f][F] = y;
|
|
199
|
-
})) : g[f] = h;
|
|
200
|
-
}), s[e].__args = g, s.__variables = _, a && n.append("map", JSON.stringify(m));
|
|
201
|
-
}
|
|
202
|
-
Object.entries(S(r)).forEach(([g, m]) => {
|
|
203
|
-
s[e][g] = m;
|
|
204
|
-
}), Object.entries(s[e]).length === 0 && (s[e] = !0);
|
|
205
|
-
let l = null;
|
|
206
|
-
const p = N({ mutation: s });
|
|
207
|
-
if (a ? (n.append("operations", JSON.stringify({
|
|
208
|
-
query: p
|
|
209
|
-
})), l = await E().post(q(), n)) : l = await E().post(q(), {
|
|
210
|
-
query: p
|
|
211
|
-
}), l.data.errors)
|
|
212
|
-
throw new Error(l.data.errors[0].message);
|
|
213
|
-
return l.data.data[e];
|
|
214
|
-
};
|
|
215
|
-
let J = "/api/";
|
|
216
|
-
const pe = (e) => {
|
|
217
|
-
J = e;
|
|
218
|
-
}, q = () => J;
|
|
219
|
-
async function ge(e) {
|
|
220
|
-
return u("fsUploadTempFile", {
|
|
221
|
-
file: e
|
|
222
|
-
}, {
|
|
223
|
-
name: !0,
|
|
224
|
-
path: !0,
|
|
225
|
-
size: !0,
|
|
226
|
-
mime: !0
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
const we = (e, t, r) => u("sendMail", {
|
|
230
|
-
email: e,
|
|
231
|
-
subject: t,
|
|
232
|
-
message: r
|
|
233
|
-
}), he = async (e) => (await b({
|
|
234
|
-
config: {
|
|
235
|
-
__args: {
|
|
236
|
-
name: e
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
})).config;
|
|
240
|
-
function U(e) {
|
|
241
|
-
const t = "==".slice(0, (4 - e.length % 4) % 4), r = e.replace(/-/g, "+").replace(/_/g, "/") + t, s = atob(r), n = new ArrayBuffer(s.length), a = new Uint8Array(n);
|
|
242
|
-
for (let l = 0; l < s.length; l++)
|
|
243
|
-
a[l] = s.charCodeAt(l);
|
|
244
|
-
return n;
|
|
245
|
-
}
|
|
246
|
-
function P(e) {
|
|
9
|
+
function N(e) {
|
|
247
10
|
const t = new Uint8Array(e);
|
|
248
11
|
let r = "";
|
|
249
12
|
for (const a of t)
|
|
@@ -253,47 +16,47 @@ function P(e) {
|
|
|
253
16
|
"_"
|
|
254
17
|
).replace(/=/g, "");
|
|
255
18
|
}
|
|
256
|
-
var
|
|
257
|
-
function
|
|
258
|
-
if (t ===
|
|
19
|
+
var l = "copy", m = "convert";
|
|
20
|
+
function C(e, t, r) {
|
|
21
|
+
if (t === l)
|
|
259
22
|
return r;
|
|
260
|
-
if (t ===
|
|
23
|
+
if (t === m)
|
|
261
24
|
return e(r);
|
|
262
25
|
if (t instanceof Array)
|
|
263
|
-
return r.map((
|
|
26
|
+
return r.map((n) => C(e, t[0], n));
|
|
264
27
|
if (t instanceof Object) {
|
|
265
|
-
const
|
|
266
|
-
for (const [
|
|
28
|
+
const n = {};
|
|
29
|
+
for (const [s, a] of Object.entries(t)) {
|
|
267
30
|
if (a.derive) {
|
|
268
|
-
const
|
|
269
|
-
|
|
31
|
+
const o = a.derive(r);
|
|
32
|
+
o !== void 0 && (r[s] = o);
|
|
270
33
|
}
|
|
271
|
-
if (!(
|
|
34
|
+
if (!(s in r)) {
|
|
272
35
|
if (a.required)
|
|
273
|
-
throw new Error(`Missing key: ${
|
|
36
|
+
throw new Error(`Missing key: ${s}`);
|
|
274
37
|
continue;
|
|
275
38
|
}
|
|
276
|
-
if (r[
|
|
277
|
-
s
|
|
39
|
+
if (r[s] == null) {
|
|
40
|
+
n[s] = null;
|
|
278
41
|
continue;
|
|
279
42
|
}
|
|
280
|
-
s
|
|
43
|
+
n[s] = C(
|
|
281
44
|
e,
|
|
282
45
|
a.schema,
|
|
283
|
-
r[
|
|
46
|
+
r[s]
|
|
284
47
|
);
|
|
285
48
|
}
|
|
286
|
-
return
|
|
49
|
+
return n;
|
|
287
50
|
}
|
|
288
51
|
}
|
|
289
|
-
function
|
|
52
|
+
function v(e, t) {
|
|
290
53
|
return {
|
|
291
54
|
required: !0,
|
|
292
55
|
schema: e,
|
|
293
56
|
derive: t
|
|
294
57
|
};
|
|
295
58
|
}
|
|
296
|
-
function
|
|
59
|
+
function u(e) {
|
|
297
60
|
return {
|
|
298
61
|
required: !0,
|
|
299
62
|
schema: e
|
|
@@ -305,219 +68,472 @@ function c(e) {
|
|
|
305
68
|
schema: e
|
|
306
69
|
};
|
|
307
70
|
}
|
|
308
|
-
var
|
|
309
|
-
type:
|
|
310
|
-
id:
|
|
311
|
-
transports: c(
|
|
312
|
-
},
|
|
313
|
-
appid: c(
|
|
314
|
-
appidExclude: c(
|
|
315
|
-
credProps: c(
|
|
316
|
-
},
|
|
317
|
-
appid: c(
|
|
318
|
-
appidExclude: c(
|
|
319
|
-
credProps: c(
|
|
320
|
-
},
|
|
321
|
-
publicKey:
|
|
322
|
-
rp:
|
|
323
|
-
user:
|
|
324
|
-
id:
|
|
325
|
-
name:
|
|
326
|
-
displayName:
|
|
71
|
+
var J = {
|
|
72
|
+
type: u(l),
|
|
73
|
+
id: u(m),
|
|
74
|
+
transports: c(l)
|
|
75
|
+
}, P = {
|
|
76
|
+
appid: c(l),
|
|
77
|
+
appidExclude: c(l),
|
|
78
|
+
credProps: c(l)
|
|
79
|
+
}, U = {
|
|
80
|
+
appid: c(l),
|
|
81
|
+
appidExclude: c(l),
|
|
82
|
+
credProps: c(l)
|
|
83
|
+
}, T = {
|
|
84
|
+
publicKey: u({
|
|
85
|
+
rp: u(l),
|
|
86
|
+
user: u({
|
|
87
|
+
id: u(m),
|
|
88
|
+
name: u(l),
|
|
89
|
+
displayName: u(l)
|
|
327
90
|
}),
|
|
328
|
-
challenge:
|
|
329
|
-
pubKeyCredParams:
|
|
330
|
-
timeout: c(
|
|
331
|
-
excludeCredentials: c([
|
|
332
|
-
authenticatorSelection: c(
|
|
333
|
-
attestation: c(
|
|
334
|
-
extensions: c(
|
|
91
|
+
challenge: u(m),
|
|
92
|
+
pubKeyCredParams: u(l),
|
|
93
|
+
timeout: c(l),
|
|
94
|
+
excludeCredentials: c([J]),
|
|
95
|
+
authenticatorSelection: c(l),
|
|
96
|
+
attestation: c(l),
|
|
97
|
+
extensions: c(P)
|
|
335
98
|
}),
|
|
336
|
-
signal: c(
|
|
337
|
-
},
|
|
338
|
-
type:
|
|
339
|
-
id:
|
|
340
|
-
rawId:
|
|
341
|
-
authenticatorAttachment: c(
|
|
342
|
-
response:
|
|
343
|
-
clientDataJSON:
|
|
344
|
-
attestationObject:
|
|
345
|
-
transports:
|
|
346
|
-
|
|
99
|
+
signal: c(l)
|
|
100
|
+
}, V = {
|
|
101
|
+
type: u(l),
|
|
102
|
+
id: u(l),
|
|
103
|
+
rawId: u(m),
|
|
104
|
+
authenticatorAttachment: c(l),
|
|
105
|
+
response: u({
|
|
106
|
+
clientDataJSON: u(m),
|
|
107
|
+
attestationObject: u(m),
|
|
108
|
+
transports: v(
|
|
109
|
+
l,
|
|
347
110
|
(e) => {
|
|
348
111
|
var t;
|
|
349
112
|
return ((t = e.getTransports) == null ? void 0 : t.call(e)) || [];
|
|
350
113
|
}
|
|
351
114
|
)
|
|
352
115
|
}),
|
|
353
|
-
clientExtensionResults:
|
|
354
|
-
|
|
116
|
+
clientExtensionResults: v(
|
|
117
|
+
U,
|
|
355
118
|
(e) => e.getClientExtensionResults()
|
|
356
119
|
)
|
|
357
|
-
},
|
|
358
|
-
mediation: c(
|
|
359
|
-
publicKey:
|
|
360
|
-
challenge:
|
|
361
|
-
timeout: c(
|
|
362
|
-
rpId: c(
|
|
363
|
-
allowCredentials: c([
|
|
364
|
-
userVerification: c(
|
|
365
|
-
extensions: c(
|
|
120
|
+
}, K = {
|
|
121
|
+
mediation: c(l),
|
|
122
|
+
publicKey: u({
|
|
123
|
+
challenge: u(m),
|
|
124
|
+
timeout: c(l),
|
|
125
|
+
rpId: c(l),
|
|
126
|
+
allowCredentials: c([J]),
|
|
127
|
+
userVerification: c(l),
|
|
128
|
+
extensions: c(P)
|
|
366
129
|
}),
|
|
367
|
-
signal: c(
|
|
368
|
-
},
|
|
369
|
-
type:
|
|
370
|
-
id:
|
|
371
|
-
rawId:
|
|
372
|
-
authenticatorAttachment: c(
|
|
373
|
-
response:
|
|
374
|
-
clientDataJSON:
|
|
375
|
-
authenticatorData:
|
|
376
|
-
signature:
|
|
377
|
-
userHandle:
|
|
130
|
+
signal: c(l)
|
|
131
|
+
}, D = {
|
|
132
|
+
type: u(l),
|
|
133
|
+
id: u(l),
|
|
134
|
+
rawId: u(m),
|
|
135
|
+
authenticatorAttachment: c(l),
|
|
136
|
+
response: u({
|
|
137
|
+
clientDataJSON: u(m),
|
|
138
|
+
authenticatorData: u(m),
|
|
139
|
+
signature: u(m),
|
|
140
|
+
userHandle: u(m)
|
|
378
141
|
}),
|
|
379
|
-
clientExtensionResults:
|
|
380
|
-
|
|
142
|
+
clientExtensionResults: v(
|
|
143
|
+
U,
|
|
381
144
|
(e) => e.getClientExtensionResults()
|
|
382
145
|
)
|
|
383
146
|
};
|
|
384
|
-
function
|
|
385
|
-
return
|
|
147
|
+
function B(e) {
|
|
148
|
+
return C(j, T, e);
|
|
386
149
|
}
|
|
387
|
-
function
|
|
388
|
-
return
|
|
389
|
-
|
|
390
|
-
|
|
150
|
+
function Q(e) {
|
|
151
|
+
return C(
|
|
152
|
+
N,
|
|
153
|
+
V,
|
|
391
154
|
e
|
|
392
155
|
);
|
|
393
156
|
}
|
|
394
|
-
function
|
|
395
|
-
return
|
|
157
|
+
function W(e) {
|
|
158
|
+
return C(j, K, e);
|
|
396
159
|
}
|
|
397
|
-
function
|
|
398
|
-
return
|
|
399
|
-
|
|
400
|
-
|
|
160
|
+
function $(e) {
|
|
161
|
+
return C(
|
|
162
|
+
N,
|
|
163
|
+
D,
|
|
401
164
|
e
|
|
402
165
|
);
|
|
403
166
|
}
|
|
404
|
-
async function
|
|
167
|
+
async function z(e) {
|
|
405
168
|
const t = await navigator.credentials.create(
|
|
406
169
|
e
|
|
407
170
|
);
|
|
408
|
-
return t.toJSON = () =>
|
|
171
|
+
return t.toJSON = () => Q(t), t;
|
|
409
172
|
}
|
|
410
|
-
async function
|
|
173
|
+
async function G(e) {
|
|
411
174
|
const t = await navigator.credentials.get(
|
|
412
175
|
e
|
|
413
176
|
);
|
|
414
|
-
return t.toJSON = () =>
|
|
177
|
+
return t.toJSON = () => $(t), t;
|
|
415
178
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
179
|
+
const H = (e) => ({
|
|
180
|
+
login: async (t) => {
|
|
181
|
+
const n = (await h(e, {
|
|
182
|
+
webAuthnRequestOptions: {
|
|
183
|
+
__args: {
|
|
184
|
+
username: t
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
})).webAuthnRequestOptions, s = W({
|
|
188
|
+
publicKey: n
|
|
189
|
+
}), a = await G(s);
|
|
190
|
+
await f(e, "webAuthnAssertion", {
|
|
191
|
+
username: t,
|
|
192
|
+
assertion: a.toJSON()
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
register: async () => {
|
|
196
|
+
const t = await h(e, { webAuthnCreationOptions: !0 }), r = B({
|
|
197
|
+
publicKey: t.webAuthnCreationOptions
|
|
198
|
+
}), n = await z(r);
|
|
199
|
+
await f(e, "webAuthnRegister", {
|
|
200
|
+
registration: n.toJSON()
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}), I = (e) => ({
|
|
204
|
+
WebAuthn: H(e),
|
|
205
|
+
login: (t, r, n = "") => f(e, "login", {
|
|
206
|
+
username: t,
|
|
207
|
+
password: r,
|
|
208
|
+
code: n
|
|
209
|
+
}),
|
|
210
|
+
logout: () => f(e, "logout"),
|
|
211
|
+
updatePassword: (t, r) => f(e, "updatePassword", {
|
|
212
|
+
old_password: t,
|
|
213
|
+
new_password: r
|
|
214
|
+
}),
|
|
215
|
+
resetPassword: (t, r, n) => f(e, "resetPassword", {
|
|
216
|
+
email: t,
|
|
217
|
+
password: r,
|
|
218
|
+
code: n
|
|
219
|
+
}),
|
|
220
|
+
forgetPassword: (t) => f(e, "forgetPassword", {
|
|
221
|
+
email: t
|
|
222
|
+
}),
|
|
223
|
+
granted: async (t) => (await h(e, {
|
|
224
|
+
granted: {
|
|
419
225
|
__args: {
|
|
420
|
-
|
|
226
|
+
rights: t
|
|
421
227
|
}
|
|
422
228
|
}
|
|
423
|
-
})).
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
229
|
+
})).granted
|
|
230
|
+
}), M = (e, t, r) => {
|
|
231
|
+
const n = t, s = e, a = r, o = (i) => a[i] ? a[i]() : null;
|
|
232
|
+
return {
|
|
233
|
+
field: o,
|
|
234
|
+
$fields: a,
|
|
235
|
+
gqlFields(i) {
|
|
236
|
+
const p = [];
|
|
237
|
+
for (const d of i)
|
|
238
|
+
if (typeof d == "string") {
|
|
239
|
+
const g = o(d);
|
|
240
|
+
g && p.push(g.getGQLField());
|
|
241
|
+
} else typeof d == "object" && p.push(d);
|
|
242
|
+
return p;
|
|
243
|
+
},
|
|
244
|
+
async update(i, p) {
|
|
245
|
+
return await f(s, "update" + n, { id: i, data: p });
|
|
246
|
+
},
|
|
247
|
+
async delete(i) {
|
|
248
|
+
return await f(s, "delete" + n, { id: i });
|
|
249
|
+
},
|
|
250
|
+
async add(i) {
|
|
251
|
+
return await f(s, "add" + n, { data: i });
|
|
252
|
+
},
|
|
253
|
+
fields(i) {
|
|
254
|
+
let p = [];
|
|
255
|
+
for (let d of i) {
|
|
256
|
+
const g = o(d);
|
|
257
|
+
g && p.push(g);
|
|
258
|
+
}
|
|
259
|
+
return p;
|
|
260
|
+
},
|
|
261
|
+
async get(i, p) {
|
|
262
|
+
return (await h(s, {
|
|
263
|
+
["list" + n]: {
|
|
264
|
+
__args: {
|
|
265
|
+
filters: i
|
|
266
|
+
},
|
|
267
|
+
data: {
|
|
268
|
+
__args: {
|
|
269
|
+
limit: 1
|
|
270
|
+
},
|
|
271
|
+
...A(p)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}))["list" + n].data[0];
|
|
275
|
+
},
|
|
276
|
+
async list(i, p) {
|
|
277
|
+
return (await h(s, {
|
|
278
|
+
["list" + n]: {
|
|
279
|
+
__args: {
|
|
280
|
+
filters: i
|
|
281
|
+
},
|
|
282
|
+
data: {
|
|
283
|
+
...A(p)
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}))["list" + n].data;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
function X(e) {
|
|
291
|
+
e = "<~" + e + "~>";
|
|
292
|
+
var t, r, n, s, a, o = String, i = 255;
|
|
293
|
+
for (e.slice(0, 2) === "<~" && e.slice(-2), e = e.slice(2, -2).replace(/\s/g, "").replace("z", "!!!!!"), t = "uuuuu".slice(e.length % 5 || 5), e += t, n = [], s = 0, a = e.length; a > s; s += 5) r = 52200625 * (e.charCodeAt(s) - 33) + 614125 * (e.charCodeAt(s + 1) - 33) + 7225 * (e.charCodeAt(s + 2) - 33) + 85 * (e.charCodeAt(s + 3) - 33) + (e.charCodeAt(s + 4) - 33), n.push(i & r >> 24, i & r >> 16, i & r >> 8, i & r);
|
|
294
|
+
return function(p, d) {
|
|
295
|
+
for (var g = d; g > 0; g--) p.pop();
|
|
296
|
+
}(n, t.length), o.fromCharCode.apply(o, n);
|
|
430
297
|
}
|
|
431
|
-
|
|
432
|
-
const e =
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
298
|
+
const q = (e = "") => {
|
|
299
|
+
const t = e, r = (n = "application/octet-stream") => {
|
|
300
|
+
const s = new Uint8Array(t.length);
|
|
301
|
+
for (let i = 0; i < t.length; i++)
|
|
302
|
+
s[i] = t.charCodeAt(i);
|
|
303
|
+
const a = new Blob([s], { type: n });
|
|
304
|
+
return URL.createObjectURL(a);
|
|
305
|
+
};
|
|
306
|
+
return {
|
|
307
|
+
getContent: () => t,
|
|
308
|
+
getURL: r,
|
|
309
|
+
download: (n) => {
|
|
310
|
+
const s = document.createElement("a");
|
|
311
|
+
s.download = n, s.href = r(), document.body.appendChild(s), s.click(), document.body.removeChild(s);
|
|
312
|
+
},
|
|
313
|
+
open: (n) => {
|
|
314
|
+
window.open(r(n), "_blank");
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
}, ie = {
|
|
318
|
+
fromBase85: (e) => q(X(e)),
|
|
319
|
+
fromBase64: (e) => q(atob(e)),
|
|
320
|
+
fromString: (e) => q(e)
|
|
321
|
+
}, R = (e) => {
|
|
322
|
+
let t = {};
|
|
323
|
+
return typeof e == "string" ? (t[e] = !0, t) : e instanceof Array ? (e.forEach((r) => {
|
|
324
|
+
Object.entries(R(r)).forEach(([n, s]) => {
|
|
325
|
+
t[n] = s;
|
|
326
|
+
});
|
|
327
|
+
}), t) : (Object.entries(e).forEach(([r, n]) => {
|
|
328
|
+
if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
|
|
329
|
+
t[r] = n;
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if (typeof n == "boolean") {
|
|
333
|
+
t[r] = n;
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
t[r] = R(n);
|
|
337
|
+
}), t);
|
|
338
|
+
}, A = (e) => R(e), h = async (e, t) => {
|
|
339
|
+
let r = E(A(t));
|
|
340
|
+
const n = await e.post("", {
|
|
341
|
+
query: `{ ${r} }`
|
|
437
342
|
});
|
|
343
|
+
if (n.data.errors)
|
|
344
|
+
throw new Error(n.data.errors[0].message);
|
|
345
|
+
return n.data.data;
|
|
346
|
+
};
|
|
347
|
+
function Y(e) {
|
|
348
|
+
for (let t = 0; t < e.length; t++)
|
|
349
|
+
if (e[t] instanceof File)
|
|
350
|
+
return !0;
|
|
351
|
+
return !1;
|
|
438
352
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
353
|
+
function Z(e) {
|
|
354
|
+
for (let t in e)
|
|
355
|
+
if (e[t] instanceof File)
|
|
356
|
+
return !0;
|
|
357
|
+
return !1;
|
|
358
|
+
}
|
|
359
|
+
const f = async (e, t, r = null, n = []) => {
|
|
360
|
+
let s = {
|
|
361
|
+
[t]: {}
|
|
362
|
+
};
|
|
363
|
+
const a = new FormData();
|
|
364
|
+
let o = !1;
|
|
365
|
+
if (r) {
|
|
366
|
+
const d = {}, g = {}, O = {};
|
|
367
|
+
let b = 0;
|
|
368
|
+
Object.entries(r).forEach(([w, _]) => {
|
|
369
|
+
if (_ instanceof Array && Y(_)) {
|
|
370
|
+
o = !0;
|
|
371
|
+
let y = 0;
|
|
372
|
+
_.forEach((F) => {
|
|
373
|
+
F instanceof File && (d[w] = new S(w), g[b] = ["variables." + w + "." + y], a.append(b.toString(), F), b++);
|
|
374
|
+
}), O[w] = "[Upload!]!";
|
|
375
|
+
} else _ instanceof File ? (o = !0, d[w] = new S(w), g[b] = ["variables." + w], a.append(b.toString(), _), O[w] = "Upload!", b++) : _ instanceof Object && Z(_) ? (o = !0, d[w] = {}, Object.entries(_).forEach(([y, F]) => {
|
|
376
|
+
F instanceof File ? (d[w][y] = new S(y), g[b] = ["variables." + y], a.append(b.toString(), F), O[y] = "Upload!", b++) : d[w][y] = F;
|
|
377
|
+
})) : _ !== void 0 && (d[w] = _);
|
|
378
|
+
}), s[t].__args = d, s.__variables = O, o && a.append("map", JSON.stringify(g));
|
|
379
|
+
}
|
|
380
|
+
Object.entries(A(n)).forEach(([d, g]) => {
|
|
381
|
+
s[t][d] = g;
|
|
382
|
+
}), Object.entries(s[t]).length === 0 && (s[t] = !0);
|
|
383
|
+
let i = null;
|
|
384
|
+
const p = E({ mutation: s });
|
|
385
|
+
if (o ? (a.append("operations", JSON.stringify({
|
|
386
|
+
query: p
|
|
387
|
+
})), i = await e.post("", a)) : i = await e.post("", {
|
|
388
|
+
query: p
|
|
389
|
+
}), i.data.errors)
|
|
390
|
+
throw new Error(i.data.errors[0].message);
|
|
391
|
+
return i.data.data[t];
|
|
392
|
+
}, x = (e) => ({
|
|
393
|
+
uploadTempFile: (t) => f(e, "fsUploadTempFile", {
|
|
394
|
+
file: t
|
|
395
|
+
}, {
|
|
444
396
|
name: !0,
|
|
445
397
|
path: !0,
|
|
446
398
|
size: !0,
|
|
447
|
-
mime: !0
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
399
|
+
mime: !0
|
|
400
|
+
}),
|
|
401
|
+
folders: {
|
|
402
|
+
list: async (t) => (await h(e, {
|
|
403
|
+
fsListFolders: {
|
|
404
|
+
__args: {
|
|
405
|
+
path: t
|
|
406
|
+
},
|
|
407
|
+
name: !0,
|
|
408
|
+
path: !0
|
|
409
|
+
}
|
|
410
|
+
})).fsListFolders,
|
|
411
|
+
create: (t) => f(e, "fsCreateFolder", { path: t }),
|
|
412
|
+
delete: (t) => f(e, "fsDeleteFolder", { path: t }),
|
|
413
|
+
rename: (t, r) => f(e, "fsRenameFolder", { path: t, name: r })
|
|
414
|
+
},
|
|
415
|
+
files: {
|
|
416
|
+
list: async (t) => (await h(e, {
|
|
417
|
+
fsListFiles: {
|
|
418
|
+
__args: {
|
|
419
|
+
path: t
|
|
420
|
+
},
|
|
421
|
+
name: !0,
|
|
422
|
+
path: !0,
|
|
423
|
+
size: !0,
|
|
424
|
+
mime: !0,
|
|
425
|
+
canPreview: !0,
|
|
426
|
+
imagePath: !0
|
|
427
|
+
}
|
|
428
|
+
})).fsListFiles,
|
|
429
|
+
read: async (t) => {
|
|
430
|
+
let r = await h(e, {
|
|
431
|
+
fsFile: {
|
|
432
|
+
__args: {
|
|
433
|
+
path: t
|
|
434
|
+
},
|
|
435
|
+
base64Content: !0
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
return window.atob(r.fsFile.base64Content);
|
|
455
439
|
},
|
|
456
|
-
|
|
457
|
-
|
|
440
|
+
write: (t, r) => f(e, "fsWriteFile", {
|
|
441
|
+
path: t,
|
|
442
|
+
content: r
|
|
443
|
+
}),
|
|
444
|
+
delete: (t) => f(e, "fsDeleteFile", { path: t }),
|
|
445
|
+
rename: (t, r) => f(e, "fsRenameFile", { path: t, name: r }),
|
|
446
|
+
move: (t, r) => f(e, "fsMoveFile", { source: t, target: r })
|
|
458
447
|
}
|
|
459
|
-
})
|
|
460
|
-
|
|
461
|
-
|
|
448
|
+
}), k = (e) => ({
|
|
449
|
+
get: async (t) => (await e({
|
|
450
|
+
config: {
|
|
462
451
|
__args: {
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
base64Content: !0
|
|
452
|
+
name: t
|
|
453
|
+
}
|
|
466
454
|
}
|
|
467
|
-
})
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}),
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
455
|
+
})).config
|
|
456
|
+
}), ee = (e) => ({
|
|
457
|
+
send: (t, r, n) => f(e, "sendMail", {
|
|
458
|
+
email: t,
|
|
459
|
+
subject: r,
|
|
460
|
+
message: n
|
|
461
|
+
})
|
|
462
|
+
}), te = (e) => ({
|
|
463
|
+
list: async () => (await h(e, {
|
|
464
|
+
listUser: {
|
|
465
|
+
data: {
|
|
466
|
+
user_id: !0,
|
|
467
|
+
username: !0,
|
|
468
|
+
first_name: !0,
|
|
469
|
+
last_name: !0,
|
|
470
|
+
status: !0
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
})).listUser.data
|
|
474
|
+
}), re = () => {
|
|
475
|
+
const e = {};
|
|
476
|
+
return {
|
|
477
|
+
create(t, r) {
|
|
478
|
+
e[t] = {};
|
|
479
|
+
for (const n of Object.entries(r)) {
|
|
480
|
+
const [s, a] = n;
|
|
481
|
+
e[t][s] = () => ({
|
|
482
|
+
name: a.name ? a.name : s,
|
|
483
|
+
raw: a,
|
|
484
|
+
getName: () => a.name ? a.name : s,
|
|
485
|
+
getGQLField: () => a.gqlField !== void 0 ? a.gqlField : a.name || s,
|
|
486
|
+
getRaw() {
|
|
487
|
+
return a;
|
|
488
|
+
},
|
|
489
|
+
getValue(o) {
|
|
490
|
+
return a.field && typeof a.field == "function" ? a.field(o) : a.field && typeof a.field == "string" ? o[a.field] : o[this.getName()];
|
|
491
|
+
},
|
|
492
|
+
getFormattedValue(o) {
|
|
493
|
+
const i = this.getValue(o);
|
|
494
|
+
return a.format ? a.format(i) : i;
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
return e[t];
|
|
499
|
+
},
|
|
500
|
+
get(t) {
|
|
501
|
+
return e[t];
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
}, ne = (e) => ({
|
|
505
|
+
list: async () => (await h(e, {
|
|
506
|
+
listRole: {
|
|
507
|
+
name: !0
|
|
508
|
+
}
|
|
509
|
+
})).listRole
|
|
510
|
+
}), oe = (e) => {
|
|
511
|
+
const t = L.create({
|
|
512
|
+
baseURL: e,
|
|
513
|
+
withCredentials: !0
|
|
514
|
+
}), r = (a, o = null, i = []) => f(t, a, o, i), n = (a) => h(t, a), s = re();
|
|
515
|
+
return {
|
|
516
|
+
baseURL: e,
|
|
517
|
+
axios: t,
|
|
518
|
+
auth: I(t),
|
|
519
|
+
mutation: r,
|
|
520
|
+
query: n,
|
|
521
|
+
config: k(n),
|
|
522
|
+
mail: ee(t),
|
|
523
|
+
users: te(t),
|
|
524
|
+
fs: x(t),
|
|
525
|
+
models: s,
|
|
526
|
+
model(a) {
|
|
527
|
+
return M(t, a, s.get(a));
|
|
528
|
+
},
|
|
529
|
+
roles: ne(t)
|
|
530
|
+
};
|
|
531
|
+
};
|
|
488
532
|
export {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
Se as fsDeleteFolder,
|
|
496
|
-
_e as fsListFiles,
|
|
497
|
-
Fe as fsListFolders,
|
|
498
|
-
Ee as fsMoveFile,
|
|
499
|
-
ye as fsReadFile,
|
|
500
|
-
Re as fsRenameFile,
|
|
501
|
-
ve as fsRenameFolder,
|
|
502
|
-
Ce as fsWriteFile,
|
|
503
|
-
q as getApiUrl,
|
|
504
|
-
E as getAxios,
|
|
505
|
-
he as getConfig,
|
|
506
|
-
ue as getGQLFields,
|
|
507
|
-
L as getModelField,
|
|
508
|
-
ce as granted,
|
|
509
|
-
re as login,
|
|
510
|
-
ne as logout,
|
|
511
|
-
fe as model,
|
|
512
|
-
u as mutation,
|
|
513
|
-
b as query,
|
|
514
|
-
ie as resetPassword,
|
|
515
|
-
we as sendMail,
|
|
516
|
-
pe as setApiUrl,
|
|
517
|
-
oe as setAxios,
|
|
518
|
-
S as toQuery,
|
|
519
|
-
se as updatePassword,
|
|
520
|
-
ge as uploadFile,
|
|
521
|
-
be as webauthnLogin,
|
|
522
|
-
me as webauthnRegister
|
|
533
|
+
ie as File,
|
|
534
|
+
oe as createClient,
|
|
535
|
+
q as file,
|
|
536
|
+
f as mutation,
|
|
537
|
+
h as query,
|
|
538
|
+
A as toQuery
|
|
523
539
|
};
|