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