@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/light.js CHANGED
@@ -1,539 +1,548 @@
1
- import T from "axios";
2
- import { jsonToGraphQLQuery as N, VariableType as S } from "json-to-graphql-query";
3
- const re = (e, t, r = "") => u("login", {
4
- username: e,
5
- password: t,
6
- code: r
7
- }), ne = () => u("logout"), se = (e, t) => u("updatePassword", {
8
- old_password: e,
9
- new_password: t
10
- }), ae = (e, t, r) => u("resetPassword", {
11
- email: e,
12
- password: t,
13
- code: r
14
- }), ie = (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 w({
23
- granted: {
24
- __args: {
25
- rights: e
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
- })).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(i) {
41
- return n.field && typeof n.field == "function" ? n.field(i) : n.field && typeof n.field == "string" ? i[n.field] : i[this.getName()];
42
- },
43
- getFormattedValue(i) {
44
- const l = this.getValue(i);
45
- return n.format ? n.format(l) : l;
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
- }, U = (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 = U(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;
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
- name: t,
62
- $fields: C[e],
63
- async update(r, s) {
64
- return await u("update" + t, { id: r, data: s });
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 delete(r) {
67
- return await u("delete" + t, { id: r });
253
+ async update(i, p) {
254
+ return await c(s, "update" + n, { id: i, data: p });
68
255
  },
69
- async add(r) {
70
- return await u("add" + t, { data: r });
256
+ async delete(i) {
257
+ return await c(s, "delete" + n, { id: i });
71
258
  },
72
- fields(r) {
73
- let s = [];
74
- for (let n of r) {
75
- const i = U(t, n);
76
- i && s.push(i);
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 s;
268
+ return p;
79
269
  },
80
- async get(r, s) {
81
- return (await w({
82
- ["list" + t]: {
270
+ async get(i, p) {
271
+ return (await h(s, {
272
+ ["list" + n]: {
83
273
  __args: {
84
- filters: r
274
+ filters: i
85
275
  },
86
276
  data: {
87
277
  __args: {
88
278
  limit: 1
89
279
  },
90
- ...R(s)
280
+ ...A(p)
91
281
  }
92
282
  }
93
- }))["list" + t].data[0];
283
+ }))["list" + n].data[0];
94
284
  },
95
- async list(r, s) {
96
- return (await w({
97
- ["list" + t]: {
285
+ async list(i, p) {
286
+ return (await h(s, {
287
+ ["list" + n]: {
98
288
  __args: {
99
- filters: r
289
+ filters: i
100
290
  },
101
291
  data: {
102
- ...R(s)
292
+ ...A(p)
103
293
  }
104
294
  }
105
- }))["list" + t].data;
295
+ }))["list" + n].data;
106
296
  }
107
297
  };
108
298
  };
109
- function M(e) {
110
- e = "<~" + e + "~>";
111
- var t, r, s, n, i, l = String, d = 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, i = e.length; i > 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(d & r >> 24, d & r >> 16, d & r >> 8, d & r);
114
- return function(g, b) {
115
- for (var _ = b; _ > 0; _--)
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 = (e = "") => {
120
- const t = e, r = (s = "application/octet-stream") => {
121
- const n = new Uint8Array(t.length);
122
- for (let d = 0; d < t.length; d++)
123
- n[d] = t.charCodeAt(d);
124
- const i = new Blob([n], { type: s });
125
- return URL.createObjectURL(i);
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: () => t,
316
+ getContent: () => e,
129
317
  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);
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: (s) => {
135
- window.open(r(s), "_blank");
322
+ open: (n) => {
323
+ window.open(r(n), "_blank");
136
324
  }
137
325
  };
138
- }, de = {
139
- fromBase85: (e) => v(M(e)),
140
- fromBase64: (e) => v(atob(e)),
141
- fromString: (e) => v(e)
142
- }, pe = async () => (await w({
143
- listRole: {
144
- name: !0
145
- }
146
- })).listRole, ge = async () => (await w({
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
- }), t) : (Object.entries(e).forEach(([r, s]) => {
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
- t[r] = s;
338
+ e[r] = n;
165
339
  return;
166
340
  }
167
- if (typeof s == "boolean") {
168
- t[r] = s;
341
+ if (typeof n == "boolean") {
342
+ e[r] = n;
169
343
  return;
170
344
  }
171
- t[r] = j(s);
172
- }), t);
173
- }, R = (e) => j(e), w = async (e) => {
174
- let t = N(R(e));
175
- const r = await E().post(q(), {
176
- query: `{ ${t} }`
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 (r.data.errors)
179
- throw new Error(r.data.errors[0].message);
180
- return r.data.data;
352
+ if (n.data.errors)
353
+ throw new Error(n.data.errors[0].message);
354
+ return n.data.data;
181
355
  };
182
- function B(e) {
183
- for (let t = 0; t < e.length; t++)
184
- if (e[t] instanceof File)
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 Q(e) {
189
- for (let t in e)
190
- if (e[t] instanceof File)
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 u = async (e, t = null, r = []) => {
368
+ const c = async (t, e, r = null, n = []) => {
195
369
  let s = {
196
370
  [e]: {}
197
371
  };
198
- const n = new FormData();
199
- let i = !1;
200
- if (t) {
201
- const g = {}, b = {}, _ = {};
202
- let m = 0;
203
- Object.entries(t).forEach(([p, h]) => {
204
- if (h instanceof Array && B(h)) {
205
- i = !0;
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
- h.forEach((F) => {
208
- F instanceof File && (g[p] = new S(p), b[m] = ["variables." + p + "." + y], n.append(m.toString(), F), m++);
209
- }), _[p] = "[Upload!]!";
210
- } else
211
- h instanceof File ? (i = !0, g[p] = new S(p), b[m] = ["variables." + p], n.append(m.toString(), h), _[p] = "Upload!", m++) : h instanceof Object && Q(h) ? (i = !0, g[p] = {}, Object.entries(h).forEach(([y, F]) => {
212
- F instanceof File ? (g[p][y] = new S(y), b[m] = ["variables." + y], n.append(m.toString(), F), _[y] = "Upload!", m++) : g[p][y] = F;
213
- })) : h !== void 0 && (g[p] = h);
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(R(r)).forEach(([g, b]) => {
217
- s[e][g] = b;
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 l = null;
220
- const d = N({ mutation: s });
221
- if (i ? (n.append("operations", JSON.stringify({
222
- query: d
223
- })), l = await E().post(q(), n)) : l = await E().post(q(), {
224
- query: d
225
- }), l.data.errors)
226
- throw new Error(l.data.errors[0].message);
227
- return l.data.data[e];
228
- };
229
- let L = "/api/";
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
- const me = (e, t, r) => u("sendMail", {
244
- email: e,
245
- subject: t,
246
- message: r
247
- }), be = async (e) => (await w({
248
- config: {
249
- __args: {
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
- if (!(n in r)) {
286
- if (i.required)
287
- throw new Error(`Missing key: ${n}`);
288
- continue;
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
- if (r[n] == null) {
291
- s[n] = null;
292
- continue;
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
- return s;
301
- }
302
- }
303
- function x(e, t) {
304
- return {
305
- required: !0,
306
- schema: e,
307
- derive: t
308
- };
309
- }
310
- function o(e) {
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
- required: !0,
313
- schema: e
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
- function c(e) {
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
- required: !1,
319
- schema: e
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
- de as File,
504
- le as defineModel,
542
+ ie as File,
543
+ oe as createClient,
505
544
  v as file,
506
- ie as forgetPassword,
507
- Se as fsCreateFolder,
508
- Re as fsDeleteFile,
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
  };