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