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