@hostlink/light 3.4.0 → 3.5.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/light.js CHANGED
@@ -1,71 +1,71 @@
1
- import { jsonToGraphQLQuery as I, VariableType as S } from "json-to-graphql-query";
2
- import Q from "collect.js";
3
- import gt from "axios";
4
- function $(t) {
1
+ import { jsonToGraphQLQuery as x, VariableType as j } from "json-to-graphql-query";
2
+ import W from "collect.js";
3
+ import ht from "axios";
4
+ function z(t) {
5
5
  if (t === null || typeof t != "object")
6
6
  return !1;
7
7
  const e = Object.getPrototypeOf(t);
8
8
  return e !== null && e !== Object.prototype && Object.getPrototypeOf(e) !== null || Symbol.iterator in t ? !1 : Symbol.toStringTag in t ? Object.prototype.toString.call(t) === "[object Module]" : !0;
9
9
  }
10
- function W(t, e, r = ".", s) {
11
- if (!$(e))
12
- return W(t, {}, r, s);
10
+ function H(t, e, r = ".", s) {
11
+ if (!z(e))
12
+ return H(t, {}, r, s);
13
13
  const n = Object.assign({}, e);
14
- for (const c in t) {
15
- if (c === "__proto__" || c === "constructor")
14
+ for (const f in t) {
15
+ if (f === "__proto__" || f === "constructor")
16
16
  continue;
17
- const l = t[c];
18
- l != null && (s && s(n, c, l, r) || (Array.isArray(l) && Array.isArray(n[c]) ? n[c] = [...l, ...n[c]] : $(l) && $(n[c]) ? n[c] = W(
19
- l,
20
- n[c],
21
- (r ? `${r}.` : "") + c.toString(),
17
+ const c = t[f];
18
+ c != null && (s && s(n, f, c, r) || (Array.isArray(c) && Array.isArray(n[f]) ? n[f] = [...c, ...n[f]] : z(c) && z(n[f]) ? n[f] = H(
19
+ c,
20
+ n[f],
21
+ (r ? `${r}.` : "") + f.toString(),
22
22
  s
23
- ) : n[c] = l));
23
+ ) : n[f] = c));
24
24
  }
25
25
  return n;
26
26
  }
27
- function dt(t) {
27
+ function ft(t) {
28
28
  return (...e) => (
29
29
  // eslint-disable-next-line unicorn/no-array-reduce
30
- e.reduce((r, s) => W(r, s, "", t), {})
30
+ e.reduce((r, s) => H(r, s, "", t), {})
31
31
  );
32
32
  }
33
- const j = dt();
34
- let q = null;
35
- const _t = (t) => {
36
- q = t;
37
- }, K = () => {
38
- if (!q)
33
+ const E = ft();
34
+ let R = null;
35
+ const pt = (t) => {
36
+ R = t;
37
+ }, I = () => {
38
+ if (!R)
39
39
  throw new Error("Api client not initialized. Call setApiClient() first.");
40
- return q;
41
- }, ce = () => q;
42
- function N(t) {
40
+ return R;
41
+ }, ne = () => R;
42
+ function T(t) {
43
43
  for (let e = 0; e < t.length; e++)
44
44
  if (t[e] instanceof File)
45
45
  return !0;
46
46
  return !1;
47
47
  }
48
- function x(t) {
48
+ function K(t) {
49
49
  for (let e in t)
50
- if (t[e] instanceof File || t[e] instanceof Array && N(t[e]))
50
+ if (t[e] instanceof File || t[e] instanceof Array && T(t[e]))
51
51
  return !0;
52
52
  return !1;
53
53
  }
54
- function yt(t) {
54
+ function gt(t) {
55
55
  t = "<~" + t + "~>";
56
- var e, r, s, n, c, l = String, f = 255;
57
- 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, s = [], n = 0, c = t.length; c > n; n += 5) r = 52200625 * (t.charCodeAt(n) - 33) + 614125 * (t.charCodeAt(n + 1) - 33) + 7225 * (t.charCodeAt(n + 2) - 33) + 85 * (t.charCodeAt(n + 3) - 33) + (t.charCodeAt(n + 4) - 33), s.push(f & r >> 24, f & r >> 16, f & r >> 8, f & r);
58
- return (function(p, o) {
59
- for (var i = o; i > 0; i--) p.pop();
60
- })(s, e.length), l.fromCharCode.apply(l, s);
56
+ var e, r, s, n, f, c = String, p = 255;
57
+ 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, s = [], n = 0, f = t.length; f > n; n += 5) r = 52200625 * (t.charCodeAt(n) - 33) + 614125 * (t.charCodeAt(n + 1) - 33) + 7225 * (t.charCodeAt(n + 2) - 33) + 85 * (t.charCodeAt(n + 3) - 33) + (t.charCodeAt(n + 4) - 33), s.push(p & r >> 24, p & r >> 16, p & r >> 8, p & r);
58
+ return (function(h, o) {
59
+ for (var i = o; i > 0; i--) h.pop();
60
+ })(s, e.length), c.fromCharCode.apply(c, s);
61
61
  }
62
62
  const tt = (t = "") => {
63
63
  const e = t, r = (s = "application/octet-stream") => {
64
64
  const n = new Uint8Array(e.length);
65
- for (let f = 0; f < e.length; f++)
66
- n[f] = e.charCodeAt(f);
67
- const c = new Blob([n], { type: s });
68
- return URL.createObjectURL(c);
65
+ for (let p = 0; p < e.length; p++)
66
+ n[p] = e.charCodeAt(p);
67
+ const f = new Blob([n], { type: s });
68
+ return URL.createObjectURL(f);
69
69
  };
70
70
  return {
71
71
  getContent: () => e,
@@ -78,54 +78,54 @@ const tt = (t = "") => {
78
78
  window.open(r(s), "_blank");
79
79
  }
80
80
  };
81
- }, ue = (t) => tt(atob(t)), he = (t) => tt(yt(t));
81
+ }, oe = (t) => tt(atob(t)), ie = (t) => tt(gt(t));
82
82
  function et(t, e, r, s, n) {
83
83
  if (!(!t || typeof t != "object"))
84
- for (let c in t) {
85
- const l = t[c];
86
- if (l && typeof l == "object") {
87
- if ("__args" in l) {
88
- const f = l.__args, p = {};
89
- Object.entries(f).forEach(([o, i]) => {
90
- if (i instanceof Array && N(i)) {
91
- p[o] = new S(o);
84
+ for (let f in t) {
85
+ const c = t[f];
86
+ if (c && typeof c == "object") {
87
+ if ("__args" in c) {
88
+ const p = c.__args, h = {};
89
+ Object.entries(p).forEach(([o, i]) => {
90
+ if (i instanceof Array && T(i)) {
91
+ h[o] = new j(o);
92
92
  let a = 0;
93
- i.forEach((u) => {
94
- u instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + o + "." + a), s.append(n.current.toString(), u), n.current++, a++);
93
+ i.forEach((l) => {
94
+ l instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + o + "." + a), s.append(n.current.toString(), l), n.current++, a++);
95
95
  }), e[o] = "[Upload!]!";
96
- } else i instanceof File ? (p[o] = new S(o), r[n.current] = ["variables." + o], s.append(n.current.toString(), i), e[o] = "Upload!", n.current++) : i instanceof Object && x(i) ? (p[o] = {}, Object.entries(i).forEach(([a, u]) => {
97
- if (u instanceof Array && N(u)) {
98
- p[o][a] = new S(a);
96
+ } else i instanceof File ? (h[o] = new j(o), r[n.current] = ["variables." + o], s.append(n.current.toString(), i), e[o] = "Upload!", n.current++) : i instanceof Object && K(i) ? (h[o] = {}, Object.entries(i).forEach(([a, l]) => {
97
+ if (l instanceof Array && T(l)) {
98
+ h[o][a] = new j(a);
99
99
  let m = 0;
100
- u.forEach((d) => {
100
+ l.forEach((d) => {
101
101
  d instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + a + "." + m), s.append(n.current.toString(), d), n.current++, m++);
102
102
  }), e[a] = "[Upload!]!";
103
- } else u instanceof File ? (p[o][a] = new S(a), r[n.current] = ["variables." + a], s.append(n.current.toString(), u), e[a] = "Upload!", n.current++) : p[o][a] = u;
104
- })) : i != null && (p[o] = i);
105
- }), l.__args = p;
103
+ } else l instanceof File ? (h[o][a] = new j(a), r[n.current] = ["variables." + a], s.append(n.current.toString(), l), e[a] = "Upload!", n.current++) : h[o][a] = l;
104
+ })) : i != null && (h[o] = i);
105
+ }), c.__args = h;
106
106
  }
107
- et(l, e, r, s, n);
107
+ et(c, e, r, s, n);
108
108
  }
109
109
  }
110
110
  }
111
111
  const rt = (t) => async (e) => {
112
112
  const r = e, s = new FormData();
113
113
  let n = !1;
114
- const c = {}, l = {};
115
- et(r, c, l, s, { current: 0 }), n = Object.keys(c).length > 0, n && (r.__variables = c);
116
- let p = null;
117
- const i = I({ query: r });
118
- if (n ? (s.append("map", JSON.stringify(l)), s.append("operations", JSON.stringify({
114
+ const f = {}, c = {};
115
+ et(r, f, c, s, { current: 0 }), n = Object.keys(f).length > 0, n && (r.__variables = f);
116
+ let h = null;
117
+ const i = x({ query: r });
118
+ if (n ? (s.append("map", JSON.stringify(c)), s.append("operations", JSON.stringify({
119
119
  query: i
120
- })), p = await t.post("", s)) : p = await t.post("", {
120
+ })), h = await t.post("", s)) : h = await t.post("", {
121
121
  query: i
122
- }), p.data.errors)
123
- throw new Error(p.data.errors[0].message);
124
- return p.data.data;
125
- }, F = async (t) => rt(K().axios)(t);
126
- function L(t, e, r = F) {
127
- let s, n = [], c, l;
128
- const f = (o) => !o || typeof o != "object" ? !1 : Object.values(o).some((i) => i && typeof i == "object" && Object.keys(i).some((a) => a.startsWith("_"))), p = () => n.length === 0 ? (n.unshift({}), n[0]) : (f(n[0]) && n.unshift({}), n[0]);
122
+ }), h.data.errors)
123
+ throw new Error(h.data.errors[0].message);
124
+ return h.data.data;
125
+ }, O = async (t) => rt(I().axios)(t);
126
+ function G(t, e, r = O) {
127
+ let s, n = [], f, c;
128
+ const p = (o) => !o || typeof o != "object" ? !1 : Object.values(o).some((i) => i && typeof i == "object" && Object.keys(i).some((a) => a.startsWith("_"))), h = () => n.length === 0 ? (n.unshift({}), n[0]) : (p(n[0]) && n.unshift({}), n[0]);
129
129
  return {
130
130
  first() {
131
131
  return this.fetchFirst();
@@ -139,29 +139,29 @@ function L(t, e, r = F) {
139
139
  },
140
140
  async fetchWithMeta() {
141
141
  let i = await r(this.toQuery(!0));
142
- if (l) {
143
- const a = l.split(".");
144
- for (const u of a)
145
- i = i[u];
142
+ if (c) {
143
+ const a = c.split(".");
144
+ for (const l of a)
145
+ i = i[l];
146
146
  return i;
147
147
  }
148
148
  return i[`list${t}`];
149
149
  },
150
150
  async fetch() {
151
151
  let i = await r(this.toQuery());
152
- if (l) {
153
- const a = l.split(".");
154
- for (const u of a)
155
- i = i[u];
152
+ if (c) {
153
+ const a = c.split(".");
154
+ for (const l of a)
155
+ i = i[l];
156
156
  return i.data;
157
157
  }
158
158
  return i[`list${t}`].data;
159
159
  },
160
160
  dataPath(o) {
161
- return o && typeof o == "string" && (l = o), this;
161
+ return o && typeof o == "string" && (c = o), this;
162
162
  },
163
163
  sort(o) {
164
- return o && typeof o == "string" && (c = o), this;
164
+ return o && typeof o == "string" && (f = o), this;
165
165
  },
166
166
  filters(o) {
167
167
  return o && typeof o == "object" && (n = [o]), this;
@@ -170,8 +170,8 @@ function L(t, e, r = F) {
170
170
  // where('key', value) -> exact match
171
171
  // where('key', '>', value) -> operator-based (>, <, >=, <=, !=, in, contains)
172
172
  where(o, i, a) {
173
- const u = (m, d, b) => {
174
- const C = {
173
+ const l = (m, d, b) => {
174
+ const k = {
175
175
  ">": "_gt",
176
176
  "<": "_lt",
177
177
  ">=": "_gte",
@@ -180,12 +180,12 @@ function L(t, e, r = F) {
180
180
  in: "_in",
181
181
  contains: "_contains"
182
182
  }[d];
183
- C && n.push({ [m]: { [C]: b } });
183
+ k && n.push({ [m]: { [k]: b } });
184
184
  };
185
185
  if (a !== void 0)
186
- u(o, String(i), a);
186
+ l(o, String(i), a);
187
187
  else {
188
- const m = p(), d = j(m, { [o]: i });
188
+ const m = h(), d = E(m, { [o]: i });
189
189
  n[0] = d;
190
190
  }
191
191
  return this;
@@ -194,8 +194,8 @@ function L(t, e, r = F) {
194
194
  // If the same field is used multiple times, it merges them into an array
195
195
  whereContains(o, i) {
196
196
  if (o && typeof o == "string") {
197
- const a = p(), u = { _contains: i };
198
- a[o] ? Array.isArray(a[o]) ? a[o].push(u) : a[o] = [a[o], u] : a[o] = [u], n[0] = a;
197
+ const a = h(), l = { _contains: i };
198
+ a[o] ? Array.isArray(a[o]) ? a[o].push(l) : a[o] = [a[o], l] : a[o] = [l], n[0] = a;
199
199
  }
200
200
  return this;
201
201
  },
@@ -204,33 +204,33 @@ function L(t, e, r = F) {
204
204
  // If the same field is used multiple times, it merges them into an array
205
205
  whereIn(o, i) {
206
206
  if (o && typeof o == "string" && Array.isArray(i)) {
207
- const a = p(), u = { _in: i };
208
- a[o] ? Array.isArray(a[o]) ? a[o].push(u) : a[o] = [a[o], u] : a[o] = [u], n[0] = a;
207
+ const a = h(), l = { _in: i };
208
+ a[o] ? Array.isArray(a[o]) ? a[o].push(l) : a[o] = [a[o], l] : a[o] = [l], n[0] = a;
209
209
  }
210
210
  return this;
211
211
  },
212
212
  // whereBetween adds a _between filter for a specific field
213
213
  whereBetween(o, i, a) {
214
214
  if (o && typeof o == "string") {
215
- const u = p(), m = { _between: [i, a] };
216
- u[o] ? Array.isArray(u[o]) ? u[o].push(m) : u[o] = [u[o], m] : u[o] = m, n[0] = u;
215
+ const l = h(), m = { _between: [i, a] };
216
+ l[o] ? Array.isArray(l[o]) ? l[o].push(m) : l[o] = [l[o], m] : l[o] = m, n[0] = l;
217
217
  }
218
218
  return this;
219
219
  },
220
220
  // limit sets paging/limit for the data selection
221
221
  limit(o) {
222
- return typeof o == "number" && Number.isFinite(o) && (s = j(s || {}, { limit: o })), this;
222
+ return typeof o == "number" && Number.isFinite(o) && (s = E(s || {}, { limit: o })), this;
223
223
  },
224
224
  // offset sets the starting index for the data selection
225
225
  offset(o) {
226
- return typeof o == "number" && Number.isFinite(o) && (s = j(s || {}, { offset: o })), this;
226
+ return typeof o == "number" && Number.isFinite(o) && (s = E(s || {}, { offset: o })), this;
227
227
  },
228
228
  toQuery(o = !1) {
229
229
  let i;
230
- const a = n.length > 0 && Object.keys(n[0] || {}).length > 0, u = a ? 1 : 0, m = n.length > u;
231
- a && m ? i = n : m ? i = n.slice(u) : a && (i = n[0]);
232
- const d = j(
233
- c ? { sort: c } : {},
230
+ const a = n.length > 0 && Object.keys(n[0] || {}).length > 0, l = a ? 1 : 0, m = n.length > l;
231
+ a && m ? i = n : m ? i = n.slice(l) : a && (i = n[0]);
232
+ const d = E(
233
+ f ? { sort: f } : {},
234
234
  i ? { filters: i } : {}
235
235
  ), b = {
236
236
  data: {
@@ -241,14 +241,14 @@ function L(t, e, r = F) {
241
241
  total: !0,
242
242
  key: !0,
243
243
  name: !0
244
- }), l) {
245
- const O = l.split(".");
246
- let C = b;
247
- for (let P = O.length - 1; P >= 0; P--)
248
- C = {
249
- [O[P]]: C
244
+ }), c) {
245
+ const P = c.split(".");
246
+ let k = b;
247
+ for (let U = P.length - 1; U >= 0; U--)
248
+ k = {
249
+ [P[U]]: k
250
250
  };
251
- return C;
251
+ return k;
252
252
  }
253
253
  return {
254
254
  [`list${t}`]: b
@@ -256,7 +256,7 @@ function L(t, e, r = F) {
256
256
  }
257
257
  };
258
258
  }
259
- const wt = "list", bt = [
259
+ const dt = "list", _t = [
260
260
  "flatMap",
261
261
  "chunk",
262
262
  "shuffle",
@@ -282,7 +282,7 @@ const wt = "list", bt = [
282
282
  "slice",
283
283
  "tap",
284
284
  "sort"
285
- ], mt = [
285
+ ], yt = [
286
286
  "avg",
287
287
  "count",
288
288
  "countBy",
@@ -353,14 +353,14 @@ w.prototype.clone = function() {
353
353
  const t = Object.create(this);
354
354
  return t.steps = JSON.parse(JSON.stringify(this.steps)), t.filters = JSON.parse(JSON.stringify(this.filters)), t.fields = JSON.parse(JSON.stringify(this.fields)), t;
355
355
  };
356
- Q().macro("whereContains", function(t, e) {
356
+ W().macro("whereContains", function(t, e) {
357
357
  return this.filter((r) => r[t].toLowerCase().includes(e.toLowerCase()));
358
358
  });
359
359
  w.prototype.fetchData = async function() {
360
360
  try {
361
361
  if (this._batchData) {
362
- const f = this._batchData;
363
- return this.meta = f.meta, Q(f.data);
362
+ const p = this._batchData;
363
+ return this.meta = p.meta, W(p.data);
364
364
  }
365
365
  let t = {
366
366
  meta: {
@@ -372,17 +372,17 @@ w.prototype.fetchData = async function() {
372
372
  t.__args = this.buildArgs(), t.data = this.fields, this.already_limit && (t.data.__args = t.data.__args || {}, t.data.__args.limit = this.limit), this.already_offset && (t.data.__args = t.data.__args || {}, t.data.__args.offset = this.offset);
373
373
  const e = this.data_path.split(".");
374
374
  let r = {}, s = r, n = e[e.length - 1];
375
- for (const f of e) {
376
- if (f === n) {
377
- s[f] = t;
375
+ for (const p of e) {
376
+ if (p === n) {
377
+ s[p] = t;
378
378
  break;
379
379
  }
380
- s[f] = {}, s = s[f];
380
+ s[p] = {}, s = s[p];
381
381
  }
382
- let l = await (this._queryFn || F)(r);
383
- for (const f of e)
384
- l = l[f];
385
- return this.meta = l.meta, Q(l.data);
382
+ let c = await (this._queryFn || O)(r);
383
+ for (const p of e)
384
+ c = c[p];
385
+ return this.meta = c.meta, W(c.data);
386
386
  } catch (t) {
387
387
  throw console.error("Error fetching collection data:", t), t;
388
388
  }
@@ -396,12 +396,12 @@ w.prototype.processData = async function() {
396
396
  w.prototype.all = async function() {
397
397
  return (await this.processData()).all();
398
398
  };
399
- for (const t of bt)
399
+ for (const t of _t)
400
400
  w.prototype[t] = function(...e) {
401
401
  const r = this.clone();
402
402
  return r.steps.push({ type: t, args: e }), r;
403
403
  };
404
- for (const t of mt)
404
+ for (const t of yt)
405
405
  w.prototype[t] = async function(...e) {
406
406
  return (await this.clone().processData())[t](...e);
407
407
  };
@@ -486,29 +486,29 @@ w.prototype.take = function(t) {
486
486
  w.prototype.splice = function(t, e) {
487
487
  return this.steps.push({ type: "splice", args: [t, e] }), this.offset = t, this.limit = e, this.already_limit = !0, this.already_offset = !0, this;
488
488
  };
489
- const st = (t, e, r = F) => {
489
+ const st = (t, e, r = O) => {
490
490
  const s = new w(e);
491
- return s._queryFn = r, s.data_path = wt + t, s;
491
+ return s._queryFn = r, s.data_path = dt + t, s;
492
492
  }, nt = (t, e = {}, r = {}) => {
493
- const s = r.mutation || g, n = r.createList || L, c = r.createCollection || st, l = e;
494
- let f = "list" + t;
495
- const p = (o) => l[o] ? l[o] : null;
493
+ const s = r.mutation || g, n = r.createList || G, f = r.createCollection || st, c = e;
494
+ let p = "list" + t;
495
+ const h = (o) => c[o] ? c[o] : null;
496
496
  return {
497
- field: p,
498
- $fields: l,
497
+ field: h,
498
+ $fields: c,
499
499
  setDataPath(o) {
500
- return f = o, f;
500
+ return p = o, p;
501
501
  },
502
502
  getDataPath() {
503
- return f;
503
+ return p;
504
504
  },
505
505
  gqlFields(o) {
506
506
  let i = {};
507
507
  for (const a of o)
508
508
  if (typeof a == "string") {
509
- const u = p(a);
510
- u && (i = j(i, u.gqlField ? typeof u.gqlField == "string" ? { [u.gqlField]: !0 } : u.gqlField : { [u.name || a]: !0 }));
511
- } else typeof a == "object" && (i = j(i, a));
509
+ const l = h(a);
510
+ l && (i = E(i, l.gqlField ? typeof l.gqlField == "string" ? { [l.gqlField]: !0 } : l.gqlField : { [l.name || a]: !0 }));
511
+ } else typeof a == "object" && (i = E(i, a));
512
512
  return i;
513
513
  },
514
514
  update(o, i) {
@@ -535,111 +535,111 @@ const st = (t, e, r = F) => {
535
535
  fields(o) {
536
536
  let i = [];
537
537
  for (let a of o) {
538
- const u = p(a);
539
- u && i.push(u);
538
+ const l = h(a);
539
+ l && i.push(l);
540
540
  }
541
541
  return i;
542
542
  },
543
543
  async get(o, i) {
544
- const a = c(t, ne(i));
545
- for (const [u, m] of Object.entries(o))
546
- a.where(u, "==", m);
544
+ const a = f(t, Kt(i));
545
+ for (const [l, m] of Object.entries(o))
546
+ a.where(l, "==", m);
547
547
  return await a.first();
548
548
  },
549
549
  list(o) {
550
550
  let i = o;
551
551
  const a = {};
552
552
  Object.entries(o).forEach(([d]) => {
553
- l[d] && (a[d] = l[d], l[d].gqlField && (delete i[d], i = j(i, l[d].gqlField)), l[d].gql && (delete i[d], i = j(i, l[d].gql)));
553
+ c[d] && (a[d] = c[d], c[d].gqlField && (delete i[d], i = E(i, c[d].gqlField)), c[d].gql && (delete i[d], i = E(i, c[d].gql)));
554
554
  });
555
- const u = n(t, i).dataPath(f), m = u.fetch.bind(u);
555
+ const l = n(t, i).dataPath(p), m = l.fetch.bind(l);
556
556
  return {
557
- ...u,
557
+ ...l,
558
558
  async fetch() {
559
559
  return (await m()).map((b) => {
560
- const O = { ...b };
561
- return Object.entries(a).forEach(([C, P]) => {
562
- P.field && typeof P.field == "function" && (O[C] = P.field(b[C], b));
563
- }), O;
560
+ const P = { ...b };
561
+ return Object.entries(a).forEach(([k, U]) => {
562
+ U.field && typeof U.field == "function" && (P[k] = U.field(b[k], b));
563
+ }), P;
564
564
  });
565
565
  },
566
566
  async fetchFirst() {
567
- const b = await u.fetchFirst.bind(u)();
567
+ const b = await l.fetchFirst.bind(l)();
568
568
  if (!b) return b;
569
- const O = { ...b };
570
- return Object.entries(a).forEach(([C, P]) => {
571
- P.field && typeof P.field == "function" && (O[C] = P.field(b[C], b));
572
- }), O;
569
+ const P = { ...b };
570
+ return Object.entries(a).forEach(([k, U]) => {
571
+ U.field && typeof U.field == "function" && (P[k] = U.field(b[k], b));
572
+ }), P;
573
573
  }
574
574
  };
575
575
  }
576
576
  };
577
- }, E = {}, ot = (t, e) => {
577
+ }, D = {}, ot = (t, e) => {
578
578
  const r = nt(t, e);
579
- return E[t] = r, r;
580
- }, z = (t) => E[t] ? E[t] : ot(t, {}), pe = (t) => !!E[t], fe = () => Object.keys(E), ge = () => {
581
- Object.keys(E).forEach((t) => delete E[t]);
582
- }, de = (t) => {
579
+ return D[t] = r, r;
580
+ }, $ = (t) => D[t] ? D[t] : ot(t, {}), ae = (t) => !!D[t], ce = () => Object.keys(D), le = () => {
581
+ Object.keys(D).forEach((t) => delete D[t]);
582
+ }, ue = (t) => {
583
583
  Object.entries(t).forEach(([e, r]) => {
584
584
  ot(e, r);
585
585
  });
586
- }, _e = () => F({
586
+ }, he = () => O({
587
587
  app: {
588
588
  permissions: !0
589
589
  }
590
590
  }).then((t) => t.app.permissions), Y = (t, e) => {
591
591
  const r = async () => {
592
- const { app: l } = await t({
592
+ const { app: c } = await t({
593
593
  app: {
594
594
  auth: {
595
595
  webAuthnRequestOptions: !0
596
596
  }
597
597
  }
598
- }), f = l.auth.webAuthnRequestOptions, p = PublicKeyCredential.parseRequestOptionsFromJSON(f);
599
- return await navigator.credentials.get({ publicKey: p });
598
+ }), p = c.auth.webAuthnRequestOptions, h = PublicKeyCredential.parseRequestOptionsFromJSON(p);
599
+ return await navigator.credentials.get({ publicKey: h });
600
600
  }, s = async () => {
601
- const { app: l } = await t({
601
+ const { app: c } = await t({
602
602
  app: {
603
603
  auth: {
604
604
  webAuthnCreationOptions: !0
605
605
  }
606
606
  }
607
- }), f = PublicKeyCredential.parseCreationOptionsFromJSON(l.auth.webAuthnCreationOptions);
608
- return await navigator.credentials.create({ publicKey: f });
607
+ }), p = PublicKeyCredential.parseCreationOptionsFromJSON(c.auth.webAuthnCreationOptions);
608
+ return await navigator.credentials.create({ publicKey: p });
609
609
  };
610
610
  return { assertion: r, attestation: s, login: async () => {
611
- const l = await r();
611
+ const c = await r();
612
612
  return await e({
613
613
  webAuthnAssertion: {
614
614
  __args: {
615
- assertion: l.toJSON()
615
+ assertion: c.toJSON()
616
616
  }
617
617
  }
618
- }).then((f) => f.webAuthnAssertion);
618
+ }).then((p) => p.webAuthnAssertion);
619
619
  }, register: async () => {
620
- const l = await s();
620
+ const c = await s();
621
621
  return await e({
622
622
  webAuthnRegister: {
623
623
  __args: {
624
- registration: l.toJSON()
624
+ registration: c.toJSON()
625
625
  }
626
626
  }
627
- }).then((f) => f.webAuthnRegister);
627
+ }).then((p) => p.webAuthnRegister);
628
628
  } };
629
- }, G = Y(F, g), Ft = G.assertion, At = G.attestation, kt = G.login, Ct = G.register, Ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
629
+ }, J = Y((t) => O(t), (t) => g(t)), wt = J.assertion, bt = J.attestation, mt = J.login, At = J.register, Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
630
630
  __proto__: null,
631
- assertion: Ft,
632
- attestation: At,
631
+ assertion: wt,
632
+ attestation: bt,
633
633
  createWebAuthn: Y,
634
- login: kt,
635
- register: Ct
636
- }, Symbol.toStringTag, { value: "Module" })), Pt = (t, e) => ({
637
- getCurrentUser: (r = J) => t({ my: r }).then((s) => s.my),
638
- login: (r, s, n = "") => e({ login: { __args: { username: r, password: s, code: n } } }).then((c) => c.login),
634
+ login: mt,
635
+ register: At
636
+ }, Symbol.toStringTag, { value: "Module" })), kt = (t, e) => ({
637
+ getCurrentUser: (r = Q) => t({ my: r }).then((s) => s.my),
638
+ login: (r, s, n = "") => e({ login: { __args: { username: r, password: s, code: n } } }).then((f) => f.login),
639
639
  logout: () => e({ logout: !0 }).then((r) => r.logout),
640
- changeExpiredPassword: (r, s, n) => e({ changeExpiredPassword: { __args: { username: r, old_password: s, new_password: n } } }).then((c) => c.changeExpiredPassword),
640
+ changeExpiredPassword: (r, s, n) => e({ changeExpiredPassword: { __args: { username: r, old_password: s, new_password: n } } }).then((f) => f.changeExpiredPassword),
641
641
  updatePassword: (r, s) => e({ changeUserPassword: { __args: { old_password: r, new_password: s } } }).then((n) => n.changeUserPassword),
642
- resetPassword: (r, s, n) => e({ resetPassword: { __args: { jwt: r, password: s, code: n } } }).then((c) => c.resetPassword),
642
+ resetPassword: (r, s, n) => e({ resetPassword: { __args: { jwt: r, password: s, code: n } } }).then((f) => f.resetPassword),
643
643
  forgetPassword: (r, s) => e({ forgetPassword: { __args: { username: r, email: s } } }).then((n) => n.forgetPassword),
644
644
  verifyCode: (r, s) => e({ forgetPasswordVerifyCode: { __args: { jwt: r, code: s } } }).then((n) => n.forgetPasswordVerifyCode),
645
645
  grantedRights: (r) => t({
@@ -664,7 +664,7 @@ const st = (t, e, r = F) => {
664
664
  login: (r) => e({ lightAuthLoginMicrosoft: { __args: { access_token: r } } }).then((s) => s.lightAuthLoginMicrosoft),
665
665
  register: (r) => e({ lightAuthRegisterMicrosoft: { __args: { account_id: r } } }).then((s) => s.lightAuthRegisterMicrosoft)
666
666
  }
667
- }), Ut = (t = J) => F({ my: t }).then((e) => e.my), Dt = (t, e, r = "") => g({ login: { __args: { username: t, password: e, code: r } } }).then((s) => s.login), St = () => g({ logout: !0 }).then((t) => t.logout), jt = (t, e, r) => g({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((s) => s.changeExpiredPassword), vt = (t, e) => g({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), Et = (t, e, r) => g({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((s) => s.resetPassword), Mt = (t, e) => g({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), Tt = (t, e) => g({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), Nt = (t) => F({
667
+ }), Ot = (t = Q) => O({ my: t }).then((e) => e.my), Pt = (t, e, r = "") => g({ login: { __args: { username: t, password: e, code: r } } }).then((s) => s.login), Ut = () => g({ logout: !0 }).then((t) => t.logout), Ct = (t, e, r) => g({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((s) => s.changeExpiredPassword), St = (t, e) => g({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), jt = (t, e, r) => g({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((s) => s.resetPassword), Et = (t, e) => g({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), Mt = (t, e) => g({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), Dt = (t) => O({
668
668
  my: {
669
669
  granted: {
670
670
  __args: {
@@ -672,7 +672,7 @@ const st = (t, e, r = F) => {
672
672
  }
673
673
  }
674
674
  }
675
- }).then((e) => e.my.granted), Rt = (t) => F({
675
+ }).then((e) => e.my.granted), qt = (t) => O({
676
676
  my: {
677
677
  grantedRights: {
678
678
  __args: {
@@ -680,9 +680,9 @@ const st = (t, e, r = F) => {
680
680
  }
681
681
  }
682
682
  }
683
- }).then((e) => e.my.grantedRights), ye = {
684
- getCurrentUser: Ut,
685
- webAuthn: Ot,
683
+ }).then((e) => e.my.grantedRights), fe = {
684
+ getCurrentUser: Ot,
685
+ webAuthn: Ft,
686
686
  google: {
687
687
  unlink: () => g({ lightAuthUnlinkGoogle: !0 }).then((t) => t.lightAuthUnlinkGoogle),
688
688
  login: (t) => g({ lightAuthLoginGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthLoginGoogle),
@@ -698,166 +698,35 @@ const st = (t, e, r = F) => {
698
698
  login: (t) => g({ lightAuthLoginMicrosoft: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginMicrosoft),
699
699
  register: (t) => g({ lightAuthRegisterMicrosoft: { __args: { account_id: t } } }).then((e) => e.lightAuthRegisterMicrosoft)
700
700
  },
701
- login: Dt,
702
- logout: St,
703
- changeExpiredPassword: jt,
704
- updatePassword: vt,
705
- resetPassword: Et,
706
- forgetPassword: Mt,
707
- verifyCode: Tt,
708
- grantedRights: Rt,
709
- isGranted: Nt
710
- }, it = {
711
- name: !0,
712
- path: !0,
713
- size: !0,
714
- mime: !0,
715
- url: !0
716
- }, we = (t, e, r = it) => F({
717
- app: {
718
- drive: {
719
- __args: { index: t },
720
- files: {
721
- __args: { path: e },
722
- ...r
723
- }
724
- }
725
- }
726
- }).then((s) => s.app.drive.files), be = (t, e) => F({
727
- app: {
728
- drive: {
729
- __args: {
730
- index: t
731
- },
732
- file: {
733
- __args: {
734
- path: e
735
- },
736
- base64Content: !0
737
- }
738
- }
739
- }
740
- }).then((r) => r.app.drive?.file?.base64Content), Bt = (t, e = F, r = g) => ({
741
- list: (s, n = it) => e({ app: { drive: { __args: { index: t }, files: { __args: { path: s }, ...n } } } }).then((c) => c.app.drive.files),
742
- get: (s, n = {
743
- name: !0,
744
- path: !0,
745
- size: !0,
746
- mime: !0,
747
- url: !0
748
- }) => e({
749
- app: {
750
- drive: {
751
- __args: {
752
- index: t
753
- },
754
- file: {
755
- __args: {
756
- path: s
757
- },
758
- ...n
759
- }
760
- }
761
- }
762
- }).then((c) => c.app.drive.file),
763
- readFileAsBase64(s) {
764
- return e({ app: { drive: { __args: { index: t }, file: { __args: { path: s }, base64Content: !0 } } } }).then((n) => n.app.drive?.file?.base64Content);
765
- },
766
- read: async (s) => {
767
- let n = await e({
768
- app: {
769
- drive: {
770
- __args: {
771
- index: t
772
- },
773
- file: {
774
- __args: {
775
- path: s
776
- },
777
- base64Content: !0
778
- }
779
- }
780
- }
781
- });
782
- if (!n.app.drive.file || !n.app.drive.file.base64Content)
783
- throw new Error(`File not found or cannot read content: ${s}`);
784
- return typeof window < "u" && window.atob ? window.atob(n.app.drive.file.base64Content) : n.app.drive.file.base64Content;
785
- },
786
- write: (s, n) => r({ lightDriveWriteFile: { __args: { index: t, path: s, content: n } } }).then((c) => c.lightDriveWriteFile),
787
- delete: (s) => r({ lightDriveDeleteFile: { __args: { index: t, path: s } } }).then((n) => n.lightDriveDeleteFile),
788
- rename: (s, n) => r({ lightDriveRenameFile: { __args: { index: t, path: s, name: n } } }).then((c) => c.lightDriveRenameFile),
789
- move: (s, n) => r({ lightDriveMoveFile: { __args: { index: t, source: s, destination: n } } }).then((c) => c.lightDriveMoveFile)
790
- }), at = {
791
- name: !0,
792
- path: !0
793
- }, me = (t, e, r = at) => F({
794
- app: {
795
- drive: {
796
- __args: { index: t },
797
- folders: {
798
- __args: { path: e },
799
- ...r
800
- }
801
- }
802
- }
803
- }).then((s) => s.app.drive.folders), qt = (t, e = F, r = g) => ({
804
- list: (s, n = at) => e({ app: { drive: { __args: { index: t }, folders: { __args: { path: s }, ...n } } } }).then((c) => c.app.drive.folders),
805
- create: (s) => r({ lightDriveCreateFolder: { __args: { index: t, path: s } } }).then((n) => n.lightDriveCreateFolder),
806
- delete: (s) => r({ lightDriveDeleteFolder: { __args: { index: t, path: s } } }).then((n) => n.lightDriveDeleteFolder),
807
- rename: (s, n) => r({ lightDriveRenameFolder: { __args: { index: t, path: s, name: n } } }).then((c) => c.lightDriveRenameFolder)
808
- }), Fe = () => F({
809
- app: {
810
- drives: {
811
- index: !0,
812
- name: !0
813
- }
814
- }
815
- }).then((t) => t.app.drives), Ae = (t) => lt(F, g)(t), lt = (t, e) => (r) => {
816
- const s = Bt(r, t, e), n = qt(r, t, e);
817
- return {
818
- folders: n,
819
- files: s,
820
- listFiles: s.list,
821
- getFile: s.get,
822
- readFile: s.read,
823
- writeFile: s.write,
824
- deleteFile: s.delete,
825
- renameFile: s.rename,
826
- moveFile: s.move,
827
- listFolders: n.list,
828
- createFolder: n.create,
829
- deleteFolder: n.delete,
830
- renameFolder: n.rename,
831
- uploadTempFile: (c) => e({
832
- lightDriveUploadTempFile: {
833
- __args: { index: r, file: c },
834
- name: !0,
835
- path: !0,
836
- size: !0,
837
- mime: !0
838
- }
839
- }).then((l) => l.lightDriveUploadTempFile)
840
- };
841
- }, J = {
701
+ login: Pt,
702
+ logout: Ut,
703
+ changeExpiredPassword: Ct,
704
+ updatePassword: St,
705
+ resetPassword: jt,
706
+ forgetPassword: Et,
707
+ verifyCode: Mt,
708
+ grantedRights: qt,
709
+ isGranted: Dt
710
+ }, Q = {
842
711
  user_id: !0,
843
712
  username: !0,
844
713
  first_name: !0,
845
714
  last_name: !0,
846
715
  status: !0
847
- }, ke = (t) => g({
716
+ }, pe = (t) => g({
848
717
  addUser: {
849
718
  __args: t
850
719
  }
851
- }).then((e) => e.addUser), Ce = (t) => g({
720
+ }).then((e) => e.addUser), ge = (t) => g({
852
721
  deleteUser: {
853
722
  __args: { id: t }
854
723
  }
855
- }).then((e) => e.deleteUser), Oe = (t = J) => L("Users", t).dataPath("app.listUser").fetch(), Pe = (t, e) => g({
724
+ }).then((e) => e.deleteUser), de = (t = Q) => G("Users", t).dataPath("app.listUser").fetch(), _e = (t, e) => g({
856
725
  updateUser: {
857
726
  __args: { id: t, data: e }
858
727
  }
859
- }).then((r) => r.updateUser), Lt = (t, e) => ({
860
- list: (r = J) => e("Users", r).dataPath("app.listUser").fetch(),
728
+ }).then((r) => r.updateUser), Nt = (t, e) => ({
729
+ list: (r = Q) => e("Users", r).dataPath("app.listUser").fetch(),
861
730
  create: (r) => t({
862
731
  addUser: { __args: r }
863
732
  }).then((s) => s.addUser),
@@ -867,7 +736,7 @@ const st = (t, e, r = F) => {
867
736
  update: (r, s) => t({
868
737
  updateUser: { __args: { id: r, data: s } }
869
738
  }).then((n) => n.updateUser)
870
- }), ct = (t) => (e) => t({
739
+ }), it = (t) => (e) => t({
871
740
  app: {
872
741
  listConfig: {
873
742
  __args: {
@@ -881,13 +750,13 @@ const st = (t, e, r = F) => {
881
750
  }
882
751
  }
883
752
  }
884
- }).then((r) => r.app.listConfig.data[0]?.value), Ue = ct(F), ut = {
753
+ }).then((r) => r.app.listConfig.data[0]?.value), ye = it(O), at = {
885
754
  name: !0
886
- }, De = (t = ut) => F({
755
+ }, we = (t = at) => O({
887
756
  app: {
888
757
  roles: t
889
758
  }
890
- }).then((e) => e.app.roles), Se = (t, e) => g({
759
+ }).then((e) => e.app.roles), be = (t, e) => g({
891
760
  addRole: {
892
761
  __args: {
893
762
  data: {
@@ -896,12 +765,12 @@ const st = (t, e, r = F) => {
896
765
  }
897
766
  }
898
767
  }
899
- }).then((r) => r.addRole), je = (t) => g({
768
+ }).then((r) => r.addRole), me = (t) => g({
900
769
  deleteRole: {
901
770
  __args: { name: t }
902
771
  }
903
- }).then((e) => e.deleteRole), Gt = (t, e) => ({
904
- list: (r = ut) => t({
772
+ }).then((e) => e.deleteRole), Tt = (t, e) => ({
773
+ list: (r = at) => t({
905
774
  app: { roles: r }
906
775
  }).then((s) => s.app.roles),
907
776
  create: (r, s) => e({
@@ -911,96 +780,96 @@ const st = (t, e, r = F) => {
911
780
  deleteRole: { __args: { name: r } }
912
781
  }).then((s) => s.deleteRole)
913
782
  });
914
- function H(t) {
783
+ function X(t) {
915
784
  if (Array.isArray(t))
916
- return t.map((e) => H(e)).filter((e) => e !== void 0);
785
+ return t.map((e) => X(e)).filter((e) => e !== void 0);
917
786
  if (t !== null && typeof t == "object") {
918
787
  const e = Object.getPrototypeOf(t);
919
788
  if (e === Object.prototype || e === null)
920
789
  return Object.fromEntries(
921
- Object.entries(t).filter(([, r]) => r !== void 0).map(([r, s]) => [r, H(s)])
790
+ Object.entries(t).filter(([, r]) => r !== void 0).map(([r, s]) => [r, X(s)])
922
791
  );
923
792
  }
924
793
  return t;
925
794
  }
926
- function ht(t, e, r, s, n) {
795
+ function ct(t, e, r, s, n) {
927
796
  if (!(!t || typeof t != "object"))
928
- for (let c in t) {
929
- const l = t[c];
930
- if (l && typeof l == "object") {
931
- if ("__args" in l) {
932
- const f = H(l.__args), p = {};
933
- Object.entries(f).forEach(([o, i]) => {
934
- if (i instanceof Array && N(i)) {
935
- p[o] = new S(o);
797
+ for (let f in t) {
798
+ const c = t[f];
799
+ if (c && typeof c == "object") {
800
+ if ("__args" in c) {
801
+ const p = X(c.__args), h = {};
802
+ Object.entries(p).forEach(([o, i]) => {
803
+ if (i instanceof Array && T(i)) {
804
+ h[o] = new j(o);
936
805
  let a = 0;
937
- i.forEach((u) => {
938
- u instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + o + "." + a), s.append(n.current.toString(), u), n.current++, a++);
806
+ i.forEach((l) => {
807
+ l instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + o + "." + a), s.append(n.current.toString(), l), n.current++, a++);
939
808
  }), e[o] = "[Upload!]!";
940
- } else i instanceof File ? (p[o] = new S(o), r[n.current] = ["variables." + o], s.append(n.current.toString(), i), e[o] = "Upload!", n.current++) : i instanceof Object && x(i) ? (p[o] = {}, Object.entries(i).forEach(([a, u]) => {
941
- if (u instanceof Array && N(u)) {
942
- p[o][a] = new S(a);
809
+ } else i instanceof File ? (h[o] = new j(o), r[n.current] = ["variables." + o], s.append(n.current.toString(), i), e[o] = "Upload!", n.current++) : i instanceof Object && K(i) ? (h[o] = {}, Object.entries(i).forEach(([a, l]) => {
810
+ if (l instanceof Array && T(l)) {
811
+ h[o][a] = new j(a);
943
812
  let m = 0;
944
- u.forEach((d) => {
813
+ l.forEach((d) => {
945
814
  d instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + a + "." + m), s.append(n.current.toString(), d), n.current++, m++);
946
815
  }), e[a] = "[Upload!]!";
947
- } else u instanceof File ? (p[o][a] = new S(a), r[n.current] = ["variables." + a], s.append(n.current.toString(), u), e[a] = "Upload!", n.current++) : p[o][a] = u;
948
- })) : i != null && (p[o] = i);
949
- }), l.__args = p;
816
+ } else l instanceof File ? (h[o][a] = new j(a), r[n.current] = ["variables." + a], s.append(n.current.toString(), l), e[a] = "Upload!", n.current++) : h[o][a] = l;
817
+ })) : i != null && (h[o] = i);
818
+ }), c.__args = h;
950
819
  }
951
- ht(l, e, r, s, n);
820
+ ct(c, e, r, s, n);
952
821
  }
953
822
  }
954
823
  }
955
- const pt = (t) => async (e) => {
824
+ const lt = (t) => async (e) => {
956
825
  const r = e, s = new FormData();
957
826
  let n = !1;
958
- const c = {}, l = {};
959
- ht(r, c, l, s, { current: 0 }), n = Object.keys(c).length > 0, n && (r.__variables = c);
960
- let p = null;
961
- const i = I({ mutation: r });
962
- if (n ? (s.append("map", JSON.stringify(l)), s.append("operations", JSON.stringify({
827
+ const f = {}, c = {};
828
+ ct(r, f, c, s, { current: 0 }), n = Object.keys(f).length > 0, n && (r.__variables = f);
829
+ let h = null;
830
+ const i = x({ mutation: r });
831
+ if (n ? (s.append("map", JSON.stringify(c)), s.append("operations", JSON.stringify({
963
832
  query: i
964
- })), p = await t.post("", s)) : p = await t.post("", {
833
+ })), h = await t.post("", s)) : h = await t.post("", {
965
834
  query: i
966
- }), p.data.errors)
967
- throw new Error(p.data.errors[0].message);
968
- return p.data.data;
969
- }, g = async (t) => pt(K().axios)(t), ve = (t, e, r) => g({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((s) => s.sendMail), Jt = (t) => ({
835
+ }), h.data.errors)
836
+ throw new Error(h.data.errors[0].message);
837
+ return h.data.data;
838
+ }, g = async (t) => lt(I().axios)(t), Ae = (t, e, r) => g({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((s) => s.sendMail), Bt = (t) => ({
970
839
  send: (e, r, s) => t({ sendMail: { __args: { email: e, subject: r, message: s } } }).then((n) => n.sendMail)
971
- }), $t = (t) => g({
840
+ }), Lt = (t) => g({
972
841
  lightFSCreateFolder: {
973
842
  __args: { location: t }
974
843
  }
975
- }).then((e) => e.lightFSCreateFolder), zt = (t) => g({
844
+ }).then((e) => e.lightFSCreateFolder), Rt = (t) => g({
976
845
  lightFSDeleteFolder: {
977
846
  __args: { location: t }
978
847
  }
979
- }).then((e) => e.lightFSDeleteFolder), Qt = (t, e) => g({
848
+ }).then((e) => e.lightFSDeleteFolder), Gt = (t, e) => g({
980
849
  lightFSRenameFolder: {
981
850
  __args: { location: t, newName: e }
982
851
  }
983
- }).then((r) => r.lightFSRenameFolder), Wt = (t, e) => g({
852
+ }).then((r) => r.lightFSRenameFolder), Jt = (t, e) => g({
984
853
  lightFSRenameFile: {
985
854
  __args: { location: t, newName: e }
986
855
  }
987
- }).then((r) => r.lightFSRenameFile), Ht = (t, e) => g({
856
+ }).then((r) => r.lightFSRenameFile), Qt = (t, e) => g({
988
857
  lightFSWriteFile: {
989
858
  __args: { location: t, content: e }
990
859
  }
991
- }).then((r) => r.lightFSWriteFile), Xt = (t, e, r = !1) => g({
860
+ }).then((r) => r.lightFSWriteFile), zt = (t, e, r = !1) => g({
992
861
  lightFSUploadFile: {
993
862
  __args: { location: t, file: e, rename: r }
994
863
  }
995
- }).then((s) => s.lightFSUploadFile), Yt = (t) => g({
864
+ }).then((s) => s.lightFSUploadFile), $t = (t) => g({
996
865
  lightFSDeleteFile: {
997
866
  __args: { location: t }
998
867
  }
999
- }).then((e) => e.lightFSDeleteFile), Zt = (t, e) => g({
868
+ }).then((e) => e.lightFSDeleteFile), Wt = (t, e) => g({
1000
869
  lightFSMove: {
1001
870
  __args: { from: t, to: e }
1002
871
  }
1003
- }).then((r) => r.lightFSMove), Vt = (t) => F({
872
+ }).then((r) => r.lightFSMove), Ht = (t) => O({
1004
873
  app: {
1005
874
  fs: {
1006
875
  exists: {
@@ -1008,9 +877,9 @@ const pt = (t) => async (e) => {
1008
877
  }
1009
878
  }
1010
879
  }
1011
- }).then((e) => e.app.fs.exists), It = (t, e) => {
880
+ }).then((e) => e.app.fs.exists), Xt = (t, e) => {
1012
881
  const r = {};
1013
- return t && (r.search = t), e && (r.label = e), F({
882
+ return t && (r.search = t), e && (r.label = e), O({
1014
883
  app: {
1015
884
  fs: {
1016
885
  find: {
@@ -1032,7 +901,7 @@ const pt = (t) => async (e) => {
1032
901
  }
1033
902
  }
1034
903
  }).then((s) => s.app.fs.find);
1035
- }, Kt = (t) => F({
904
+ }, vt = (t) => O({
1036
905
  app: {
1037
906
  fs: {
1038
907
  node: {
@@ -1062,7 +931,7 @@ const pt = (t) => async (e) => {
1062
931
  }
1063
932
  }
1064
933
  }
1065
- }).then((r) => r.app.fs.node), xt = (t, e = "text") => F({
934
+ }).then((r) => r.app.fs.node), Yt = (t, e = "text") => O({
1066
935
  app: {
1067
936
  fs: {
1068
937
  node: {
@@ -1079,7 +948,7 @@ const pt = (t) => async (e) => {
1079
948
  }).then((r) => {
1080
949
  const s = r.app.fs.node;
1081
950
  return s?.__typename === "File" ? e === "text" ? s.content : s.base64Content : null;
1082
- }), te = (t, e) => g({
951
+ }), Zt = (t, e) => g({
1083
952
  lightFSUploadBase64: {
1084
953
  __args: { location: t, base64: e },
1085
954
  __typename: !0,
@@ -1093,11 +962,11 @@ const pt = (t) => async (e) => {
1093
962
  lastModified: !0
1094
963
  }]
1095
964
  }
1096
- }).then((r) => r.lightFSUploadBase64), ee = (t) => g({
965
+ }).then((r) => r.lightFSUploadBase64), Vt = (t) => g({
1097
966
  lightFSDuplicateFile: {
1098
967
  __args: { location: t }
1099
968
  }
1100
- }).then((e) => e.lightFSDuplicateFile), re = (t, e) => g({
969
+ }).then((e) => e.lightFSDuplicateFile), xt = (t, e) => g({
1101
970
  lightFSUploadTempFile: {
1102
971
  __args: { location: t, file: e },
1103
972
  name: !0,
@@ -1106,9 +975,9 @@ const pt = (t) => async (e) => {
1106
975
  size: !0,
1107
976
  mimeType: !0
1108
977
  }
1109
- }).then((r) => r.lightFSUploadTempFile), se = (t, e, r) => {
978
+ }).then((r) => r.lightFSUploadTempFile), It = (t, e, r) => {
1110
979
  const s = { location: t };
1111
- return e && (s.type = e), r && (s.search = r), F({
980
+ return e && (s.type = e), r && (s.search = r), O({
1112
981
  app: {
1113
982
  fs: {
1114
983
  listFiles: {
@@ -1124,28 +993,28 @@ const pt = (t) => async (e) => {
1124
993
  }
1125
994
  }
1126
995
  }).then((n) => n.app.fs.listFiles);
1127
- }, Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
996
+ }, Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1128
997
  __proto__: null,
1129
- createFolder: $t,
1130
- deleteFile: Yt,
1131
- deleteFolder: zt,
1132
- duplicateFile: ee,
1133
- exists: Vt,
1134
- find: It,
1135
- list: Kt,
1136
- listFiles: se,
1137
- move: Zt,
1138
- readFile: xt,
1139
- renameFile: Wt,
1140
- renameFolder: Qt,
1141
- uploadBase64: te,
1142
- uploadFile: Xt,
1143
- uploadTempFile: re,
1144
- writeFile: Ht
1145
- }, Symbol.toStringTag, { value: "Module" })), X = (t) => {
998
+ createFolder: Lt,
999
+ deleteFile: $t,
1000
+ deleteFolder: Rt,
1001
+ duplicateFile: Vt,
1002
+ exists: Ht,
1003
+ find: Xt,
1004
+ list: vt,
1005
+ listFiles: It,
1006
+ move: Wt,
1007
+ readFile: Yt,
1008
+ renameFile: Jt,
1009
+ renameFolder: Gt,
1010
+ uploadBase64: Zt,
1011
+ uploadFile: zt,
1012
+ uploadTempFile: xt,
1013
+ writeFile: Qt
1014
+ }, Symbol.toStringTag, { value: "Module" })), v = (t) => {
1146
1015
  let e = {};
1147
1016
  return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
1148
- Object.entries(X(r)).forEach(([s, n]) => {
1017
+ Object.entries(v(r)).forEach(([s, n]) => {
1149
1018
  e[s] = n;
1150
1019
  });
1151
1020
  }), e) : (Object.entries(t).forEach(([r, s]) => {
@@ -1157,87 +1026,87 @@ const pt = (t) => async (e) => {
1157
1026
  e[r] = s;
1158
1027
  return;
1159
1028
  }
1160
- e[r] = X(s);
1029
+ e[r] = v(s);
1161
1030
  }), e);
1162
- }, ne = (t) => X(t), Me = (t) => {
1031
+ }, Kt = (t) => v(t), ke = (t) => {
1163
1032
  const e = typeof window > "u";
1164
- let r = [], s = null, n = null, c = null, l = null;
1165
- const f = /* @__PURE__ */ new Set(), p = gt.create({
1033
+ let r = [], s = null, n = null, f = null, c = null;
1034
+ const p = /* @__PURE__ */ new Set(), h = ht.create({
1166
1035
  baseURL: t,
1167
1036
  withCredentials: !0
1168
- }), o = async () => s && !oe(s) || !n ? s : (c ??= n().then((h) => (s = h, h)).finally(() => {
1169
- c = null;
1170
- }), c);
1171
- p.interceptors.request.use(async (h) => {
1037
+ }), o = async () => s && !te(s) || !n ? s : (f ??= n().then((u) => (s = u, u)).finally(() => {
1038
+ f = null;
1039
+ }), f);
1040
+ h.interceptors.request.use(async (u) => {
1172
1041
  const _ = await o();
1173
- return _ && (h.headers.Authorization = `Bearer ${_}`), h;
1042
+ return _ && (u.headers.Authorization = `Bearer ${_}`), u;
1174
1043
  });
1175
1044
  let i = !1, a = [];
1176
- const u = (h, _ = null) => {
1045
+ const l = (u, _ = null) => {
1177
1046
  a.forEach((y) => {
1178
- h ? y.reject(h) : y.resolve(_);
1047
+ u ? y.reject(u) : y.resolve(_);
1179
1048
  }), a = [];
1180
1049
  };
1181
- p.interceptors.response.use(
1182
- (h) => {
1183
- const _ = h.data.errors;
1050
+ h.interceptors.response.use(
1051
+ (u) => {
1052
+ const _ = u.data.errors;
1184
1053
  if (_ && _.some((y) => y.extensions?.code === "TOKEN_EXPIRED")) {
1185
- const y = h.config;
1186
- return y._lightTokenRetried ? h : (y._lightTokenRetried = !0, n && (s = null), i ? new Promise((A, k) => {
1187
- a.push({ resolve: A, reject: k });
1188
- }).then(() => p(y)).catch((A) => Promise.reject(A)) : (i = !0, m().then(() => (i = !1, u(null), p(y))).catch((A) => (i = !1, u(A), Promise.reject(A)))));
1054
+ const y = u.config;
1055
+ return y._lightTokenRetried ? u : (y._lightTokenRetried = !0, n && (s = null), i ? new Promise((A, F) => {
1056
+ a.push({ resolve: A, reject: F });
1057
+ }).then(() => h(y)).catch((A) => Promise.reject(A)) : (i = !0, m().then(() => (i = !1, l(null), h(y))).catch((A) => (i = !1, l(A), Promise.reject(A)))));
1189
1058
  }
1190
- return h;
1059
+ return u;
1191
1060
  },
1192
- (h) => Promise.reject(h)
1061
+ (u) => Promise.reject(u)
1193
1062
  );
1194
1063
  function m() {
1195
1064
  return n ? o().then(() => {
1196
- }) : p.post("/refresh_token");
1065
+ }) : h.post("/refresh_token");
1197
1066
  }
1198
- e && (p.interceptors.request.use((h) => (h.withCredentials = !0, r.length > 0 && (h.headers.Cookie = r.join("; ")), h)), p.interceptors.response.use((h) => {
1199
- if (h.headers["set-cookie"]) {
1200
- const _ = h.headers["set-cookie"].map((A) => A.split(";")[0]), y = /* @__PURE__ */ new Map();
1067
+ e && (h.interceptors.request.use((u) => (u.withCredentials = !0, r.length > 0 && (u.headers.Cookie = r.join("; ")), u)), h.interceptors.response.use((u) => {
1068
+ if (u.headers["set-cookie"]) {
1069
+ const _ = u.headers["set-cookie"].map((A) => A.split(";")[0]), y = /* @__PURE__ */ new Map();
1201
1070
  r.forEach((A) => {
1202
- const k = A.split("=")[0];
1203
- y.set(k, A);
1071
+ const F = A.split("=")[0];
1072
+ y.set(F, A);
1204
1073
  }), _.forEach((A) => {
1205
- const k = A.split("=")[0];
1206
- y.set(k, A);
1074
+ const F = A.split("=")[0];
1075
+ y.set(F, A);
1207
1076
  }), r = Array.from(y.values());
1208
1077
  }
1209
- return h;
1078
+ return u;
1210
1079
  }));
1211
- const d = rt(p), b = pt(p), O = (h, _) => L(h, _, d), C = (h, _) => st(h, _, d), P = (h) => {
1212
- const _ = z(h), y = nt(h, _.$fields, {
1080
+ const d = rt(h), b = lt(h), P = (u, _) => G(u, _, d), k = (u, _) => st(u, _, d), U = (u) => {
1081
+ const _ = $(u), y = nt(u, _.$fields, {
1213
1082
  mutation: b,
1214
- createList: O,
1215
- createCollection: C
1083
+ createList: P,
1084
+ createCollection: k
1216
1085
  });
1217
1086
  return y.setDataPath(_.getDataPath()), y;
1218
- }, U = Pt(d, b), Z = () => f.forEach((h) => h()), T = (h) => (async (..._) => {
1219
- const y = await h(..._);
1087
+ }, C = kt(d, b), Z = () => p.forEach((u) => u()), N = (u) => (async (..._) => {
1088
+ const y = await u(..._);
1220
1089
  return Z(), y;
1221
- }), ft = {
1222
- ...U,
1223
- login: T(U.login),
1090
+ }), ut = {
1091
+ ...C,
1092
+ login: N(C.login),
1224
1093
  logout: (async () => {
1225
1094
  try {
1226
- return await U.logout();
1095
+ return await C.logout();
1227
1096
  } finally {
1228
1097
  Z();
1229
1098
  }
1230
1099
  }),
1231
- google: { ...U.google, login: T(U.google.login) },
1232
- facebook: { ...U.facebook, login: T(U.facebook.login) },
1233
- microsoft: { ...U.microsoft, login: T(U.microsoft.login) },
1234
- webAuthn: { ...U.webAuthn, login: T(U.webAuthn.login) }
1100
+ google: { ...C.google, login: N(C.google.login) },
1101
+ facebook: { ...C.facebook, login: N(C.facebook.login) },
1102
+ microsoft: { ...C.microsoft, login: N(C.microsoft.login) },
1103
+ webAuthn: { ...C.webAuthn, login: N(C.webAuthn.login) }
1235
1104
  }, V = {
1236
- post: p.post.bind(p),
1105
+ post: h.post.bind(h),
1237
1106
  baseURL: t,
1238
- axios: p,
1239
- setAccessToken(h) {
1240
- s = h;
1107
+ axios: h,
1108
+ setAccessToken(u) {
1109
+ s = u;
1241
1110
  },
1242
1111
  getAccessToken() {
1243
1112
  return s;
@@ -1245,139 +1114,132 @@ const pt = (t) => async (e) => {
1245
1114
  clearAccessToken() {
1246
1115
  s = null;
1247
1116
  },
1248
- setAccessTokenProvider(h) {
1249
- l?.(), l = null, n = h, s = null, c = null;
1117
+ setAccessTokenProvider(u) {
1118
+ c?.(), c = null, n = u, s = null, f = null;
1250
1119
  },
1251
- onAuthChange(h) {
1252
- return f.add(h), () => f.delete(h);
1120
+ onAuthChange(u) {
1121
+ return p.add(u), () => p.delete(u);
1253
1122
  },
1254
- useAudience(h, _) {
1255
- l?.(), n = async () => (await h.mutation({
1123
+ useAudience(u, _) {
1124
+ c?.(), n = async () => (await u.mutation({
1256
1125
  createAudienceAccessToken: {
1257
1126
  __args: { audience: _ }
1258
1127
  }
1259
- })).createAudienceAccessToken, s = null, c = null, l = h.onAuthChange(() => {
1260
- s = null, c = null;
1128
+ })).createAudienceAccessToken, s = null, f = null, c = u.onAuthChange(() => {
1129
+ s = null, f = null;
1261
1130
  });
1262
1131
  },
1263
- auth: ft,
1132
+ auth: ut,
1264
1133
  mutation: b,
1265
1134
  query: d,
1266
- config: ct(d),
1267
- mail: Jt(b),
1268
- users: Lt(b, O),
1269
- model(h) {
1270
- return P(h);
1135
+ config: it(d),
1136
+ mail: Bt(b),
1137
+ users: Nt(b, P),
1138
+ model(u) {
1139
+ return U(u);
1271
1140
  },
1272
- roles: Gt(d, b),
1273
- collect: (h, _) => {
1274
- const y = C(h, _);
1275
- return y.data_path = z(h).getDataPath(), y;
1141
+ roles: Tt(d, b),
1142
+ collect: (u, _) => {
1143
+ const y = k(u, _);
1144
+ return y.data_path = $(u).getDataPath(), y;
1276
1145
  },
1277
- list: (h, _) => O(h, _).dataPath(z(h).getDataPath()),
1146
+ list: (u, _) => P(u, _).dataPath($(u).getDataPath()),
1278
1147
  /**
1279
1148
  * @deprecated Use `fs.*` from `filesystem` instead.
1280
1149
  */
1281
- drive: lt(d, b),
1282
- async collects(h) {
1150
+ async collects(u) {
1283
1151
  const _ = {}, y = {};
1284
- for (const k in h) {
1285
- const v = h[k].getQueryPayload();
1286
- y[k] = v.data_path, _[k] = {};
1287
- const M = v.data_path.split(".");
1288
- let R = M[M.length - 1], D = _[k];
1289
- for (const B of M) {
1290
- if (B === R) {
1291
- D[B] = v.query;
1152
+ for (const F in u) {
1153
+ const M = u[F].getQueryPayload();
1154
+ y[F] = M.data_path, _[F] = {};
1155
+ const q = M.data_path.split(".");
1156
+ let B = q[q.length - 1], S = _[F];
1157
+ for (const L of q) {
1158
+ if (L === B) {
1159
+ S[L] = M.query;
1292
1160
  break;
1293
1161
  }
1294
- D[B] = D[B] || {};
1162
+ S[L] = S[L] || {};
1295
1163
  }
1296
- _[k].__aliasFor = M[0];
1164
+ _[F].__aliasFor = q[0];
1297
1165
  }
1298
1166
  const A = await d(_);
1299
- for (const k in h) {
1300
- const v = y[k].split(".");
1301
- let M = v[v.length - 1], R = A[k];
1302
- for (const D of v) {
1303
- if (D === M) {
1304
- h[k]._batchData = A[k][D];
1167
+ for (const F in u) {
1168
+ const M = y[F].split(".");
1169
+ let q = M[M.length - 1], B = A[F];
1170
+ for (const S of M) {
1171
+ if (S === q) {
1172
+ u[F]._batchData = A[F][S];
1305
1173
  break;
1306
1174
  }
1307
- R[D] = R[D] || {};
1175
+ B[S] = B[S] || {};
1308
1176
  }
1309
1177
  }
1310
- return h;
1178
+ return u;
1311
1179
  }
1312
1180
  };
1313
- return _t(V), V;
1181
+ return pt(V), V;
1314
1182
  };
1315
- function oe(t, e = 30) {
1183
+ function te(t, e = 30) {
1316
1184
  try {
1317
1185
  const r = t.split(".")[1];
1318
1186
  if (!r) return !0;
1319
- const s = r.replace(/-/g, "+").replace(/_/g, "/"), n = s.padEnd(Math.ceil(s.length / 4) * 4, "="), c = JSON.parse(globalThis.atob(n));
1320
- return typeof c.exp == "number" ? c.exp <= Math.floor(Date.now() / 1e3) + e : !1;
1187
+ const s = r.replace(/-/g, "+").replace(/_/g, "/"), n = s.padEnd(Math.ceil(s.length / 4) * 4, "="), f = JSON.parse(globalThis.atob(n));
1188
+ return typeof f.exp == "number" ? f.exp <= Math.floor(Date.now() / 1e3) + e : !1;
1321
1189
  } catch {
1322
1190
  return !0;
1323
1191
  }
1324
1192
  }
1325
- const Te = L;
1193
+ const Oe = G;
1326
1194
  export {
1327
- N as arrayHasFile,
1328
- ye as auth,
1329
- jt as changeExpiredPassword,
1330
- ge as clearModels,
1331
- Pt as createAuth,
1332
- Me as createClient,
1195
+ T as arrayHasFile,
1196
+ fe as auth,
1197
+ Ct as changeExpiredPassword,
1198
+ le as clearModels,
1199
+ kt as createAuth,
1200
+ ke as createClient,
1333
1201
  st as createCollection,
1334
- ct as createConfig,
1335
- lt as createDrive,
1336
- ue as createFileFromBase64,
1337
- he as createFileFromBase85,
1202
+ it as createConfig,
1203
+ oe as createFileFromBase64,
1204
+ ie as createFileFromBase85,
1338
1205
  tt as createFileFromString,
1339
- L as createList,
1340
- Jt as createMail,
1341
- Se as createRole,
1342
- Gt as createRoles,
1343
- ke as createUser,
1344
- Lt as createUsers,
1345
- J as defaultUserFields,
1206
+ G as createList,
1207
+ Bt as createMail,
1208
+ be as createRole,
1209
+ Tt as createRoles,
1210
+ pe as createUser,
1211
+ Nt as createUsers,
1212
+ Q as defaultUserFields,
1346
1213
  ot as defineModel,
1347
- de as defineModels,
1348
- je as deleteRole,
1349
- Ce as deleteUser,
1350
- Mt as forgetPassword,
1351
- Ee as fs,
1352
- K as getApiClient,
1353
- ce as getApiClientOptional,
1354
- Ue as getConfig,
1355
- Ut as getCurrentUser,
1356
- Ae as getDrive,
1357
- Rt as getGrantedRights,
1358
- z as getModel,
1359
- pe as hasModel,
1360
- Nt as isGranted,
1361
- Te as list,
1362
- Fe as listDrives,
1363
- we as listFiles,
1364
- me as listFolders,
1365
- fe as listModels,
1366
- _e as listPermissions,
1367
- De as listRoles,
1368
- Oe as listUsers,
1369
- Dt as login,
1370
- St as logout,
1214
+ ue as defineModels,
1215
+ me as deleteRole,
1216
+ ge as deleteUser,
1217
+ Et as forgetPassword,
1218
+ Fe as fs,
1219
+ I as getApiClient,
1220
+ ne as getApiClientOptional,
1221
+ ye as getConfig,
1222
+ Ot as getCurrentUser,
1223
+ qt as getGrantedRights,
1224
+ $ as getModel,
1225
+ ae as hasModel,
1226
+ Dt as isGranted,
1227
+ Oe as list,
1228
+ ce as listModels,
1229
+ he as listPermissions,
1230
+ we as listRoles,
1231
+ de as listUsers,
1232
+ Pt as login,
1233
+ Ut as logout,
1371
1234
  g as mutation,
1372
- x as objectHasFile,
1373
- F as query,
1374
- be as readFileAsBase64,
1375
- Et as resetPassword,
1376
- ve as sendMail,
1377
- _t as setApiClient,
1378
- ne as toQuery,
1379
- vt as updatePassword,
1380
- Pe as updateUser,
1381
- Tt as verifyCode,
1382
- Ot as webAuthn
1235
+ K as objectHasFile,
1236
+ O as query,
1237
+ jt as resetPassword,
1238
+ Ae as sendMail,
1239
+ pt as setApiClient,
1240
+ Kt as toQuery,
1241
+ St as updatePassword,
1242
+ _e as updateUser,
1243
+ Mt as verifyCode,
1244
+ Ft as webAuthn
1383
1245
  };