@hostlink/light 3.0.5 → 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,45 +1,45 @@
1
- import { jsonToGraphQLQuery as M, VariableType as b } from "json-to-graphql-query";
2
- import H from "axios";
3
- import S from "collect.js";
4
- function E(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 = ".", o) {
11
- if (!E(e))
12
- return v(t, {}, r, o);
13
- const i = Object.assign({}, e);
14
- for (const u in t) {
15
- if (u === "__proto__" || u === "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[u];
18
- l != null && (o && o(i, u, l, r) || (Array.isArray(l) && Array.isArray(i[u]) ? i[u] = [...l, ...i[u]] : E(l) && E(i[u]) ? i[u] = 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[u],
21
- (r ? `${r}.` : "") + u.toString(),
22
- o
23
- ) : i[u] = l));
20
+ o[c],
21
+ (r ? `${r}.` : "") + c.toString(),
22
+ n
23
+ ) : o[c] = l));
24
24
  }
25
- return i;
25
+ return o;
26
26
  }
27
- function X(t) {
27
+ function H(t) {
28
28
  return (...e) => (
29
29
  // eslint-disable-next-line unicorn/no-array-reduce
30
- e.reduce((r, o) => v(r, o, "", t), {})
30
+ e.reduce((r, n) => E(r, n, "", t), {})
31
31
  );
32
32
  }
33
- const F = X();
34
- let j = null;
35
- const Y = (t) => {
36
- j = t;
37
- }, N = () => {
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
- }, Nt = () => j;
42
- function C(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;
@@ -47,57 +47,85 @@ function C(t) {
47
47
  }
48
48
  function B(t) {
49
49
  for (let e in t)
50
- if (t[e] instanceof File || t[e] instanceof Array && C(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 J(t, e, r, o, i) {
54
+ function Y(t) {
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, a) {
59
+ for (var i = a; i > 0; i--) s.pop();
60
+ })(n, e.length), l.fromCharCode.apply(l, n);
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);
69
+ };
70
+ return {
71
+ getContent: () => e,
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);
76
+ },
77
+ open: (n) => {
78
+ window.open(r(n), "_blank");
79
+ }
80
+ };
81
+ }, Lt = (t) => M(atob(t)), $t = (t) => M(Y(t));
82
+ function N(t, e, r, n, o) {
55
83
  if (!(!t || typeof t != "object"))
56
- for (let u in t) {
57
- const l = t[u];
84
+ for (let c in t) {
85
+ const l = t[c];
58
86
  if (l && typeof l == "object") {
59
87
  if ("__args" in l) {
60
88
  const h = l.__args, s = {};
61
- Object.entries(h).forEach(([n, c]) => {
62
- if (c instanceof Array && C(c)) {
63
- s[n] = new b(n);
64
- let a = 0;
65
- c.forEach((f) => {
66
- f instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + n + "." + a), o.append(i.current.toString(), f), i.current++, a++);
67
- }), e[n] = "[Upload!]!";
68
- } else c instanceof File ? (s[n] = new b(n), r[i.current] = ["variables." + n], o.append(i.current.toString(), c), e[n] = "Upload!", i.current++) : c instanceof Object && B(c) ? (s[n] = {}, Object.entries(c).forEach(([a, f]) => {
69
- if (f instanceof Array && C(f)) {
70
- s[n][a] = new b(a);
71
- let g = 0;
72
- f.forEach((_) => {
73
- _ instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + a + "." + g), o.append(i.current.toString(), _), i.current++, g++);
74
- }), e[a] = "[Upload!]!";
75
- } else f instanceof File ? (s[n][a] = new b(a), r[i.current] = ["variables." + a], o.append(i.current.toString(), f), e[a] = "Upload!", i.current++) : s[n][a] = f;
76
- })) : c != null && (s[n] = c);
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);
77
105
  }), l.__args = s;
78
106
  }
79
- J(l, e, r, o, i);
107
+ N(l, e, r, n, o);
80
108
  }
81
109
  }
82
110
  }
83
111
  const y = async (t) => {
84
- const e = N(), r = t, o = new FormData();
85
- let i = !1;
86
- const u = {}, l = {};
87
- J(r, u, l, o, { current: 0 }), i = Object.keys(u).length > 0, i && (r.__variables = u);
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);
88
116
  let s = null;
89
- const c = M({ query: r });
90
- if (i ? (o.append("map", JSON.stringify(l)), o.append("operations", JSON.stringify({
91
- query: c
92
- })), s = await e.axios.post("", o)) : s = await e.axios.post("", {
93
- 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
94
122
  }), s.data.errors)
95
123
  throw new Error(s.data.errors[0].message);
96
124
  return s.data.data;
97
125
  };
98
- function k(t, e) {
99
- let r, o = [], i, u;
100
- const l = (s) => !s || typeof s != "object" ? !1 : Object.values(s).some((n) => n && typeof n == "object" && Object.keys(n).some((c) => c.startsWith("_"))), h = () => o.length === 0 ? (o.unshift({}), o[0]) : (l(o[0]) && o.unshift({}), o[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]);
101
129
  return {
102
130
  first() {
103
131
  return this.fetchFirst();
@@ -106,44 +134,44 @@ function k(t, e) {
106
134
  return this.fetch();
107
135
  },
108
136
  async fetchFirst() {
109
- const n = await this.limit(1).fetch();
110
- return Array.isArray(n) && n.length > 0 ? n[0] : null;
137
+ const a = await this.limit(1).fetch();
138
+ return Array.isArray(a) && a.length > 0 ? a[0] : null;
111
139
  },
112
140
  async fetchWithMeta() {
113
- let n = await y(this.toQuery(!0));
114
- if (u) {
115
- const c = u.split(".");
116
- for (const a of c)
117
- n = n[a];
118
- return n;
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;
119
147
  }
120
- return n[`list${t}`];
148
+ return a[`list${t}`];
121
149
  },
122
150
  async fetch() {
123
- let n = await y(this.toQuery());
124
- if (u) {
125
- const c = u.split(".");
126
- for (const a of c)
127
- n = n[a];
128
- return n.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;
129
157
  }
130
- return n[`list${t}`].data;
158
+ return a[`list${t}`].data;
131
159
  },
132
160
  dataPath(s) {
133
- return s && typeof s == "string" && (u = s), this;
161
+ return s && typeof s == "string" && (c = s), this;
134
162
  },
135
163
  sort(s) {
136
- return s && typeof s == "string" && (i = s), this;
164
+ return s && typeof s == "string" && (o = s), this;
137
165
  },
138
166
  filters(s) {
139
- return s && typeof s == "object" && (o = [s]), this;
167
+ return s && typeof s == "object" && (n = [s]), this;
140
168
  },
141
169
  // where can be called as:
142
170
  // where('key', value) -> exact match
143
171
  // where('key', '>', value) -> operator-based (>, <, >=, <=, !=, in, contains)
144
- where(s, n, c) {
145
- const a = (f, g, _) => {
146
- const O = {
172
+ where(s, a, i) {
173
+ const u = (f, _, d) => {
174
+ const F = {
147
175
  ">": "_gt",
148
176
  "<": "_lt",
149
177
  ">=": "_gte",
@@ -151,182 +179,182 @@ function k(t, e) {
151
179
  "!=": "_ne",
152
180
  in: "_in",
153
181
  contains: "_contains"
154
- }[g];
155
- O && o.push({ [f]: { [O]: _ } });
182
+ }[_];
183
+ F && n.push({ [f]: { [F]: d } });
156
184
  };
157
- if (c !== void 0)
158
- a(s, String(n), c);
185
+ if (i !== void 0)
186
+ u(s, String(a), i);
159
187
  else {
160
- const f = h(), g = F(f, { [s]: n });
161
- o[0] = g;
188
+ const f = h(), _ = m(f, { [s]: a });
189
+ n[0] = _;
162
190
  }
163
191
  return this;
164
192
  },
165
193
  // whereContains adds a _contains filter for a specific field
166
194
  // If the same field is used multiple times, it merges them into an array
167
- whereContains(s, n) {
195
+ whereContains(s, a) {
168
196
  if (s && typeof s == "string") {
169
- const c = h(), a = { _contains: n };
170
- c[s] ? Array.isArray(c[s]) ? c[s].push(a) : c[s] = [c[s], a] : c[s] = [a], o[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;
171
199
  }
172
200
  return this;
173
201
  },
174
202
  // ...existing code...
175
203
  // whereIn adds an _in filter for a specific field
176
204
  // If the same field is used multiple times, it merges them into an array
177
- whereIn(s, n) {
178
- if (s && typeof s == "string" && Array.isArray(n)) {
179
- const c = h(), a = { _in: n };
180
- c[s] ? Array.isArray(c[s]) ? c[s].push(a) : c[s] = [c[s], a] : c[s] = [a], o[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;
181
209
  }
182
210
  return this;
183
211
  },
184
212
  // whereBetween adds a _between filter for a specific field
185
- whereBetween(s, n, c) {
213
+ whereBetween(s, a, i) {
186
214
  if (s && typeof s == "string") {
187
- const a = h(), f = { _between: [n, c] };
188
- a[s] ? Array.isArray(a[s]) ? a[s].push(f) : a[s] = [a[s], f] : a[s] = f, o[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;
189
217
  }
190
218
  return this;
191
219
  },
192
220
  // limit sets paging/limit for the data selection
193
221
  limit(s) {
194
- 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;
195
223
  },
196
224
  // offset sets the starting index for the data selection
197
225
  offset(s) {
198
- 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;
199
227
  },
200
228
  toQuery(s = !1) {
201
- let n;
202
- const c = o.length > 0 && Object.keys(o[0] || {}).length > 0, a = c ? 1 : 0, f = o.length > a;
203
- c && f ? n = o : f ? n = o.slice(a) : c && (n = o[0]);
204
- const g = F(
205
- i ? { sort: i } : {},
206
- n ? { filters: n } : {}
207
- ), _ = {
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 = {
208
236
  data: {
209
237
  ...e
210
238
  }
211
239
  };
212
- if (r && (_.data.__args = r), Object.keys(g).length > 0 && (_.__args = g), s && (_.meta = {
240
+ if (r && (d.data.__args = r), Object.keys(_).length > 0 && (d.__args = _), s && (d.meta = {
213
241
  total: !0,
214
242
  key: !0,
215
243
  name: !0
216
- }), u) {
217
- const w = u.split(".");
218
- let O = _;
219
- for (let P = w.length - 1; P >= 0; P--)
220
- O = {
221
- [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
222
250
  };
223
- return O;
251
+ return F;
224
252
  }
225
253
  return {
226
- [`list${t}`]: _
254
+ [`list${t}`]: d
227
255
  };
228
256
  }
229
257
  };
230
258
  }
231
259
  const Z = (t, e = {}) => {
232
- const r = t, o = e;
233
- let i = "list" + t;
234
- const u = (l) => o[l] ? o[l] : null;
260
+ const r = e;
261
+ let n = "list" + t;
262
+ const o = (c) => r[c] ? r[c] : null;
235
263
  return {
236
- field: u,
237
- $fields: o,
238
- setDataPath(l) {
239
- return i = l, i;
264
+ field: o,
265
+ $fields: r,
266
+ setDataPath(c) {
267
+ return n = c, n;
240
268
  },
241
269
  getDataPath() {
242
- return i;
270
+ return n;
243
271
  },
244
- gqlFields(l) {
245
- let h = {};
246
- for (const s of l)
247
- if (typeof s == "string") {
248
- const n = u(s);
249
- n && (h = F(h, n.gqlField ? typeof n.gqlField == "string" ? { [n.gqlField]: !0 } : n.gqlField : { [n.name || s]: !0 }));
250
- } else typeof s == "object" && (h = F(h, s));
251
- return h;
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;
252
280
  },
253
- update(l, h) {
281
+ update(c, l) {
254
282
  return p({
255
- ["update" + r]: {
256
- __args: { id: l, data: h }
283
+ ["update" + t]: {
284
+ __args: { id: c, data: l }
257
285
  }
258
- }).then((s) => s["update" + r]);
286
+ }).then((h) => h["update" + t]);
259
287
  },
260
- async delete(l) {
288
+ async delete(c) {
261
289
  return p({
262
- ["delete" + r]: {
263
- __args: { id: l }
290
+ ["delete" + t]: {
291
+ __args: { id: c }
264
292
  }
265
- }).then((h) => h["delete" + r]);
293
+ }).then((l) => l["delete" + t]);
266
294
  },
267
- add(l) {
295
+ add(c) {
268
296
  return p({
269
- ["add" + r]: {
270
- __args: { data: l }
297
+ ["add" + t]: {
298
+ __args: { data: c }
271
299
  }
272
- }).then((h) => h["add" + r]);
300
+ }).then((l) => l["add" + t]);
273
301
  },
274
- fields(l) {
275
- let h = [];
276
- for (let s of l) {
277
- const n = u(s);
278
- n && h.push(n);
302
+ fields(c) {
303
+ let l = [];
304
+ for (let h of c) {
305
+ const s = o(h);
306
+ s && l.push(s);
279
307
  }
280
- return h;
308
+ return l;
281
309
  },
282
- async get(l, h) {
283
- const s = (await Promise.resolve().then(() => St)).default, n = s(r, kt(h));
284
- for (const [c, a] of Object.entries(l))
285
- n.where(c, "==", a);
286
- return await n.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();
287
315
  },
288
- list(l) {
289
- let h = l;
290
- const s = {};
291
- Object.entries(l).forEach(([a]) => {
292
- o[a] && (s[a] = o[a], o[a].gqlField && (delete h[a], h = F(h, o[a].gqlField)), o[a].gql && (h = F(h, o[a].gql), delete h[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]));
293
321
  });
294
- const n = k(r, h).dataPath(i), c = n.fetch.bind(n);
322
+ const s = C(t, l).dataPath(n), a = s.fetch.bind(s);
295
323
  return {
296
- ...n,
324
+ ...s,
297
325
  async fetch() {
298
- return (await c()).map((f) => {
299
- const g = { ...f };
300
- return Object.entries(s).forEach(([_, w]) => {
301
- w.format && typeof w.format == "function" && (g[_] = w.format(f));
302
- }), g;
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;
303
331
  });
304
332
  },
305
333
  async fetchFirst() {
306
- const f = await n.fetchFirst.bind(n)();
307
- if (!f) return f;
308
- const g = { ...f };
309
- return Object.entries(s).forEach(([_, w]) => {
310
- w.format && typeof w.format == "function" && (g[_] = w.format(f));
311
- }), g;
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;
312
340
  }
313
341
  };
314
342
  }
315
343
  };
316
- }, A = {}, L = (t, e) => {
344
+ }, b = {}, J = (t, e) => {
317
345
  const r = Z(t, e);
318
- return A[t] = r, r;
319
- }, U = (t) => A[t] ? A[t] : L(t, {}), Bt = (t) => !!A[t], Jt = () => Object.keys(A), Lt = () => {
320
- Object.keys(A).forEach((t) => delete A[t]);
321
- }, Qt = (t) => {
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
+ }, Rt = (t) => {
322
350
  Object.entries(t).forEach(([e, r]) => {
323
- L(e, r);
351
+ J(e, r);
324
352
  });
325
- }, Tt = () => y({
353
+ }, Wt = () => y({
326
354
  app: {
327
355
  permissions: !0
328
356
  }
329
- }).then((t) => t.app.permissions), Q = async () => {
357
+ }).then((t) => t.app.permissions), L = async () => {
330
358
  const { app: t } = await y({
331
359
  app: {
332
360
  auth: {
@@ -335,7 +363,7 @@ const Z = (t, e = {}) => {
335
363
  }
336
364
  }), e = t.auth.webAuthnRequestOptions, r = PublicKeyCredential.parseRequestOptionsFromJSON(e);
337
365
  return await navigator.credentials.get({ publicKey: r });
338
- }, T = async () => {
366
+ }, $ = async () => {
339
367
  const { app: t } = await y({
340
368
  app: {
341
369
  auth: {
@@ -345,7 +373,7 @@ const Z = (t, e = {}) => {
345
373
  }), e = PublicKeyCredential.parseCreationOptionsFromJSON(t.auth.webAuthnCreationOptions);
346
374
  return await navigator.credentials.create({ publicKey: e });
347
375
  }, V = async () => {
348
- const t = await Q();
376
+ const t = await L();
349
377
  return await p({
350
378
  webAuthnAssertion: {
351
379
  __args: {
@@ -354,7 +382,7 @@ const Z = (t, e = {}) => {
354
382
  }
355
383
  }).then((e) => e.webAuthnAssertion);
356
384
  }, I = async () => {
357
- const t = await T();
385
+ const t = await $();
358
386
  return await p({
359
387
  webAuthnRegister: {
360
388
  __args: {
@@ -364,11 +392,11 @@ const Z = (t, e = {}) => {
364
392
  }).then((e) => e.webAuthnRegister);
365
393
  }, K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
366
394
  __proto__: null,
367
- assertion: Q,
368
- attestation: T,
395
+ assertion: L,
396
+ attestation: $,
369
397
  login: V,
370
398
  register: I
371
- }, Symbol.toStringTag, { value: "Module" })), x = (t = W) => y({ my: t }).then((e) => e.my), tt = (t, e, r = "") => p({ login: { __args: { username: t, password: e, code: r } } }).then((o) => o.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((o) => o.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((o) => o.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({
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({
372
400
  my: {
373
401
  granted: {
374
402
  __args: {
@@ -384,7 +412,7 @@ const Z = (t, e = {}) => {
384
412
  }
385
413
  }
386
414
  }
387
- }).then((e) => e.my.grantedRights), lt = () => ({
415
+ }).then((e) => e.my.grantedRights), lt = {
388
416
  getCurrentUser: x,
389
417
  webAuthn: K,
390
418
  google: {
@@ -411,13 +439,13 @@ const Z = (t, e = {}) => {
411
439
  verifyCode: it,
412
440
  grantedRights: ct,
413
441
  isGranted: at
414
- }), $ = {
442
+ }, Q = {
415
443
  name: !0,
416
444
  path: !0,
417
445
  size: !0,
418
446
  mime: !0,
419
447
  url: !0
420
- }, ut = (t, e, r = $) => y({
448
+ }, ut = (t, e, r = Q) => y({
421
449
  app: {
422
450
  drive: {
423
451
  __args: { index: t },
@@ -427,7 +455,7 @@ const Z = (t, e = {}) => {
427
455
  }
428
456
  }
429
457
  }
430
- }).then((o) => o.app.drive.files), ht = (t, e) => y({
458
+ }).then((n) => n.app.drive.files), ht = (t, e) => y({
431
459
  app: {
432
460
  drive: {
433
461
  __args: {
@@ -441,8 +469,8 @@ const Z = (t, e = {}) => {
441
469
  }
442
470
  }
443
471
  }
444
- }).then((r) => r.app.drive?.file?.base64Content), m = (t) => ({
445
- list: (e, r = $) => ut(t, e, r),
472
+ }).then((r) => r.app.drive?.file?.base64Content), ft = (t) => ({
473
+ list: (e, r = Q) => ut(t, e, r),
446
474
  get: (e, r = {
447
475
  name: !0,
448
476
  path: !0,
@@ -463,7 +491,7 @@ const Z = (t, e = {}) => {
463
491
  }
464
492
  }
465
493
  }
466
- }).then((o) => o.app.drive.file),
494
+ }).then((n) => n.app.drive.file),
467
495
  readFileAsBase64(e) {
468
496
  return ht(t, e);
469
497
  },
@@ -487,14 +515,14 @@ const Z = (t, e = {}) => {
487
515
  throw new Error(`File not found or cannot read content: ${e}`);
488
516
  return typeof window < "u" && window.atob ? window.atob(r.app.drive.file.base64Content) : r.app.drive.file.base64Content;
489
517
  },
490
- write: (e, r) => p({ lightDriveWriteFile: { __args: { index: t, path: e, content: r } } }).then((o) => o.lightDriveWriteFile),
518
+ write: (e, r) => p({ lightDriveWriteFile: { __args: { index: t, path: e, content: r } } }).then((n) => n.lightDriveWriteFile),
491
519
  delete: (e) => p({ lightDriveDeleteFile: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFile),
492
- rename: (e, r) => p({ lightDriveRenameFile: { __args: { index: t, path: e, name: r } } }).then((o) => o.lightDriveRenameFile),
493
- move: (e, r) => p({ lightDriveMoveFile: { __args: { index: t, source: e, destination: r } } }).then((o) => o.lightDriveMoveFile)
494
- }), G = {
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 = {
495
523
  name: !0,
496
524
  path: !0
497
- }, ft = (t, e, r = G) => y({
525
+ }, pt = (t, e, r = T) => y({
498
526
  app: {
499
527
  drive: {
500
528
  __args: { index: t },
@@ -504,65 +532,68 @@ const Z = (t, e = {}) => {
504
532
  }
505
533
  }
506
534
  }
507
- }).then((o) => o.app.drive.folders), D = (t) => ({
508
- list: (e, r = G) => ft(t, e, r),
535
+ }).then((n) => n.app.drive.folders), dt = (t) => ({
536
+ list: (e, r = T) => pt(t, e, r),
509
537
  create: (e) => p({ lightDriveCreateFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveCreateFolder),
510
538
  delete: (e) => p({ lightDriveDeleteFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFolder),
511
- rename: (e, r) => p({ lightDriveRenameFolder: { __args: { index: t, path: e, name: r } } }).then((o) => o.lightDriveRenameFolder)
512
- }), $t = () => y({
539
+ rename: (e, r) => p({ lightDriveRenameFolder: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFolder)
540
+ }), zt = () => y({
513
541
  app: {
514
542
  drives: {
515
543
  index: !0,
516
544
  name: !0
517
545
  }
518
546
  }
519
- }).then((t) => t.app.drives), pt = (t) => ({
520
- listFiles: m(t).list,
521
- getFile: m(t).get,
522
- readFile: m(t).read,
523
- writeFile: m(t).write,
524
- deleteFile: m(t).delete,
525
- renameFile: m(t).rename,
526
- moveFile: m(t).move,
527
- listFolders: D(t).list,
528
- createFolder: D(t).create,
529
- deleteFolder: D(t).delete,
530
- renameFolder: D(t).rename,
531
- uploadTempFile: (e) => p({
532
- lightDriveUploadTempFile: {
533
- __args: { index: t, file: e },
534
- name: !0,
535
- path: !0,
536
- size: !0,
537
- mime: !0
538
- }
539
- }).then((r) => r.lightDriveUploadTempFile),
540
- folders: D(t),
541
- files: m(t)
542
- }), 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 = {
543
574
  user_id: !0,
544
575
  username: !0,
545
576
  first_name: !0,
546
577
  last_name: !0,
547
578
  status: !0
548
- }, gt = (t) => p({
579
+ }, _t = (t) => p({
549
580
  addUser: {
550
581
  __args: t
551
582
  }
552
- }).then((e) => e.addUser), dt = (t) => p({
583
+ }).then((e) => e.addUser), yt = (t) => p({
553
584
  deleteUser: {
554
585
  __args: { id: t }
555
586
  }
556
- }).then((e) => e.deleteUser), _t = (t = W) => k("Users", t).dataPath("app.listUser").fetch(), yt = (t, e) => p({
587
+ }).then((e) => e.deleteUser), wt = (t = G) => C("Users", t).dataPath("app.listUser").fetch(), mt = (t, e) => p({
557
588
  updateUser: {
558
589
  __args: { id: t, data: e }
559
590
  }
560
- }).then((r) => r.updateUser), wt = () => ({
561
- list: _t,
562
- create: gt,
563
- delete: dt,
564
- update: yt
565
- }), mt = (t) => y({
591
+ }).then((r) => r.updateUser), bt = {
592
+ list: wt,
593
+ create: _t,
594
+ delete: yt,
595
+ update: mt
596
+ }, Ft = (t) => y({
566
597
  app: {
567
598
  listConfig: {
568
599
  __args: {
@@ -576,13 +607,13 @@ const Z = (t, e = {}) => {
576
607
  }
577
608
  }
578
609
  }
579
- }).then((e) => e.app.listConfig.data[0]?.value), bt = {
610
+ }).then((e) => e.app.listConfig.data[0]?.value), At = {
580
611
  name: !0
581
- }, Ft = (t = bt) => y({
612
+ }, Ot = (t = At) => y({
582
613
  app: {
583
614
  roles: t
584
615
  }
585
- }).then((e) => e.app.roles), At = (t, e) => p({
616
+ }).then((e) => e.app.roles), Ct = (t, e) => p({
586
617
  addRole: {
587
618
  __args: {
588
619
  data: {
@@ -591,78 +622,78 @@ const Z = (t, e = {}) => {
591
622
  }
592
623
  }
593
624
  }
594
- }).then((r) => r.addRole), Ot = (t) => p({
625
+ }).then((r) => r.addRole), Dt = (t) => p({
595
626
  deleteRole: {
596
627
  __args: { name: t }
597
628
  }
598
- }).then((e) => e.deleteRole), Dt = () => ({
599
- list: Ft,
600
- create: At,
601
- delete: Ot
629
+ }).then((e) => e.deleteRole), jt = () => ({
630
+ list: Ot,
631
+ create: Ct,
632
+ delete: Dt
602
633
  });
603
- function z(t, e, r, o, i) {
634
+ function R(t, e, r, n, o) {
604
635
  if (!(!t || typeof t != "object"))
605
- for (let u in t) {
606
- const l = t[u];
636
+ for (let c in t) {
637
+ const l = t[c];
607
638
  if (l && typeof l == "object") {
608
639
  if ("__args" in l) {
609
640
  const h = l.__args, s = {};
610
- Object.entries(h).forEach(([n, c]) => {
611
- if (c instanceof Array && C(c)) {
612
- s[n] = new b(n);
613
- let a = 0;
614
- c.forEach((f) => {
615
- f instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + n + "." + a), o.append(i.current.toString(), f), i.current++, a++);
616
- }), e[n] = "[Upload!]!";
617
- } else c instanceof File ? (s[n] = new b(n), r[i.current] = ["variables." + n], o.append(i.current.toString(), c), e[n] = "Upload!", i.current++) : c instanceof Object && B(c) ? (s[n] = {}, Object.entries(c).forEach(([a, f]) => {
618
- if (f instanceof Array && C(f)) {
619
- s[n][a] = new b(a);
620
- let g = 0;
621
- f.forEach((_) => {
622
- _ instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + a + "." + g), o.append(i.current.toString(), _), i.current++, g++);
623
- }), e[a] = "[Upload!]!";
624
- } else f instanceof File ? (s[n][a] = new b(a), r[i.current] = ["variables." + a], o.append(i.current.toString(), f), e[a] = "Upload!", i.current++) : s[n][a] = f;
625
- })) : c != null && (s[n] = c);
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);
626
657
  }), l.__args = s;
627
658
  }
628
- z(l, e, r, o, i);
659
+ R(l, e, r, n, o);
629
660
  }
630
661
  }
631
662
  }
632
663
  const p = async (t) => {
633
- const r = N().axios, o = t, i = new FormData();
634
- let u = !1;
635
- const l = {}, h = {};
636
- z(o, l, h, i, { current: 0 }), u = Object.keys(l).length > 0, u && (o.__variables = l);
637
- let n = null;
638
- const a = M({ mutation: o });
639
- if (u ? (i.append("map", JSON.stringify(h)), i.append("operations", JSON.stringify({
640
- query: a
641
- })), n = await r.post("", i)) : n = await r.post("", {
642
- query: a
643
- }), n.data.errors)
644
- throw new Error(n.data.errors[0].message);
645
- return n.data.data;
646
- }, Ct = (t, e, r) => p({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((o) => o.sendMail), jt = {
647
- send: Ct
648
- }, q = (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 = {
678
+ send: kt
679
+ }, S = (t) => {
649
680
  let e = {};
650
681
  return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
651
- Object.entries(q(r)).forEach(([o, i]) => {
652
- e[o] = i;
682
+ Object.entries(S(r)).forEach(([n, o]) => {
683
+ e[n] = o;
653
684
  });
654
- }), e) : (Object.entries(t).forEach(([r, o]) => {
685
+ }), e) : (Object.entries(t).forEach(([r, n]) => {
655
686
  if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
656
- e[r] = o;
687
+ e[r] = n;
657
688
  return;
658
689
  }
659
- if (typeof o == "boolean") {
660
- e[r] = o;
690
+ if (typeof n == "boolean") {
691
+ e[r] = n;
661
692
  return;
662
693
  }
663
- e[r] = q(o);
694
+ e[r] = S(n);
664
695
  }), e);
665
- }, kt = (t) => q(t), Pt = "list", Et = [
696
+ }, Ut = (t) => S(t), Et = "list", St = [
666
697
  "flatMap",
667
698
  "chunk",
668
699
  "shuffle",
@@ -688,7 +719,7 @@ const p = async (t) => {
688
719
  "slice",
689
720
  "tap",
690
721
  "sort"
691
- ], Ut = [
722
+ ], vt = [
692
723
  "avg",
693
724
  "count",
694
725
  "countBy",
@@ -716,7 +747,7 @@ const p = async (t) => {
716
747
  "implode",
717
748
  "partition"
718
749
  ];
719
- class d {
750
+ class g {
720
751
  _batchData = null;
721
752
  data_path = "";
722
753
  filters;
@@ -733,7 +764,7 @@ class d {
733
764
  this.filters = {}, this.steps = [], this.fields = e;
734
765
  }
735
766
  }
736
- d.prototype.getQueryPayload = function() {
767
+ g.prototype.getQueryPayload = function() {
737
768
  let t = {
738
769
  meta: {
739
770
  total: !0,
@@ -747,26 +778,26 @@ d.prototype.getQueryPayload = function() {
747
778
  steps: this.steps
748
779
  };
749
780
  };
750
- d.prototype.dataPath = function(t) {
781
+ g.prototype.dataPath = function(t) {
751
782
  const e = this.clone();
752
783
  return e.data_path = t, e;
753
784
  };
754
- d.prototype.buildArgs = function() {
785
+ g.prototype.buildArgs = function() {
755
786
  let t = {};
756
787
  return Object.keys(this.filters).length > 0 && (t.filters = this.filters), this._sort && (t.sort = this._sort, this._sortDesc && (t.sort += ":desc")), t;
757
788
  };
758
- d.prototype.clone = function() {
789
+ g.prototype.clone = function() {
759
790
  const t = Object.create(this);
760
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;
761
792
  };
762
- S().macro("whereContains", function(t, e) {
793
+ U().macro("whereContains", function(t, e) {
763
794
  return this.filter((r) => r[t].toLowerCase().includes(e.toLowerCase()));
764
795
  });
765
- d.prototype.fetchData = async function() {
796
+ g.prototype.fetchData = async function() {
766
797
  try {
767
798
  if (this._batchData) {
768
799
  const h = this._batchData;
769
- return this.meta = h.meta, S(h.data);
800
+ return this.meta = h.meta, U(h.data);
770
801
  }
771
802
  let t = {
772
803
  meta: {
@@ -777,243 +808,248 @@ d.prototype.fetchData = async function() {
777
808
  };
778
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);
779
810
  const e = this.data_path.split(".");
780
- let r = {}, o = r, i = e[e.length - 1];
811
+ let r = {}, n = r, o = e[e.length - 1];
781
812
  for (const h of e) {
782
- if (h === i) {
783
- o[h] = t;
813
+ if (h === o) {
814
+ n[h] = t;
784
815
  break;
785
816
  }
786
- o[h] = {}, o = o[h];
817
+ n[h] = {}, n = n[h];
787
818
  }
788
819
  let l = await y(r);
789
820
  for (const h of e)
790
821
  l = l[h];
791
- return this.meta = l.meta, S(l.data);
822
+ return this.meta = l.meta, U(l.data);
792
823
  } catch (t) {
793
824
  throw console.error("Error fetching collection data:", t), t;
794
825
  }
795
826
  };
796
- d.prototype.processData = async function() {
827
+ g.prototype.processData = async function() {
797
828
  let t = await this.fetchData();
798
829
  for (const e of this.steps)
799
830
  t = t[e.type](...e.args);
800
831
  return t;
801
832
  };
802
- d.prototype.all = async function() {
833
+ g.prototype.all = async function() {
803
834
  return (await this.processData()).all();
804
835
  };
805
- for (const t of Et)
806
- d.prototype[t] = function(...e) {
836
+ for (const t of St)
837
+ g.prototype[t] = function(...e) {
807
838
  const r = this.clone();
808
839
  return r.steps.push({ type: t, args: e }), r;
809
840
  };
810
- for (const t of Ut)
811
- d.prototype[t] = async function(...e) {
841
+ for (const t of vt)
842
+ g.prototype[t] = async function(...e) {
812
843
  return (await this.clone().processData())[t](...e);
813
844
  };
814
- d.prototype.average = d.prototype.avg;
815
- d.prototype.first = async function() {
845
+ g.prototype.average = g.prototype.avg;
846
+ g.prototype.first = async function() {
816
847
  return this.take(1), (await this.processData()).first();
817
848
  };
818
- d.prototype._handleBatchData = function(t, e) {
849
+ g.prototype._handleBatchData = function(t, e) {
819
850
  return this._batchData ? (this.steps.push({ type: t, args: e }), this) : null;
820
851
  };
821
- d.prototype.where = function(...t) {
852
+ g.prototype.where = function(...t) {
822
853
  const e = this._handleBatchData("where", t);
823
854
  if (e) return e;
824
855
  if (t.length === 2)
825
856
  this.filters[t[0]] = t[1];
826
857
  else if (t.length === 3) {
827
- const r = t[0], o = t[1], i = t[2];
828
- switch (o) {
858
+ const r = t[0], n = t[1], o = t[2];
859
+ switch (n) {
829
860
  case "==":
830
- this.filters[r] = i;
861
+ this.filters[r] = o;
831
862
  break;
832
863
  case "<":
833
- this.filters[r] = { lt: i };
864
+ this.filters[r] = { lt: o };
834
865
  break;
835
866
  case "<=":
836
- this.filters[r] = { lte: i };
867
+ this.filters[r] = { lte: o };
837
868
  break;
838
869
  case ">":
839
- this.filters[r] = { gt: i };
870
+ this.filters[r] = { gt: o };
840
871
  break;
841
872
  case ">=":
842
- this.filters[r] = { gte: i };
873
+ this.filters[r] = { gte: o };
843
874
  break;
844
875
  case "!==":
845
- this.filters[r] = { ne: i };
876
+ this.filters[r] = { ne: o };
846
877
  break;
847
878
  default:
848
- throw new Error(`Unsupported operator: ${o}`);
879
+ throw new Error(`Unsupported operator: ${n}`);
849
880
  }
850
881
  }
851
882
  return this;
852
883
  };
853
- d.prototype.whereContains = function(t, e) {
884
+ g.prototype.whereContains = function(t, e) {
854
885
  const r = this._handleBatchData("whereContains", [t, e]);
855
886
  return r || (this.filters[t] = { contains: e }, this);
856
887
  };
857
- d.prototype.forPage = function(t, e) {
888
+ g.prototype.forPage = function(t, e) {
858
889
  return t = Math.max(1, t), this.already_limit ? (this.steps.push({ type: "forPage", args: [t, e] }), this) : (this.limit = e, this.offset = (t - 1) * e, this.already_limit = !0, this.already_offset = !0, this);
859
890
  };
860
- d.prototype.whereIn = function(t, e) {
891
+ g.prototype.whereIn = function(t, e) {
861
892
  const r = this._handleBatchData("whereIn", [t, e]);
862
893
  return r || (this.filters[t] = { in: e }, this);
863
894
  };
864
- d.prototype.whereNotIn = function(t, e) {
895
+ g.prototype.whereNotIn = function(t, e) {
865
896
  const r = this._handleBatchData("whereNotIn", [t, e]);
866
897
  return r || (this.filters[t] = { nin: e }, this);
867
898
  };
868
- d.prototype.whereNotBetween = function(t, e) {
899
+ g.prototype.whereNotBetween = function(t, e) {
869
900
  const r = this._handleBatchData("whereNotBetween", [t, e]);
870
901
  return r || (this.filters[t] = { notBetween: e }, this);
871
902
  };
872
- d.prototype.whereBetween = function(t, e) {
903
+ g.prototype.whereBetween = function(t, e) {
873
904
  const r = this._handleBatchData("whereBetween", [t, e]);
874
905
  return r || (this.filters[t] = { between: e }, this);
875
906
  };
876
- d.prototype.sortBy = function(t) {
907
+ g.prototype.sortBy = function(t) {
877
908
  return this.steps.push({ type: "sortBy", args: [t] }), typeof t == "string" && (this._sort = t), this;
878
909
  };
879
- d.prototype.sortByDesc = function(t) {
910
+ g.prototype.sortByDesc = function(t) {
880
911
  return this.steps.push({ type: "sortByDesc", args: [t] }), typeof t == "string" && (this._sort = t, this._sortDesc = !0), this;
881
912
  };
882
- d.prototype.skip = function(t) {
913
+ g.prototype.skip = function(t) {
883
914
  if (t < 0)
884
915
  throw new Error("Offset must be non-negative");
885
916
  return this.already_offset && this.steps.push({ type: "skip", args: [t] }), this.offset = t, this.already_offset = !0, this;
886
917
  };
887
- d.prototype.take = function(t) {
918
+ g.prototype.take = function(t) {
888
919
  if (t < 0)
889
920
  throw new Error("Length must be non-negative");
890
921
  return this.already_limit ? (this.steps.push({ type: "take", args: [t] }), this) : (this.limit = t, this.already_limit = !0, this);
891
922
  };
892
- d.prototype.splice = function(t, e) {
923
+ g.prototype.splice = function(t, e) {
893
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;
894
925
  };
895
- const R = (t, e) => {
896
- const r = new d(e);
897
- return r.data_path = Pt + t, r;
898
- }, St = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
926
+ const W = (t, e) => {
927
+ const r = new g(e);
928
+ return r.data_path = Et + t, r;
929
+ }, qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
899
930
  __proto__: null,
900
- default: R
901
- }, Symbol.toStringTag, { value: "Module" })), Gt = (t) => {
931
+ default: W
932
+ }, Symbol.toStringTag, { value: "Module" })), Ht = (t) => {
902
933
  const e = typeof window > "u";
903
934
  let r = [];
904
- const o = H.create({
935
+ const n = z.create({
905
936
  baseURL: t,
906
937
  withCredentials: !0
907
938
  });
908
- e && (o.interceptors.request.use((u) => (u.withCredentials = !0, r.length > 0 && (u.headers.Cookie = r.join("; ")), u)), o.interceptors.response.use((u) => {
909
- if (u.headers["set-cookie"]) {
910
- const l = u.headers["set-cookie"].map((s) => s.split(";")[0]), h = /* @__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();
911
942
  r.forEach((s) => {
912
- const n = s.split("=")[0];
913
- h.set(n, s);
943
+ const a = s.split("=")[0];
944
+ h.set(a, s);
914
945
  }), l.forEach((s) => {
915
- const n = s.split("=")[0];
916
- h.set(n, s);
946
+ const a = s.split("=")[0];
947
+ h.set(a, s);
917
948
  }), r = Array.from(h.values());
918
949
  }
919
- return u;
950
+ return c;
920
951
  }));
921
- const i = {
922
- post: o.post,
952
+ const o = {
953
+ post: n.post,
923
954
  baseURL: t,
924
- axios: o,
925
- auth: lt(),
955
+ axios: n,
956
+ auth: lt,
926
957
  mutation: p,
927
958
  query: y,
928
- config: mt,
929
- mail: jt,
930
- users: wt(),
931
- model(u) {
932
- return U(u);
959
+ config: Ft,
960
+ mail: Pt,
961
+ users: bt,
962
+ model(c) {
963
+ return P(c);
933
964
  },
934
- roles: Dt(),
935
- collect: (u, l) => {
936
- const h = R(u, l);
937
- return h.data_path = U(u).getDataPath(), h;
965
+ roles: jt(),
966
+ collect: (c, l) => {
967
+ const h = W(c, l);
968
+ return h.data_path = P(c).getDataPath(), h;
938
969
  },
939
- list: (u, l) => k(u, l).dataPath(U(u).getDataPath()),
940
- drive: pt,
941
- async collects(u) {
970
+ list: (c, l) => C(c, l).dataPath(P(c).getDataPath()),
971
+ drive: gt,
972
+ async collects(c) {
942
973
  const l = {}, h = {};
943
- for (const n in u) {
944
- const c = u[n].getQueryPayload();
945
- h[n] = c.data_path, l[n] = {};
946
- const a = c.data_path.split(".");
947
- let f = a[a.length - 1], g = l[n];
948
- for (const _ of a) {
949
- if (_ === f) {
950
- g[_] = c.query;
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;
951
982
  break;
952
983
  }
953
- g[_] = g[_] || {};
984
+ _[d] = _[d] || {};
954
985
  }
955
- l[n].__aliasFor = a[0];
986
+ l[a].__aliasFor = u[0];
956
987
  }
957
988
  const s = await y(l);
958
- for (const n in u) {
959
- const c = h[n].split(".");
960
- let a = c[c.length - 1], f = s[n];
961
- for (const g of c) {
962
- if (g === a) {
963
- u[n]._batchData = s[n][g];
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][_];
964
995
  break;
965
996
  }
966
- f[g] = f[g] || {};
997
+ f[_] = f[_] || {};
967
998
  }
968
999
  }
969
- return u;
1000
+ return c;
970
1001
  }
971
1002
  };
972
- return Y(i), i;
973
- }, Wt = k;
1003
+ return X(o), o;
1004
+ }, Xt = C;
974
1005
  export {
1006
+ A as arrayHasFile,
975
1007
  lt as auth,
976
1008
  rt as changeExpiredPassword,
977
- Lt as clearModels,
978
- Gt as createClient,
979
- R as createCollection,
980
- k as createList,
981
- At as createRole,
982
- gt as createUser,
983
- W as defaultUserFields,
984
- L as defineModel,
985
- Qt as defineModels,
986
- Ot as deleteRole,
987
- dt as deleteUser,
1009
+ Gt as clearModels,
1010
+ Ht as createClient,
1011
+ W as createCollection,
1012
+ Lt as createFileFromBase64,
1013
+ $t as createFileFromBase85,
1014
+ M as createFileFromString,
1015
+ C as createList,
1016
+ Ct as createRole,
1017
+ _t as createUser,
1018
+ G as defaultUserFields,
1019
+ J as defineModel,
1020
+ Rt as defineModels,
1021
+ Dt as deleteRole,
1022
+ yt as deleteUser,
988
1023
  ot as forgetPassword,
989
- N as getApiClient,
990
- Nt as getApiClientOptional,
991
- mt as getConfig,
1024
+ q as getApiClient,
1025
+ Jt as getApiClientOptional,
1026
+ Ft as getConfig,
992
1027
  x as getCurrentUser,
993
- pt as getDrive,
1028
+ gt as getDrive,
994
1029
  ct as getGrantedRights,
995
- U as getModel,
996
- Bt as hasModel,
1030
+ P as getModel,
1031
+ Qt as hasModel,
997
1032
  at as isGranted,
998
- Wt as list,
999
- $t as listDrives,
1033
+ Xt as list,
1034
+ zt as listDrives,
1000
1035
  ut as listFiles,
1001
- ft as listFolders,
1002
- Jt as listModels,
1003
- Tt as listPermissions,
1004
- Ft as listRoles,
1005
- _t as listUsers,
1036
+ pt as listFolders,
1037
+ Tt as listModels,
1038
+ Wt as listPermissions,
1039
+ Ot as listRoles,
1040
+ wt as listUsers,
1006
1041
  tt as login,
1007
1042
  et as logout,
1008
1043
  p as mutation,
1044
+ B as objectHasFile,
1009
1045
  y as query,
1010
1046
  ht as readFileAsBase64,
1011
1047
  nt as resetPassword,
1012
- Ct as sendMail,
1013
- Y as setApiClient,
1014
- kt as toQuery,
1048
+ kt as sendMail,
1049
+ X as setApiClient,
1050
+ Ut as toQuery,
1015
1051
  st as updatePassword,
1016
- yt as updateUser,
1052
+ mt as updateUser,
1017
1053
  it as verifyCode,
1018
1054
  K as webAuthn
1019
1055
  };