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