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