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