@hostlink/light 2.0.0 → 2.0.1

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