@hostlink/light 3.0.6 → 3.0.7

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 B, VariableType as b } from "json-to-graphql-query";
2
- import X from "axios";
3
- import S from "collect.js";
4
- function U(t) {
1
+ import { jsonToGraphQLQuery as v, VariableType as w } from "json-to-graphql-query";
2
+ import z from "axios";
3
+ import U from "collect.js";
4
+ function k(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 v(t, e, r = ".", n) {
11
- if (!U(e))
12
- return v(t, {}, r, n);
13
- const i = Object.assign({}, e);
14
- for (const h in t) {
15
- if (h === "__proto__" || h === "constructor")
10
+ function E(t, e, r = ".", n) {
11
+ if (!k(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")
16
16
  continue;
17
- const l = t[h];
18
- l != null && (n && n(i, h, l, r) || (Array.isArray(l) && Array.isArray(i[h]) ? i[h] = [...l, ...i[h]] : U(l) && U(i[h]) ? i[h] = v(
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]] : k(l) && k(o[c]) ? o[c] = E(
19
19
  l,
20
- i[h],
21
- (r ? `${r}.` : "") + h.toString(),
20
+ o[c],
21
+ (r ? `${r}.` : "") + c.toString(),
22
22
  n
23
- ) : i[h] = l));
23
+ ) : o[c] = l));
24
24
  }
25
- return i;
25
+ return o;
26
26
  }
27
- function Y(t) {
27
+ function H(t) {
28
28
  return (...e) => (
29
29
  // eslint-disable-next-line unicorn/no-array-reduce
30
- e.reduce((r, n) => v(r, n, "", t), {})
30
+ e.reduce((r, n) => E(r, n, "", t), {})
31
31
  );
32
32
  }
33
- const F = Y();
34
- let j = null;
35
- const Z = (t) => {
36
- j = t;
37
- }, M = () => {
38
- if (!j)
33
+ const m = H();
34
+ let O = null;
35
+ const X = (t) => {
36
+ O = t;
37
+ }, q = () => {
38
+ if (!O)
39
39
  throw new Error("Api client not initialized. Call setApiClient() first.");
40
- return j;
41
- }, Jt = () => j;
42
- function D(t) {
40
+ return O;
41
+ }, Jt = () => O;
42
+ function A(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 N(t) {
48
+ function B(t) {
49
49
  for (let e in t)
50
- if (t[e] instanceof File || t[e] instanceof Array && D(t[e]))
50
+ if (t[e] instanceof File || t[e] instanceof Array && A(t[e]))
51
51
  return !0;
52
52
  return !1;
53
53
  }
54
- function V(t) {
54
+ function Y(t) {
55
55
  t = "<~" + t + "~>";
56
- var e, r, n, i, h, l = String, u = 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 = [], i = 0, h = t.length; h > 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), n.push(u & r >> 24, u & r >> 16, u & r >> 8, u & r);
58
- return (function(s, o) {
59
- for (var c = o; c > 0; c--) s.pop();
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, a) {
59
+ for (var i = a; i > 0; i--) s.pop();
60
60
  })(n, e.length), l.fromCharCode.apply(l, n);
61
61
  }
62
- const J = (t = "") => {
62
+ const M = (t = "") => {
63
63
  const e = t, r = (n = "application/octet-stream") => {
64
- const i = new Uint8Array(e.length);
65
- for (let u = 0; u < e.length; u++)
66
- i[u] = e.charCodeAt(u);
67
- const h = new Blob([i], { type: n });
68
- return URL.createObjectURL(h);
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);
69
69
  };
70
70
  return {
71
71
  getContent: () => e,
72
72
  getURL: r,
73
73
  download: (n) => {
74
- const i = document.createElement("a");
75
- i.download = n, i.href = r(), document.body.appendChild(i), i.click(), document.body.removeChild(i);
74
+ const o = document.createElement("a");
75
+ o.download = n, o.href = r(), document.body.appendChild(o), o.click(), document.body.removeChild(o);
76
76
  },
77
77
  open: (n) => {
78
78
  window.open(r(n), "_blank");
79
79
  }
80
80
  };
81
- }, Lt = (t) => J(atob(t)), Qt = (t) => J(V(t));
82
- function L(t, e, r, n, i) {
81
+ }, Lt = (t) => M(atob(t)), $t = (t) => M(Y(t));
82
+ function N(t, e, r, n, o) {
83
83
  if (!(!t || typeof t != "object"))
84
- for (let h in t) {
85
- const l = t[h];
84
+ for (let c in t) {
85
+ const l = t[c];
86
86
  if (l && typeof l == "object") {
87
87
  if ("__args" in l) {
88
- const u = l.__args, s = {};
89
- Object.entries(u).forEach(([o, c]) => {
90
- if (c instanceof Array && D(c)) {
91
- s[o] = new b(o);
92
- let a = 0;
93
- c.forEach((p) => {
94
- p instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + o + "." + a), n.append(i.current.toString(), p), i.current++, a++);
95
- }), e[o] = "[Upload!]!";
96
- } else c instanceof File ? (s[o] = new b(o), r[i.current] = ["variables." + o], n.append(i.current.toString(), c), e[o] = "Upload!", i.current++) : c instanceof Object && N(c) ? (s[o] = {}, Object.entries(c).forEach(([a, p]) => {
97
- if (p instanceof Array && D(p)) {
98
- s[o][a] = new b(a);
99
- let d = 0;
100
- p.forEach((_) => {
101
- _ instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + a + "." + d), n.append(i.current.toString(), _), i.current++, d++);
102
- }), e[a] = "[Upload!]!";
103
- } else p instanceof File ? (s[o][a] = new b(a), r[i.current] = ["variables." + a], n.append(i.current.toString(), p), e[a] = "Upload!", i.current++) : s[o][a] = p;
104
- })) : c != null && (s[o] = c);
88
+ const h = l.__args, s = {};
89
+ Object.entries(h).forEach(([a, i]) => {
90
+ if (i instanceof Array && A(i)) {
91
+ s[a] = new w(a);
92
+ let u = 0;
93
+ i.forEach((f) => {
94
+ f instanceof File && (r[o.current] || (r[o.current] = []), r[o.current].push("variables." + a + "." + u), n.append(o.current.toString(), f), o.current++, u++);
95
+ }), e[a] = "[Upload!]!";
96
+ } else i instanceof File ? (s[a] = new w(a), r[o.current] = ["variables." + a], n.append(o.current.toString(), i), e[a] = "Upload!", o.current++) : i instanceof Object && B(i) ? (s[a] = {}, Object.entries(i).forEach(([u, f]) => {
97
+ if (f instanceof Array && A(f)) {
98
+ s[a][u] = new w(u);
99
+ let _ = 0;
100
+ f.forEach((d) => {
101
+ d instanceof File && (r[o.current] || (r[o.current] = []), r[o.current].push("variables." + u + "." + _), n.append(o.current.toString(), d), o.current++, _++);
102
+ }), e[u] = "[Upload!]!";
103
+ } else f instanceof File ? (s[a][u] = new w(u), r[o.current] = ["variables." + u], n.append(o.current.toString(), f), e[u] = "Upload!", o.current++) : s[a][u] = f;
104
+ })) : i != null && (s[a] = i);
105
105
  }), l.__args = s;
106
106
  }
107
- L(l, e, r, n, i);
107
+ N(l, e, r, n, o);
108
108
  }
109
109
  }
110
110
  }
111
111
  const y = async (t) => {
112
- const e = M(), r = t, n = new FormData();
113
- let i = !1;
114
- const h = {}, l = {};
115
- L(r, h, l, n, { current: 0 }), i = Object.keys(h).length > 0, i && (r.__variables = h);
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
116
  let s = null;
117
- const c = B({ query: r });
118
- if (i ? (n.append("map", JSON.stringify(l)), n.append("operations", JSON.stringify({
119
- query: c
120
- })), s = await e.axios.post("", n)) : s = await e.axios.post("", {
121
- query: c
117
+ const i = v({ query: r });
118
+ if (o ? (n.append("map", JSON.stringify(l)), n.append("operations", JSON.stringify({
119
+ query: i
120
+ })), s = await e.post("", n)) : s = await e.post("", {
121
+ query: i
122
122
  }), s.data.errors)
123
123
  throw new Error(s.data.errors[0].message);
124
124
  return s.data.data;
125
125
  };
126
- function k(t, e) {
127
- let r, n = [], i, h;
128
- const l = (s) => !s || typeof s != "object" ? !1 : Object.values(s).some((o) => o && typeof o == "object" && Object.keys(o).some((c) => c.startsWith("_"))), u = () => n.length === 0 ? (n.unshift({}), n[0]) : (l(n[0]) && n.unshift({}), n[0]);
126
+ function C(t, e) {
127
+ let r, n = [], o, c;
128
+ const l = (s) => !s || typeof s != "object" ? !1 : Object.values(s).some((a) => a && typeof a == "object" && Object.keys(a).some((i) => i.startsWith("_"))), h = () => n.length === 0 ? (n.unshift({}), n[0]) : (l(n[0]) && n.unshift({}), n[0]);
129
129
  return {
130
130
  first() {
131
131
  return this.fetchFirst();
@@ -134,34 +134,34 @@ function k(t, e) {
134
134
  return this.fetch();
135
135
  },
136
136
  async fetchFirst() {
137
- const o = await this.limit(1).fetch();
138
- return Array.isArray(o) && o.length > 0 ? o[0] : null;
137
+ const a = await this.limit(1).fetch();
138
+ return Array.isArray(a) && a.length > 0 ? a[0] : null;
139
139
  },
140
140
  async fetchWithMeta() {
141
- let o = await y(this.toQuery(!0));
142
- if (h) {
143
- const c = h.split(".");
144
- for (const a of c)
145
- o = o[a];
146
- return o;
141
+ let a = await y(this.toQuery(!0));
142
+ if (c) {
143
+ const i = c.split(".");
144
+ for (const u of i)
145
+ a = a[u];
146
+ return a;
147
147
  }
148
- return o[`list${t}`];
148
+ return a[`list${t}`];
149
149
  },
150
150
  async fetch() {
151
- let o = await y(this.toQuery());
152
- if (h) {
153
- const c = h.split(".");
154
- for (const a of c)
155
- o = o[a];
156
- return o.data;
151
+ let a = await y(this.toQuery());
152
+ if (c) {
153
+ const i = c.split(".");
154
+ for (const u of i)
155
+ a = a[u];
156
+ return a.data;
157
157
  }
158
- return o[`list${t}`].data;
158
+ return a[`list${t}`].data;
159
159
  },
160
160
  dataPath(s) {
161
- return s && typeof s == "string" && (h = s), this;
161
+ return s && typeof s == "string" && (c = s), this;
162
162
  },
163
163
  sort(s) {
164
- return s && typeof s == "string" && (i = s), this;
164
+ return s && typeof s == "string" && (o = s), this;
165
165
  },
166
166
  filters(s) {
167
167
  return s && typeof s == "object" && (n = [s]), this;
@@ -169,9 +169,9 @@ function k(t, e) {
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, o, c) {
173
- const a = (p, d, _) => {
174
- const O = {
172
+ where(s, a, i) {
173
+ const u = (f, _, d) => {
174
+ const F = {
175
175
  ">": "_gt",
176
176
  "<": "_lt",
177
177
  ">=": "_gte",
@@ -179,182 +179,182 @@ function k(t, e) {
179
179
  "!=": "_ne",
180
180
  in: "_in",
181
181
  contains: "_contains"
182
- }[d];
183
- O && n.push({ [p]: { [O]: _ } });
182
+ }[_];
183
+ F && n.push({ [f]: { [F]: d } });
184
184
  };
185
- if (c !== void 0)
186
- a(s, String(o), c);
185
+ if (i !== void 0)
186
+ u(s, String(a), i);
187
187
  else {
188
- const p = u(), d = F(p, { [s]: o });
189
- n[0] = d;
188
+ const f = h(), _ = m(f, { [s]: a });
189
+ n[0] = _;
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, o) {
195
+ whereContains(s, a) {
196
196
  if (s && typeof s == "string") {
197
- const c = u(), a = { _contains: o };
198
- c[s] ? Array.isArray(c[s]) ? c[s].push(a) : c[s] = [c[s], a] : c[s] = [a], n[0] = c;
197
+ const i = h(), u = { _contains: a };
198
+ i[s] ? Array.isArray(i[s]) ? i[s].push(u) : i[s] = [i[s], u] : i[s] = [u], n[0] = i;
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, o) {
206
- if (s && typeof s == "string" && Array.isArray(o)) {
207
- const c = u(), a = { _in: o };
208
- c[s] ? Array.isArray(c[s]) ? c[s].push(a) : c[s] = [c[s], a] : c[s] = [a], n[0] = c;
205
+ whereIn(s, a) {
206
+ if (s && typeof s == "string" && Array.isArray(a)) {
207
+ const i = h(), u = { _in: a };
208
+ i[s] ? Array.isArray(i[s]) ? i[s].push(u) : i[s] = [i[s], u] : i[s] = [u], n[0] = i;
209
209
  }
210
210
  return this;
211
211
  },
212
212
  // whereBetween adds a _between filter for a specific field
213
- whereBetween(s, o, c) {
213
+ whereBetween(s, a, i) {
214
214
  if (s && typeof s == "string") {
215
- const a = u(), p = { _between: [o, c] };
216
- a[s] ? Array.isArray(a[s]) ? a[s].push(p) : a[s] = [a[s], p] : a[s] = p, n[0] = a;
215
+ const u = h(), f = { _between: [a, i] };
216
+ u[s] ? Array.isArray(u[s]) ? u[s].push(f) : u[s] = [u[s], f] : u[s] = f, n[0] = u;
217
217
  }
218
218
  return this;
219
219
  },
220
220
  // limit sets paging/limit for the data selection
221
221
  limit(s) {
222
- return typeof s == "number" && Number.isFinite(s) && (r = F(r || {}, { limit: s })), this;
222
+ return typeof s == "number" && Number.isFinite(s) && (r = m(r || {}, { limit: s })), this;
223
223
  },
224
224
  // offset sets the starting index for the data selection
225
225
  offset(s) {
226
- return typeof s == "number" && Number.isFinite(s) && (r = F(r || {}, { offset: s })), this;
226
+ return typeof s == "number" && Number.isFinite(s) && (r = m(r || {}, { offset: s })), this;
227
227
  },
228
228
  toQuery(s = !1) {
229
- let o;
230
- const c = n.length > 0 && Object.keys(n[0] || {}).length > 0, a = c ? 1 : 0, p = n.length > a;
231
- c && p ? o = n : p ? o = n.slice(a) : c && (o = n[0]);
232
- const d = F(
233
- i ? { sort: i } : {},
234
- o ? { filters: o } : {}
235
- ), _ = {
229
+ let a;
230
+ const i = n.length > 0 && Object.keys(n[0] || {}).length > 0, u = i ? 1 : 0, f = n.length > u;
231
+ i && f ? a = n : f ? a = n.slice(u) : i && (a = n[0]);
232
+ const _ = m(
233
+ o ? { sort: o } : {},
234
+ a ? { filters: a } : {}
235
+ ), d = {
236
236
  data: {
237
237
  ...e
238
238
  }
239
239
  };
240
- if (r && (_.data.__args = r), Object.keys(d).length > 0 && (_.__args = d), s && (_.meta = {
240
+ if (r && (d.data.__args = r), Object.keys(_).length > 0 && (d.__args = _), s && (d.meta = {
241
241
  total: !0,
242
242
  key: !0,
243
243
  name: !0
244
- }), h) {
245
- const w = h.split(".");
246
- let O = _;
247
- for (let P = w.length - 1; P >= 0; P--)
248
- O = {
249
- [w[P]]: O
244
+ }), c) {
245
+ const D = c.split(".");
246
+ let F = d;
247
+ for (let j = D.length - 1; j >= 0; j--)
248
+ F = {
249
+ [D[j]]: F
250
250
  };
251
- return O;
251
+ return F;
252
252
  }
253
253
  return {
254
- [`list${t}`]: _
254
+ [`list${t}`]: d
255
255
  };
256
256
  }
257
257
  };
258
258
  }
259
- const I = (t, e = {}) => {
260
- const r = t, n = e;
261
- let i = "list" + t;
262
- const h = (l) => n[l] ? n[l] : null;
259
+ const Z = (t, e = {}) => {
260
+ const r = e;
261
+ let n = "list" + t;
262
+ const o = (c) => r[c] ? r[c] : null;
263
263
  return {
264
- field: h,
265
- $fields: n,
266
- setDataPath(l) {
267
- return i = l, i;
264
+ field: o,
265
+ $fields: r,
266
+ setDataPath(c) {
267
+ return n = c, n;
268
268
  },
269
269
  getDataPath() {
270
- return i;
270
+ return n;
271
271
  },
272
- gqlFields(l) {
273
- let u = {};
274
- for (const s of l)
275
- if (typeof s == "string") {
276
- const o = h(s);
277
- o && (u = F(u, o.gqlField ? typeof o.gqlField == "string" ? { [o.gqlField]: !0 } : o.gqlField : { [o.name || s]: !0 }));
278
- } else typeof s == "object" && (u = F(u, s));
279
- return u;
272
+ gqlFields(c) {
273
+ let l = {};
274
+ for (const h of c)
275
+ if (typeof h == "string") {
276
+ const s = o(h);
277
+ s && (l = m(l, s.gqlField ? typeof s.gqlField == "string" ? { [s.gqlField]: !0 } : s.gqlField : { [s.name || h]: !0 }));
278
+ } else typeof h == "object" && (l = m(l, h));
279
+ return l;
280
280
  },
281
- update(l, u) {
282
- return f({
283
- ["update" + r]: {
284
- __args: { id: l, data: u }
281
+ update(c, l) {
282
+ return p({
283
+ ["update" + t]: {
284
+ __args: { id: c, data: l }
285
285
  }
286
- }).then((s) => s["update" + r]);
286
+ }).then((h) => h["update" + t]);
287
287
  },
288
- async delete(l) {
289
- return f({
290
- ["delete" + r]: {
291
- __args: { id: l }
288
+ async delete(c) {
289
+ return p({
290
+ ["delete" + t]: {
291
+ __args: { id: c }
292
292
  }
293
- }).then((u) => u["delete" + r]);
293
+ }).then((l) => l["delete" + t]);
294
294
  },
295
- add(l) {
296
- return f({
297
- ["add" + r]: {
298
- __args: { data: l }
295
+ add(c) {
296
+ return p({
297
+ ["add" + t]: {
298
+ __args: { data: c }
299
299
  }
300
- }).then((u) => u["add" + r]);
300
+ }).then((l) => l["add" + t]);
301
301
  },
302
- fields(l) {
303
- let u = [];
304
- for (let s of l) {
305
- const o = h(s);
306
- o && u.push(o);
302
+ fields(c) {
303
+ let l = [];
304
+ for (let h of c) {
305
+ const s = o(h);
306
+ s && l.push(s);
307
307
  }
308
- return u;
308
+ return l;
309
309
  },
310
- async get(l, u) {
311
- const s = (await Promise.resolve().then(() => qt)).default, o = s(r, Ut(u));
312
- for (const [c, a] of Object.entries(l))
313
- o.where(c, "==", a);
314
- return await o.first();
310
+ async get(c, l) {
311
+ const h = (await Promise.resolve().then(() => qt)).default, s = h(t, Ut(l));
312
+ for (const [a, i] of Object.entries(c))
313
+ s.where(a, "==", i);
314
+ return await s.first();
315
315
  },
316
- list(l) {
317
- let u = l;
318
- const s = {};
319
- Object.entries(l).forEach(([a]) => {
320
- n[a] && (s[a] = n[a], n[a].gqlField && (delete u[a], u = F(u, n[a].gqlField)), n[a].gql && (u = F(u, n[a].gql), delete u[a]));
316
+ list(c) {
317
+ let l = c;
318
+ const h = {};
319
+ Object.entries(c).forEach(([i]) => {
320
+ r[i] && (h[i] = r[i], r[i].gqlField && (delete l[i], l = m(l, r[i].gqlField)), r[i].gql && (l = m(l, r[i].gql), delete l[i]));
321
321
  });
322
- const o = k(r, u).dataPath(i), c = o.fetch.bind(o);
322
+ const s = C(t, l).dataPath(n), a = s.fetch.bind(s);
323
323
  return {
324
- ...o,
324
+ ...s,
325
325
  async fetch() {
326
- return (await c()).map((p) => {
327
- const d = { ...p };
328
- return Object.entries(s).forEach(([_, w]) => {
329
- w.format && typeof w.format == "function" && (d[_] = w.format(p));
330
- }), d;
326
+ return (await a()).map((u) => {
327
+ const f = { ...u };
328
+ return Object.entries(h).forEach(([_, d]) => {
329
+ d.format && typeof d.format == "function" && (f[_] = d.format(u));
330
+ }), f;
331
331
  });
332
332
  },
333
333
  async fetchFirst() {
334
- const p = await o.fetchFirst.bind(o)();
335
- if (!p) return p;
336
- const d = { ...p };
337
- return Object.entries(s).forEach(([_, w]) => {
338
- w.format && typeof w.format == "function" && (d[_] = w.format(p));
339
- }), d;
334
+ const u = await s.fetchFirst.bind(s)();
335
+ if (!u) return u;
336
+ const f = { ...u };
337
+ return Object.entries(h).forEach(([_, d]) => {
338
+ d.format && typeof d.format == "function" && (f[_] = d.format(u));
339
+ }), f;
340
340
  }
341
341
  };
342
342
  }
343
343
  };
344
- }, A = {}, Q = (t, e) => {
345
- const r = I(t, e);
346
- return A[t] = r, r;
347
- }, E = (t) => A[t] ? A[t] : Q(t, {}), Tt = (t) => !!A[t], $t = () => Object.keys(A), Gt = () => {
348
- Object.keys(A).forEach((t) => delete A[t]);
344
+ }, b = {}, J = (t, e) => {
345
+ const r = Z(t, e);
346
+ return b[t] = r, r;
347
+ }, P = (t) => b[t] ? b[t] : J(t, {}), Qt = (t) => !!b[t], Tt = () => Object.keys(b), Gt = () => {
348
+ Object.keys(b).forEach((t) => delete b[t]);
349
349
  }, Rt = (t) => {
350
350
  Object.entries(t).forEach(([e, r]) => {
351
- Q(e, r);
351
+ J(e, r);
352
352
  });
353
353
  }, Wt = () => y({
354
354
  app: {
355
355
  permissions: !0
356
356
  }
357
- }).then((t) => t.app.permissions), T = async () => {
357
+ }).then((t) => t.app.permissions), L = async () => {
358
358
  const { app: t } = await y({
359
359
  app: {
360
360
  auth: {
@@ -372,31 +372,31 @@ const I = (t, e = {}) => {
372
372
  }
373
373
  }), e = PublicKeyCredential.parseCreationOptionsFromJSON(t.auth.webAuthnCreationOptions);
374
374
  return await navigator.credentials.create({ publicKey: e });
375
- }, K = async () => {
376
- const t = await T();
377
- return await f({
375
+ }, V = async () => {
376
+ const t = await L();
377
+ return await p({
378
378
  webAuthnAssertion: {
379
379
  __args: {
380
380
  assertion: t.toJSON()
381
381
  }
382
382
  }
383
383
  }).then((e) => e.webAuthnAssertion);
384
- }, x = async () => {
384
+ }, I = async () => {
385
385
  const t = await $();
386
- return await f({
386
+ return await p({
387
387
  webAuthnRegister: {
388
388
  __args: {
389
389
  registration: t.toJSON()
390
390
  }
391
391
  }
392
392
  }).then((e) => e.webAuthnRegister);
393
- }, tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
393
+ }, K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
394
394
  __proto__: null,
395
- assertion: T,
395
+ assertion: L,
396
396
  attestation: $,
397
- login: K,
398
- register: x
399
- }, Symbol.toStringTag, { value: "Module" })), et = (t = W) => y({ my: t }).then((e) => e.my), rt = (t, e, r = "") => f({ login: { __args: { username: t, password: e, code: r } } }).then((n) => n.login), st = () => f({ logout: !0 }).then((t) => t.logout), nt = (t, e, r) => f({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((n) => n.changeExpiredPassword), ot = (t, e) => f({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), it = (t, e, r) => f({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((n) => n.resetPassword), at = (t, e) => f({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), ct = (t, e) => f({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), lt = (t) => y({
397
+ login: V,
398
+ register: I
399
+ }, Symbol.toStringTag, { value: "Module" })), x = (t = G) => y({ my: t }).then((e) => e.my), tt = (t, e, r = "") => p({ login: { __args: { username: t, password: e, code: r } } }).then((n) => n.login), et = () => p({ logout: !0 }).then((t) => t.logout), rt = (t, e, r) => p({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((n) => n.changeExpiredPassword), st = (t, e) => p({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), nt = (t, e, r) => p({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((n) => n.resetPassword), ot = (t, e) => p({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), it = (t, e) => p({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), at = (t) => y({
400
400
  my: {
401
401
  granted: {
402
402
  __args: {
@@ -404,7 +404,7 @@ const I = (t, e = {}) => {
404
404
  }
405
405
  }
406
406
  }
407
- }).then((e) => e.my.granted), ut = (t) => y({
407
+ }).then((e) => e.my.granted), ct = (t) => y({
408
408
  my: {
409
409
  grantedRights: {
410
410
  __args: {
@@ -412,40 +412,40 @@ const I = (t, e = {}) => {
412
412
  }
413
413
  }
414
414
  }
415
- }).then((e) => e.my.grantedRights), ht = () => ({
416
- getCurrentUser: et,
417
- webAuthn: tt,
415
+ }).then((e) => e.my.grantedRights), lt = {
416
+ getCurrentUser: x,
417
+ webAuthn: K,
418
418
  google: {
419
- unlink: () => f({ lightAuthUnlinkGoogle: !0 }).then((t) => t.lightAuthUnlinkGoogle),
420
- login: (t) => f({ lightAuthLoginGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthLoginGoogle),
421
- register: (t) => f({ lightAuthRegisterGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthRegisterGoogle)
419
+ unlink: () => p({ lightAuthUnlinkGoogle: !0 }).then((t) => t.lightAuthUnlinkGoogle),
420
+ login: (t) => p({ lightAuthLoginGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthLoginGoogle),
421
+ register: (t) => p({ lightAuthRegisterGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthRegisterGoogle)
422
422
  },
423
423
  facebook: {
424
- unlink: () => f({ lightAuthUnlinkFacebook: !0 }).then((t) => t.lightAuthUnlinkFacebook),
425
- login: (t) => f({ lightAuthLoginFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginFacebook),
426
- register: (t) => f({ lightAuthRegisterFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthRegisterFacebook)
424
+ unlink: () => p({ lightAuthUnlinkFacebook: !0 }).then((t) => t.lightAuthUnlinkFacebook),
425
+ login: (t) => p({ lightAuthLoginFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginFacebook),
426
+ register: (t) => p({ lightAuthRegisterFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthRegisterFacebook)
427
427
  },
428
428
  microsoft: {
429
- unlink: () => f({ lightAuthUnlinkMicrosoft: !0 }).then((t) => t.lightAuthUnlinkMicrosoft),
430
- login: (t) => f({ lightAuthLoginMicrosoft: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginMicrosoft),
431
- register: (t) => f({ lightAuthRegisterMicrosoft: { __args: { account_id: t } } }).then((e) => e.lightAuthRegisterMicrosoft)
429
+ unlink: () => p({ lightAuthUnlinkMicrosoft: !0 }).then((t) => t.lightAuthUnlinkMicrosoft),
430
+ login: (t) => p({ lightAuthLoginMicrosoft: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginMicrosoft),
431
+ register: (t) => p({ lightAuthRegisterMicrosoft: { __args: { account_id: t } } }).then((e) => e.lightAuthRegisterMicrosoft)
432
432
  },
433
- login: rt,
434
- logout: st,
435
- changeExpiredPassword: nt,
436
- updatePassword: ot,
437
- resetPassword: it,
438
- forgetPassword: at,
439
- verifyCode: ct,
440
- grantedRights: ut,
441
- isGranted: lt
442
- }), G = {
433
+ login: tt,
434
+ logout: et,
435
+ changeExpiredPassword: rt,
436
+ updatePassword: st,
437
+ resetPassword: nt,
438
+ forgetPassword: ot,
439
+ verifyCode: it,
440
+ grantedRights: ct,
441
+ isGranted: at
442
+ }, Q = {
443
443
  name: !0,
444
444
  path: !0,
445
445
  size: !0,
446
446
  mime: !0,
447
447
  url: !0
448
- }, pt = (t, e, r = G) => y({
448
+ }, ut = (t, e, r = Q) => y({
449
449
  app: {
450
450
  drive: {
451
451
  __args: { index: t },
@@ -455,7 +455,7 @@ const I = (t, e = {}) => {
455
455
  }
456
456
  }
457
457
  }
458
- }).then((n) => n.app.drive.files), ft = (t, e) => y({
458
+ }).then((n) => n.app.drive.files), ht = (t, e) => y({
459
459
  app: {
460
460
  drive: {
461
461
  __args: {
@@ -469,8 +469,8 @@ const I = (t, e = {}) => {
469
469
  }
470
470
  }
471
471
  }
472
- }).then((r) => r.app.drive?.file?.base64Content), m = (t) => ({
473
- list: (e, r = G) => pt(t, e, r),
472
+ }).then((r) => r.app.drive?.file?.base64Content), ft = (t) => ({
473
+ list: (e, r = Q) => ut(t, e, r),
474
474
  get: (e, r = {
475
475
  name: !0,
476
476
  path: !0,
@@ -493,7 +493,7 @@ const I = (t, e = {}) => {
493
493
  }
494
494
  }).then((n) => n.app.drive.file),
495
495
  readFileAsBase64(e) {
496
- return ft(t, e);
496
+ return ht(t, e);
497
497
  },
498
498
  read: async (e) => {
499
499
  let r = await y({
@@ -515,14 +515,14 @@ const I = (t, e = {}) => {
515
515
  throw new Error(`File not found or cannot read content: ${e}`);
516
516
  return typeof window < "u" && window.atob ? window.atob(r.app.drive.file.base64Content) : r.app.drive.file.base64Content;
517
517
  },
518
- write: (e, r) => f({ lightDriveWriteFile: { __args: { index: t, path: e, content: r } } }).then((n) => n.lightDriveWriteFile),
519
- delete: (e) => f({ lightDriveDeleteFile: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFile),
520
- rename: (e, r) => f({ lightDriveRenameFile: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFile),
521
- move: (e, r) => f({ lightDriveMoveFile: { __args: { index: t, source: e, destination: r } } }).then((n) => n.lightDriveMoveFile)
522
- }), R = {
518
+ write: (e, r) => p({ lightDriveWriteFile: { __args: { index: t, path: e, content: r } } }).then((n) => n.lightDriveWriteFile),
519
+ delete: (e) => p({ lightDriveDeleteFile: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFile),
520
+ rename: (e, r) => p({ lightDriveRenameFile: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFile),
521
+ move: (e, r) => p({ lightDriveMoveFile: { __args: { index: t, source: e, destination: r } } }).then((n) => n.lightDriveMoveFile)
522
+ }), T = {
523
523
  name: !0,
524
524
  path: !0
525
- }, dt = (t, e, r = R) => y({
525
+ }, pt = (t, e, r = T) => y({
526
526
  app: {
527
527
  drive: {
528
528
  __args: { index: t },
@@ -532,11 +532,11 @@ const I = (t, e = {}) => {
532
532
  }
533
533
  }
534
534
  }
535
- }).then((n) => n.app.drive.folders), C = (t) => ({
536
- list: (e, r = R) => dt(t, e, r),
537
- create: (e) => f({ lightDriveCreateFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveCreateFolder),
538
- delete: (e) => f({ lightDriveDeleteFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFolder),
539
- rename: (e, r) => f({ lightDriveRenameFolder: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFolder)
535
+ }).then((n) => n.app.drive.folders), dt = (t) => ({
536
+ list: (e, r = T) => pt(t, e, r),
537
+ create: (e) => p({ lightDriveCreateFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveCreateFolder),
538
+ delete: (e) => p({ lightDriveDeleteFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFolder),
539
+ rename: (e, r) => p({ lightDriveRenameFolder: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFolder)
540
540
  }), zt = () => y({
541
541
  app: {
542
542
  drives: {
@@ -544,53 +544,56 @@ const I = (t, e = {}) => {
544
544
  name: !0
545
545
  }
546
546
  }
547
- }).then((t) => t.app.drives), gt = (t) => ({
548
- listFiles: m(t).list,
549
- getFile: m(t).get,
550
- readFile: m(t).read,
551
- writeFile: m(t).write,
552
- deleteFile: m(t).delete,
553
- renameFile: m(t).rename,
554
- moveFile: m(t).move,
555
- listFolders: C(t).list,
556
- createFolder: C(t).create,
557
- deleteFolder: C(t).delete,
558
- renameFolder: C(t).rename,
559
- uploadTempFile: (e) => f({
560
- lightDriveUploadTempFile: {
561
- __args: { index: t, file: e },
562
- name: !0,
563
- path: !0,
564
- size: !0,
565
- mime: !0
566
- }
567
- }).then((r) => r.lightDriveUploadTempFile),
568
- folders: C(t),
569
- files: m(t)
570
- }), W = {
547
+ }).then((t) => t.app.drives), gt = (t) => {
548
+ const e = ft(t), r = dt(t);
549
+ return {
550
+ folders: r,
551
+ files: e,
552
+ listFiles: e.list,
553
+ getFile: e.get,
554
+ readFile: e.read,
555
+ writeFile: e.write,
556
+ deleteFile: e.delete,
557
+ renameFile: e.rename,
558
+ moveFile: e.move,
559
+ listFolders: r.list,
560
+ createFolder: r.create,
561
+ deleteFolder: r.delete,
562
+ renameFolder: r.rename,
563
+ uploadTempFile: (n) => p({
564
+ lightDriveUploadTempFile: {
565
+ __args: { index: t, file: n },
566
+ name: !0,
567
+ path: !0,
568
+ size: !0,
569
+ mime: !0
570
+ }
571
+ }).then((o) => o.lightDriveUploadTempFile)
572
+ };
573
+ }, G = {
571
574
  user_id: !0,
572
575
  username: !0,
573
576
  first_name: !0,
574
577
  last_name: !0,
575
578
  status: !0
576
- }, _t = (t) => f({
579
+ }, _t = (t) => p({
577
580
  addUser: {
578
581
  __args: t
579
582
  }
580
- }).then((e) => e.addUser), yt = (t) => f({
583
+ }).then((e) => e.addUser), yt = (t) => p({
581
584
  deleteUser: {
582
585
  __args: { id: t }
583
586
  }
584
- }).then((e) => e.deleteUser), wt = (t = W) => k("Users", t).dataPath("app.listUser").fetch(), mt = (t, e) => f({
587
+ }).then((e) => e.deleteUser), wt = (t = G) => C("Users", t).dataPath("app.listUser").fetch(), mt = (t, e) => p({
585
588
  updateUser: {
586
589
  __args: { id: t, data: e }
587
590
  }
588
- }).then((r) => r.updateUser), bt = () => ({
591
+ }).then((r) => r.updateUser), bt = {
589
592
  list: wt,
590
593
  create: _t,
591
594
  delete: yt,
592
595
  update: mt
593
- }), Ft = (t) => y({
596
+ }, Ft = (t) => y({
594
597
  app: {
595
598
  listConfig: {
596
599
  __args: {
@@ -610,7 +613,7 @@ const I = (t, e = {}) => {
610
613
  app: {
611
614
  roles: t
612
615
  }
613
- }).then((e) => e.app.roles), Ct = (t, e) => f({
616
+ }).then((e) => e.app.roles), Ct = (t, e) => p({
614
617
  addRole: {
615
618
  __args: {
616
619
  data: {
@@ -619,7 +622,7 @@ const I = (t, e = {}) => {
619
622
  }
620
623
  }
621
624
  }
622
- }).then((r) => r.addRole), Dt = (t) => f({
625
+ }).then((r) => r.addRole), Dt = (t) => p({
623
626
  deleteRole: {
624
627
  __args: { name: t }
625
628
  }
@@ -628,56 +631,56 @@ const I = (t, e = {}) => {
628
631
  create: Ct,
629
632
  delete: Dt
630
633
  });
631
- function z(t, e, r, n, i) {
634
+ function R(t, e, r, n, o) {
632
635
  if (!(!t || typeof t != "object"))
633
- for (let h in t) {
634
- const l = t[h];
636
+ for (let c in t) {
637
+ const l = t[c];
635
638
  if (l && typeof l == "object") {
636
639
  if ("__args" in l) {
637
- const u = l.__args, s = {};
638
- Object.entries(u).forEach(([o, c]) => {
639
- if (c instanceof Array && D(c)) {
640
- s[o] = new b(o);
641
- let a = 0;
642
- c.forEach((p) => {
643
- p instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + o + "." + a), n.append(i.current.toString(), p), i.current++, a++);
644
- }), e[o] = "[Upload!]!";
645
- } else c instanceof File ? (s[o] = new b(o), r[i.current] = ["variables." + o], n.append(i.current.toString(), c), e[o] = "Upload!", i.current++) : c instanceof Object && N(c) ? (s[o] = {}, Object.entries(c).forEach(([a, p]) => {
646
- if (p instanceof Array && D(p)) {
647
- s[o][a] = new b(a);
648
- let d = 0;
649
- p.forEach((_) => {
650
- _ instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + a + "." + d), n.append(i.current.toString(), _), i.current++, d++);
651
- }), e[a] = "[Upload!]!";
652
- } else p instanceof File ? (s[o][a] = new b(a), r[i.current] = ["variables." + a], n.append(i.current.toString(), p), e[a] = "Upload!", i.current++) : s[o][a] = p;
653
- })) : c != null && (s[o] = c);
640
+ const h = l.__args, s = {};
641
+ Object.entries(h).forEach(([a, i]) => {
642
+ if (i instanceof Array && A(i)) {
643
+ s[a] = new w(a);
644
+ let u = 0;
645
+ i.forEach((f) => {
646
+ f instanceof File && (r[o.current] || (r[o.current] = []), r[o.current].push("variables." + a + "." + u), n.append(o.current.toString(), f), o.current++, u++);
647
+ }), e[a] = "[Upload!]!";
648
+ } else i instanceof File ? (s[a] = new w(a), r[o.current] = ["variables." + a], n.append(o.current.toString(), i), e[a] = "Upload!", o.current++) : i instanceof Object && B(i) ? (s[a] = {}, Object.entries(i).forEach(([u, f]) => {
649
+ if (f instanceof Array && A(f)) {
650
+ s[a][u] = new w(u);
651
+ let _ = 0;
652
+ f.forEach((d) => {
653
+ d instanceof File && (r[o.current] || (r[o.current] = []), r[o.current].push("variables." + u + "." + _), n.append(o.current.toString(), d), o.current++, _++);
654
+ }), e[u] = "[Upload!]!";
655
+ } else f instanceof File ? (s[a][u] = new w(u), r[o.current] = ["variables." + u], n.append(o.current.toString(), f), e[u] = "Upload!", o.current++) : s[a][u] = f;
656
+ })) : i != null && (s[a] = i);
654
657
  }), l.__args = s;
655
658
  }
656
- z(l, e, r, n, i);
659
+ R(l, e, r, n, o);
657
660
  }
658
661
  }
659
662
  }
660
- const f = async (t) => {
661
- const r = M().axios, n = t, i = new FormData();
662
- let h = !1;
663
- const l = {}, u = {};
664
- z(n, l, u, i, { current: 0 }), h = Object.keys(l).length > 0, h && (n.__variables = l);
665
- let o = null;
666
- const a = B({ mutation: n });
667
- if (h ? (i.append("map", JSON.stringify(u)), i.append("operations", JSON.stringify({
668
- query: a
669
- })), o = await r.post("", i)) : o = await r.post("", {
670
- query: a
671
- }), o.data.errors)
672
- throw new Error(o.data.errors[0].message);
673
- return o.data.data;
674
- }, kt = (t, e, r) => f({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((n) => n.sendMail), Pt = {
663
+ const p = async (t) => {
664
+ const { axios: e } = q(), r = t, n = new FormData();
665
+ let o = !1;
666
+ const c = {}, l = {};
667
+ R(r, c, l, n, { current: 0 }), o = Object.keys(c).length > 0, o && (r.__variables = c);
668
+ let s = null;
669
+ const i = v({ mutation: r });
670
+ if (o ? (n.append("map", JSON.stringify(l)), n.append("operations", JSON.stringify({
671
+ query: i
672
+ })), s = await e.post("", n)) : s = await e.post("", {
673
+ query: i
674
+ }), s.data.errors)
675
+ throw new Error(s.data.errors[0].message);
676
+ return s.data.data;
677
+ }, kt = (t, e, r) => p({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((n) => n.sendMail), Pt = {
675
678
  send: kt
676
- }, q = (t) => {
679
+ }, S = (t) => {
677
680
  let e = {};
678
681
  return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
679
- Object.entries(q(r)).forEach(([n, i]) => {
680
- e[n] = i;
682
+ Object.entries(S(r)).forEach(([n, o]) => {
683
+ e[n] = o;
681
684
  });
682
685
  }), e) : (Object.entries(t).forEach(([r, n]) => {
683
686
  if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
@@ -688,9 +691,9 @@ const f = async (t) => {
688
691
  e[r] = n;
689
692
  return;
690
693
  }
691
- e[r] = q(n);
694
+ e[r] = S(n);
692
695
  }), e);
693
- }, Ut = (t) => q(t), Et = "list", St = [
696
+ }, Ut = (t) => S(t), Et = "list", St = [
694
697
  "flatMap",
695
698
  "chunk",
696
699
  "shuffle",
@@ -787,14 +790,14 @@ g.prototype.clone = function() {
787
790
  const t = Object.create(this);
788
791
  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;
789
792
  };
790
- S().macro("whereContains", function(t, e) {
793
+ U().macro("whereContains", function(t, e) {
791
794
  return this.filter((r) => r[t].toLowerCase().includes(e.toLowerCase()));
792
795
  });
793
796
  g.prototype.fetchData = async function() {
794
797
  try {
795
798
  if (this._batchData) {
796
- const u = this._batchData;
797
- return this.meta = u.meta, S(u.data);
799
+ const h = this._batchData;
800
+ return this.meta = h.meta, U(h.data);
798
801
  }
799
802
  let t = {
800
803
  meta: {
@@ -805,18 +808,18 @@ g.prototype.fetchData = async function() {
805
808
  };
806
809
  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);
807
810
  const e = this.data_path.split(".");
808
- let r = {}, n = r, i = e[e.length - 1];
809
- for (const u of e) {
810
- if (u === i) {
811
- n[u] = t;
811
+ let r = {}, n = r, o = e[e.length - 1];
812
+ for (const h of e) {
813
+ if (h === o) {
814
+ n[h] = t;
812
815
  break;
813
816
  }
814
- n[u] = {}, n = n[u];
817
+ n[h] = {}, n = n[h];
815
818
  }
816
819
  let l = await y(r);
817
- for (const u of e)
818
- l = l[u];
819
- return this.meta = l.meta, S(l.data);
820
+ for (const h of e)
821
+ l = l[h];
822
+ return this.meta = l.meta, U(l.data);
820
823
  } catch (t) {
821
824
  throw console.error("Error fetching collection data:", t), t;
822
825
  }
@@ -852,25 +855,25 @@ g.prototype.where = function(...t) {
852
855
  if (t.length === 2)
853
856
  this.filters[t[0]] = t[1];
854
857
  else if (t.length === 3) {
855
- const r = t[0], n = t[1], i = t[2];
858
+ const r = t[0], n = t[1], o = t[2];
856
859
  switch (n) {
857
860
  case "==":
858
- this.filters[r] = i;
861
+ this.filters[r] = o;
859
862
  break;
860
863
  case "<":
861
- this.filters[r] = { lt: i };
864
+ this.filters[r] = { lt: o };
862
865
  break;
863
866
  case "<=":
864
- this.filters[r] = { lte: i };
867
+ this.filters[r] = { lte: o };
865
868
  break;
866
869
  case ">":
867
- this.filters[r] = { gt: i };
870
+ this.filters[r] = { gt: o };
868
871
  break;
869
872
  case ">=":
870
- this.filters[r] = { gte: i };
873
+ this.filters[r] = { gte: o };
871
874
  break;
872
875
  case "!==":
873
- this.filters[r] = { ne: i };
876
+ this.filters[r] = { ne: o };
874
877
  break;
875
878
  default:
876
879
  throw new Error(`Unsupported operator: ${n}`);
@@ -920,133 +923,133 @@ g.prototype.take = function(t) {
920
923
  g.prototype.splice = function(t, e) {
921
924
  return this.steps.push({ type: "splice", args: [t, e] }), this.offset = t, this.limit = e, this.already_limit = !0, this.already_offset = !0, this;
922
925
  };
923
- const H = (t, e) => {
926
+ const W = (t, e) => {
924
927
  const r = new g(e);
925
928
  return r.data_path = Et + t, r;
926
929
  }, qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
927
930
  __proto__: null,
928
- default: H
931
+ default: W
929
932
  }, Symbol.toStringTag, { value: "Module" })), Ht = (t) => {
930
933
  const e = typeof window > "u";
931
934
  let r = [];
932
- const n = X.create({
935
+ const n = z.create({
933
936
  baseURL: t,
934
937
  withCredentials: !0
935
938
  });
936
- e && (n.interceptors.request.use((h) => (h.withCredentials = !0, r.length > 0 && (h.headers.Cookie = r.join("; ")), h)), n.interceptors.response.use((h) => {
937
- if (h.headers["set-cookie"]) {
938
- const l = h.headers["set-cookie"].map((s) => s.split(";")[0]), u = /* @__PURE__ */ new Map();
939
+ e && (n.interceptors.request.use((c) => (c.withCredentials = !0, r.length > 0 && (c.headers.Cookie = r.join("; ")), c)), n.interceptors.response.use((c) => {
940
+ if (c.headers["set-cookie"]) {
941
+ const l = c.headers["set-cookie"].map((s) => s.split(";")[0]), h = /* @__PURE__ */ new Map();
939
942
  r.forEach((s) => {
940
- const o = s.split("=")[0];
941
- u.set(o, s);
943
+ const a = s.split("=")[0];
944
+ h.set(a, s);
942
945
  }), l.forEach((s) => {
943
- const o = s.split("=")[0];
944
- u.set(o, s);
945
- }), r = Array.from(u.values());
946
+ const a = s.split("=")[0];
947
+ h.set(a, s);
948
+ }), r = Array.from(h.values());
946
949
  }
947
- return h;
950
+ return c;
948
951
  }));
949
- const i = {
952
+ const o = {
950
953
  post: n.post,
951
954
  baseURL: t,
952
955
  axios: n,
953
- auth: ht(),
954
- mutation: f,
956
+ auth: lt,
957
+ mutation: p,
955
958
  query: y,
956
959
  config: Ft,
957
960
  mail: Pt,
958
- users: bt(),
959
- model(h) {
960
- return E(h);
961
+ users: bt,
962
+ model(c) {
963
+ return P(c);
961
964
  },
962
965
  roles: jt(),
963
- collect: (h, l) => {
964
- const u = H(h, l);
965
- return u.data_path = E(h).getDataPath(), u;
966
+ collect: (c, l) => {
967
+ const h = W(c, l);
968
+ return h.data_path = P(c).getDataPath(), h;
966
969
  },
967
- list: (h, l) => k(h, l).dataPath(E(h).getDataPath()),
970
+ list: (c, l) => C(c, l).dataPath(P(c).getDataPath()),
968
971
  drive: gt,
969
- async collects(h) {
970
- const l = {}, u = {};
971
- for (const o in h) {
972
- const c = h[o].getQueryPayload();
973
- u[o] = c.data_path, l[o] = {};
974
- const a = c.data_path.split(".");
975
- let p = a[a.length - 1], d = l[o];
976
- for (const _ of a) {
977
- if (_ === p) {
978
- d[_] = c.query;
972
+ async collects(c) {
973
+ const l = {}, h = {};
974
+ for (const a in c) {
975
+ const i = c[a].getQueryPayload();
976
+ h[a] = i.data_path, l[a] = {};
977
+ const u = i.data_path.split(".");
978
+ let f = u[u.length - 1], _ = l[a];
979
+ for (const d of u) {
980
+ if (d === f) {
981
+ _[d] = i.query;
979
982
  break;
980
983
  }
981
- d[_] = d[_] || {};
984
+ _[d] = _[d] || {};
982
985
  }
983
- l[o].__aliasFor = a[0];
986
+ l[a].__aliasFor = u[0];
984
987
  }
985
988
  const s = await y(l);
986
- for (const o in h) {
987
- const c = u[o].split(".");
988
- let a = c[c.length - 1], p = s[o];
989
- for (const d of c) {
990
- if (d === a) {
991
- h[o]._batchData = s[o][d];
989
+ for (const a in c) {
990
+ const i = h[a].split(".");
991
+ let u = i[i.length - 1], f = s[a];
992
+ for (const _ of i) {
993
+ if (_ === u) {
994
+ c[a]._batchData = s[a][_];
992
995
  break;
993
996
  }
994
- p[d] = p[d] || {};
997
+ f[_] = f[_] || {};
995
998
  }
996
999
  }
997
- return h;
1000
+ return c;
998
1001
  }
999
1002
  };
1000
- return Z(i), i;
1001
- }, Xt = k;
1003
+ return X(o), o;
1004
+ }, Xt = C;
1002
1005
  export {
1003
- D as arrayHasFile,
1004
- ht as auth,
1005
- nt as changeExpiredPassword,
1006
+ A as arrayHasFile,
1007
+ lt as auth,
1008
+ rt as changeExpiredPassword,
1006
1009
  Gt as clearModels,
1007
1010
  Ht as createClient,
1008
- H as createCollection,
1011
+ W as createCollection,
1009
1012
  Lt as createFileFromBase64,
1010
- Qt as createFileFromBase85,
1011
- J as createFileFromString,
1012
- k as createList,
1013
+ $t as createFileFromBase85,
1014
+ M as createFileFromString,
1015
+ C as createList,
1013
1016
  Ct as createRole,
1014
1017
  _t as createUser,
1015
- W as defaultUserFields,
1016
- Q as defineModel,
1018
+ G as defaultUserFields,
1019
+ J as defineModel,
1017
1020
  Rt as defineModels,
1018
1021
  Dt as deleteRole,
1019
1022
  yt as deleteUser,
1020
- at as forgetPassword,
1021
- M as getApiClient,
1023
+ ot as forgetPassword,
1024
+ q as getApiClient,
1022
1025
  Jt as getApiClientOptional,
1023
1026
  Ft as getConfig,
1024
- et as getCurrentUser,
1027
+ x as getCurrentUser,
1025
1028
  gt as getDrive,
1026
- ut as getGrantedRights,
1027
- E as getModel,
1028
- Tt as hasModel,
1029
- lt as isGranted,
1029
+ ct as getGrantedRights,
1030
+ P as getModel,
1031
+ Qt as hasModel,
1032
+ at as isGranted,
1030
1033
  Xt as list,
1031
1034
  zt as listDrives,
1032
- pt as listFiles,
1033
- dt as listFolders,
1034
- $t as listModels,
1035
+ ut as listFiles,
1036
+ pt as listFolders,
1037
+ Tt as listModels,
1035
1038
  Wt as listPermissions,
1036
1039
  Ot as listRoles,
1037
1040
  wt as listUsers,
1038
- rt as login,
1039
- st as logout,
1040
- f as mutation,
1041
- N as objectHasFile,
1041
+ tt as login,
1042
+ et as logout,
1043
+ p as mutation,
1044
+ B as objectHasFile,
1042
1045
  y as query,
1043
- ft as readFileAsBase64,
1044
- it as resetPassword,
1046
+ ht as readFileAsBase64,
1047
+ nt as resetPassword,
1045
1048
  kt as sendMail,
1046
- Z as setApiClient,
1049
+ X as setApiClient,
1047
1050
  Ut as toQuery,
1048
- ot as updatePassword,
1051
+ st as updatePassword,
1049
1052
  mt as updateUser,
1050
- ct as verifyCode,
1051
- tt as webAuthn
1053
+ it as verifyCode,
1054
+ K as webAuthn
1052
1055
  };