@hostlink/light 3.0.4 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/createClient.d.ts +0 -4
- package/dist/index.d.ts +2 -2
- package/dist/light.js +416 -515
- package/dist/light.umd.cjs +1 -1
- package/dist/model.d.ts +1 -1
- package/dist/models.d.ts +205 -88
- package/package.json +1 -1
package/dist/light.js
CHANGED
|
@@ -1,93 +1,121 @@
|
|
|
1
|
-
import { jsonToGraphQLQuery as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { jsonToGraphQLQuery as B, VariableType as b } from "json-to-graphql-query";
|
|
2
|
+
import X from "axios";
|
|
3
|
+
import S from "collect.js";
|
|
4
|
+
function U(t) {
|
|
5
5
|
if (t === null || typeof t != "object")
|
|
6
6
|
return !1;
|
|
7
7
|
const e = Object.getPrototypeOf(t);
|
|
8
8
|
return e !== null && e !== Object.prototype && Object.getPrototypeOf(e) !== null || Symbol.iterator in t ? !1 : Symbol.toStringTag in t ? Object.prototype.toString.call(t) === "[object Module]" : !0;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
if (!
|
|
12
|
-
return
|
|
10
|
+
function v(t, e, r = ".", n) {
|
|
11
|
+
if (!U(e))
|
|
12
|
+
return v(t, {}, r, n);
|
|
13
13
|
const i = Object.assign({}, e);
|
|
14
|
-
for (const
|
|
15
|
-
if (
|
|
14
|
+
for (const h in t) {
|
|
15
|
+
if (h === "__proto__" || h === "constructor")
|
|
16
16
|
continue;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
i[
|
|
21
|
-
(r ? `${r}.` : "") +
|
|
17
|
+
const l = t[h];
|
|
18
|
+
l != null && (n && n(i, h, l, r) || (Array.isArray(l) && Array.isArray(i[h]) ? i[h] = [...l, ...i[h]] : U(l) && U(i[h]) ? i[h] = v(
|
|
19
|
+
l,
|
|
20
|
+
i[h],
|
|
21
|
+
(r ? `${r}.` : "") + h.toString(),
|
|
22
22
|
n
|
|
23
|
-
) : i[
|
|
23
|
+
) : i[h] = l));
|
|
24
24
|
}
|
|
25
25
|
return i;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function Y(t) {
|
|
28
28
|
return (...e) => (
|
|
29
29
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
30
|
-
e.reduce((r, n) =>
|
|
30
|
+
e.reduce((r, n) => v(r, n, "", t), {})
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
if (!
|
|
33
|
+
const F = Y();
|
|
34
|
+
let j = null;
|
|
35
|
+
const Z = (t) => {
|
|
36
|
+
j = t;
|
|
37
|
+
}, M = () => {
|
|
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 N(t) {
|
|
49
49
|
for (let e in t)
|
|
50
|
-
if (t[e] instanceof File || t[e] instanceof Array &&
|
|
50
|
+
if (t[e] instanceof File || t[e] instanceof Array && D(t[e]))
|
|
51
51
|
return !0;
|
|
52
52
|
return !1;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function V(t) {
|
|
55
|
+
t = "<~" + t + "~>";
|
|
56
|
+
var e, r, n, i, h, l = String, u = 255;
|
|
57
|
+
for (t.slice(0, 2) === "<~" && t.slice(-2), t = t.slice(2, -2).replace(/\s/g, "").replace("z", "!!!!!"), e = "uuuuu".slice(t.length % 5 || 5), t += e, n = [], i = 0, h = t.length; h > i; i += 5) r = 52200625 * (t.charCodeAt(i) - 33) + 614125 * (t.charCodeAt(i + 1) - 33) + 7225 * (t.charCodeAt(i + 2) - 33) + 85 * (t.charCodeAt(i + 3) - 33) + (t.charCodeAt(i + 4) - 33), n.push(u & r >> 24, u & r >> 16, u & r >> 8, u & r);
|
|
58
|
+
return (function(s, o) {
|
|
59
|
+
for (var c = o; c > 0; c--) s.pop();
|
|
60
|
+
})(n, e.length), l.fromCharCode.apply(l, n);
|
|
61
|
+
}
|
|
62
|
+
const J = (t = "") => {
|
|
63
|
+
const e = t, r = (n = "application/octet-stream") => {
|
|
64
|
+
const i = new Uint8Array(e.length);
|
|
65
|
+
for (let u = 0; u < e.length; u++)
|
|
66
|
+
i[u] = e.charCodeAt(u);
|
|
67
|
+
const h = new Blob([i], { type: n });
|
|
68
|
+
return URL.createObjectURL(h);
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
getContent: () => e,
|
|
72
|
+
getURL: r,
|
|
73
|
+
download: (n) => {
|
|
74
|
+
const i = document.createElement("a");
|
|
75
|
+
i.download = n, i.href = r(), document.body.appendChild(i), i.click(), document.body.removeChild(i);
|
|
76
|
+
},
|
|
77
|
+
open: (n) => {
|
|
78
|
+
window.open(r(n), "_blank");
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}, Lt = (t) => J(atob(t)), Qt = (t) => J(V(t));
|
|
82
|
+
function L(t, e, r, n, i) {
|
|
55
83
|
if (!(!t || typeof t != "object"))
|
|
56
|
-
for (let
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
if ("__args" in
|
|
60
|
-
const u =
|
|
84
|
+
for (let h in t) {
|
|
85
|
+
const l = t[h];
|
|
86
|
+
if (l && typeof l == "object") {
|
|
87
|
+
if ("__args" in l) {
|
|
88
|
+
const u = l.__args, s = {};
|
|
61
89
|
Object.entries(u).forEach(([o, c]) => {
|
|
62
|
-
if (c instanceof Array &&
|
|
63
|
-
s[o] = new
|
|
64
|
-
let
|
|
65
|
-
c.forEach((
|
|
66
|
-
|
|
90
|
+
if (c instanceof Array && D(c)) {
|
|
91
|
+
s[o] = new b(o);
|
|
92
|
+
let a = 0;
|
|
93
|
+
c.forEach((p) => {
|
|
94
|
+
p instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + o + "." + a), n.append(i.current.toString(), p), i.current++, a++);
|
|
67
95
|
}), e[o] = "[Upload!]!";
|
|
68
|
-
} else c instanceof File ? (s[o] = new
|
|
69
|
-
if (
|
|
70
|
-
s[o][
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}), e[
|
|
75
|
-
} else
|
|
96
|
+
} else c instanceof File ? (s[o] = new b(o), r[i.current] = ["variables." + o], n.append(i.current.toString(), c), e[o] = "Upload!", i.current++) : c instanceof Object && N(c) ? (s[o] = {}, Object.entries(c).forEach(([a, p]) => {
|
|
97
|
+
if (p instanceof Array && D(p)) {
|
|
98
|
+
s[o][a] = new b(a);
|
|
99
|
+
let d = 0;
|
|
100
|
+
p.forEach((_) => {
|
|
101
|
+
_ instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + a + "." + d), n.append(i.current.toString(), _), i.current++, d++);
|
|
102
|
+
}), e[a] = "[Upload!]!";
|
|
103
|
+
} else p instanceof File ? (s[o][a] = new b(a), r[i.current] = ["variables." + a], n.append(i.current.toString(), p), e[a] = "Upload!", i.current++) : s[o][a] = p;
|
|
76
104
|
})) : c != null && (s[o] = c);
|
|
77
|
-
}),
|
|
105
|
+
}), l.__args = s;
|
|
78
106
|
}
|
|
79
|
-
|
|
107
|
+
L(l, e, r, n, i);
|
|
80
108
|
}
|
|
81
109
|
}
|
|
82
110
|
}
|
|
83
111
|
const y = async (t) => {
|
|
84
|
-
const e =
|
|
112
|
+
const e = M(), r = t, n = new FormData();
|
|
85
113
|
let i = !1;
|
|
86
|
-
const
|
|
87
|
-
|
|
114
|
+
const h = {}, l = {};
|
|
115
|
+
L(r, h, l, n, { current: 0 }), i = Object.keys(h).length > 0, i && (r.__variables = h);
|
|
88
116
|
let s = null;
|
|
89
|
-
const c =
|
|
90
|
-
if (i ? (n.append("map", JSON.stringify(
|
|
117
|
+
const c = B({ query: r });
|
|
118
|
+
if (i ? (n.append("map", JSON.stringify(l)), n.append("operations", JSON.stringify({
|
|
91
119
|
query: c
|
|
92
120
|
})), s = await e.axios.post("", n)) : s = await e.axios.post("", {
|
|
93
121
|
query: c
|
|
@@ -95,9 +123,9 @@ const y = async (t) => {
|
|
|
95
123
|
throw new Error(s.data.errors[0].message);
|
|
96
124
|
return s.data.data;
|
|
97
125
|
};
|
|
98
|
-
function
|
|
99
|
-
let r, n = [], i,
|
|
100
|
-
const
|
|
126
|
+
function k(t, e) {
|
|
127
|
+
let r, n = [], i, h;
|
|
128
|
+
const l = (s) => !s || typeof s != "object" ? !1 : Object.values(s).some((o) => o && typeof o == "object" && Object.keys(o).some((c) => c.startsWith("_"))), u = () => n.length === 0 ? (n.unshift({}), n[0]) : (l(n[0]) && n.unshift({}), n[0]);
|
|
101
129
|
return {
|
|
102
130
|
first() {
|
|
103
131
|
return this.fetchFirst();
|
|
@@ -111,26 +139,26 @@ function C(t, e) {
|
|
|
111
139
|
},
|
|
112
140
|
async fetchWithMeta() {
|
|
113
141
|
let o = await y(this.toQuery(!0));
|
|
114
|
-
if (
|
|
115
|
-
const c =
|
|
116
|
-
for (const
|
|
117
|
-
o = o[
|
|
142
|
+
if (h) {
|
|
143
|
+
const c = h.split(".");
|
|
144
|
+
for (const a of c)
|
|
145
|
+
o = o[a];
|
|
118
146
|
return o;
|
|
119
147
|
}
|
|
120
148
|
return o[`list${t}`];
|
|
121
149
|
},
|
|
122
150
|
async fetch() {
|
|
123
151
|
let o = await y(this.toQuery());
|
|
124
|
-
if (
|
|
125
|
-
const c =
|
|
126
|
-
for (const
|
|
127
|
-
o = o[
|
|
152
|
+
if (h) {
|
|
153
|
+
const c = h.split(".");
|
|
154
|
+
for (const a of c)
|
|
155
|
+
o = o[a];
|
|
128
156
|
return o.data;
|
|
129
157
|
}
|
|
130
158
|
return o[`list${t}`].data;
|
|
131
159
|
},
|
|
132
160
|
dataPath(s) {
|
|
133
|
-
return s && typeof s == "string" && (
|
|
161
|
+
return s && typeof s == "string" && (h = s), this;
|
|
134
162
|
},
|
|
135
163
|
sort(s) {
|
|
136
164
|
return s && typeof s == "string" && (i = s), this;
|
|
@@ -142,7 +170,7 @@ function C(t, e) {
|
|
|
142
170
|
// where('key', value) -> exact match
|
|
143
171
|
// where('key', '>', value) -> operator-based (>, <, >=, <=, !=, in, contains)
|
|
144
172
|
where(s, o, c) {
|
|
145
|
-
const
|
|
173
|
+
const a = (p, d, _) => {
|
|
146
174
|
const O = {
|
|
147
175
|
">": "_gt",
|
|
148
176
|
"<": "_lt",
|
|
@@ -151,14 +179,14 @@ function C(t, e) {
|
|
|
151
179
|
"!=": "_ne",
|
|
152
180
|
in: "_in",
|
|
153
181
|
contains: "_contains"
|
|
154
|
-
}[
|
|
155
|
-
O && n.push({ [
|
|
182
|
+
}[d];
|
|
183
|
+
O && n.push({ [p]: { [O]: _ } });
|
|
156
184
|
};
|
|
157
185
|
if (c !== void 0)
|
|
158
|
-
|
|
186
|
+
a(s, String(o), c);
|
|
159
187
|
else {
|
|
160
|
-
const
|
|
161
|
-
n[0] =
|
|
188
|
+
const p = u(), d = F(p, { [s]: o });
|
|
189
|
+
n[0] = d;
|
|
162
190
|
}
|
|
163
191
|
return this;
|
|
164
192
|
},
|
|
@@ -166,8 +194,8 @@ function C(t, e) {
|
|
|
166
194
|
// If the same field is used multiple times, it merges them into an array
|
|
167
195
|
whereContains(s, o) {
|
|
168
196
|
if (s && typeof s == "string") {
|
|
169
|
-
const c = u(),
|
|
170
|
-
c[s] ? Array.isArray(c[s]) ? c[s].push(
|
|
197
|
+
const c = u(), a = { _contains: o };
|
|
198
|
+
c[s] ? Array.isArray(c[s]) ? c[s].push(a) : c[s] = [c[s], a] : c[s] = [a], n[0] = c;
|
|
171
199
|
}
|
|
172
200
|
return this;
|
|
173
201
|
},
|
|
@@ -176,46 +204,46 @@ function C(t, e) {
|
|
|
176
204
|
// If the same field is used multiple times, it merges them into an array
|
|
177
205
|
whereIn(s, o) {
|
|
178
206
|
if (s && typeof s == "string" && Array.isArray(o)) {
|
|
179
|
-
const c = u(),
|
|
180
|
-
c[s] ? Array.isArray(c[s]) ? c[s].push(
|
|
207
|
+
const c = u(), a = { _in: o };
|
|
208
|
+
c[s] ? Array.isArray(c[s]) ? c[s].push(a) : c[s] = [c[s], a] : c[s] = [a], n[0] = c;
|
|
181
209
|
}
|
|
182
210
|
return this;
|
|
183
211
|
},
|
|
184
212
|
// whereBetween adds a _between filter for a specific field
|
|
185
213
|
whereBetween(s, o, c) {
|
|
186
214
|
if (s && typeof s == "string") {
|
|
187
|
-
const
|
|
188
|
-
|
|
215
|
+
const a = u(), p = { _between: [o, c] };
|
|
216
|
+
a[s] ? Array.isArray(a[s]) ? a[s].push(p) : a[s] = [a[s], p] : a[s] = p, n[0] = a;
|
|
189
217
|
}
|
|
190
218
|
return this;
|
|
191
219
|
},
|
|
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 = F(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 = F(r || {}, { offset: s })), this;
|
|
199
227
|
},
|
|
200
228
|
toQuery(s = !1) {
|
|
201
229
|
let o;
|
|
202
|
-
const c = n.length > 0 && Object.keys(n[0] || {}).length > 0,
|
|
203
|
-
c &&
|
|
204
|
-
const
|
|
230
|
+
const c = n.length > 0 && Object.keys(n[0] || {}).length > 0, a = c ? 1 : 0, p = n.length > a;
|
|
231
|
+
c && p ? o = n : p ? o = n.slice(a) : c && (o = n[0]);
|
|
232
|
+
const d = F(
|
|
205
233
|
i ? { sort: i } : {},
|
|
206
234
|
o ? { filters: o } : {}
|
|
207
|
-
),
|
|
235
|
+
), _ = {
|
|
208
236
|
data: {
|
|
209
237
|
...e
|
|
210
238
|
}
|
|
211
239
|
};
|
|
212
|
-
if (r && (
|
|
240
|
+
if (r && (_.data.__args = r), Object.keys(d).length > 0 && (_.__args = d), s && (_.meta = {
|
|
213
241
|
total: !0,
|
|
214
242
|
key: !0,
|
|
215
243
|
name: !0
|
|
216
|
-
}),
|
|
217
|
-
const w =
|
|
218
|
-
let O =
|
|
244
|
+
}), h) {
|
|
245
|
+
const w = h.split(".");
|
|
246
|
+
let O = _;
|
|
219
247
|
for (let P = w.length - 1; P >= 0; P--)
|
|
220
248
|
O = {
|
|
221
249
|
[w[P]]: O
|
|
@@ -223,243 +251,110 @@ function C(t, e) {
|
|
|
223
251
|
return O;
|
|
224
252
|
}
|
|
225
253
|
return {
|
|
226
|
-
[`list${t}`]:
|
|
254
|
+
[`list${t}`]: _
|
|
227
255
|
};
|
|
228
256
|
}
|
|
229
257
|
};
|
|
230
258
|
}
|
|
231
|
-
const
|
|
259
|
+
const I = (t, e = {}) => {
|
|
232
260
|
const r = t, n = e;
|
|
233
261
|
let i = "list" + t;
|
|
234
|
-
const
|
|
262
|
+
const h = (l) => n[l] ? n[l] : null;
|
|
235
263
|
return {
|
|
236
|
-
field:
|
|
264
|
+
field: h,
|
|
237
265
|
$fields: n,
|
|
238
|
-
setDataPath(
|
|
239
|
-
return i =
|
|
266
|
+
setDataPath(l) {
|
|
267
|
+
return i = l, i;
|
|
240
268
|
},
|
|
241
269
|
getDataPath() {
|
|
242
270
|
return i;
|
|
243
271
|
},
|
|
244
|
-
gqlFields(
|
|
272
|
+
gqlFields(l) {
|
|
245
273
|
let u = {};
|
|
246
|
-
for (const s of
|
|
274
|
+
for (const s of l)
|
|
247
275
|
if (typeof s == "string") {
|
|
248
|
-
const o =
|
|
249
|
-
o && (u =
|
|
250
|
-
} else typeof s == "object" && (u =
|
|
276
|
+
const o = h(s);
|
|
277
|
+
o && (u = F(u, o.gqlField ? typeof o.gqlField == "string" ? { [o.gqlField]: !0 } : o.gqlField : { [o.name || s]: !0 }));
|
|
278
|
+
} else typeof s == "object" && (u = F(u, s));
|
|
251
279
|
return u;
|
|
252
280
|
},
|
|
253
|
-
update(
|
|
254
|
-
return
|
|
281
|
+
update(l, u) {
|
|
282
|
+
return f({
|
|
255
283
|
["update" + r]: {
|
|
256
|
-
__args: { id:
|
|
284
|
+
__args: { id: l, data: u }
|
|
257
285
|
}
|
|
258
286
|
}).then((s) => s["update" + r]);
|
|
259
287
|
},
|
|
260
|
-
async delete(
|
|
261
|
-
return
|
|
288
|
+
async delete(l) {
|
|
289
|
+
return f({
|
|
262
290
|
["delete" + r]: {
|
|
263
|
-
__args: { id:
|
|
291
|
+
__args: { id: l }
|
|
264
292
|
}
|
|
265
293
|
}).then((u) => u["delete" + r]);
|
|
266
294
|
},
|
|
267
|
-
add(
|
|
268
|
-
return
|
|
295
|
+
add(l) {
|
|
296
|
+
return f({
|
|
269
297
|
["add" + r]: {
|
|
270
|
-
__args: { data:
|
|
298
|
+
__args: { data: l }
|
|
271
299
|
}
|
|
272
300
|
}).then((u) => u["add" + r]);
|
|
273
301
|
},
|
|
274
|
-
fields(
|
|
302
|
+
fields(l) {
|
|
275
303
|
let u = [];
|
|
276
|
-
for (let s of
|
|
277
|
-
const o =
|
|
304
|
+
for (let s of l) {
|
|
305
|
+
const o = h(s);
|
|
278
306
|
o && u.push(o);
|
|
279
307
|
}
|
|
280
308
|
return u;
|
|
281
309
|
},
|
|
282
|
-
async get(
|
|
283
|
-
const s = (await Promise.resolve().then(() =>
|
|
284
|
-
for (const [c,
|
|
285
|
-
o.where(c, "==",
|
|
310
|
+
async get(l, u) {
|
|
311
|
+
const s = (await Promise.resolve().then(() => qt)).default, o = s(r, Ut(u));
|
|
312
|
+
for (const [c, a] of Object.entries(l))
|
|
313
|
+
o.where(c, "==", a);
|
|
286
314
|
return await o.first();
|
|
287
315
|
},
|
|
288
|
-
list(
|
|
289
|
-
let u =
|
|
316
|
+
list(l) {
|
|
317
|
+
let u = l;
|
|
290
318
|
const s = {};
|
|
291
|
-
Object.entries(
|
|
292
|
-
n[
|
|
319
|
+
Object.entries(l).forEach(([a]) => {
|
|
320
|
+
n[a] && (s[a] = n[a], n[a].gqlField && (delete u[a], u = F(u, n[a].gqlField)), n[a].gql && (u = F(u, n[a].gql), delete u[a]));
|
|
293
321
|
});
|
|
294
|
-
const o =
|
|
322
|
+
const o = k(r, u).dataPath(i), c = o.fetch.bind(o);
|
|
295
323
|
return {
|
|
296
324
|
...o,
|
|
297
325
|
async fetch() {
|
|
298
|
-
return (await c()).map((
|
|
299
|
-
const
|
|
300
|
-
return Object.entries(s).forEach(([
|
|
301
|
-
w.format && typeof w.format == "function" && (_
|
|
302
|
-
}),
|
|
326
|
+
return (await c()).map((p) => {
|
|
327
|
+
const d = { ...p };
|
|
328
|
+
return Object.entries(s).forEach(([_, w]) => {
|
|
329
|
+
w.format && typeof w.format == "function" && (d[_] = w.format(p));
|
|
330
|
+
}), d;
|
|
303
331
|
});
|
|
304
332
|
},
|
|
305
333
|
async fetchFirst() {
|
|
306
|
-
const
|
|
307
|
-
if (!
|
|
308
|
-
const
|
|
309
|
-
return Object.entries(s).forEach(([
|
|
310
|
-
w.format && typeof w.format == "function" && (_
|
|
311
|
-
}),
|
|
334
|
+
const p = await o.fetchFirst.bind(o)();
|
|
335
|
+
if (!p) return p;
|
|
336
|
+
const d = { ...p };
|
|
337
|
+
return Object.entries(s).forEach(([_, w]) => {
|
|
338
|
+
w.format && typeof w.format == "function" && (d[_] = w.format(p));
|
|
339
|
+
}), d;
|
|
312
340
|
}
|
|
313
341
|
};
|
|
314
342
|
}
|
|
315
343
|
};
|
|
316
|
-
},
|
|
317
|
-
const
|
|
318
|
-
return
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
e[r] = i, t && (b[r] = i);
|
|
327
|
-
},
|
|
328
|
-
/**
|
|
329
|
-
* 獲取模型
|
|
330
|
-
* @param name 模型名稱
|
|
331
|
-
* @returns 模型實例
|
|
332
|
-
*/
|
|
333
|
-
get(r) {
|
|
334
|
-
return e[r] || (t && b[r] ? e[r] = b[r] : this.create(r, {})), e[r];
|
|
335
|
-
},
|
|
336
|
-
/**
|
|
337
|
-
* 檢查模型是否存在
|
|
338
|
-
* @param name 模型名稱
|
|
339
|
-
* @returns 是否存在
|
|
340
|
-
*/
|
|
341
|
-
has(r) {
|
|
342
|
-
return !!e[r] || t && !!b[r];
|
|
343
|
-
},
|
|
344
|
-
/**
|
|
345
|
-
* 列出所有模型名稱
|
|
346
|
-
* @returns 模型名稱陣列
|
|
347
|
-
*/
|
|
348
|
-
list() {
|
|
349
|
-
const r = Object.keys(e), n = t ? Object.keys(b) : [];
|
|
350
|
-
return [.../* @__PURE__ */ new Set([...r, ...n])];
|
|
351
|
-
},
|
|
352
|
-
/**
|
|
353
|
-
* 清除所有模型
|
|
354
|
-
*/
|
|
355
|
-
clear() {
|
|
356
|
-
Object.keys(e).forEach((r) => delete e[r]);
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
}, Nt = () => {
|
|
360
|
-
const t = v(!1);
|
|
361
|
-
return {
|
|
362
|
-
// 暴露完整的管理器
|
|
363
|
-
manager: t,
|
|
364
|
-
// 便利方法 - 直接暴露常用功能
|
|
365
|
-
createModel: t.create,
|
|
366
|
-
getModel: t.get,
|
|
367
|
-
hasModel: t.has,
|
|
368
|
-
listModels: t.list,
|
|
369
|
-
clearModels: t.clear,
|
|
370
|
-
/**
|
|
371
|
-
* 快速創建並獲取模型
|
|
372
|
-
* @param name 模型名稱
|
|
373
|
-
* @param fields 模型欄位定義
|
|
374
|
-
* @returns 模型實例
|
|
375
|
-
*/
|
|
376
|
-
defineModel(e, r) {
|
|
377
|
-
return t.create(e, r), t.get(e);
|
|
378
|
-
},
|
|
379
|
-
/**
|
|
380
|
-
* 批量創建模型
|
|
381
|
-
* @param models 模型定義對象
|
|
382
|
-
*/
|
|
383
|
-
defineModels(e) {
|
|
384
|
-
Object.entries(e).forEach(([r, n]) => {
|
|
385
|
-
t.create(r, n);
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
}, Bt = () => {
|
|
390
|
-
const t = v(!0);
|
|
391
|
-
return {
|
|
392
|
-
// 暴露完整的管理器
|
|
393
|
-
manager: t,
|
|
394
|
-
// 便利方法 - 直接暴露常用功能
|
|
395
|
-
createModel: t.create,
|
|
396
|
-
getModel: t.get,
|
|
397
|
-
hasModel: t.has,
|
|
398
|
-
listModels: t.list,
|
|
399
|
-
clearModels: t.clear,
|
|
400
|
-
/**
|
|
401
|
-
* 快速創建並獲取模型
|
|
402
|
-
* @param name 模型名稱
|
|
403
|
-
* @param fields 模型欄位定義
|
|
404
|
-
* @returns 模型實例
|
|
405
|
-
*/
|
|
406
|
-
defineModel(e, r) {
|
|
407
|
-
return t.create(e, r), t.get(e);
|
|
408
|
-
},
|
|
409
|
-
/**
|
|
410
|
-
* 批量創建模型
|
|
411
|
-
* @param models 模型定義對象
|
|
412
|
-
*/
|
|
413
|
-
defineModels(e) {
|
|
414
|
-
Object.entries(e).forEach(([r, n]) => {
|
|
415
|
-
t.create(r, n);
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
}, Jt = () => ({
|
|
420
|
-
/**
|
|
421
|
-
* 創建全域模型
|
|
422
|
-
* @param name 模型名稱
|
|
423
|
-
* @param fields 模型欄位定義
|
|
424
|
-
*/
|
|
425
|
-
define(t, e) {
|
|
426
|
-
const r = L(t, e);
|
|
427
|
-
return b[t] = r, r;
|
|
428
|
-
},
|
|
429
|
-
/**
|
|
430
|
-
* 獲取全域模型
|
|
431
|
-
* @param name 模型名稱
|
|
432
|
-
* @returns 模型實例
|
|
433
|
-
*/
|
|
434
|
-
get(t) {
|
|
435
|
-
return b[t];
|
|
436
|
-
},
|
|
437
|
-
/**
|
|
438
|
-
* 檢查全域模型是否存在
|
|
439
|
-
* @param name 模型名稱
|
|
440
|
-
* @returns 是否存在
|
|
441
|
-
*/
|
|
442
|
-
has(t) {
|
|
443
|
-
return !!b[t];
|
|
444
|
-
},
|
|
445
|
-
/**
|
|
446
|
-
* 列出所有全域模型
|
|
447
|
-
* @returns 模型名稱陣列
|
|
448
|
-
*/
|
|
449
|
-
list() {
|
|
450
|
-
return Object.keys(b);
|
|
451
|
-
},
|
|
452
|
-
/**
|
|
453
|
-
* 清除所有全域模型
|
|
454
|
-
*/
|
|
455
|
-
clear() {
|
|
456
|
-
Object.keys(b).forEach((t) => delete b[t]);
|
|
457
|
-
}
|
|
458
|
-
}), Lt = () => y({
|
|
344
|
+
}, A = {}, Q = (t, e) => {
|
|
345
|
+
const r = I(t, e);
|
|
346
|
+
return A[t] = r, r;
|
|
347
|
+
}, E = (t) => A[t] ? A[t] : Q(t, {}), Tt = (t) => !!A[t], $t = () => Object.keys(A), Gt = () => {
|
|
348
|
+
Object.keys(A).forEach((t) => delete A[t]);
|
|
349
|
+
}, Rt = (t) => {
|
|
350
|
+
Object.entries(t).forEach(([e, r]) => {
|
|
351
|
+
Q(e, r);
|
|
352
|
+
});
|
|
353
|
+
}, Wt = () => y({
|
|
459
354
|
app: {
|
|
460
355
|
permissions: !0
|
|
461
356
|
}
|
|
462
|
-
}).then((t) => t.app.permissions),
|
|
357
|
+
}).then((t) => t.app.permissions), T = async () => {
|
|
463
358
|
const { app: t } = await y({
|
|
464
359
|
app: {
|
|
465
360
|
auth: {
|
|
@@ -468,7 +363,7 @@ const L = (t, e) => {
|
|
|
468
363
|
}
|
|
469
364
|
}), e = t.auth.webAuthnRequestOptions, r = PublicKeyCredential.parseRequestOptionsFromJSON(e);
|
|
470
365
|
return await navigator.credentials.get({ publicKey: r });
|
|
471
|
-
},
|
|
366
|
+
}, $ = async () => {
|
|
472
367
|
const { app: t } = await y({
|
|
473
368
|
app: {
|
|
474
369
|
auth: {
|
|
@@ -477,31 +372,31 @@ const L = (t, e) => {
|
|
|
477
372
|
}
|
|
478
373
|
}), e = PublicKeyCredential.parseCreationOptionsFromJSON(t.auth.webAuthnCreationOptions);
|
|
479
374
|
return await navigator.credentials.create({ publicKey: e });
|
|
480
|
-
},
|
|
481
|
-
const t = await
|
|
482
|
-
return await
|
|
375
|
+
}, K = async () => {
|
|
376
|
+
const t = await T();
|
|
377
|
+
return await f({
|
|
483
378
|
webAuthnAssertion: {
|
|
484
379
|
__args: {
|
|
485
380
|
assertion: t.toJSON()
|
|
486
381
|
}
|
|
487
382
|
}
|
|
488
383
|
}).then((e) => e.webAuthnAssertion);
|
|
489
|
-
},
|
|
490
|
-
const t = await
|
|
491
|
-
return await
|
|
384
|
+
}, x = async () => {
|
|
385
|
+
const t = await $();
|
|
386
|
+
return await f({
|
|
492
387
|
webAuthnRegister: {
|
|
493
388
|
__args: {
|
|
494
389
|
registration: t.toJSON()
|
|
495
390
|
}
|
|
496
391
|
}
|
|
497
392
|
}).then((e) => e.webAuthnRegister);
|
|
498
|
-
},
|
|
393
|
+
}, tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
499
394
|
__proto__: null,
|
|
500
|
-
assertion:
|
|
501
|
-
attestation:
|
|
502
|
-
login:
|
|
503
|
-
register:
|
|
504
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
395
|
+
assertion: T,
|
|
396
|
+
attestation: $,
|
|
397
|
+
login: K,
|
|
398
|
+
register: x
|
|
399
|
+
}, Symbol.toStringTag, { value: "Module" })), et = (t = W) => y({ my: t }).then((e) => e.my), rt = (t, e, r = "") => f({ login: { __args: { username: t, password: e, code: r } } }).then((n) => n.login), st = () => f({ logout: !0 }).then((t) => t.logout), nt = (t, e, r) => f({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((n) => n.changeExpiredPassword), ot = (t, e) => f({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), it = (t, e, r) => f({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((n) => n.resetPassword), at = (t, e) => f({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), ct = (t, e) => f({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), lt = (t) => y({
|
|
505
400
|
my: {
|
|
506
401
|
granted: {
|
|
507
402
|
__args: {
|
|
@@ -509,7 +404,7 @@ const L = (t, e) => {
|
|
|
509
404
|
}
|
|
510
405
|
}
|
|
511
406
|
}
|
|
512
|
-
}).then((e) => e.my.granted),
|
|
407
|
+
}).then((e) => e.my.granted), ut = (t) => y({
|
|
513
408
|
my: {
|
|
514
409
|
grantedRights: {
|
|
515
410
|
__args: {
|
|
@@ -517,40 +412,40 @@ const L = (t, e) => {
|
|
|
517
412
|
}
|
|
518
413
|
}
|
|
519
414
|
}
|
|
520
|
-
}).then((e) => e.my.grantedRights),
|
|
521
|
-
getCurrentUser:
|
|
522
|
-
webAuthn:
|
|
415
|
+
}).then((e) => e.my.grantedRights), ht = () => ({
|
|
416
|
+
getCurrentUser: et,
|
|
417
|
+
webAuthn: tt,
|
|
523
418
|
google: {
|
|
524
|
-
unlink: () =>
|
|
525
|
-
login: (t) =>
|
|
526
|
-
register: (t) =>
|
|
419
|
+
unlink: () => f({ lightAuthUnlinkGoogle: !0 }).then((t) => t.lightAuthUnlinkGoogle),
|
|
420
|
+
login: (t) => f({ lightAuthLoginGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthLoginGoogle),
|
|
421
|
+
register: (t) => f({ lightAuthRegisterGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthRegisterGoogle)
|
|
527
422
|
},
|
|
528
423
|
facebook: {
|
|
529
|
-
unlink: () =>
|
|
530
|
-
login: (t) =>
|
|
531
|
-
register: (t) =>
|
|
424
|
+
unlink: () => f({ lightAuthUnlinkFacebook: !0 }).then((t) => t.lightAuthUnlinkFacebook),
|
|
425
|
+
login: (t) => f({ lightAuthLoginFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginFacebook),
|
|
426
|
+
register: (t) => f({ lightAuthRegisterFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthRegisterFacebook)
|
|
532
427
|
},
|
|
533
428
|
microsoft: {
|
|
534
|
-
unlink: () =>
|
|
535
|
-
login: (t) =>
|
|
536
|
-
register: (t) =>
|
|
429
|
+
unlink: () => f({ lightAuthUnlinkMicrosoft: !0 }).then((t) => t.lightAuthUnlinkMicrosoft),
|
|
430
|
+
login: (t) => f({ lightAuthLoginMicrosoft: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginMicrosoft),
|
|
431
|
+
register: (t) => f({ lightAuthRegisterMicrosoft: { __args: { account_id: t } } }).then((e) => e.lightAuthRegisterMicrosoft)
|
|
537
432
|
},
|
|
538
|
-
login:
|
|
539
|
-
logout:
|
|
540
|
-
changeExpiredPassword:
|
|
541
|
-
updatePassword:
|
|
542
|
-
resetPassword:
|
|
543
|
-
forgetPassword:
|
|
544
|
-
verifyCode:
|
|
545
|
-
grantedRights:
|
|
546
|
-
isGranted:
|
|
547
|
-
}),
|
|
433
|
+
login: rt,
|
|
434
|
+
logout: st,
|
|
435
|
+
changeExpiredPassword: nt,
|
|
436
|
+
updatePassword: ot,
|
|
437
|
+
resetPassword: it,
|
|
438
|
+
forgetPassword: at,
|
|
439
|
+
verifyCode: ct,
|
|
440
|
+
grantedRights: ut,
|
|
441
|
+
isGranted: lt
|
|
442
|
+
}), G = {
|
|
548
443
|
name: !0,
|
|
549
444
|
path: !0,
|
|
550
445
|
size: !0,
|
|
551
446
|
mime: !0,
|
|
552
447
|
url: !0
|
|
553
|
-
},
|
|
448
|
+
}, pt = (t, e, r = G) => y({
|
|
554
449
|
app: {
|
|
555
450
|
drive: {
|
|
556
451
|
__args: { index: t },
|
|
@@ -560,7 +455,7 @@ const L = (t, e) => {
|
|
|
560
455
|
}
|
|
561
456
|
}
|
|
562
457
|
}
|
|
563
|
-
}).then((n) => n.app.drive.files),
|
|
458
|
+
}).then((n) => n.app.drive.files), ft = (t, e) => y({
|
|
564
459
|
app: {
|
|
565
460
|
drive: {
|
|
566
461
|
__args: {
|
|
@@ -575,7 +470,7 @@ const L = (t, e) => {
|
|
|
575
470
|
}
|
|
576
471
|
}
|
|
577
472
|
}).then((r) => r.app.drive?.file?.base64Content), m = (t) => ({
|
|
578
|
-
list: (e, r =
|
|
473
|
+
list: (e, r = G) => pt(t, e, r),
|
|
579
474
|
get: (e, r = {
|
|
580
475
|
name: !0,
|
|
581
476
|
path: !0,
|
|
@@ -598,7 +493,7 @@ const L = (t, e) => {
|
|
|
598
493
|
}
|
|
599
494
|
}).then((n) => n.app.drive.file),
|
|
600
495
|
readFileAsBase64(e) {
|
|
601
|
-
return
|
|
496
|
+
return ft(t, e);
|
|
602
497
|
},
|
|
603
498
|
read: async (e) => {
|
|
604
499
|
let r = await y({
|
|
@@ -620,14 +515,14 @@ const L = (t, e) => {
|
|
|
620
515
|
throw new Error(`File not found or cannot read content: ${e}`);
|
|
621
516
|
return typeof window < "u" && window.atob ? window.atob(r.app.drive.file.base64Content) : r.app.drive.file.base64Content;
|
|
622
517
|
},
|
|
623
|
-
write: (e, r) =>
|
|
624
|
-
delete: (e) =>
|
|
625
|
-
rename: (e, r) =>
|
|
626
|
-
move: (e, r) =>
|
|
627
|
-
}),
|
|
518
|
+
write: (e, r) => f({ lightDriveWriteFile: { __args: { index: t, path: e, content: r } } }).then((n) => n.lightDriveWriteFile),
|
|
519
|
+
delete: (e) => f({ lightDriveDeleteFile: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFile),
|
|
520
|
+
rename: (e, r) => f({ lightDriveRenameFile: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFile),
|
|
521
|
+
move: (e, r) => f({ lightDriveMoveFile: { __args: { index: t, source: e, destination: r } } }).then((n) => n.lightDriveMoveFile)
|
|
522
|
+
}), R = {
|
|
628
523
|
name: !0,
|
|
629
524
|
path: !0
|
|
630
|
-
},
|
|
525
|
+
}, dt = (t, e, r = R) => y({
|
|
631
526
|
app: {
|
|
632
527
|
drive: {
|
|
633
528
|
__args: { index: t },
|
|
@@ -637,19 +532,19 @@ const L = (t, e) => {
|
|
|
637
532
|
}
|
|
638
533
|
}
|
|
639
534
|
}
|
|
640
|
-
}).then((n) => n.app.drive.folders),
|
|
641
|
-
list: (e, r =
|
|
642
|
-
create: (e) =>
|
|
643
|
-
delete: (e) =>
|
|
644
|
-
rename: (e, r) =>
|
|
645
|
-
}),
|
|
535
|
+
}).then((n) => n.app.drive.folders), C = (t) => ({
|
|
536
|
+
list: (e, r = R) => dt(t, e, r),
|
|
537
|
+
create: (e) => f({ lightDriveCreateFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveCreateFolder),
|
|
538
|
+
delete: (e) => f({ lightDriveDeleteFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFolder),
|
|
539
|
+
rename: (e, r) => f({ lightDriveRenameFolder: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFolder)
|
|
540
|
+
}), zt = () => y({
|
|
646
541
|
app: {
|
|
647
542
|
drives: {
|
|
648
543
|
index: !0,
|
|
649
544
|
name: !0
|
|
650
545
|
}
|
|
651
546
|
}
|
|
652
|
-
}).then((t) => t.app.drives),
|
|
547
|
+
}).then((t) => t.app.drives), gt = (t) => ({
|
|
653
548
|
listFiles: m(t).list,
|
|
654
549
|
getFile: m(t).get,
|
|
655
550
|
readFile: m(t).read,
|
|
@@ -657,11 +552,11 @@ const L = (t, e) => {
|
|
|
657
552
|
deleteFile: m(t).delete,
|
|
658
553
|
renameFile: m(t).rename,
|
|
659
554
|
moveFile: m(t).move,
|
|
660
|
-
listFolders:
|
|
661
|
-
createFolder:
|
|
662
|
-
deleteFolder:
|
|
663
|
-
renameFolder:
|
|
664
|
-
uploadTempFile: (e) =>
|
|
555
|
+
listFolders: C(t).list,
|
|
556
|
+
createFolder: C(t).create,
|
|
557
|
+
deleteFolder: C(t).delete,
|
|
558
|
+
renameFolder: C(t).rename,
|
|
559
|
+
uploadTempFile: (e) => f({
|
|
665
560
|
lightDriveUploadTempFile: {
|
|
666
561
|
__args: { index: t, file: e },
|
|
667
562
|
name: !0,
|
|
@@ -670,7 +565,7 @@ const L = (t, e) => {
|
|
|
670
565
|
mime: !0
|
|
671
566
|
}
|
|
672
567
|
}).then((r) => r.lightDriveUploadTempFile),
|
|
673
|
-
folders:
|
|
568
|
+
folders: C(t),
|
|
674
569
|
files: m(t)
|
|
675
570
|
}), W = {
|
|
676
571
|
user_id: !0,
|
|
@@ -678,24 +573,24 @@ const L = (t, e) => {
|
|
|
678
573
|
first_name: !0,
|
|
679
574
|
last_name: !0,
|
|
680
575
|
status: !0
|
|
681
|
-
},
|
|
576
|
+
}, _t = (t) => f({
|
|
682
577
|
addUser: {
|
|
683
578
|
__args: t
|
|
684
579
|
}
|
|
685
|
-
}).then((e) => e.addUser),
|
|
580
|
+
}).then((e) => e.addUser), yt = (t) => f({
|
|
686
581
|
deleteUser: {
|
|
687
582
|
__args: { id: t }
|
|
688
583
|
}
|
|
689
|
-
}).then((e) => e.deleteUser),
|
|
584
|
+
}).then((e) => e.deleteUser), wt = (t = W) => k("Users", t).dataPath("app.listUser").fetch(), mt = (t, e) => f({
|
|
690
585
|
updateUser: {
|
|
691
586
|
__args: { id: t, data: e }
|
|
692
587
|
}
|
|
693
|
-
}).then((r) => r.updateUser),
|
|
694
|
-
list:
|
|
695
|
-
create:
|
|
696
|
-
delete:
|
|
697
|
-
update:
|
|
698
|
-
}),
|
|
588
|
+
}).then((r) => r.updateUser), bt = () => ({
|
|
589
|
+
list: wt,
|
|
590
|
+
create: _t,
|
|
591
|
+
delete: yt,
|
|
592
|
+
update: mt
|
|
593
|
+
}), Ft = (t) => y({
|
|
699
594
|
app: {
|
|
700
595
|
listConfig: {
|
|
701
596
|
__args: {
|
|
@@ -709,13 +604,13 @@ const L = (t, e) => {
|
|
|
709
604
|
}
|
|
710
605
|
}
|
|
711
606
|
}
|
|
712
|
-
}).then((e) => e.app.listConfig.data[0]?.value),
|
|
607
|
+
}).then((e) => e.app.listConfig.data[0]?.value), At = {
|
|
713
608
|
name: !0
|
|
714
|
-
},
|
|
609
|
+
}, Ot = (t = At) => y({
|
|
715
610
|
app: {
|
|
716
611
|
roles: t
|
|
717
612
|
}
|
|
718
|
-
}).then((e) => e.app.roles),
|
|
613
|
+
}).then((e) => e.app.roles), Ct = (t, e) => f({
|
|
719
614
|
addRole: {
|
|
720
615
|
__args: {
|
|
721
616
|
data: {
|
|
@@ -724,64 +619,64 @@ const L = (t, e) => {
|
|
|
724
619
|
}
|
|
725
620
|
}
|
|
726
621
|
}
|
|
727
|
-
}).then((r) => r.addRole),
|
|
622
|
+
}).then((r) => r.addRole), Dt = (t) => f({
|
|
728
623
|
deleteRole: {
|
|
729
624
|
__args: { name: t }
|
|
730
625
|
}
|
|
731
|
-
}).then((e) => e.deleteRole),
|
|
732
|
-
list:
|
|
733
|
-
create:
|
|
734
|
-
delete:
|
|
626
|
+
}).then((e) => e.deleteRole), jt = () => ({
|
|
627
|
+
list: Ot,
|
|
628
|
+
create: Ct,
|
|
629
|
+
delete: Dt
|
|
735
630
|
});
|
|
736
631
|
function z(t, e, r, n, i) {
|
|
737
632
|
if (!(!t || typeof t != "object"))
|
|
738
|
-
for (let
|
|
739
|
-
const
|
|
740
|
-
if (
|
|
741
|
-
if ("__args" in
|
|
742
|
-
const u =
|
|
633
|
+
for (let h in t) {
|
|
634
|
+
const l = t[h];
|
|
635
|
+
if (l && typeof l == "object") {
|
|
636
|
+
if ("__args" in l) {
|
|
637
|
+
const u = l.__args, s = {};
|
|
743
638
|
Object.entries(u).forEach(([o, c]) => {
|
|
744
|
-
if (c instanceof Array &&
|
|
745
|
-
s[o] = new
|
|
746
|
-
let
|
|
747
|
-
c.forEach((
|
|
748
|
-
|
|
639
|
+
if (c instanceof Array && D(c)) {
|
|
640
|
+
s[o] = new b(o);
|
|
641
|
+
let a = 0;
|
|
642
|
+
c.forEach((p) => {
|
|
643
|
+
p instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + o + "." + a), n.append(i.current.toString(), p), i.current++, a++);
|
|
749
644
|
}), e[o] = "[Upload!]!";
|
|
750
|
-
} else c instanceof File ? (s[o] = new
|
|
751
|
-
if (
|
|
752
|
-
s[o][
|
|
753
|
-
let
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
}), e[
|
|
757
|
-
} else
|
|
645
|
+
} else c instanceof File ? (s[o] = new b(o), r[i.current] = ["variables." + o], n.append(i.current.toString(), c), e[o] = "Upload!", i.current++) : c instanceof Object && N(c) ? (s[o] = {}, Object.entries(c).forEach(([a, p]) => {
|
|
646
|
+
if (p instanceof Array && D(p)) {
|
|
647
|
+
s[o][a] = new b(a);
|
|
648
|
+
let d = 0;
|
|
649
|
+
p.forEach((_) => {
|
|
650
|
+
_ instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + a + "." + d), n.append(i.current.toString(), _), i.current++, d++);
|
|
651
|
+
}), e[a] = "[Upload!]!";
|
|
652
|
+
} else p instanceof File ? (s[o][a] = new b(a), r[i.current] = ["variables." + a], n.append(i.current.toString(), p), e[a] = "Upload!", i.current++) : s[o][a] = p;
|
|
758
653
|
})) : c != null && (s[o] = c);
|
|
759
|
-
}),
|
|
654
|
+
}), l.__args = s;
|
|
760
655
|
}
|
|
761
|
-
z(
|
|
656
|
+
z(l, e, r, n, i);
|
|
762
657
|
}
|
|
763
658
|
}
|
|
764
659
|
}
|
|
765
|
-
const
|
|
766
|
-
const r =
|
|
767
|
-
let
|
|
768
|
-
const
|
|
769
|
-
z(n,
|
|
660
|
+
const f = async (t) => {
|
|
661
|
+
const r = M().axios, n = t, i = new FormData();
|
|
662
|
+
let h = !1;
|
|
663
|
+
const l = {}, u = {};
|
|
664
|
+
z(n, l, u, i, { current: 0 }), h = Object.keys(l).length > 0, h && (n.__variables = l);
|
|
770
665
|
let o = null;
|
|
771
|
-
const
|
|
772
|
-
if (
|
|
773
|
-
query:
|
|
666
|
+
const a = B({ mutation: n });
|
|
667
|
+
if (h ? (i.append("map", JSON.stringify(u)), i.append("operations", JSON.stringify({
|
|
668
|
+
query: a
|
|
774
669
|
})), o = await r.post("", i)) : o = await r.post("", {
|
|
775
|
-
query:
|
|
670
|
+
query: a
|
|
776
671
|
}), o.data.errors)
|
|
777
672
|
throw new Error(o.data.errors[0].message);
|
|
778
673
|
return o.data.data;
|
|
779
|
-
},
|
|
780
|
-
send:
|
|
781
|
-
},
|
|
674
|
+
}, kt = (t, e, r) => f({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((n) => n.sendMail), Pt = {
|
|
675
|
+
send: kt
|
|
676
|
+
}, q = (t) => {
|
|
782
677
|
let e = {};
|
|
783
678
|
return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
|
|
784
|
-
Object.entries(
|
|
679
|
+
Object.entries(q(r)).forEach(([n, i]) => {
|
|
785
680
|
e[n] = i;
|
|
786
681
|
});
|
|
787
682
|
}), e) : (Object.entries(t).forEach(([r, n]) => {
|
|
@@ -793,9 +688,9 @@ const p = async (t) => {
|
|
|
793
688
|
e[r] = n;
|
|
794
689
|
return;
|
|
795
690
|
}
|
|
796
|
-
e[r] =
|
|
691
|
+
e[r] = q(n);
|
|
797
692
|
}), e);
|
|
798
|
-
},
|
|
693
|
+
}, Ut = (t) => q(t), Et = "list", St = [
|
|
799
694
|
"flatMap",
|
|
800
695
|
"chunk",
|
|
801
696
|
"shuffle",
|
|
@@ -821,7 +716,7 @@ const p = async (t) => {
|
|
|
821
716
|
"slice",
|
|
822
717
|
"tap",
|
|
823
718
|
"sort"
|
|
824
|
-
],
|
|
719
|
+
], vt = [
|
|
825
720
|
"avg",
|
|
826
721
|
"count",
|
|
827
722
|
"countBy",
|
|
@@ -849,7 +744,7 @@ const p = async (t) => {
|
|
|
849
744
|
"implode",
|
|
850
745
|
"partition"
|
|
851
746
|
];
|
|
852
|
-
class
|
|
747
|
+
class g {
|
|
853
748
|
_batchData = null;
|
|
854
749
|
data_path = "";
|
|
855
750
|
filters;
|
|
@@ -866,7 +761,7 @@ class d {
|
|
|
866
761
|
this.filters = {}, this.steps = [], this.fields = e;
|
|
867
762
|
}
|
|
868
763
|
}
|
|
869
|
-
|
|
764
|
+
g.prototype.getQueryPayload = function() {
|
|
870
765
|
let t = {
|
|
871
766
|
meta: {
|
|
872
767
|
total: !0,
|
|
@@ -880,26 +775,26 @@ d.prototype.getQueryPayload = function() {
|
|
|
880
775
|
steps: this.steps
|
|
881
776
|
};
|
|
882
777
|
};
|
|
883
|
-
|
|
778
|
+
g.prototype.dataPath = function(t) {
|
|
884
779
|
const e = this.clone();
|
|
885
780
|
return e.data_path = t, e;
|
|
886
781
|
};
|
|
887
|
-
|
|
782
|
+
g.prototype.buildArgs = function() {
|
|
888
783
|
let t = {};
|
|
889
784
|
return Object.keys(this.filters).length > 0 && (t.filters = this.filters), this._sort && (t.sort = this._sort, this._sortDesc && (t.sort += ":desc")), t;
|
|
890
785
|
};
|
|
891
|
-
|
|
786
|
+
g.prototype.clone = function() {
|
|
892
787
|
const t = Object.create(this);
|
|
893
788
|
return t.steps = JSON.parse(JSON.stringify(this.steps)), t.filters = JSON.parse(JSON.stringify(this.filters)), t.fields = JSON.parse(JSON.stringify(this.fields)), t;
|
|
894
789
|
};
|
|
895
|
-
|
|
790
|
+
S().macro("whereContains", function(t, e) {
|
|
896
791
|
return this.filter((r) => r[t].toLowerCase().includes(e.toLowerCase()));
|
|
897
792
|
});
|
|
898
|
-
|
|
793
|
+
g.prototype.fetchData = async function() {
|
|
899
794
|
try {
|
|
900
795
|
if (this._batchData) {
|
|
901
796
|
const u = this._batchData;
|
|
902
|
-
return this.meta = u.meta,
|
|
797
|
+
return this.meta = u.meta, S(u.data);
|
|
903
798
|
}
|
|
904
799
|
let t = {
|
|
905
800
|
meta: {
|
|
@@ -918,40 +813,40 @@ d.prototype.fetchData = async function() {
|
|
|
918
813
|
}
|
|
919
814
|
n[u] = {}, n = n[u];
|
|
920
815
|
}
|
|
921
|
-
let
|
|
816
|
+
let l = await y(r);
|
|
922
817
|
for (const u of e)
|
|
923
|
-
|
|
924
|
-
return this.meta =
|
|
818
|
+
l = l[u];
|
|
819
|
+
return this.meta = l.meta, S(l.data);
|
|
925
820
|
} catch (t) {
|
|
926
821
|
throw console.error("Error fetching collection data:", t), t;
|
|
927
822
|
}
|
|
928
823
|
};
|
|
929
|
-
|
|
824
|
+
g.prototype.processData = async function() {
|
|
930
825
|
let t = await this.fetchData();
|
|
931
826
|
for (const e of this.steps)
|
|
932
827
|
t = t[e.type](...e.args);
|
|
933
828
|
return t;
|
|
934
829
|
};
|
|
935
|
-
|
|
830
|
+
g.prototype.all = async function() {
|
|
936
831
|
return (await this.processData()).all();
|
|
937
832
|
};
|
|
938
|
-
for (const t of
|
|
939
|
-
|
|
833
|
+
for (const t of St)
|
|
834
|
+
g.prototype[t] = function(...e) {
|
|
940
835
|
const r = this.clone();
|
|
941
836
|
return r.steps.push({ type: t, args: e }), r;
|
|
942
837
|
};
|
|
943
|
-
for (const t of
|
|
944
|
-
|
|
838
|
+
for (const t of vt)
|
|
839
|
+
g.prototype[t] = async function(...e) {
|
|
945
840
|
return (await this.clone().processData())[t](...e);
|
|
946
841
|
};
|
|
947
|
-
|
|
948
|
-
|
|
842
|
+
g.prototype.average = g.prototype.avg;
|
|
843
|
+
g.prototype.first = async function() {
|
|
949
844
|
return this.take(1), (await this.processData()).first();
|
|
950
845
|
};
|
|
951
|
-
|
|
846
|
+
g.prototype._handleBatchData = function(t, e) {
|
|
952
847
|
return this._batchData ? (this.steps.push({ type: t, args: e }), this) : null;
|
|
953
848
|
};
|
|
954
|
-
|
|
849
|
+
g.prototype.where = function(...t) {
|
|
955
850
|
const e = this._handleBatchData("where", t);
|
|
956
851
|
if (e) return e;
|
|
957
852
|
if (t.length === 2)
|
|
@@ -983,169 +878,175 @@ d.prototype.where = function(...t) {
|
|
|
983
878
|
}
|
|
984
879
|
return this;
|
|
985
880
|
};
|
|
986
|
-
|
|
881
|
+
g.prototype.whereContains = function(t, e) {
|
|
987
882
|
const r = this._handleBatchData("whereContains", [t, e]);
|
|
988
883
|
return r || (this.filters[t] = { contains: e }, this);
|
|
989
884
|
};
|
|
990
|
-
|
|
885
|
+
g.prototype.forPage = function(t, e) {
|
|
991
886
|
return t = Math.max(1, t), this.already_limit ? (this.steps.push({ type: "forPage", args: [t, e] }), this) : (this.limit = e, this.offset = (t - 1) * e, this.already_limit = !0, this.already_offset = !0, this);
|
|
992
887
|
};
|
|
993
|
-
|
|
888
|
+
g.prototype.whereIn = function(t, e) {
|
|
994
889
|
const r = this._handleBatchData("whereIn", [t, e]);
|
|
995
890
|
return r || (this.filters[t] = { in: e }, this);
|
|
996
891
|
};
|
|
997
|
-
|
|
892
|
+
g.prototype.whereNotIn = function(t, e) {
|
|
998
893
|
const r = this._handleBatchData("whereNotIn", [t, e]);
|
|
999
894
|
return r || (this.filters[t] = { nin: e }, this);
|
|
1000
895
|
};
|
|
1001
|
-
|
|
896
|
+
g.prototype.whereNotBetween = function(t, e) {
|
|
1002
897
|
const r = this._handleBatchData("whereNotBetween", [t, e]);
|
|
1003
898
|
return r || (this.filters[t] = { notBetween: e }, this);
|
|
1004
899
|
};
|
|
1005
|
-
|
|
900
|
+
g.prototype.whereBetween = function(t, e) {
|
|
1006
901
|
const r = this._handleBatchData("whereBetween", [t, e]);
|
|
1007
902
|
return r || (this.filters[t] = { between: e }, this);
|
|
1008
903
|
};
|
|
1009
|
-
|
|
904
|
+
g.prototype.sortBy = function(t) {
|
|
1010
905
|
return this.steps.push({ type: "sortBy", args: [t] }), typeof t == "string" && (this._sort = t), this;
|
|
1011
906
|
};
|
|
1012
|
-
|
|
907
|
+
g.prototype.sortByDesc = function(t) {
|
|
1013
908
|
return this.steps.push({ type: "sortByDesc", args: [t] }), typeof t == "string" && (this._sort = t, this._sortDesc = !0), this;
|
|
1014
909
|
};
|
|
1015
|
-
|
|
910
|
+
g.prototype.skip = function(t) {
|
|
1016
911
|
if (t < 0)
|
|
1017
912
|
throw new Error("Offset must be non-negative");
|
|
1018
913
|
return this.already_offset && this.steps.push({ type: "skip", args: [t] }), this.offset = t, this.already_offset = !0, this;
|
|
1019
914
|
};
|
|
1020
|
-
|
|
915
|
+
g.prototype.take = function(t) {
|
|
1021
916
|
if (t < 0)
|
|
1022
917
|
throw new Error("Length must be non-negative");
|
|
1023
918
|
return this.already_limit ? (this.steps.push({ type: "take", args: [t] }), this) : (this.limit = t, this.already_limit = !0, this);
|
|
1024
919
|
};
|
|
1025
|
-
|
|
920
|
+
g.prototype.splice = function(t, e) {
|
|
1026
921
|
return this.steps.push({ type: "splice", args: [t, e] }), this.offset = t, this.limit = e, this.already_limit = !0, this.already_offset = !0, this;
|
|
1027
922
|
};
|
|
1028
|
-
const
|
|
1029
|
-
const r = new
|
|
1030
|
-
return r.data_path =
|
|
1031
|
-
},
|
|
923
|
+
const H = (t, e) => {
|
|
924
|
+
const r = new g(e);
|
|
925
|
+
return r.data_path = Et + t, r;
|
|
926
|
+
}, qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1032
927
|
__proto__: null,
|
|
1033
|
-
default:
|
|
1034
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
928
|
+
default: H
|
|
929
|
+
}, Symbol.toStringTag, { value: "Module" })), Ht = (t) => {
|
|
1035
930
|
const e = typeof window > "u";
|
|
1036
931
|
let r = [];
|
|
1037
|
-
const n =
|
|
932
|
+
const n = X.create({
|
|
1038
933
|
baseURL: t,
|
|
1039
934
|
withCredentials: !0
|
|
1040
935
|
});
|
|
1041
|
-
e && (n.interceptors.request.use((
|
|
1042
|
-
if (
|
|
1043
|
-
const
|
|
1044
|
-
r.forEach((
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1047
|
-
}),
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1050
|
-
}), r = Array.from(
|
|
936
|
+
e && (n.interceptors.request.use((h) => (h.withCredentials = !0, r.length > 0 && (h.headers.Cookie = r.join("; ")), h)), n.interceptors.response.use((h) => {
|
|
937
|
+
if (h.headers["set-cookie"]) {
|
|
938
|
+
const l = h.headers["set-cookie"].map((s) => s.split(";")[0]), u = /* @__PURE__ */ new Map();
|
|
939
|
+
r.forEach((s) => {
|
|
940
|
+
const o = s.split("=")[0];
|
|
941
|
+
u.set(o, s);
|
|
942
|
+
}), l.forEach((s) => {
|
|
943
|
+
const o = s.split("=")[0];
|
|
944
|
+
u.set(o, s);
|
|
945
|
+
}), r = Array.from(u.values());
|
|
1051
946
|
}
|
|
1052
|
-
return
|
|
947
|
+
return h;
|
|
1053
948
|
}));
|
|
1054
|
-
const i =
|
|
949
|
+
const i = {
|
|
1055
950
|
post: n.post,
|
|
1056
951
|
baseURL: t,
|
|
1057
952
|
axios: n,
|
|
1058
|
-
auth:
|
|
1059
|
-
mutation:
|
|
953
|
+
auth: ht(),
|
|
954
|
+
mutation: f,
|
|
1060
955
|
query: y,
|
|
1061
|
-
config:
|
|
1062
|
-
mail:
|
|
1063
|
-
users:
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
return i.get(a);
|
|
956
|
+
config: Ft,
|
|
957
|
+
mail: Pt,
|
|
958
|
+
users: bt(),
|
|
959
|
+
model(h) {
|
|
960
|
+
return E(h);
|
|
1067
961
|
},
|
|
1068
|
-
roles:
|
|
1069
|
-
collect: (
|
|
1070
|
-
const
|
|
1071
|
-
return
|
|
962
|
+
roles: jt(),
|
|
963
|
+
collect: (h, l) => {
|
|
964
|
+
const u = H(h, l);
|
|
965
|
+
return u.data_path = E(h).getDataPath(), u;
|
|
1072
966
|
},
|
|
1073
|
-
list: (
|
|
1074
|
-
drive:
|
|
1075
|
-
async collects(
|
|
1076
|
-
const
|
|
1077
|
-
for (const
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1080
|
-
const
|
|
1081
|
-
let
|
|
1082
|
-
for (const
|
|
1083
|
-
if (
|
|
1084
|
-
|
|
967
|
+
list: (h, l) => k(h, l).dataPath(E(h).getDataPath()),
|
|
968
|
+
drive: gt,
|
|
969
|
+
async collects(h) {
|
|
970
|
+
const l = {}, u = {};
|
|
971
|
+
for (const o in h) {
|
|
972
|
+
const c = h[o].getQueryPayload();
|
|
973
|
+
u[o] = c.data_path, l[o] = {};
|
|
974
|
+
const a = c.data_path.split(".");
|
|
975
|
+
let p = a[a.length - 1], d = l[o];
|
|
976
|
+
for (const _ of a) {
|
|
977
|
+
if (_ === p) {
|
|
978
|
+
d[_] = c.query;
|
|
1085
979
|
break;
|
|
1086
980
|
}
|
|
1087
|
-
|
|
981
|
+
d[_] = d[_] || {};
|
|
1088
982
|
}
|
|
1089
|
-
|
|
983
|
+
l[o].__aliasFor = a[0];
|
|
1090
984
|
}
|
|
1091
|
-
const
|
|
1092
|
-
for (const
|
|
1093
|
-
const
|
|
1094
|
-
let
|
|
1095
|
-
for (const
|
|
1096
|
-
if (
|
|
1097
|
-
|
|
985
|
+
const s = await y(l);
|
|
986
|
+
for (const o in h) {
|
|
987
|
+
const c = u[o].split(".");
|
|
988
|
+
let a = c[c.length - 1], p = s[o];
|
|
989
|
+
for (const d of c) {
|
|
990
|
+
if (d === a) {
|
|
991
|
+
h[o]._batchData = s[o][d];
|
|
1098
992
|
break;
|
|
1099
993
|
}
|
|
1100
|
-
|
|
994
|
+
p[d] = p[d] || {};
|
|
1101
995
|
}
|
|
1102
996
|
}
|
|
1103
|
-
return
|
|
997
|
+
return h;
|
|
1104
998
|
}
|
|
1105
999
|
};
|
|
1106
|
-
return
|
|
1107
|
-
},
|
|
1000
|
+
return Z(i), i;
|
|
1001
|
+
}, Xt = k;
|
|
1108
1002
|
export {
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1003
|
+
D as arrayHasFile,
|
|
1004
|
+
ht as auth,
|
|
1005
|
+
nt as changeExpiredPassword,
|
|
1006
|
+
Gt as clearModels,
|
|
1007
|
+
Ht as createClient,
|
|
1008
|
+
H as createCollection,
|
|
1009
|
+
Lt as createFileFromBase64,
|
|
1010
|
+
Qt as createFileFromBase85,
|
|
1011
|
+
J as createFileFromString,
|
|
1012
|
+
k as createList,
|
|
1013
|
+
Ct as createRole,
|
|
1014
|
+
_t as createUser,
|
|
1117
1015
|
W as defaultUserFields,
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1016
|
+
Q as defineModel,
|
|
1017
|
+
Rt as defineModels,
|
|
1018
|
+
Dt as deleteRole,
|
|
1019
|
+
yt as deleteUser,
|
|
1020
|
+
at as forgetPassword,
|
|
1021
|
+
M as getApiClient,
|
|
1022
|
+
Jt as getApiClientOptional,
|
|
1023
|
+
Ft as getConfig,
|
|
1024
|
+
et as getCurrentUser,
|
|
1025
|
+
gt as getDrive,
|
|
1026
|
+
ut as getGrantedRights,
|
|
1027
|
+
E as getModel,
|
|
1028
|
+
Tt as hasModel,
|
|
1029
|
+
lt as isGranted,
|
|
1030
|
+
Xt as list,
|
|
1031
|
+
zt as listDrives,
|
|
1032
|
+
pt as listFiles,
|
|
1033
|
+
dt as listFolders,
|
|
1034
|
+
$t as listModels,
|
|
1035
|
+
Wt as listPermissions,
|
|
1036
|
+
Ot as listRoles,
|
|
1037
|
+
wt as listUsers,
|
|
1038
|
+
rt as login,
|
|
1039
|
+
st as logout,
|
|
1040
|
+
f as mutation,
|
|
1041
|
+
N as objectHasFile,
|
|
1138
1042
|
y as query,
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
Nt as useModel,
|
|
1149
|
-
ot as verifyCode,
|
|
1150
|
-
K as webAuthn
|
|
1043
|
+
ft as readFileAsBase64,
|
|
1044
|
+
it as resetPassword,
|
|
1045
|
+
kt as sendMail,
|
|
1046
|
+
Z as setApiClient,
|
|
1047
|
+
Ut as toQuery,
|
|
1048
|
+
ot as updatePassword,
|
|
1049
|
+
mt as updateUser,
|
|
1050
|
+
ct as verifyCode,
|
|
1051
|
+
tt as webAuthn
|
|
1151
1052
|
};
|