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