@hostlink/light 1.2.3 → 1.2.5
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/light.js +100 -100
- package/dist/light.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/light.js
CHANGED
|
@@ -7,11 +7,11 @@ const re = (e, t, r = "") => u("login", {
|
|
|
7
7
|
}), ne = () => u("logout"), se = (e, t) => u("updatePassword", {
|
|
8
8
|
old_password: e,
|
|
9
9
|
new_password: t
|
|
10
|
-
}),
|
|
10
|
+
}), ie = (e, t, r) => u("resetPassword", {
|
|
11
11
|
email: e,
|
|
12
12
|
password: t,
|
|
13
13
|
code: r
|
|
14
|
-
}),
|
|
14
|
+
}), ae = (e) => u("forgetPassword", {
|
|
15
15
|
email: e
|
|
16
16
|
});
|
|
17
17
|
let O;
|
|
@@ -37,11 +37,11 @@ const oe = (e) => {
|
|
|
37
37
|
getRaw() {
|
|
38
38
|
return n;
|
|
39
39
|
},
|
|
40
|
-
getValue(
|
|
41
|
-
return n.field && typeof n.field == "function" ? n.field(
|
|
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
42
|
},
|
|
43
|
-
getFormattedValue(
|
|
44
|
-
const l = this.getValue(
|
|
43
|
+
getFormattedValue(a) {
|
|
44
|
+
const l = this.getValue(a);
|
|
45
45
|
return n.format ? n.format(l) : l;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
@@ -72,8 +72,8 @@ const oe = (e) => {
|
|
|
72
72
|
fields(r) {
|
|
73
73
|
let s = [];
|
|
74
74
|
for (let n of r) {
|
|
75
|
-
const
|
|
76
|
-
|
|
75
|
+
const a = L(t, n);
|
|
76
|
+
a && s.push(a);
|
|
77
77
|
}
|
|
78
78
|
return s;
|
|
79
79
|
},
|
|
@@ -108,21 +108,21 @@ const oe = (e) => {
|
|
|
108
108
|
};
|
|
109
109
|
function M(e) {
|
|
110
110
|
e = "<~" + e + "~>";
|
|
111
|
-
var t, r, s, n,
|
|
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,
|
|
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(
|
|
114
|
-
return function(
|
|
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
115
|
for (var _ = m; _ > 0; _--)
|
|
116
|
-
|
|
116
|
+
g.pop();
|
|
117
117
|
}(s, t.length), l.fromCharCode.apply(l, s);
|
|
118
118
|
}
|
|
119
119
|
const v = (e = "") => {
|
|
120
120
|
const t = e, r = (s = "application/octet-stream") => {
|
|
121
121
|
const n = new Uint8Array(t.length);
|
|
122
|
-
for (let
|
|
123
|
-
n[
|
|
124
|
-
const
|
|
125
|
-
return URL.createObjectURL(
|
|
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
126
|
};
|
|
127
127
|
return {
|
|
128
128
|
getContent: () => t,
|
|
@@ -182,32 +182,32 @@ const u = async (e, t = null, r = []) => {
|
|
|
182
182
|
[e]: {}
|
|
183
183
|
};
|
|
184
184
|
const n = new FormData();
|
|
185
|
-
let
|
|
185
|
+
let a = !1;
|
|
186
186
|
if (t) {
|
|
187
|
-
const
|
|
188
|
-
let
|
|
189
|
-
Object.entries(t).forEach(([
|
|
187
|
+
const g = {}, m = {}, _ = {};
|
|
188
|
+
let w = 0;
|
|
189
|
+
Object.entries(t).forEach(([f, h]) => {
|
|
190
190
|
if (h instanceof Array && B(h)) {
|
|
191
|
-
|
|
192
|
-
let
|
|
193
|
-
h.forEach((
|
|
194
|
-
|
|
195
|
-
}), _[
|
|
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
196
|
} else
|
|
197
|
-
h instanceof File ? (
|
|
198
|
-
|
|
199
|
-
})) :
|
|
200
|
-
}), s[e].__args =
|
|
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
201
|
}
|
|
202
|
-
Object.entries(S(r)).forEach(([
|
|
203
|
-
s[e][
|
|
202
|
+
Object.entries(S(r)).forEach(([g, m]) => {
|
|
203
|
+
s[e][g] = m;
|
|
204
204
|
}), Object.entries(s[e]).length === 0 && (s[e] = !0);
|
|
205
205
|
let l = null;
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
query:
|
|
206
|
+
const p = N({ mutation: s });
|
|
207
|
+
if (a ? (n.append("operations", JSON.stringify({
|
|
208
|
+
query: p
|
|
209
209
|
})), l = await E().post(q(), n)) : l = await E().post(q(), {
|
|
210
|
-
query:
|
|
210
|
+
query: p
|
|
211
211
|
}), l.data.errors)
|
|
212
212
|
throw new Error(l.data.errors[0].message);
|
|
213
213
|
return l.data.data[e];
|
|
@@ -237,39 +237,39 @@ const we = (e, t, r) => u("sendMail", {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
})).config;
|
|
240
|
-
function
|
|
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),
|
|
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
242
|
for (let l = 0; l < s.length; l++)
|
|
243
|
-
|
|
243
|
+
a[l] = s.charCodeAt(l);
|
|
244
244
|
return n;
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function P(e) {
|
|
247
247
|
const t = new Uint8Array(e);
|
|
248
248
|
let r = "";
|
|
249
|
-
for (const
|
|
250
|
-
r += String.fromCharCode(
|
|
249
|
+
for (const a of t)
|
|
250
|
+
r += String.fromCharCode(a);
|
|
251
251
|
return btoa(r).replace(/\+/g, "-").replace(
|
|
252
252
|
/\//g,
|
|
253
253
|
"_"
|
|
254
254
|
).replace(/=/g, "");
|
|
255
255
|
}
|
|
256
|
-
var
|
|
256
|
+
var i = "copy", d = "convert";
|
|
257
257
|
function A(e, t, r) {
|
|
258
|
-
if (t ===
|
|
258
|
+
if (t === i)
|
|
259
259
|
return r;
|
|
260
|
-
if (t ===
|
|
260
|
+
if (t === d)
|
|
261
261
|
return e(r);
|
|
262
262
|
if (t instanceof Array)
|
|
263
263
|
return r.map((s) => A(e, t[0], s));
|
|
264
264
|
if (t instanceof Object) {
|
|
265
265
|
const s = {};
|
|
266
|
-
for (const [n,
|
|
267
|
-
if (
|
|
268
|
-
const l =
|
|
266
|
+
for (const [n, a] of Object.entries(t)) {
|
|
267
|
+
if (a.derive) {
|
|
268
|
+
const l = a.derive(r);
|
|
269
269
|
l !== void 0 && (r[n] = l);
|
|
270
270
|
}
|
|
271
271
|
if (!(n in r)) {
|
|
272
|
-
if (
|
|
272
|
+
if (a.required)
|
|
273
273
|
throw new Error(`Missing key: ${n}`);
|
|
274
274
|
continue;
|
|
275
275
|
}
|
|
@@ -279,7 +279,7 @@ function A(e, t, r) {
|
|
|
279
279
|
}
|
|
280
280
|
s[n] = A(
|
|
281
281
|
e,
|
|
282
|
-
|
|
282
|
+
a.schema,
|
|
283
283
|
r[n]
|
|
284
284
|
);
|
|
285
285
|
}
|
|
@@ -306,44 +306,44 @@ function c(e) {
|
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
308
|
var D = {
|
|
309
|
-
type: o(
|
|
310
|
-
id: o(
|
|
311
|
-
transports: c(
|
|
309
|
+
type: o(i),
|
|
310
|
+
id: o(d),
|
|
311
|
+
transports: c(i)
|
|
312
312
|
}, V = {
|
|
313
|
-
appid: c(
|
|
314
|
-
appidExclude: c(
|
|
315
|
-
credProps: c(
|
|
313
|
+
appid: c(i),
|
|
314
|
+
appidExclude: c(i),
|
|
315
|
+
credProps: c(i)
|
|
316
316
|
}, K = {
|
|
317
|
-
appid: c(
|
|
318
|
-
appidExclude: c(
|
|
319
|
-
credProps: c(
|
|
317
|
+
appid: c(i),
|
|
318
|
+
appidExclude: c(i),
|
|
319
|
+
credProps: c(i)
|
|
320
320
|
}, G = {
|
|
321
321
|
publicKey: o({
|
|
322
|
-
rp: o(
|
|
322
|
+
rp: o(i),
|
|
323
323
|
user: o({
|
|
324
|
-
id: o(
|
|
325
|
-
name: o(
|
|
326
|
-
displayName: o(
|
|
324
|
+
id: o(d),
|
|
325
|
+
name: o(i),
|
|
326
|
+
displayName: o(i)
|
|
327
327
|
}),
|
|
328
|
-
challenge: o(
|
|
329
|
-
pubKeyCredParams: o(
|
|
330
|
-
timeout: c(
|
|
328
|
+
challenge: o(d),
|
|
329
|
+
pubKeyCredParams: o(i),
|
|
330
|
+
timeout: c(i),
|
|
331
331
|
excludeCredentials: c([D]),
|
|
332
|
-
authenticatorSelection: c(
|
|
333
|
-
attestation: c(
|
|
332
|
+
authenticatorSelection: c(i),
|
|
333
|
+
attestation: c(i),
|
|
334
334
|
extensions: c(V)
|
|
335
335
|
}),
|
|
336
|
-
signal: c(
|
|
336
|
+
signal: c(i)
|
|
337
337
|
}, W = {
|
|
338
|
-
type: o(
|
|
339
|
-
id: o(
|
|
340
|
-
rawId: o(
|
|
341
|
-
authenticatorAttachment: c(
|
|
338
|
+
type: o(i),
|
|
339
|
+
id: o(i),
|
|
340
|
+
rawId: o(d),
|
|
341
|
+
authenticatorAttachment: c(i),
|
|
342
342
|
response: o({
|
|
343
|
-
clientDataJSON: o(
|
|
344
|
-
attestationObject: o(
|
|
343
|
+
clientDataJSON: o(d),
|
|
344
|
+
attestationObject: o(d),
|
|
345
345
|
transports: x(
|
|
346
|
-
|
|
346
|
+
i,
|
|
347
347
|
(e) => {
|
|
348
348
|
var t;
|
|
349
349
|
return ((t = e.getTransports) == null ? void 0 : t.call(e)) || [];
|
|
@@ -355,26 +355,26 @@ var D = {
|
|
|
355
355
|
(e) => e.getClientExtensionResults()
|
|
356
356
|
)
|
|
357
357
|
}, $ = {
|
|
358
|
-
mediation: c(
|
|
358
|
+
mediation: c(i),
|
|
359
359
|
publicKey: o({
|
|
360
|
-
challenge: o(
|
|
361
|
-
timeout: c(
|
|
362
|
-
rpId: c(
|
|
360
|
+
challenge: o(d),
|
|
361
|
+
timeout: c(i),
|
|
362
|
+
rpId: c(i),
|
|
363
363
|
allowCredentials: c([D]),
|
|
364
|
-
userVerification: c(
|
|
364
|
+
userVerification: c(i),
|
|
365
365
|
extensions: c(V)
|
|
366
366
|
}),
|
|
367
|
-
signal: c(
|
|
367
|
+
signal: c(i)
|
|
368
368
|
}, z = {
|
|
369
|
-
type: o(
|
|
370
|
-
id: o(
|
|
371
|
-
rawId: o(
|
|
372
|
-
authenticatorAttachment: c(
|
|
369
|
+
type: o(i),
|
|
370
|
+
id: o(i),
|
|
371
|
+
rawId: o(d),
|
|
372
|
+
authenticatorAttachment: c(i),
|
|
373
373
|
response: o({
|
|
374
|
-
clientDataJSON: o(
|
|
375
|
-
authenticatorData: o(
|
|
376
|
-
signature: o(
|
|
377
|
-
userHandle: o(
|
|
374
|
+
clientDataJSON: o(d),
|
|
375
|
+
authenticatorData: o(d),
|
|
376
|
+
signature: o(d),
|
|
377
|
+
userHandle: o(d)
|
|
378
378
|
}),
|
|
379
379
|
clientExtensionResults: x(
|
|
380
380
|
K,
|
|
@@ -382,21 +382,21 @@ var D = {
|
|
|
382
382
|
)
|
|
383
383
|
};
|
|
384
384
|
function H(e) {
|
|
385
|
-
return A(
|
|
385
|
+
return A(U, G, e);
|
|
386
386
|
}
|
|
387
387
|
function I(e) {
|
|
388
388
|
return A(
|
|
389
|
-
|
|
389
|
+
P,
|
|
390
390
|
W,
|
|
391
391
|
e
|
|
392
392
|
);
|
|
393
393
|
}
|
|
394
394
|
function X(e) {
|
|
395
|
-
return A(
|
|
395
|
+
return A(U, $, e);
|
|
396
396
|
}
|
|
397
397
|
function Y(e) {
|
|
398
398
|
return A(
|
|
399
|
-
|
|
399
|
+
P,
|
|
400
400
|
z,
|
|
401
401
|
e
|
|
402
402
|
);
|
|
@@ -448,7 +448,7 @@ const _e = async (e) => (await b({
|
|
|
448
448
|
canPreview: !0,
|
|
449
449
|
imagePath: !0
|
|
450
450
|
}
|
|
451
|
-
})).fsListFiles,
|
|
451
|
+
})).fsListFiles, Fe = async (e) => (await b({
|
|
452
452
|
fsListFolders: {
|
|
453
453
|
__args: {
|
|
454
454
|
path: e
|
|
@@ -456,7 +456,7 @@ const _e = async (e) => (await b({
|
|
|
456
456
|
name: !0,
|
|
457
457
|
path: !0
|
|
458
458
|
}
|
|
459
|
-
})).fsListFolders,
|
|
459
|
+
})).fsListFolders, ye = async (e) => {
|
|
460
460
|
let t = await b({
|
|
461
461
|
fsFile: {
|
|
462
462
|
__args: {
|
|
@@ -489,14 +489,14 @@ export {
|
|
|
489
489
|
de as File,
|
|
490
490
|
le as defineModel,
|
|
491
491
|
v as file,
|
|
492
|
-
|
|
492
|
+
ae as forgetPassword,
|
|
493
493
|
Oe as fsCreateFolder,
|
|
494
494
|
Ae as fsDeleteFile,
|
|
495
495
|
Se as fsDeleteFolder,
|
|
496
496
|
_e as fsListFiles,
|
|
497
|
-
|
|
497
|
+
Fe as fsListFolders,
|
|
498
498
|
Ee as fsMoveFile,
|
|
499
|
-
|
|
499
|
+
ye as fsReadFile,
|
|
500
500
|
Re as fsRenameFile,
|
|
501
501
|
ve as fsRenameFolder,
|
|
502
502
|
Ce as fsWriteFile,
|
|
@@ -511,7 +511,7 @@ export {
|
|
|
511
511
|
fe as model,
|
|
512
512
|
u as mutation,
|
|
513
513
|
b as query,
|
|
514
|
-
|
|
514
|
+
ie as resetPassword,
|
|
515
515
|
we as sendMail,
|
|
516
516
|
pe as setApiUrl,
|
|
517
517
|
oe as setAxios,
|
package/dist/light.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(s,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("axios"),require("json-to-graphql-query")):typeof define=="function"&&define.amd?define(["exports","axios","json-to-graphql-query"],S):(s=typeof globalThis<"u"?globalThis:s||self,S(s.light={},s.axios,s.jsonToGraphqlQuery))})(this,function(s,S,R){"use strict";const Q=(e,t,n="")=>u("login",{username:e,password:t,code:n}),B=()=>u("logout"),W=(e,t)=>u("updatePassword",{old_password:e,new_password:t}),$=(e,t,n)=>u("resetPassword",{email:e,password:t,code:n}),z=e=>u("forgetPassword",{email:e});let q;const G=e=>{q=e},j=()=>(q||(q=S.create({withCredentials:!0})),q),H=async e=>(await
|
|
1
|
+
(function(s,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("axios"),require("json-to-graphql-query")):typeof define=="function"&&define.amd?define(["exports","axios","json-to-graphql-query"],S):(s=typeof globalThis<"u"?globalThis:s||self,S(s.light={},s.axios,s.jsonToGraphqlQuery))})(this,function(s,S,R){"use strict";const Q=(e,t,n="")=>u("login",{username:e,password:t,code:n}),B=()=>u("logout"),W=(e,t)=>u("updatePassword",{old_password:e,new_password:t}),$=(e,t,n)=>u("resetPassword",{email:e,password:t,code:n}),z=e=>u("forgetPassword",{email:e});let q;const G=e=>{q=e},j=()=>(q||(q=S.create({withCredentials:!0})),q),H=async e=>(await h({granted:{__args:{rights:e}}})).granted,A={},I=(e,t)=>{A[e]={};for(const n of Object.entries(t)){const[i,r]=n;A[e][i]=()=>({name:r.name?r.name:i,raw:r,getName:()=>r.name?r.name:i,getGQLField:()=>r.gqlField!==void 0?r.gqlField:r.name||i,getRaw(){return r},getValue(o){return r.field&&typeof r.field=="function"?r.field(o):r.field&&typeof r.field=="string"?o[r.field]:o[this.getName()]},getFormattedValue(o){const f=this.getValue(o);return r.format?r.format(f):f}})}},N=(e,t)=>!A[e]||!A[e][t]?null:A[e][t](),X=(e,t)=>{const n=[];for(const i of t)if(typeof i=="string"){const r=N(e,i);r&&n.push(r.getGQLField())}else typeof i=="object"&&n.push(i);return n},Y=e=>{const t=e;return{name:t,$fields:A[e],async update(n,i){return await u("update"+t,{id:n,data:i})},async delete(n){return await u("delete"+t,{id:n})},async add(n){return await u("add"+t,{data:n})},fields(n){let i=[];for(let r of n){const o=N(t,r);o&&i.push(o)}return i},async get(n,i){return(await h({["list"+t]:{__args:{filters:n},data:{__args:{limit:1},...v(i)}}}))["list"+t].data[0]},async list(n,i){return(await h({["list"+t]:{__args:{filters:n},data:{...v(i)}}}))["list"+t].data}}};function Z(e){e="<~"+e+"~>";var t,n,i,r,o,f=String,p=255;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,i=[],r=0,o=e.length;o>r;r+=5)n=52200625*(e.charCodeAt(r)-33)+614125*(e.charCodeAt(r+1)-33)+7225*(e.charCodeAt(r+2)-33)+85*(e.charCodeAt(r+3)-33)+(e.charCodeAt(r+4)-33),i.push(p&n>>24,p&n>>16,p&n>>8,p&n);return function(w,F){for(var y=F;y>0;y--)w.pop()}(i,t.length),f.fromCharCode.apply(f,i)}const E=(e="")=>{const t=e,n=(i="application/octet-stream")=>{const r=new Uint8Array(t.length);for(let p=0;p<t.length;p++)r[p]=t.charCodeAt(p);const o=new Blob([r],{type:i});return URL.createObjectURL(o)};return{getContent:()=>t,getURL:n,download:i=>{const r=document.createElement("a");r.download=i,r.href=n(),document.body.appendChild(r),r.click(),document.body.removeChild(r)},open:i=>{window.open(n(i),"_blank")}}},x={fromBase85:e=>E(Z(e)),fromBase64:e=>E(atob(e)),fromString:e=>E(e)},P=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(n=>{Object.entries(P(n)).forEach(([i,r])=>{t[i]=r})}),t):(Object.entries(e).forEach(([n,i])=>{if(n=="__args"||n=="__aliasFor"||n=="__variables"||n=="__directives"||n=="__all_on"||n=="__name"){t[n]=i;return}if(typeof i=="boolean"){t[n]=i;return}t[n]=P(i)}),t)},v=e=>P(e),h=async e=>{let t=R.jsonToGraphQLQuery(v(e));const n=await j().post(L(),{query:`{ ${t} }`});if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data};function k(e){for(let t=0;t<e.length;t++)if(e[t]instanceof File)return!0;return!1}function ee(e){for(let t in e)if(e[t]instanceof File)return!0;return!1}const u=async(e,t=null,n=[])=>{let i={[e]:{}};const r=new FormData;let o=!1;if(t){const w={},F={},y={};let b=0;Object.entries(t).forEach(([g,m])=>{if(m instanceof Array&&k(m)){o=!0;let _=0;m.forEach(O=>{O instanceof File&&(w[g]=new R.VariableType(g),F[b]=["variables."+g+"."+_],r.append(b.toString(),O),b++)}),y[g]="[Upload!]!"}else m instanceof File?(o=!0,w[g]=new R.VariableType(g),F[b]=["variables."+g],r.append(b.toString(),m),y[g]="Upload!",b++):m instanceof Object&&ee(m)?(o=!0,w[g]===void 0&&(w[g]={}),Object.entries(m).forEach(([_,O])=>{O instanceof File?(w[g][_]=new R.VariableType(_),F[b]=["variables."+_],r.append(b.toString(),O),y[_]="Upload!",b++):w[g][_]=O})):w[g]=m}),i[e].__args=w,i.__variables=y,o&&r.append("map",JSON.stringify(F))}Object.entries(v(n)).forEach(([w,F])=>{i[e][w]=F}),Object.entries(i[e]).length===0&&(i[e]=!0);let f=null;const p=R.jsonToGraphQLQuery({mutation:i});if(o?(r.append("operations",JSON.stringify({query:p})),f=await j().post(L(),r)):f=await j().post(L(),{query:p}),f.data.errors)throw new Error(f.data.errors[0].message);return f.data.data[e]};let J="/api/";const te=e=>{J=e},L=()=>J;async function ne(e){return u("fsUploadTempFile",{file:e},{name:!0,path:!0,size:!0,mime:!0})}const re=(e,t,n)=>u("sendMail",{email:e,subject:t,message:n}),ie=async e=>(await h({config:{__args:{name:e}}})).config;function M(e){const t="==".slice(0,(4-e.length%4)%4),n=e.replace(/-/g,"+").replace(/_/g,"/")+t,i=atob(n),r=new ArrayBuffer(i.length),o=new Uint8Array(r);for(let f=0;f<i.length;f++)o[f]=i.charCodeAt(f);return r}function D(e){const t=new Uint8Array(e);let n="";for(const o of t)n+=String.fromCharCode(o);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var a="copy",d="convert";function C(e,t,n){if(t===a)return n;if(t===d)return e(n);if(t instanceof Array)return n.map(i=>C(e,t[0],i));if(t instanceof Object){const i={};for(const[r,o]of Object.entries(t)){if(o.derive){const f=o.derive(n);f!==void 0&&(n[r]=f)}if(!(r in n)){if(o.required)throw new Error(`Missing key: ${r}`);continue}if(n[r]==null){i[r]=null;continue}i[r]=C(e,o.schema,n[r])}return i}}function U(e,t){return{required:!0,schema:e,derive:t}}function l(e){return{required:!0,schema:e}}function c(e){return{required:!1,schema:e}}var T={type:l(a),id:l(d),transports:c(a)},V={appid:c(a),appidExclude:c(a),credProps:c(a)},K={appid:c(a),appidExclude:c(a),credProps:c(a)},se={publicKey:l({rp:l(a),user:l({id:l(d),name:l(a),displayName:l(a)}),challenge:l(d),pubKeyCredParams:l(a),timeout:c(a),excludeCredentials:c([T]),authenticatorSelection:c(a),attestation:c(a),extensions:c(V)}),signal:c(a)},ae={type:l(a),id:l(a),rawId:l(d),authenticatorAttachment:c(a),response:l({clientDataJSON:l(d),attestationObject:l(d),transports:U(a,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:U(K,e=>e.getClientExtensionResults())},oe={mediation:c(a),publicKey:l({challenge:l(d),timeout:c(a),rpId:c(a),allowCredentials:c([T]),userVerification:c(a),extensions:c(V)}),signal:c(a)},le={type:l(a),id:l(a),rawId:l(d),authenticatorAttachment:c(a),response:l({clientDataJSON:l(d),authenticatorData:l(d),signature:l(d),userHandle:l(d)}),clientExtensionResults:U(K,e=>e.getClientExtensionResults())};function ce(e){return C(M,se,e)}function ue(e){return C(D,ae,e)}function fe(e){return C(M,oe,e)}function de(e){return C(D,le,e)}async function ge(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>ue(t),t}async function pe(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>de(t),t}async function we(e){const n=(await h({webAuthnRequestOptions:{__args:{username:e}}})).webAuthnRequestOptions,i=fe({publicKey:n}),r=await pe(i);await u("webAuthnAssertion",{username:e,assertion:r.toJSON()})}async function he(){const e=await h({webAuthnCreationOptions:!0}),t=ce({publicKey:e.webAuthnCreationOptions}),n=await ge(t);await u("webAuthnRegister",{registration:n.toJSON()})}const be=async e=>(await h({fsListFiles:{__args:{path:e},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,me=async e=>(await h({fsListFolders:{__args:{path:e},name:!0,path:!0}})).fsListFolders,Fe=async e=>{let t=await h({fsFile:{__args:{path:e},base64Content:!0}});return window.atob(t.fsFile.base64Content)},ye=(e,t)=>u("fsWriteFile",{path:e,content:t}),_e=e=>u("fsDeleteFile",{path:e}),Ae=e=>u("fsCreateFolder",{path:e}),Ce=e=>u("fsDeleteFolder",{path:e}),Oe=(e,t)=>u("fsRenameFile",{path:e,name:t}),Se=(e,t)=>u("fsRenameFolder",{path:e,name:t}),Re=(e,t)=>u("fsMoveFile",{source:e,target:t});s.File=x,s.defineModel=I,s.file=E,s.forgetPassword=z,s.fsCreateFolder=Ae,s.fsDeleteFile=_e,s.fsDeleteFolder=Ce,s.fsListFiles=be,s.fsListFolders=me,s.fsMoveFile=Re,s.fsReadFile=Fe,s.fsRenameFile=Oe,s.fsRenameFolder=Se,s.fsWriteFile=ye,s.getApiUrl=L,s.getAxios=j,s.getConfig=ie,s.getGQLFields=X,s.getModelField=N,s.granted=H,s.login=Q,s.logout=B,s.model=Y,s.mutation=u,s.query=h,s.resetPassword=$,s.sendMail=re,s.setApiUrl=te,s.setAxios=G,s.toQuery=v,s.updatePassword=W,s.uploadFile=ne,s.webauthnLogin=we,s.webauthnRegister=he,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|