@hostlink/light 3.0.15 → 3.1.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,131 +1,131 @@
1
- import { jsonToGraphQLQuery as v, VariableType as w } from "json-to-graphql-query";
1
+ import { jsonToGraphQLQuery as q, VariableType as F } from "json-to-graphql-query";
2
2
  import U from "collect.js";
3
- import z from "axios";
4
- function j(t) {
3
+ import H from "axios";
4
+ function P(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 E(t, e, r = ".", n) {
11
- if (!j(e))
12
- return E(t, {}, r, n);
13
- const o = Object.assign({}, e);
14
- for (const c in t) {
15
- if (c === "__proto__" || c === "constructor")
10
+ function v(t, e, r = ".", s) {
11
+ if (!P(e))
12
+ return v(t, {}, r, s);
13
+ const i = Object.assign({}, e);
14
+ for (const u in t) {
15
+ if (u === "__proto__" || u === "constructor")
16
16
  continue;
17
- const l = t[c];
18
- l != null && (n && n(o, c, l, r) || (Array.isArray(l) && Array.isArray(o[c]) ? o[c] = [...l, ...o[c]] : j(l) && j(o[c]) ? o[c] = E(
17
+ const l = t[u];
18
+ l != null && (s && s(i, u, l, r) || (Array.isArray(l) && Array.isArray(i[u]) ? i[u] = [...l, ...i[u]] : P(l) && P(i[u]) ? i[u] = v(
19
19
  l,
20
- o[c],
21
- (r ? `${r}.` : "") + c.toString(),
22
- n
23
- ) : o[c] = l));
20
+ i[u],
21
+ (r ? `${r}.` : "") + u.toString(),
22
+ s
23
+ ) : i[u] = l));
24
24
  }
25
- return o;
25
+ return i;
26
26
  }
27
- function H(t) {
27
+ function X(t) {
28
28
  return (...e) => (
29
29
  // eslint-disable-next-line unicorn/no-array-reduce
30
- e.reduce((r, n) => E(r, n, "", t), {})
30
+ e.reduce((r, s) => v(r, s, "", t), {})
31
31
  );
32
32
  }
33
- const b = H();
34
- let O = null;
35
- const X = (t) => {
36
- O = t;
37
- }, q = () => {
38
- if (!O)
33
+ const A = X();
34
+ let j = null;
35
+ const Y = (t) => {
36
+ j = t;
37
+ }, B = () => {
38
+ if (!j)
39
39
  throw new Error("Api client not initialized. Call setApiClient() first.");
40
- return O;
41
- }, Nt = () => O;
42
- function A(t) {
40
+ return j;
41
+ }, Jt = () => j;
42
+ function D(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 B(t) {
48
+ function M(t) {
49
49
  for (let e in t)
50
- if (t[e] instanceof File || t[e] instanceof Array && A(t[e]))
50
+ if (t[e] instanceof File || t[e] instanceof Array && D(t[e]))
51
51
  return !0;
52
52
  return !1;
53
53
  }
54
- function Y(t) {
54
+ function Z(t) {
55
55
  t = "<~" + t + "~>";
56
- var e, r, n, o, c, l = String, h = 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, n = [], o = 0, c = t.length; c > o; o += 5) r = 52200625 * (t.charCodeAt(o) - 33) + 614125 * (t.charCodeAt(o + 1) - 33) + 7225 * (t.charCodeAt(o + 2) - 33) + 85 * (t.charCodeAt(o + 3) - 33) + (t.charCodeAt(o + 4) - 33), n.push(h & r >> 24, h & r >> 16, h & r >> 8, h & r);
58
- return (function(s, i) {
59
- for (var a = i; a > 0; a--) s.pop();
60
- })(n, e.length), l.fromCharCode.apply(l, n);
56
+ var e, r, s, i, u, 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 = [], i = 0, u = t.length; u > i; i += 5) r = 52200625 * (t.charCodeAt(i) - 33) + 614125 * (t.charCodeAt(i + 1) - 33) + 7225 * (t.charCodeAt(i + 2) - 33) + 85 * (t.charCodeAt(i + 3) - 33) + (t.charCodeAt(i + 4) - 33), s.push(f & r >> 24, f & r >> 16, f & r >> 8, f & r);
58
+ return (function(n, o) {
59
+ for (var a = o; a > 0; a--) n.pop();
60
+ })(s, e.length), l.fromCharCode.apply(l, s);
61
61
  }
62
- const M = (t = "") => {
63
- const e = t, r = (n = "application/octet-stream") => {
64
- const o = new Uint8Array(e.length);
65
- for (let h = 0; h < e.length; h++)
66
- o[h] = e.charCodeAt(h);
67
- const c = new Blob([o], { type: n });
68
- return URL.createObjectURL(c);
62
+ const N = (t = "") => {
63
+ const e = t, r = (s = "application/octet-stream") => {
64
+ const i = new Uint8Array(e.length);
65
+ for (let f = 0; f < e.length; f++)
66
+ i[f] = e.charCodeAt(f);
67
+ const u = new Blob([i], { type: s });
68
+ return URL.createObjectURL(u);
69
69
  };
70
70
  return {
71
71
  getContent: () => e,
72
72
  getURL: r,
73
- download: (n) => {
74
- const o = document.createElement("a");
75
- o.download = n, o.href = r(), document.body.appendChild(o), o.click(), document.body.removeChild(o);
73
+ download: (s) => {
74
+ const i = document.createElement("a");
75
+ i.download = s, i.href = r(), document.body.appendChild(i), i.click(), document.body.removeChild(i);
76
76
  },
77
- open: (n) => {
78
- window.open(r(n), "_blank");
77
+ open: (s) => {
78
+ window.open(r(s), "_blank");
79
79
  }
80
80
  };
81
- }, Jt = (t) => M(atob(t)), Lt = (t) => M(Y(t));
82
- function N(t, e, r, n, o) {
81
+ }, Lt = (t) => N(atob(t)), Qt = (t) => N(Z(t));
82
+ function J(t, e, r, s, i) {
83
83
  if (!(!t || typeof t != "object"))
84
- for (let c in t) {
85
- const l = t[c];
84
+ for (let u in t) {
85
+ const l = t[u];
86
86
  if (l && typeof l == "object") {
87
87
  if ("__args" in l) {
88
- const h = l.__args, s = {};
89
- Object.entries(h).forEach(([i, a]) => {
90
- if (a instanceof Array && A(a)) {
91
- s[i] = new w(i);
92
- let u = 0;
93
- a.forEach((p) => {
94
- p instanceof File && (r[o.current] || (r[o.current] = []), r[o.current].push("variables." + i + "." + u), n.append(o.current.toString(), p), o.current++, u++);
95
- }), e[i] = "[Upload!]!";
96
- } else a instanceof File ? (s[i] = new w(i), r[o.current] = ["variables." + i], n.append(o.current.toString(), a), e[i] = "Upload!", o.current++) : a instanceof Object && B(a) ? (s[i] = {}, Object.entries(a).forEach(([u, p]) => {
97
- if (p instanceof Array && A(p)) {
98
- s[i][u] = new w(u);
88
+ const f = l.__args, n = {};
89
+ Object.entries(f).forEach(([o, a]) => {
90
+ if (a instanceof Array && D(a)) {
91
+ n[o] = new F(o);
92
+ let c = 0;
93
+ a.forEach((h) => {
94
+ h instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + o + "." + c), s.append(i.current.toString(), h), i.current++, c++);
95
+ }), e[o] = "[Upload!]!";
96
+ } else a instanceof File ? (n[o] = new F(o), r[i.current] = ["variables." + o], s.append(i.current.toString(), a), e[o] = "Upload!", i.current++) : a instanceof Object && M(a) ? (n[o] = {}, Object.entries(a).forEach(([c, h]) => {
97
+ if (h instanceof Array && D(h)) {
98
+ n[o][c] = new F(c);
99
99
  let d = 0;
100
- p.forEach((g) => {
101
- g instanceof File && (r[o.current] || (r[o.current] = []), r[o.current].push("variables." + u + "." + d), n.append(o.current.toString(), g), o.current++, d++);
102
- }), e[u] = "[Upload!]!";
103
- } else p instanceof File ? (s[i][u] = new w(u), r[o.current] = ["variables." + u], n.append(o.current.toString(), p), e[u] = "Upload!", o.current++) : s[i][u] = p;
104
- })) : a != null && (s[i] = a);
105
- }), l.__args = s;
100
+ h.forEach((g) => {
101
+ g instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + c + "." + d), s.append(i.current.toString(), g), i.current++, d++);
102
+ }), e[c] = "[Upload!]!";
103
+ } else h instanceof File ? (n[o][c] = new F(c), r[i.current] = ["variables." + c], s.append(i.current.toString(), h), e[c] = "Upload!", i.current++) : n[o][c] = h;
104
+ })) : a != null && (n[o] = a);
105
+ }), l.__args = n;
106
106
  }
107
- N(l, e, r, n, o);
107
+ J(l, e, r, s, i);
108
108
  }
109
109
  }
110
110
  }
111
111
  const y = async (t) => {
112
- const { axios: e } = q(), r = t, n = new FormData();
113
- let o = !1;
114
- const c = {}, l = {};
115
- N(r, c, l, n, { current: 0 }), o = Object.keys(c).length > 0, o && (r.__variables = c);
116
- let s = null;
117
- const a = v({ query: r });
118
- if (o ? (n.append("map", JSON.stringify(l)), n.append("operations", JSON.stringify({
112
+ const { axios: e } = B(), r = t, s = new FormData();
113
+ let i = !1;
114
+ const u = {}, l = {};
115
+ J(r, u, l, s, { current: 0 }), i = Object.keys(u).length > 0, i && (r.__variables = u);
116
+ let n = null;
117
+ const a = q({ query: r });
118
+ if (i ? (s.append("map", JSON.stringify(l)), s.append("operations", JSON.stringify({
119
119
  query: a
120
- })), s = await e.post("", n)) : s = await e.post("", {
120
+ })), n = await e.post("", s)) : n = await e.post("", {
121
121
  query: a
122
- }), s.data.errors)
123
- throw new Error(s.data.errors[0].message);
124
- return s.data.data;
122
+ }), n.data.errors)
123
+ throw new Error(n.data.errors[0].message);
124
+ return n.data.data;
125
125
  };
126
- function C(t, e) {
127
- let r, n = [], o, c;
128
- const l = (s) => !s || typeof s != "object" ? !1 : Object.values(s).some((i) => i && typeof i == "object" && Object.keys(i).some((a) => a.startsWith("_"))), h = () => n.length === 0 ? (n.unshift({}), n[0]) : (l(n[0]) && n.unshift({}), n[0]);
126
+ function k(t, e) {
127
+ let r, s = [], i, u;
128
+ const l = (n) => !n || typeof n != "object" ? !1 : Object.values(n).some((o) => o && typeof o == "object" && Object.keys(o).some((a) => a.startsWith("_"))), f = () => s.length === 0 ? (s.unshift({}), s[0]) : (l(s[0]) && s.unshift({}), s[0]);
129
129
  return {
130
130
  first() {
131
131
  return this.fetchFirst();
@@ -134,44 +134,44 @@ function C(t, e) {
134
134
  return this.fetch();
135
135
  },
136
136
  async fetchFirst() {
137
- const i = await this.limit(1).fetch();
138
- return Array.isArray(i) && i.length > 0 ? i[0] : null;
137
+ const o = await this.limit(1).fetch();
138
+ return Array.isArray(o) && o.length > 0 ? o[0] : null;
139
139
  },
140
140
  async fetchWithMeta() {
141
- let i = await y(this.toQuery(!0));
142
- if (c) {
143
- const a = c.split(".");
144
- for (const u of a)
145
- i = i[u];
146
- return i;
141
+ let o = await y(this.toQuery(!0));
142
+ if (u) {
143
+ const a = u.split(".");
144
+ for (const c of a)
145
+ o = o[c];
146
+ return o;
147
147
  }
148
- return i[`list${t}`];
148
+ return o[`list${t}`];
149
149
  },
150
150
  async fetch() {
151
- let i = await y(this.toQuery());
152
- if (c) {
153
- const a = c.split(".");
154
- for (const u of a)
155
- i = i[u];
156
- return i.data;
151
+ let o = await y(this.toQuery());
152
+ if (u) {
153
+ const a = u.split(".");
154
+ for (const c of a)
155
+ o = o[c];
156
+ return o.data;
157
157
  }
158
- return i[`list${t}`].data;
158
+ return o[`list${t}`].data;
159
159
  },
160
- dataPath(s) {
161
- return s && typeof s == "string" && (c = s), this;
160
+ dataPath(n) {
161
+ return n && typeof n == "string" && (u = n), this;
162
162
  },
163
- sort(s) {
164
- return s && typeof s == "string" && (o = s), this;
163
+ sort(n) {
164
+ return n && typeof n == "string" && (i = n), this;
165
165
  },
166
- filters(s) {
167
- return s && typeof s == "object" && (n = [s]), this;
166
+ filters(n) {
167
+ return n && typeof n == "object" && (s = [n]), this;
168
168
  },
169
169
  // where can be called as:
170
170
  // where('key', value) -> exact match
171
171
  // where('key', '>', value) -> operator-based (>, <, >=, <=, !=, in, contains)
172
- where(s, i, a) {
173
- const u = (p, d, g) => {
174
- const F = {
172
+ where(n, o, a) {
173
+ const c = (h, d, g) => {
174
+ const b = {
175
175
  ">": "_gt",
176
176
  "<": "_lt",
177
177
  ">=": "_gte",
@@ -180,75 +180,75 @@ function C(t, e) {
180
180
  in: "_in",
181
181
  contains: "_contains"
182
182
  }[d];
183
- F && n.push({ [p]: { [F]: g } });
183
+ b && s.push({ [h]: { [b]: g } });
184
184
  };
185
185
  if (a !== void 0)
186
- u(s, String(i), a);
186
+ c(n, String(o), a);
187
187
  else {
188
- const p = h(), d = b(p, { [s]: i });
189
- n[0] = d;
188
+ const h = f(), d = A(h, { [n]: o });
189
+ s[0] = d;
190
190
  }
191
191
  return this;
192
192
  },
193
193
  // whereContains adds a _contains filter for a specific field
194
194
  // If the same field is used multiple times, it merges them into an array
195
- whereContains(s, i) {
196
- if (s && typeof s == "string") {
197
- const a = h(), u = { _contains: i };
198
- a[s] ? Array.isArray(a[s]) ? a[s].push(u) : a[s] = [a[s], u] : a[s] = [u], n[0] = a;
195
+ whereContains(n, o) {
196
+ if (n && typeof n == "string") {
197
+ const a = f(), c = { _contains: o };
198
+ a[n] ? Array.isArray(a[n]) ? a[n].push(c) : a[n] = [a[n], c] : a[n] = [c], s[0] = a;
199
199
  }
200
200
  return this;
201
201
  },
202
202
  // ...existing code...
203
203
  // whereIn adds an _in filter for a specific field
204
204
  // If the same field is used multiple times, it merges them into an array
205
- whereIn(s, i) {
206
- if (s && typeof s == "string" && Array.isArray(i)) {
207
- const a = h(), u = { _in: i };
208
- a[s] ? Array.isArray(a[s]) ? a[s].push(u) : a[s] = [a[s], u] : a[s] = [u], n[0] = a;
205
+ whereIn(n, o) {
206
+ if (n && typeof n == "string" && Array.isArray(o)) {
207
+ const a = f(), c = { _in: o };
208
+ a[n] ? Array.isArray(a[n]) ? a[n].push(c) : a[n] = [a[n], c] : a[n] = [c], s[0] = a;
209
209
  }
210
210
  return this;
211
211
  },
212
212
  // whereBetween adds a _between filter for a specific field
213
- whereBetween(s, i, a) {
214
- if (s && typeof s == "string") {
215
- const u = h(), p = { _between: [i, a] };
216
- u[s] ? Array.isArray(u[s]) ? u[s].push(p) : u[s] = [u[s], p] : u[s] = p, n[0] = u;
213
+ whereBetween(n, o, a) {
214
+ if (n && typeof n == "string") {
215
+ const c = f(), h = { _between: [o, a] };
216
+ c[n] ? Array.isArray(c[n]) ? c[n].push(h) : c[n] = [c[n], h] : c[n] = h, s[0] = c;
217
217
  }
218
218
  return this;
219
219
  },
220
220
  // limit sets paging/limit for the data selection
221
- limit(s) {
222
- return typeof s == "number" && Number.isFinite(s) && (r = b(r || {}, { limit: s })), this;
221
+ limit(n) {
222
+ return typeof n == "number" && Number.isFinite(n) && (r = A(r || {}, { limit: n })), this;
223
223
  },
224
224
  // offset sets the starting index for the data selection
225
- offset(s) {
226
- return typeof s == "number" && Number.isFinite(s) && (r = b(r || {}, { offset: s })), this;
225
+ offset(n) {
226
+ return typeof n == "number" && Number.isFinite(n) && (r = A(r || {}, { offset: n })), this;
227
227
  },
228
- toQuery(s = !1) {
229
- let i;
230
- const a = n.length > 0 && Object.keys(n[0] || {}).length > 0, u = a ? 1 : 0, p = n.length > u;
231
- a && p ? i = n : p ? i = n.slice(u) : a && (i = n[0]);
232
- const d = b(
233
- o ? { sort: o } : {},
234
- i ? { filters: i } : {}
228
+ toQuery(n = !1) {
229
+ let o;
230
+ const a = s.length > 0 && Object.keys(s[0] || {}).length > 0, c = a ? 1 : 0, h = s.length > c;
231
+ a && h ? o = s : h ? o = s.slice(c) : a && (o = s[0]);
232
+ const d = A(
233
+ i ? { sort: i } : {},
234
+ o ? { filters: o } : {}
235
235
  ), g = {
236
236
  data: {
237
237
  ...e
238
238
  }
239
239
  };
240
- if (r && (g.data.__args = r), Object.keys(d).length > 0 && (g.__args = d), s && (g.meta = {
240
+ if (r && (g.data.__args = r), Object.keys(d).length > 0 && (g.__args = d), n && (g.meta = {
241
241
  total: !0,
242
242
  key: !0,
243
243
  name: !0
244
- }), c) {
245
- const D = c.split(".");
246
- let F = g;
247
- for (let k = D.length - 1; k >= 0; k--)
248
- F = {
249
- [D[k]]: F
244
+ }), u) {
245
+ const m = u.split(".");
246
+ let b = g;
247
+ for (let w = m.length - 1; w >= 0; w--)
248
+ b = {
249
+ [m[w]]: b
250
250
  };
251
- return F;
251
+ return b;
252
252
  }
253
253
  return {
254
254
  [`list${t}`]: g
@@ -256,7 +256,7 @@ function C(t, e) {
256
256
  }
257
257
  };
258
258
  }
259
- const Z = "list", V = [
259
+ const V = "list", I = [
260
260
  "flatMap",
261
261
  "chunk",
262
262
  "shuffle",
@@ -282,7 +282,7 @@ const Z = "list", V = [
282
282
  "slice",
283
283
  "tap",
284
284
  "sort"
285
- ], I = [
285
+ ], K = [
286
286
  "avg",
287
287
  "count",
288
288
  "countBy",
@@ -359,8 +359,8 @@ U().macro("whereContains", function(t, e) {
359
359
  _.prototype.fetchData = async function() {
360
360
  try {
361
361
  if (this._batchData) {
362
- const h = this._batchData;
363
- return this.meta = h.meta, U(h.data);
362
+ const f = this._batchData;
363
+ return this.meta = f.meta, U(f.data);
364
364
  }
365
365
  let t = {
366
366
  meta: {
@@ -371,17 +371,17 @@ _.prototype.fetchData = async function() {
371
371
  };
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
- let r = {}, n = r, o = e[e.length - 1];
375
- for (const h of e) {
376
- if (h === o) {
377
- n[h] = t;
374
+ let r = {}, s = r, i = e[e.length - 1];
375
+ for (const f of e) {
376
+ if (f === i) {
377
+ s[f] = t;
378
378
  break;
379
379
  }
380
- n[h] = {}, n = n[h];
380
+ s[f] = {}, s = s[f];
381
381
  }
382
382
  let l = await y(r);
383
- for (const h of e)
384
- l = l[h];
383
+ for (const f of e)
384
+ l = l[f];
385
385
  return this.meta = l.meta, U(l.data);
386
386
  } catch (t) {
387
387
  throw console.error("Error fetching collection data:", t), t;
@@ -396,12 +396,12 @@ _.prototype.processData = async function() {
396
396
  _.prototype.all = async function() {
397
397
  return (await this.processData()).all();
398
398
  };
399
- for (const t of V)
399
+ for (const t of I)
400
400
  _.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 I)
404
+ for (const t of K)
405
405
  _.prototype[t] = async function(...e) {
406
406
  return (await this.clone().processData())[t](...e);
407
407
  };
@@ -418,28 +418,28 @@ _.prototype.where = function(...t) {
418
418
  if (t.length === 2)
419
419
  this.filters[t[0]] = t[1];
420
420
  else if (t.length === 3) {
421
- const r = t[0], n = t[1], o = t[2];
422
- switch (n) {
421
+ const r = t[0], s = t[1], i = t[2];
422
+ switch (s) {
423
423
  case "==":
424
- this.filters[r] = o;
424
+ this.filters[r] = i;
425
425
  break;
426
426
  case "<":
427
- this.filters[r] = { lt: o };
427
+ this.filters[r] = { lt: i };
428
428
  break;
429
429
  case "<=":
430
- this.filters[r] = { lte: o };
430
+ this.filters[r] = { lte: i };
431
431
  break;
432
432
  case ">":
433
- this.filters[r] = { gt: o };
433
+ this.filters[r] = { gt: i };
434
434
  break;
435
435
  case ">=":
436
- this.filters[r] = { gte: o };
436
+ this.filters[r] = { gte: i };
437
437
  break;
438
438
  case "!==":
439
- this.filters[r] = { ne: o };
439
+ this.filters[r] = { ne: i };
440
440
  break;
441
441
  default:
442
- throw new Error(`Unsupported operator: ${n}`);
442
+ throw new Error(`Unsupported operator: ${s}`);
443
443
  }
444
444
  }
445
445
  return this;
@@ -486,108 +486,108 @@ _.prototype.take = function(t) {
486
486
  _.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 J = (t, e) => {
489
+ const L = (t, e) => {
490
490
  const r = new _(e);
491
- return r.data_path = Z + t, r;
492
- }, K = (t, e = {}) => {
491
+ return r.data_path = V + t, r;
492
+ }, x = (t, e = {}) => {
493
493
  const r = e;
494
- let n = "list" + t;
495
- const o = (c) => r[c] ? r[c] : null;
494
+ let s = "list" + t;
495
+ const i = (u) => r[u] ? r[u] : null;
496
496
  return {
497
- field: o,
497
+ field: i,
498
498
  $fields: r,
499
- setDataPath(c) {
500
- return n = c, n;
499
+ setDataPath(u) {
500
+ return s = u, s;
501
501
  },
502
502
  getDataPath() {
503
- return n;
503
+ return s;
504
504
  },
505
- gqlFields(c) {
505
+ gqlFields(u) {
506
506
  let l = {};
507
- for (const h of c)
508
- if (typeof h == "string") {
509
- const s = o(h);
510
- s && (l = b(l, s.gqlField ? typeof s.gqlField == "string" ? { [s.gqlField]: !0 } : s.gqlField : { [s.name || h]: !0 }));
511
- } else typeof h == "object" && (l = b(l, h));
507
+ for (const f of u)
508
+ if (typeof f == "string") {
509
+ const n = i(f);
510
+ n && (l = A(l, n.gqlField ? typeof n.gqlField == "string" ? { [n.gqlField]: !0 } : n.gqlField : { [n.name || f]: !0 }));
511
+ } else typeof f == "object" && (l = A(l, f));
512
512
  return l;
513
513
  },
514
- update(c, l) {
515
- return f({
514
+ update(u, l) {
515
+ return p({
516
516
  ["update" + t]: {
517
- __args: { id: c, data: l }
517
+ __args: { id: u, data: l }
518
518
  }
519
- }).then((h) => h["update" + t]);
519
+ }).then((f) => f["update" + t]);
520
520
  },
521
- async delete(c) {
522
- return f({
521
+ async delete(u) {
522
+ return p({
523
523
  ["delete" + t]: {
524
- __args: { id: c }
524
+ __args: { id: u }
525
525
  }
526
526
  }).then((l) => l["delete" + t]);
527
527
  },
528
- add(c) {
529
- return f({
528
+ add(u) {
529
+ return p({
530
530
  ["add" + t]: {
531
- __args: { data: c }
531
+ __args: { data: u }
532
532
  }
533
533
  }).then((l) => l["add" + t]);
534
534
  },
535
- fields(c) {
535
+ fields(u) {
536
536
  let l = [];
537
- for (let h of c) {
538
- const s = o(h);
539
- s && l.push(s);
537
+ for (let f of u) {
538
+ const n = i(f);
539
+ n && l.push(n);
540
540
  }
541
541
  return l;
542
542
  },
543
- async get(c, l) {
544
- const h = J(t, vt(l));
545
- for (const [s, i] of Object.entries(c))
546
- h.where(s, "==", i);
547
- return await h.first();
543
+ async get(u, l) {
544
+ const f = L(t, qt(l));
545
+ for (const [n, o] of Object.entries(u))
546
+ f.where(n, "==", o);
547
+ return await f.first();
548
548
  },
549
- list(c) {
550
- let l = c;
551
- const h = {};
552
- Object.entries(c).forEach(([a]) => {
553
- r[a] && (h[a] = r[a], r[a].gqlField && (delete l[a], l = b(l, r[a].gqlField)), r[a].gql && (delete l[a], l = b(l, r[a].gql)));
549
+ list(u) {
550
+ let l = u;
551
+ const f = {};
552
+ Object.entries(u).forEach(([a]) => {
553
+ r[a] && (f[a] = r[a], r[a].gqlField && (delete l[a], l = A(l, r[a].gqlField)), r[a].gql && (delete l[a], l = A(l, r[a].gql)));
554
554
  });
555
- const s = C(t, l).dataPath(n), i = s.fetch.bind(s);
555
+ const n = k(t, l).dataPath(s), o = n.fetch.bind(n);
556
556
  return {
557
- ...s,
557
+ ...n,
558
558
  async fetch() {
559
- return (await i()).map((u) => {
560
- const p = { ...u };
561
- return Object.entries(h).forEach(([d, g]) => {
562
- g.field && typeof g.field == "function" && (p[d] = g.field(u[d], u));
563
- }), p;
559
+ return (await o()).map((c) => {
560
+ const h = { ...c };
561
+ return Object.entries(f).forEach(([d, g]) => {
562
+ g.field && typeof g.field == "function" && (h[d] = g.field(c[d], c));
563
+ }), h;
564
564
  });
565
565
  },
566
566
  async fetchFirst() {
567
- const u = await s.fetchFirst.bind(s)();
568
- if (!u) return u;
569
- const p = { ...u };
570
- return Object.entries(h).forEach(([d, g]) => {
571
- g.field && typeof g.field == "function" && (p[d] = g.field(u[d], u));
572
- }), p;
567
+ const c = await n.fetchFirst.bind(n)();
568
+ if (!c) return c;
569
+ const h = { ...c };
570
+ return Object.entries(f).forEach(([d, g]) => {
571
+ g.field && typeof g.field == "function" && (h[d] = g.field(c[d], c));
572
+ }), h;
573
573
  }
574
574
  };
575
575
  }
576
576
  };
577
- }, m = {}, L = (t, e) => {
578
- const r = K(t, e);
579
- return m[t] = r, r;
580
- }, P = (t) => m[t] ? m[t] : L(t, {}), $t = (t) => !!m[t], Qt = () => Object.keys(m), Gt = () => {
581
- Object.keys(m).forEach((t) => delete m[t]);
582
- }, Tt = (t) => {
577
+ }, O = {}, Q = (t, e) => {
578
+ const r = x(t, e);
579
+ return O[t] = r, r;
580
+ }, E = (t) => O[t] ? O[t] : Q(t, {}), Tt = (t) => !!O[t], $t = () => Object.keys(O), Rt = () => {
581
+ Object.keys(O).forEach((t) => delete O[t]);
582
+ }, Gt = (t) => {
583
583
  Object.entries(t).forEach(([e, r]) => {
584
- L(e, r);
584
+ Q(e, r);
585
585
  });
586
- }, Rt = () => y({
586
+ }, Wt = () => y({
587
587
  app: {
588
588
  permissions: !0
589
589
  }
590
- }).then((t) => t.app.permissions), $ = async () => {
590
+ }).then((t) => t.app.permissions), T = async () => {
591
591
  const { app: t } = await y({
592
592
  app: {
593
593
  auth: {
@@ -596,7 +596,7 @@ const J = (t, e) => {
596
596
  }
597
597
  }), e = t.auth.webAuthnRequestOptions, r = PublicKeyCredential.parseRequestOptionsFromJSON(e);
598
598
  return await navigator.credentials.get({ publicKey: r });
599
- }, Q = async () => {
599
+ }, $ = async () => {
600
600
  const { app: t } = await y({
601
601
  app: {
602
602
  auth: {
@@ -605,31 +605,31 @@ const J = (t, e) => {
605
605
  }
606
606
  }), e = PublicKeyCredential.parseCreationOptionsFromJSON(t.auth.webAuthnCreationOptions);
607
607
  return await navigator.credentials.create({ publicKey: e });
608
- }, x = async () => {
609
- const t = await $();
610
- return await f({
608
+ }, tt = async () => {
609
+ const t = await T();
610
+ return await p({
611
611
  webAuthnAssertion: {
612
612
  __args: {
613
613
  assertion: t.toJSON()
614
614
  }
615
615
  }
616
616
  }).then((e) => e.webAuthnAssertion);
617
- }, tt = async () => {
618
- const t = await Q();
619
- return await f({
617
+ }, et = async () => {
618
+ const t = await $();
619
+ return await p({
620
620
  webAuthnRegister: {
621
621
  __args: {
622
622
  registration: t.toJSON()
623
623
  }
624
624
  }
625
625
  }).then((e) => e.webAuthnRegister);
626
- }, et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
626
+ }, rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
627
627
  __proto__: null,
628
- assertion: $,
629
- attestation: Q,
630
- login: x,
631
- register: tt
632
- }, Symbol.toStringTag, { value: "Module" })), rt = (t = R) => y({ my: t }).then((e) => e.my), st = (t, e, r = "") => f({ login: { __args: { username: t, password: e, code: r } } }).then((n) => n.login), nt = () => f({ logout: !0 }).then((t) => t.logout), ot = (t, e, r) => f({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((n) => n.changeExpiredPassword), it = (t, e) => f({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), at = (t, e, r) => f({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((n) => n.resetPassword), ct = (t, e) => f({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), lt = (t, e) => f({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), ut = (t) => y({
628
+ assertion: T,
629
+ attestation: $,
630
+ login: tt,
631
+ register: et
632
+ }, Symbol.toStringTag, { value: "Module" })), st = (t = W) => y({ my: t }).then((e) => e.my), nt = (t, e, r = "") => p({ login: { __args: { username: t, password: e, code: r } } }).then((s) => s.login), ot = () => p({ logout: !0 }).then((t) => t.logout), it = (t, e, r) => p({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((s) => s.changeExpiredPassword), at = (t, e) => p({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), ct = (t, e, r) => p({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((s) => s.resetPassword), lt = (t, e) => p({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), ut = (t, e) => p({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), ht = (t) => y({
633
633
  my: {
634
634
  granted: {
635
635
  __args: {
@@ -637,7 +637,7 @@ const J = (t, e) => {
637
637
  }
638
638
  }
639
639
  }
640
- }).then((e) => e.my.granted), ht = (t) => y({
640
+ }).then((e) => e.my.granted), ft = (t) => y({
641
641
  my: {
642
642
  grantedRights: {
643
643
  __args: {
@@ -646,39 +646,39 @@ const J = (t, e) => {
646
646
  }
647
647
  }
648
648
  }).then((e) => e.my.grantedRights), pt = {
649
- getCurrentUser: rt,
650
- webAuthn: et,
649
+ getCurrentUser: st,
650
+ webAuthn: rt,
651
651
  google: {
652
- unlink: () => f({ lightAuthUnlinkGoogle: !0 }).then((t) => t.lightAuthUnlinkGoogle),
653
- login: (t) => f({ lightAuthLoginGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthLoginGoogle),
654
- register: (t) => f({ lightAuthRegisterGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthRegisterGoogle)
652
+ unlink: () => p({ lightAuthUnlinkGoogle: !0 }).then((t) => t.lightAuthUnlinkGoogle),
653
+ login: (t) => p({ lightAuthLoginGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthLoginGoogle),
654
+ register: (t) => p({ lightAuthRegisterGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthRegisterGoogle)
655
655
  },
656
656
  facebook: {
657
- unlink: () => f({ lightAuthUnlinkFacebook: !0 }).then((t) => t.lightAuthUnlinkFacebook),
658
- login: (t) => f({ lightAuthLoginFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginFacebook),
659
- register: (t) => f({ lightAuthRegisterFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthRegisterFacebook)
657
+ unlink: () => p({ lightAuthUnlinkFacebook: !0 }).then((t) => t.lightAuthUnlinkFacebook),
658
+ login: (t) => p({ lightAuthLoginFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginFacebook),
659
+ register: (t) => p({ lightAuthRegisterFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthRegisterFacebook)
660
660
  },
661
661
  microsoft: {
662
- unlink: () => f({ lightAuthUnlinkMicrosoft: !0 }).then((t) => t.lightAuthUnlinkMicrosoft),
663
- login: (t) => f({ lightAuthLoginMicrosoft: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginMicrosoft),
664
- register: (t) => f({ lightAuthRegisterMicrosoft: { __args: { account_id: t } } }).then((e) => e.lightAuthRegisterMicrosoft)
662
+ unlink: () => p({ lightAuthUnlinkMicrosoft: !0 }).then((t) => t.lightAuthUnlinkMicrosoft),
663
+ login: (t) => p({ lightAuthLoginMicrosoft: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginMicrosoft),
664
+ register: (t) => p({ lightAuthRegisterMicrosoft: { __args: { account_id: t } } }).then((e) => e.lightAuthRegisterMicrosoft)
665
665
  },
666
- login: st,
667
- logout: nt,
668
- changeExpiredPassword: ot,
669
- updatePassword: it,
670
- resetPassword: at,
671
- forgetPassword: ct,
672
- verifyCode: lt,
673
- grantedRights: ht,
674
- isGranted: ut
675
- }, G = {
666
+ login: nt,
667
+ logout: ot,
668
+ changeExpiredPassword: it,
669
+ updatePassword: at,
670
+ resetPassword: ct,
671
+ forgetPassword: lt,
672
+ verifyCode: ut,
673
+ grantedRights: ft,
674
+ isGranted: ht
675
+ }, R = {
676
676
  name: !0,
677
677
  path: !0,
678
678
  size: !0,
679
679
  mime: !0,
680
680
  url: !0
681
- }, ft = (t, e, r = G) => y({
681
+ }, dt = (t, e, r = R) => y({
682
682
  app: {
683
683
  drive: {
684
684
  __args: { index: t },
@@ -688,7 +688,7 @@ const J = (t, e) => {
688
688
  }
689
689
  }
690
690
  }
691
- }).then((n) => n.app.drive.files), dt = (t, e) => y({
691
+ }).then((s) => s.app.drive.files), gt = (t, e) => y({
692
692
  app: {
693
693
  drive: {
694
694
  __args: {
@@ -702,8 +702,8 @@ const J = (t, e) => {
702
702
  }
703
703
  }
704
704
  }
705
- }).then((r) => r.app.drive?.file?.base64Content), gt = (t) => ({
706
- list: (e, r = G) => ft(t, e, r),
705
+ }).then((r) => r.app.drive?.file?.base64Content), _t = (t) => ({
706
+ list: (e, r = R) => dt(t, e, r),
707
707
  get: (e, r = {
708
708
  name: !0,
709
709
  path: !0,
@@ -724,9 +724,9 @@ const J = (t, e) => {
724
724
  }
725
725
  }
726
726
  }
727
- }).then((n) => n.app.drive.file),
727
+ }).then((s) => s.app.drive.file),
728
728
  readFileAsBase64(e) {
729
- return dt(t, e);
729
+ return gt(t, e);
730
730
  },
731
731
  read: async (e) => {
732
732
  let r = await y({
@@ -748,14 +748,14 @@ const J = (t, e) => {
748
748
  throw new Error(`File not found or cannot read content: ${e}`);
749
749
  return typeof window < "u" && window.atob ? window.atob(r.app.drive.file.base64Content) : r.app.drive.file.base64Content;
750
750
  },
751
- write: (e, r) => f({ lightDriveWriteFile: { __args: { index: t, path: e, content: r } } }).then((n) => n.lightDriveWriteFile),
752
- delete: (e) => f({ lightDriveDeleteFile: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFile),
753
- rename: (e, r) => f({ lightDriveRenameFile: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFile),
754
- move: (e, r) => f({ lightDriveMoveFile: { __args: { index: t, source: e, destination: r } } }).then((n) => n.lightDriveMoveFile)
755
- }), T = {
751
+ write: (e, r) => p({ lightDriveWriteFile: { __args: { index: t, path: e, content: r } } }).then((s) => s.lightDriveWriteFile),
752
+ delete: (e) => p({ lightDriveDeleteFile: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFile),
753
+ rename: (e, r) => p({ lightDriveRenameFile: { __args: { index: t, path: e, name: r } } }).then((s) => s.lightDriveRenameFile),
754
+ move: (e, r) => p({ lightDriveMoveFile: { __args: { index: t, source: e, destination: r } } }).then((s) => s.lightDriveMoveFile)
755
+ }), G = {
756
756
  name: !0,
757
757
  path: !0
758
- }, _t = (t, e, r = T) => y({
758
+ }, yt = (t, e, r = G) => y({
759
759
  app: {
760
760
  drive: {
761
761
  __args: { index: t },
@@ -765,20 +765,20 @@ const J = (t, e) => {
765
765
  }
766
766
  }
767
767
  }
768
- }).then((n) => n.app.drive.folders), yt = (t) => ({
769
- list: (e, r = T) => _t(t, e, r),
770
- create: (e) => f({ lightDriveCreateFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveCreateFolder),
771
- delete: (e) => f({ lightDriveDeleteFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFolder),
772
- rename: (e, r) => f({ lightDriveRenameFolder: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFolder)
773
- }), Wt = () => y({
768
+ }).then((s) => s.app.drive.folders), wt = (t) => ({
769
+ list: (e, r = G) => yt(t, e, r),
770
+ create: (e) => p({ lightDriveCreateFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveCreateFolder),
771
+ delete: (e) => p({ lightDriveDeleteFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFolder),
772
+ rename: (e, r) => p({ lightDriveRenameFolder: { __args: { index: t, path: e, name: r } } }).then((s) => s.lightDriveRenameFolder)
773
+ }), zt = () => y({
774
774
  app: {
775
775
  drives: {
776
776
  index: !0,
777
777
  name: !0
778
778
  }
779
779
  }
780
- }).then((t) => t.app.drives), wt = (t) => {
781
- const e = gt(t), r = yt(t);
780
+ }).then((t) => t.app.drives), bt = (t) => {
781
+ const e = _t(t), r = wt(t);
782
782
  return {
783
783
  folders: r,
784
784
  files: e,
@@ -793,39 +793,39 @@ const J = (t, e) => {
793
793
  createFolder: r.create,
794
794
  deleteFolder: r.delete,
795
795
  renameFolder: r.rename,
796
- uploadTempFile: (n) => f({
796
+ uploadTempFile: (s) => p({
797
797
  lightDriveUploadTempFile: {
798
- __args: { index: t, file: n },
798
+ __args: { index: t, file: s },
799
799
  name: !0,
800
800
  path: !0,
801
801
  size: !0,
802
802
  mime: !0
803
803
  }
804
- }).then((o) => o.lightDriveUploadTempFile)
804
+ }).then((i) => i.lightDriveUploadTempFile)
805
805
  };
806
- }, R = {
806
+ }, W = {
807
807
  user_id: !0,
808
808
  username: !0,
809
809
  first_name: !0,
810
810
  last_name: !0,
811
811
  status: !0
812
- }, bt = (t) => f({
812
+ }, mt = (t) => p({
813
813
  addUser: {
814
814
  __args: t
815
815
  }
816
- }).then((e) => e.addUser), mt = (t) => f({
816
+ }).then((e) => e.addUser), Ft = (t) => p({
817
817
  deleteUser: {
818
818
  __args: { id: t }
819
819
  }
820
- }).then((e) => e.deleteUser), Ft = (t = R) => C("Users", t).dataPath("app.listUser").fetch(), At = (t, e) => f({
820
+ }).then((e) => e.deleteUser), At = (t = W) => k("Users", t).dataPath("app.listUser").fetch(), Ot = (t, e) => p({
821
821
  updateUser: {
822
822
  __args: { id: t, data: e }
823
823
  }
824
- }).then((r) => r.updateUser), Ot = {
825
- list: Ft,
826
- create: bt,
827
- delete: mt,
828
- update: At
824
+ }).then((r) => r.updateUser), Dt = {
825
+ list: At,
826
+ create: mt,
827
+ delete: Ft,
828
+ update: Ot
829
829
  }, Ct = (t) => y({
830
830
  app: {
831
831
  listConfig: {
@@ -840,13 +840,13 @@ const J = (t, e) => {
840
840
  }
841
841
  }
842
842
  }
843
- }).then((e) => e.app.listConfig.data[0]?.value), Dt = {
843
+ }).then((e) => e.app.listConfig.data[0]?.value), jt = {
844
844
  name: !0
845
- }, kt = (t = Dt) => y({
845
+ }, kt = (t = jt) => y({
846
846
  app: {
847
847
  roles: t
848
848
  }
849
- }).then((e) => e.app.roles), jt = (t, e) => f({
849
+ }).then((e) => e.app.roles), Pt = (t, e) => p({
850
850
  addRole: {
851
851
  __args: {
852
852
  data: {
@@ -855,198 +855,220 @@ const J = (t, e) => {
855
855
  }
856
856
  }
857
857
  }
858
- }).then((r) => r.addRole), Pt = (t) => f({
858
+ }).then((r) => r.addRole), Et = (t) => p({
859
859
  deleteRole: {
860
860
  __args: { name: t }
861
861
  }
862
862
  }).then((e) => e.deleteRole), Ut = () => ({
863
863
  list: kt,
864
- create: jt,
865
- delete: Pt
864
+ create: Pt,
865
+ delete: Et
866
866
  });
867
- function W(t, e, r, n, o) {
867
+ function z(t, e, r, s, i) {
868
868
  if (!(!t || typeof t != "object"))
869
- for (let c in t) {
870
- const l = t[c];
869
+ for (let u in t) {
870
+ const l = t[u];
871
871
  if (l && typeof l == "object") {
872
872
  if ("__args" in l) {
873
- const h = l.__args, s = {};
874
- Object.entries(h).forEach(([i, a]) => {
875
- if (a instanceof Array && A(a)) {
876
- s[i] = new w(i);
877
- let u = 0;
878
- a.forEach((p) => {
879
- p instanceof File && (r[o.current] || (r[o.current] = []), r[o.current].push("variables." + i + "." + u), n.append(o.current.toString(), p), o.current++, u++);
880
- }), e[i] = "[Upload!]!";
881
- } else a instanceof File ? (s[i] = new w(i), r[o.current] = ["variables." + i], n.append(o.current.toString(), a), e[i] = "Upload!", o.current++) : a instanceof Object && B(a) ? (s[i] = {}, Object.entries(a).forEach(([u, p]) => {
882
- if (p instanceof Array && A(p)) {
883
- s[i][u] = new w(u);
873
+ const f = l.__args, n = {};
874
+ Object.entries(f).forEach(([o, a]) => {
875
+ if (a instanceof Array && D(a)) {
876
+ n[o] = new F(o);
877
+ let c = 0;
878
+ a.forEach((h) => {
879
+ h instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + o + "." + c), s.append(i.current.toString(), h), i.current++, c++);
880
+ }), e[o] = "[Upload!]!";
881
+ } else a instanceof File ? (n[o] = new F(o), r[i.current] = ["variables." + o], s.append(i.current.toString(), a), e[o] = "Upload!", i.current++) : a instanceof Object && M(a) ? (n[o] = {}, Object.entries(a).forEach(([c, h]) => {
882
+ if (h instanceof Array && D(h)) {
883
+ n[o][c] = new F(c);
884
884
  let d = 0;
885
- p.forEach((g) => {
886
- g instanceof File && (r[o.current] || (r[o.current] = []), r[o.current].push("variables." + u + "." + d), n.append(o.current.toString(), g), o.current++, d++);
887
- }), e[u] = "[Upload!]!";
888
- } else p instanceof File ? (s[i][u] = new w(u), r[o.current] = ["variables." + u], n.append(o.current.toString(), p), e[u] = "Upload!", o.current++) : s[i][u] = p;
889
- })) : a != null && (s[i] = a);
890
- }), l.__args = s;
885
+ h.forEach((g) => {
886
+ g instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + c + "." + d), s.append(i.current.toString(), g), i.current++, d++);
887
+ }), e[c] = "[Upload!]!";
888
+ } else h instanceof File ? (n[o][c] = new F(c), r[i.current] = ["variables." + c], s.append(i.current.toString(), h), e[c] = "Upload!", i.current++) : n[o][c] = h;
889
+ })) : a != null && (n[o] = a);
890
+ }), l.__args = n;
891
891
  }
892
- W(l, e, r, n, o);
892
+ z(l, e, r, s, i);
893
893
  }
894
894
  }
895
895
  }
896
- const f = async (t) => {
897
- const { axios: e } = q(), r = t, n = new FormData();
898
- let o = !1;
899
- const c = {}, l = {};
900
- W(r, c, l, n, { current: 0 }), o = Object.keys(c).length > 0, o && (r.__variables = c);
901
- let s = null;
902
- const a = v({ mutation: r });
903
- if (o ? (n.append("map", JSON.stringify(l)), n.append("operations", JSON.stringify({
896
+ const p = async (t) => {
897
+ const { axios: e } = B(), r = t, s = new FormData();
898
+ let i = !1;
899
+ const u = {}, l = {};
900
+ z(r, u, l, s, { current: 0 }), i = Object.keys(u).length > 0, i && (r.__variables = u);
901
+ let n = null;
902
+ const a = q({ mutation: r });
903
+ if (i ? (s.append("map", JSON.stringify(l)), s.append("operations", JSON.stringify({
904
904
  query: a
905
- })), s = await e.post("", n)) : s = await e.post("", {
905
+ })), n = await e.post("", s)) : n = await e.post("", {
906
906
  query: a
907
- }), s.data.errors)
908
- throw new Error(s.data.errors[0].message);
909
- return s.data.data;
910
- }, Et = (t, e, r) => f({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((n) => n.sendMail), St = {
911
- send: Et
907
+ }), n.data.errors)
908
+ throw new Error(n.data.errors[0].message);
909
+ return n.data.data;
910
+ }, vt = (t, e, r) => p({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((s) => s.sendMail), St = {
911
+ send: vt
912
912
  }, S = (t) => {
913
913
  let e = {};
914
914
  return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
915
- Object.entries(S(r)).forEach(([n, o]) => {
916
- e[n] = o;
915
+ Object.entries(S(r)).forEach(([s, i]) => {
916
+ e[s] = i;
917
917
  });
918
- }), e) : (Object.entries(t).forEach(([r, n]) => {
918
+ }), e) : (Object.entries(t).forEach(([r, s]) => {
919
919
  if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
920
- e[r] = n;
920
+ e[r] = s;
921
921
  return;
922
922
  }
923
- if (typeof n == "boolean") {
924
- e[r] = n;
923
+ if (typeof s == "boolean") {
924
+ e[r] = s;
925
925
  return;
926
926
  }
927
- e[r] = S(n);
927
+ e[r] = S(s);
928
928
  }), e);
929
- }, vt = (t) => S(t), zt = (t) => {
929
+ }, qt = (t) => S(t), Ht = (t) => {
930
930
  const e = typeof window > "u";
931
931
  let r = [];
932
- const n = z.create({
932
+ const s = H.create({
933
933
  baseURL: t,
934
934
  withCredentials: !0
935
935
  });
936
- e && (n.interceptors.request.use((c) => (c.withCredentials = !0, r.length > 0 && (c.headers.Cookie = r.join("; ")), c)), n.interceptors.response.use((c) => {
937
- if (c.headers["set-cookie"]) {
938
- const l = c.headers["set-cookie"].map((s) => s.split(";")[0]), h = /* @__PURE__ */ new Map();
939
- r.forEach((s) => {
940
- const i = s.split("=")[0];
941
- h.set(i, s);
942
- }), l.forEach((s) => {
943
- const i = s.split("=")[0];
944
- h.set(i, s);
945
- }), r = Array.from(h.values());
936
+ let i = !1, u = [];
937
+ const l = (o, a = null) => {
938
+ u.forEach((c) => {
939
+ o ? c.reject(o) : c.resolve(a);
940
+ }), u = [];
941
+ };
942
+ s.interceptors.response.use(
943
+ (o) => {
944
+ const a = o.data.errors;
945
+ if (a && a.some((c) => c.extensions?.code === "TOKEN_EXPIRED")) {
946
+ const c = o.config;
947
+ return i ? new Promise((h, d) => {
948
+ u.push({ resolve: h, reject: d });
949
+ }).then(() => s(c)).catch((h) => Promise.reject(h)) : (i = !0, f().then(() => (i = !1, l(null), s(c))).catch((h) => (i = !1, l(h), window.location.href = "/login", Promise.reject(h))));
950
+ }
951
+ return o;
952
+ },
953
+ (o) => Promise.reject(o)
954
+ );
955
+ function f() {
956
+ return s.post("/refresh_token");
957
+ }
958
+ e && (s.interceptors.request.use((o) => (o.withCredentials = !0, r.length > 0 && (o.headers.Cookie = r.join("; ")), o)), s.interceptors.response.use((o) => {
959
+ if (o.headers["set-cookie"]) {
960
+ const a = o.headers["set-cookie"].map((h) => h.split(";")[0]), c = /* @__PURE__ */ new Map();
961
+ r.forEach((h) => {
962
+ const d = h.split("=")[0];
963
+ c.set(d, h);
964
+ }), a.forEach((h) => {
965
+ const d = h.split("=")[0];
966
+ c.set(d, h);
967
+ }), r = Array.from(c.values());
946
968
  }
947
- return c;
969
+ return o;
948
970
  }));
949
- const o = {
950
- post: n.post,
971
+ const n = {
972
+ post: s.post,
951
973
  baseURL: t,
952
- axios: n,
974
+ axios: s,
953
975
  auth: pt,
954
- mutation: f,
976
+ mutation: p,
955
977
  query: y,
956
978
  config: Ct,
957
979
  mail: St,
958
- users: Ot,
959
- model(c) {
960
- return P(c);
980
+ users: Dt,
981
+ model(o) {
982
+ return E(o);
961
983
  },
962
984
  roles: Ut(),
963
- collect: (c, l) => {
964
- const h = J(c, l);
965
- return h.data_path = P(c).getDataPath(), h;
985
+ collect: (o, a) => {
986
+ const c = L(o, a);
987
+ return c.data_path = E(o).getDataPath(), c;
966
988
  },
967
- list: (c, l) => C(c, l).dataPath(P(c).getDataPath()),
968
- drive: wt,
969
- async collects(c) {
970
- const l = {}, h = {};
971
- for (const i in c) {
972
- const a = c[i].getQueryPayload();
973
- h[i] = a.data_path, l[i] = {};
974
- const u = a.data_path.split(".");
975
- let p = u[u.length - 1], d = l[i];
976
- for (const g of u) {
977
- if (g === p) {
978
- d[g] = a.query;
989
+ list: (o, a) => k(o, a).dataPath(E(o).getDataPath()),
990
+ drive: bt,
991
+ async collects(o) {
992
+ const a = {}, c = {};
993
+ for (const d in o) {
994
+ const g = o[d].getQueryPayload();
995
+ c[d] = g.data_path, a[d] = {};
996
+ const m = g.data_path.split(".");
997
+ let b = m[m.length - 1], w = a[d];
998
+ for (const C of m) {
999
+ if (C === b) {
1000
+ w[C] = g.query;
979
1001
  break;
980
1002
  }
981
- d[g] = d[g] || {};
1003
+ w[C] = w[C] || {};
982
1004
  }
983
- l[i].__aliasFor = u[0];
1005
+ a[d].__aliasFor = m[0];
984
1006
  }
985
- const s = await y(l);
986
- for (const i in c) {
987
- const a = h[i].split(".");
988
- let u = a[a.length - 1], p = s[i];
989
- for (const d of a) {
990
- if (d === u) {
991
- c[i]._batchData = s[i][d];
1007
+ const h = await y(a);
1008
+ for (const d in o) {
1009
+ const g = c[d].split(".");
1010
+ let m = g[g.length - 1], b = h[d];
1011
+ for (const w of g) {
1012
+ if (w === m) {
1013
+ o[d]._batchData = h[d][w];
992
1014
  break;
993
1015
  }
994
- p[d] = p[d] || {};
1016
+ b[w] = b[w] || {};
995
1017
  }
996
1018
  }
997
- return c;
1019
+ return o;
998
1020
  }
999
1021
  };
1000
- return X(o), o;
1001
- }, Ht = C;
1022
+ return Y(n), n;
1023
+ }, Xt = k;
1002
1024
  export {
1003
- A as arrayHasFile,
1025
+ D as arrayHasFile,
1004
1026
  pt as auth,
1005
- ot as changeExpiredPassword,
1006
- Gt as clearModels,
1007
- zt as createClient,
1008
- J as createCollection,
1009
- Jt as createFileFromBase64,
1010
- Lt as createFileFromBase85,
1011
- M as createFileFromString,
1012
- C as createList,
1013
- jt as createRole,
1014
- bt as createUser,
1015
- R as defaultUserFields,
1016
- L as defineModel,
1017
- Tt as defineModels,
1018
- Pt as deleteRole,
1019
- mt as deleteUser,
1020
- ct as forgetPassword,
1021
- q as getApiClient,
1022
- Nt as getApiClientOptional,
1027
+ it as changeExpiredPassword,
1028
+ Rt as clearModels,
1029
+ Ht as createClient,
1030
+ L as createCollection,
1031
+ Lt as createFileFromBase64,
1032
+ Qt as createFileFromBase85,
1033
+ N as createFileFromString,
1034
+ k as createList,
1035
+ Pt as createRole,
1036
+ mt as createUser,
1037
+ W as defaultUserFields,
1038
+ Q as defineModel,
1039
+ Gt as defineModels,
1040
+ Et as deleteRole,
1041
+ Ft as deleteUser,
1042
+ lt as forgetPassword,
1043
+ B as getApiClient,
1044
+ Jt as getApiClientOptional,
1023
1045
  Ct as getConfig,
1024
- rt as getCurrentUser,
1025
- wt as getDrive,
1026
- ht as getGrantedRights,
1027
- P as getModel,
1028
- $t as hasModel,
1029
- ut as isGranted,
1030
- Ht as list,
1031
- Wt as listDrives,
1032
- ft as listFiles,
1033
- _t as listFolders,
1034
- Qt as listModels,
1035
- Rt as listPermissions,
1046
+ st as getCurrentUser,
1047
+ bt as getDrive,
1048
+ ft as getGrantedRights,
1049
+ E as getModel,
1050
+ Tt as hasModel,
1051
+ ht as isGranted,
1052
+ Xt as list,
1053
+ zt as listDrives,
1054
+ dt as listFiles,
1055
+ yt as listFolders,
1056
+ $t as listModels,
1057
+ Wt as listPermissions,
1036
1058
  kt as listRoles,
1037
- Ft as listUsers,
1038
- st as login,
1039
- nt as logout,
1040
- f as mutation,
1041
- B as objectHasFile,
1059
+ At as listUsers,
1060
+ nt as login,
1061
+ ot as logout,
1062
+ p as mutation,
1063
+ M as objectHasFile,
1042
1064
  y as query,
1043
- dt as readFileAsBase64,
1044
- at as resetPassword,
1045
- Et as sendMail,
1046
- X as setApiClient,
1047
- vt as toQuery,
1048
- it as updatePassword,
1049
- At as updateUser,
1050
- lt as verifyCode,
1051
- et as webAuthn
1065
+ gt as readFileAsBase64,
1066
+ ct as resetPassword,
1067
+ vt as sendMail,
1068
+ Y as setApiClient,
1069
+ qt as toQuery,
1070
+ at as updatePassword,
1071
+ Ot as updateUser,
1072
+ ut as verifyCode,
1073
+ rt as webAuthn
1052
1074
  };