@hostlink/light 3.2.8 → 3.3.2
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/README.md +422 -10
- package/dist/auth.d.ts +36 -1
- package/dist/config.d.ts +2 -0
- package/dist/createClient.d.ts +19 -16
- package/dist/createCollection.d.ts +3 -1
- package/dist/createList.d.ts +3 -1
- package/dist/drive.d.ts +56 -4
- package/dist/file.d.ts +12 -1
- package/dist/filesystem.d.ts +4 -1
- package/dist/folder.d.ts +9 -2
- package/dist/light.js +686 -578
- package/dist/light.umd.cjs +1 -1
- package/dist/mail.d.ts +4 -0
- package/dist/model.d.ts +9 -2
- package/dist/mutation.d.ts +3 -0
- package/dist/query.d.ts +2 -0
- package/dist/role.d.ts +6 -0
- package/dist/users.d.ts +7 -0
- package/dist/webauthn.d.ts +7 -0
- package/package.json +1 -1
- package/dist/drive.robust.test.d.ts +0 -1
- package/dist/drive.test.d.ts +0 -1
- /package/dist/{drive.basic.test.d.ts → createClient.test.d.ts} +0 -0
package/dist/light.js
CHANGED
|
@@ -1,131 +1,131 @@
|
|
|
1
|
-
import { jsonToGraphQLQuery as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { jsonToGraphQLQuery as Q, VariableType as O } from "json-to-graphql-query";
|
|
2
|
+
import L from "collect.js";
|
|
3
|
+
import ot from "axios";
|
|
4
|
+
function R(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 T(t, e, r = ".", s) {
|
|
11
|
+
if (!R(e))
|
|
12
|
+
return T(t, {}, r, s);
|
|
13
|
+
const n = Object.assign({}, e);
|
|
14
|
+
for (const h in t) {
|
|
15
|
+
if (h === "__proto__" || h === "constructor")
|
|
16
16
|
continue;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(r ? `${r}.` : "") +
|
|
17
|
+
const l = t[h];
|
|
18
|
+
l != null && (s && s(n, h, l, r) || (Array.isArray(l) && Array.isArray(n[h]) ? n[h] = [...l, ...n[h]] : R(l) && R(n[h]) ? n[h] = T(
|
|
19
|
+
l,
|
|
20
|
+
n[h],
|
|
21
|
+
(r ? `${r}.` : "") + h.toString(),
|
|
22
22
|
s
|
|
23
|
-
) :
|
|
23
|
+
) : n[h] = l));
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return n;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function it(t) {
|
|
28
28
|
return (...e) => (
|
|
29
29
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
30
|
-
e.reduce((r, s) =>
|
|
30
|
+
e.reduce((r, s) => T(r, s, "", t), {})
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
if (!
|
|
33
|
+
const U = it();
|
|
34
|
+
let M = null;
|
|
35
|
+
const at = (t) => {
|
|
36
|
+
M = t;
|
|
37
|
+
}, z = () => {
|
|
38
|
+
if (!M)
|
|
39
39
|
throw new Error("Api client not initialized. Call setApiClient() first.");
|
|
40
|
-
return
|
|
41
|
-
},
|
|
42
|
-
function
|
|
40
|
+
return M;
|
|
41
|
+
}, xt = () => M;
|
|
42
|
+
function S(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 W(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 && S(t[e]))
|
|
51
51
|
return !0;
|
|
52
52
|
return !1;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function lt(t) {
|
|
55
55
|
t = "<~" + t + "~>";
|
|
56
|
-
var e, r, s,
|
|
57
|
-
for (t.slice(0, 2) === "<~" && t.slice(-2), t = t.slice(2, -2).replace(/\s/g, "").replace("z", "!!!!!"), e = "uuuuu".slice(t.length % 5 || 5), t += e, s = [],
|
|
58
|
-
return (function(
|
|
59
|
-
for (var
|
|
60
|
-
})(s, e.length),
|
|
56
|
+
var e, r, s, n, h, l = String, f = 255;
|
|
57
|
+
for (t.slice(0, 2) === "<~" && t.slice(-2), t = t.slice(2, -2).replace(/\s/g, "").replace("z", "!!!!!"), e = "uuuuu".slice(t.length % 5 || 5), t += e, s = [], n = 0, h = t.length; h > n; n += 5) r = 52200625 * (t.charCodeAt(n) - 33) + 614125 * (t.charCodeAt(n + 1) - 33) + 7225 * (t.charCodeAt(n + 2) - 33) + 85 * (t.charCodeAt(n + 3) - 33) + (t.charCodeAt(n + 4) - 33), s.push(f & r >> 24, f & r >> 16, f & r >> 8, f & r);
|
|
58
|
+
return (function(p, o) {
|
|
59
|
+
for (var i = o; i > 0; i--) p.pop();
|
|
60
|
+
})(s, e.length), l.fromCharCode.apply(l, s);
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const H = (t = "") => {
|
|
63
63
|
const e = t, r = (s = "application/octet-stream") => {
|
|
64
|
-
const
|
|
65
|
-
for (let
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
return URL.createObjectURL(
|
|
64
|
+
const n = new Uint8Array(e.length);
|
|
65
|
+
for (let f = 0; f < e.length; f++)
|
|
66
|
+
n[f] = e.charCodeAt(f);
|
|
67
|
+
const h = new Blob([n], { type: s });
|
|
68
|
+
return URL.createObjectURL(h);
|
|
69
69
|
};
|
|
70
70
|
return {
|
|
71
71
|
getContent: () => e,
|
|
72
72
|
getURL: r,
|
|
73
73
|
download: (s) => {
|
|
74
|
-
const
|
|
75
|
-
|
|
74
|
+
const n = document.createElement("a");
|
|
75
|
+
n.download = s, n.href = r(), document.body.appendChild(n), n.click(), document.body.removeChild(n);
|
|
76
76
|
},
|
|
77
77
|
open: (s) => {
|
|
78
78
|
window.open(r(s), "_blank");
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
},
|
|
82
|
-
function
|
|
81
|
+
}, te = (t) => H(atob(t)), ee = (t) => H(lt(t));
|
|
82
|
+
function X(t, e, r, s, n) {
|
|
83
83
|
if (!(!t || typeof t != "object"))
|
|
84
|
-
for (let
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
if ("__args" in
|
|
88
|
-
const
|
|
89
|
-
Object.entries(
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
let
|
|
93
|
-
|
|
94
|
-
|
|
84
|
+
for (let h in t) {
|
|
85
|
+
const l = t[h];
|
|
86
|
+
if (l && typeof l == "object") {
|
|
87
|
+
if ("__args" in l) {
|
|
88
|
+
const f = l.__args, p = {};
|
|
89
|
+
Object.entries(f).forEach(([o, i]) => {
|
|
90
|
+
if (i instanceof Array && S(i)) {
|
|
91
|
+
p[o] = new O(o);
|
|
92
|
+
let a = 0;
|
|
93
|
+
i.forEach((c) => {
|
|
94
|
+
c instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + o + "." + a), s.append(n.current.toString(), c), n.current++, a++);
|
|
95
95
|
}), e[o] = "[Upload!]!";
|
|
96
|
-
} else
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}), e[
|
|
103
|
-
} else
|
|
104
|
-
})) :
|
|
105
|
-
}),
|
|
96
|
+
} else i instanceof File ? (p[o] = new O(o), r[n.current] = ["variables." + o], s.append(n.current.toString(), i), e[o] = "Upload!", n.current++) : i instanceof Object && W(i) ? (p[o] = {}, Object.entries(i).forEach(([a, c]) => {
|
|
97
|
+
if (c instanceof Array && S(c)) {
|
|
98
|
+
p[o][a] = new O(a);
|
|
99
|
+
let m = 0;
|
|
100
|
+
c.forEach((w) => {
|
|
101
|
+
w instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + a + "." + m), s.append(n.current.toString(), w), n.current++, m++);
|
|
102
|
+
}), e[a] = "[Upload!]!";
|
|
103
|
+
} else c instanceof File ? (p[o][a] = new O(a), r[n.current] = ["variables." + a], s.append(n.current.toString(), c), e[a] = "Upload!", n.current++) : p[o][a] = c;
|
|
104
|
+
})) : i != null && (p[o] = i);
|
|
105
|
+
}), l.__args = p;
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
X(l, e, r, s, n);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
let
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
let
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
query:
|
|
120
|
-
})),
|
|
121
|
-
query:
|
|
122
|
-
}),
|
|
123
|
-
throw new Error(
|
|
124
|
-
return
|
|
125
|
-
};
|
|
126
|
-
function
|
|
127
|
-
let
|
|
128
|
-
const
|
|
111
|
+
const Y = (t) => async (e) => {
|
|
112
|
+
const r = e, s = new FormData();
|
|
113
|
+
let n = !1;
|
|
114
|
+
const h = {}, l = {};
|
|
115
|
+
X(r, h, l, s, { current: 0 }), n = Object.keys(h).length > 0, n && (r.__variables = h);
|
|
116
|
+
let p = null;
|
|
117
|
+
const i = Q({ query: r });
|
|
118
|
+
if (n ? (s.append("map", JSON.stringify(l)), s.append("operations", JSON.stringify({
|
|
119
|
+
query: i
|
|
120
|
+
})), p = await t.post("", s)) : p = await t.post("", {
|
|
121
|
+
query: i
|
|
122
|
+
}), p.data.errors)
|
|
123
|
+
throw new Error(p.data.errors[0].message);
|
|
124
|
+
return p.data.data;
|
|
125
|
+
}, F = async (t) => Y(z().axios)(t);
|
|
126
|
+
function v(t, e, r = F) {
|
|
127
|
+
let s, n = [], h, l;
|
|
128
|
+
const f = (o) => !o || typeof o != "object" ? !1 : Object.values(o).some((i) => i && typeof i == "object" && Object.keys(i).some((a) => a.startsWith("_"))), p = () => n.length === 0 ? (n.unshift({}), n[0]) : (f(n[0]) && n.unshift({}), n[0]);
|
|
129
129
|
return {
|
|
130
130
|
first() {
|
|
131
131
|
return this.fetchFirst();
|
|
@@ -134,44 +134,44 @@ function j(t, e) {
|
|
|
134
134
|
return this.fetch();
|
|
135
135
|
},
|
|
136
136
|
async fetchFirst() {
|
|
137
|
-
const
|
|
138
|
-
return Array.isArray(
|
|
137
|
+
const i = await this.limit(1).fetch();
|
|
138
|
+
return Array.isArray(i) && i.length > 0 ? i[0] : null;
|
|
139
139
|
},
|
|
140
140
|
async fetchWithMeta() {
|
|
141
|
-
let
|
|
142
|
-
if (
|
|
143
|
-
const a =
|
|
144
|
-
for (const
|
|
145
|
-
|
|
146
|
-
return
|
|
141
|
+
let i = await r(this.toQuery(!0));
|
|
142
|
+
if (l) {
|
|
143
|
+
const a = l.split(".");
|
|
144
|
+
for (const c of a)
|
|
145
|
+
i = i[c];
|
|
146
|
+
return i;
|
|
147
147
|
}
|
|
148
|
-
return
|
|
148
|
+
return i[`list${t}`];
|
|
149
149
|
},
|
|
150
150
|
async fetch() {
|
|
151
|
-
let
|
|
152
|
-
if (
|
|
153
|
-
const a =
|
|
154
|
-
for (const
|
|
155
|
-
|
|
156
|
-
return
|
|
151
|
+
let i = await r(this.toQuery());
|
|
152
|
+
if (l) {
|
|
153
|
+
const a = l.split(".");
|
|
154
|
+
for (const c of a)
|
|
155
|
+
i = i[c];
|
|
156
|
+
return i.data;
|
|
157
157
|
}
|
|
158
|
-
return
|
|
158
|
+
return i[`list${t}`].data;
|
|
159
159
|
},
|
|
160
|
-
dataPath(
|
|
161
|
-
return
|
|
160
|
+
dataPath(o) {
|
|
161
|
+
return o && typeof o == "string" && (l = o), this;
|
|
162
162
|
},
|
|
163
|
-
sort(
|
|
164
|
-
return
|
|
163
|
+
sort(o) {
|
|
164
|
+
return o && typeof o == "string" && (h = o), this;
|
|
165
165
|
},
|
|
166
|
-
filters(
|
|
167
|
-
return
|
|
166
|
+
filters(o) {
|
|
167
|
+
return o && typeof o == "object" && (n = [o]), this;
|
|
168
168
|
},
|
|
169
169
|
// where can be called as:
|
|
170
170
|
// where('key', value) -> exact match
|
|
171
171
|
// where('key', '>', value) -> operator-based (>, <, >=, <=, !=, in, contains)
|
|
172
|
-
where(
|
|
173
|
-
const
|
|
174
|
-
const
|
|
172
|
+
where(o, i, a) {
|
|
173
|
+
const c = (m, w, u) => {
|
|
174
|
+
const d = {
|
|
175
175
|
">": "_gt",
|
|
176
176
|
"<": "_lt",
|
|
177
177
|
">=": "_gte",
|
|
@@ -179,84 +179,84 @@ function j(t, e) {
|
|
|
179
179
|
"!=": "_ne",
|
|
180
180
|
in: "_in",
|
|
181
181
|
contains: "_contains"
|
|
182
|
-
}[
|
|
183
|
-
|
|
182
|
+
}[w];
|
|
183
|
+
d && n.push({ [m]: { [d]: u } });
|
|
184
184
|
};
|
|
185
185
|
if (a !== void 0)
|
|
186
|
-
|
|
186
|
+
c(o, String(i), a);
|
|
187
187
|
else {
|
|
188
|
-
const
|
|
189
|
-
|
|
188
|
+
const m = p(), w = U(m, { [o]: i });
|
|
189
|
+
n[0] = w;
|
|
190
190
|
}
|
|
191
191
|
return this;
|
|
192
192
|
},
|
|
193
193
|
// whereContains adds a _contains filter for a specific field
|
|
194
194
|
// If the same field is used multiple times, it merges them into an array
|
|
195
|
-
whereContains(
|
|
196
|
-
if (
|
|
197
|
-
const a = p(),
|
|
198
|
-
a[
|
|
195
|
+
whereContains(o, i) {
|
|
196
|
+
if (o && typeof o == "string") {
|
|
197
|
+
const a = p(), c = { _contains: i };
|
|
198
|
+
a[o] ? Array.isArray(a[o]) ? a[o].push(c) : a[o] = [a[o], c] : a[o] = [c], n[0] = a;
|
|
199
199
|
}
|
|
200
200
|
return this;
|
|
201
201
|
},
|
|
202
202
|
// ...existing code...
|
|
203
203
|
// whereIn adds an _in filter for a specific field
|
|
204
204
|
// If the same field is used multiple times, it merges them into an array
|
|
205
|
-
whereIn(
|
|
206
|
-
if (
|
|
207
|
-
const a = p(),
|
|
208
|
-
a[
|
|
205
|
+
whereIn(o, i) {
|
|
206
|
+
if (o && typeof o == "string" && Array.isArray(i)) {
|
|
207
|
+
const a = p(), c = { _in: i };
|
|
208
|
+
a[o] ? Array.isArray(a[o]) ? a[o].push(c) : a[o] = [a[o], c] : a[o] = [c], n[0] = a;
|
|
209
209
|
}
|
|
210
210
|
return this;
|
|
211
211
|
},
|
|
212
212
|
// whereBetween adds a _between filter for a specific field
|
|
213
|
-
whereBetween(
|
|
214
|
-
if (
|
|
215
|
-
const
|
|
216
|
-
|
|
213
|
+
whereBetween(o, i, a) {
|
|
214
|
+
if (o && typeof o == "string") {
|
|
215
|
+
const c = p(), m = { _between: [i, a] };
|
|
216
|
+
c[o] ? Array.isArray(c[o]) ? c[o].push(m) : c[o] = [c[o], m] : c[o] = m, n[0] = c;
|
|
217
217
|
}
|
|
218
218
|
return this;
|
|
219
219
|
},
|
|
220
220
|
// limit sets paging/limit for the data selection
|
|
221
|
-
limit(
|
|
222
|
-
return typeof
|
|
221
|
+
limit(o) {
|
|
222
|
+
return typeof o == "number" && Number.isFinite(o) && (s = U(s || {}, { limit: o })), this;
|
|
223
223
|
},
|
|
224
224
|
// offset sets the starting index for the data selection
|
|
225
|
-
offset(
|
|
226
|
-
return typeof
|
|
225
|
+
offset(o) {
|
|
226
|
+
return typeof o == "number" && Number.isFinite(o) && (s = U(s || {}, { offset: o })), this;
|
|
227
227
|
},
|
|
228
|
-
toQuery(
|
|
229
|
-
let
|
|
230
|
-
const a =
|
|
231
|
-
a &&
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
),
|
|
228
|
+
toQuery(o = !1) {
|
|
229
|
+
let i;
|
|
230
|
+
const a = n.length > 0 && Object.keys(n[0] || {}).length > 0, c = a ? 1 : 0, m = n.length > c;
|
|
231
|
+
a && m ? i = n : m ? i = n.slice(c) : a && (i = n[0]);
|
|
232
|
+
const w = U(
|
|
233
|
+
h ? { sort: h } : {},
|
|
234
|
+
i ? { filters: i } : {}
|
|
235
|
+
), u = {
|
|
236
236
|
data: {
|
|
237
237
|
...e
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
|
-
if (
|
|
240
|
+
if (s && (u.data.__args = s), Object.keys(w).length > 0 && (u.__args = w), o && (u.meta = {
|
|
241
241
|
total: !0,
|
|
242
242
|
key: !0,
|
|
243
243
|
name: !0
|
|
244
|
-
}),
|
|
245
|
-
const
|
|
246
|
-
let
|
|
247
|
-
for (let
|
|
248
|
-
|
|
249
|
-
[
|
|
244
|
+
}), l) {
|
|
245
|
+
const _ = l.split(".");
|
|
246
|
+
let d = u;
|
|
247
|
+
for (let y = _.length - 1; y >= 0; y--)
|
|
248
|
+
d = {
|
|
249
|
+
[_[y]]: d
|
|
250
250
|
};
|
|
251
|
-
return
|
|
251
|
+
return d;
|
|
252
252
|
}
|
|
253
253
|
return {
|
|
254
|
-
[`list${t}`]:
|
|
254
|
+
[`list${t}`]: u
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
-
const
|
|
259
|
+
const ct = "list", ht = [
|
|
260
260
|
"flatMap",
|
|
261
261
|
"chunk",
|
|
262
262
|
"shuffle",
|
|
@@ -282,7 +282,7 @@ const V = "list", I = [
|
|
|
282
282
|
"slice",
|
|
283
283
|
"tap",
|
|
284
284
|
"sort"
|
|
285
|
-
],
|
|
285
|
+
], ut = [
|
|
286
286
|
"avg",
|
|
287
287
|
"count",
|
|
288
288
|
"countBy",
|
|
@@ -310,7 +310,7 @@ const V = "list", I = [
|
|
|
310
310
|
"implode",
|
|
311
311
|
"partition"
|
|
312
312
|
];
|
|
313
|
-
class
|
|
313
|
+
class b {
|
|
314
314
|
_batchData = null;
|
|
315
315
|
data_path = "";
|
|
316
316
|
filters;
|
|
@@ -327,7 +327,7 @@ class g {
|
|
|
327
327
|
this.filters = {}, this.steps = [], this.fields = e;
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
|
|
330
|
+
b.prototype.getQueryPayload = function() {
|
|
331
331
|
let t = {
|
|
332
332
|
meta: {
|
|
333
333
|
total: !0,
|
|
@@ -341,26 +341,26 @@ g.prototype.getQueryPayload = function() {
|
|
|
341
341
|
steps: this.steps
|
|
342
342
|
};
|
|
343
343
|
};
|
|
344
|
-
|
|
344
|
+
b.prototype.dataPath = function(t) {
|
|
345
345
|
const e = this.clone();
|
|
346
346
|
return e.data_path = t, e;
|
|
347
347
|
};
|
|
348
|
-
|
|
348
|
+
b.prototype.buildArgs = function() {
|
|
349
349
|
let t = {};
|
|
350
350
|
return Object.keys(this.filters).length > 0 && (t.filters = this.filters), this._sort && (t.sort = this._sort, this._sortDesc && (t.sort += ":desc")), t;
|
|
351
351
|
};
|
|
352
|
-
|
|
352
|
+
b.prototype.clone = function() {
|
|
353
353
|
const t = Object.create(this);
|
|
354
354
|
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;
|
|
355
355
|
};
|
|
356
|
-
|
|
356
|
+
L().macro("whereContains", function(t, e) {
|
|
357
357
|
return this.filter((r) => r[t].toLowerCase().includes(e.toLowerCase()));
|
|
358
358
|
});
|
|
359
|
-
|
|
359
|
+
b.prototype.fetchData = async function() {
|
|
360
360
|
try {
|
|
361
361
|
if (this._batchData) {
|
|
362
|
-
const
|
|
363
|
-
return this.meta =
|
|
362
|
+
const f = this._batchData;
|
|
363
|
+
return this.meta = f.meta, L(f.data);
|
|
364
364
|
}
|
|
365
365
|
let t = {
|
|
366
366
|
meta: {
|
|
@@ -371,72 +371,72 @@ g.prototype.fetchData = async function() {
|
|
|
371
371
|
};
|
|
372
372
|
t.__args = this.buildArgs(), t.data = this.fields, this.already_limit && (t.data.__args = t.data.__args || {}, t.data.__args.limit = this.limit), this.already_offset && (t.data.__args = t.data.__args || {}, t.data.__args.offset = this.offset);
|
|
373
373
|
const e = this.data_path.split(".");
|
|
374
|
-
let r = {}, s = r,
|
|
375
|
-
for (const
|
|
376
|
-
if (
|
|
377
|
-
s[
|
|
374
|
+
let r = {}, s = r, n = e[e.length - 1];
|
|
375
|
+
for (const f of e) {
|
|
376
|
+
if (f === n) {
|
|
377
|
+
s[f] = t;
|
|
378
378
|
break;
|
|
379
379
|
}
|
|
380
|
-
s[
|
|
380
|
+
s[f] = {}, s = s[f];
|
|
381
381
|
}
|
|
382
|
-
let
|
|
383
|
-
for (const
|
|
384
|
-
|
|
385
|
-
return this.meta =
|
|
382
|
+
let l = await (this._queryFn || F)(r);
|
|
383
|
+
for (const f of e)
|
|
384
|
+
l = l[f];
|
|
385
|
+
return this.meta = l.meta, L(l.data);
|
|
386
386
|
} catch (t) {
|
|
387
387
|
throw console.error("Error fetching collection data:", t), t;
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
|
-
|
|
390
|
+
b.prototype.processData = async function() {
|
|
391
391
|
let t = await this.fetchData();
|
|
392
392
|
for (const e of this.steps)
|
|
393
393
|
t = t[e.type](...e.args);
|
|
394
394
|
return t;
|
|
395
395
|
};
|
|
396
|
-
|
|
396
|
+
b.prototype.all = async function() {
|
|
397
397
|
return (await this.processData()).all();
|
|
398
398
|
};
|
|
399
|
-
for (const t of
|
|
400
|
-
|
|
399
|
+
for (const t of ht)
|
|
400
|
+
b.prototype[t] = function(...e) {
|
|
401
401
|
const r = this.clone();
|
|
402
402
|
return r.steps.push({ type: t, args: e }), r;
|
|
403
403
|
};
|
|
404
|
-
for (const t of
|
|
405
|
-
|
|
404
|
+
for (const t of ut)
|
|
405
|
+
b.prototype[t] = async function(...e) {
|
|
406
406
|
return (await this.clone().processData())[t](...e);
|
|
407
407
|
};
|
|
408
|
-
|
|
409
|
-
|
|
408
|
+
b.prototype.average = b.prototype.avg;
|
|
409
|
+
b.prototype.first = async function() {
|
|
410
410
|
return this.take(1), (await this.processData()).first();
|
|
411
411
|
};
|
|
412
|
-
|
|
412
|
+
b.prototype._handleBatchData = function(t, e) {
|
|
413
413
|
return this._batchData ? (this.steps.push({ type: t, args: e }), this) : null;
|
|
414
414
|
};
|
|
415
|
-
|
|
415
|
+
b.prototype.where = function(...t) {
|
|
416
416
|
const e = this._handleBatchData("where", t);
|
|
417
417
|
if (e) return e;
|
|
418
418
|
if (t.length === 2)
|
|
419
419
|
this.filters[t[0]] = t[1];
|
|
420
420
|
else if (t.length === 3) {
|
|
421
|
-
const r = t[0], s = t[1],
|
|
421
|
+
const r = t[0], s = t[1], n = t[2];
|
|
422
422
|
switch (s) {
|
|
423
423
|
case "==":
|
|
424
|
-
this.filters[r] =
|
|
424
|
+
this.filters[r] = n;
|
|
425
425
|
break;
|
|
426
426
|
case "<":
|
|
427
|
-
this.filters[r] = { lt:
|
|
427
|
+
this.filters[r] = { lt: n };
|
|
428
428
|
break;
|
|
429
429
|
case "<=":
|
|
430
|
-
this.filters[r] = { lte:
|
|
430
|
+
this.filters[r] = { lte: n };
|
|
431
431
|
break;
|
|
432
432
|
case ">":
|
|
433
|
-
this.filters[r] = { gt:
|
|
433
|
+
this.filters[r] = { gt: n };
|
|
434
434
|
break;
|
|
435
435
|
case ">=":
|
|
436
|
-
this.filters[r] = { gte:
|
|
436
|
+
this.filters[r] = { gte: n };
|
|
437
437
|
break;
|
|
438
438
|
case "!==":
|
|
439
|
-
this.filters[r] = { ne:
|
|
439
|
+
this.filters[r] = { ne: n };
|
|
440
440
|
break;
|
|
441
441
|
default:
|
|
442
442
|
throw new Error(`Unsupported operator: ${s}`);
|
|
@@ -444,192 +444,227 @@ g.prototype.where = function(...t) {
|
|
|
444
444
|
}
|
|
445
445
|
return this;
|
|
446
446
|
};
|
|
447
|
-
|
|
447
|
+
b.prototype.whereContains = function(t, e) {
|
|
448
448
|
const r = this._handleBatchData("whereContains", [t, e]);
|
|
449
449
|
return r || (this.filters[t] = { contains: e }, this);
|
|
450
450
|
};
|
|
451
|
-
|
|
451
|
+
b.prototype.forPage = function(t, e) {
|
|
452
452
|
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);
|
|
453
453
|
};
|
|
454
|
-
|
|
454
|
+
b.prototype.whereIn = function(t, e) {
|
|
455
455
|
const r = this._handleBatchData("whereIn", [t, e]);
|
|
456
456
|
return r || (this.filters[t] = { in: e }, this);
|
|
457
457
|
};
|
|
458
|
-
|
|
458
|
+
b.prototype.whereNotIn = function(t, e) {
|
|
459
459
|
const r = this._handleBatchData("whereNotIn", [t, e]);
|
|
460
460
|
return r || (this.filters[t] = { nin: e }, this);
|
|
461
461
|
};
|
|
462
|
-
|
|
462
|
+
b.prototype.whereNotBetween = function(t, e) {
|
|
463
463
|
const r = this._handleBatchData("whereNotBetween", [t, e]);
|
|
464
464
|
return r || (this.filters[t] = { notBetween: e }, this);
|
|
465
465
|
};
|
|
466
|
-
|
|
466
|
+
b.prototype.whereBetween = function(t, e) {
|
|
467
467
|
const r = this._handleBatchData("whereBetween", [t, e]);
|
|
468
468
|
return r || (this.filters[t] = { between: e }, this);
|
|
469
469
|
};
|
|
470
|
-
|
|
470
|
+
b.prototype.sortBy = function(t) {
|
|
471
471
|
return this.steps.push({ type: "sortBy", args: [t] }), typeof t == "string" && (this._sort = t), this;
|
|
472
472
|
};
|
|
473
|
-
|
|
473
|
+
b.prototype.sortByDesc = function(t) {
|
|
474
474
|
return this.steps.push({ type: "sortByDesc", args: [t] }), typeof t == "string" && (this._sort = t, this._sortDesc = !0), this;
|
|
475
475
|
};
|
|
476
|
-
|
|
476
|
+
b.prototype.skip = function(t) {
|
|
477
477
|
if (t < 0)
|
|
478
478
|
throw new Error("Offset must be non-negative");
|
|
479
479
|
return this.already_offset && this.steps.push({ type: "skip", args: [t] }), this.offset = t, this.already_offset = !0, this;
|
|
480
480
|
};
|
|
481
|
-
|
|
481
|
+
b.prototype.take = function(t) {
|
|
482
482
|
if (t < 0)
|
|
483
483
|
throw new Error("Length must be non-negative");
|
|
484
484
|
return this.already_limit ? (this.steps.push({ type: "take", args: [t] }), this) : (this.limit = t, this.already_limit = !0, this);
|
|
485
485
|
};
|
|
486
|
-
|
|
486
|
+
b.prototype.splice = function(t, e) {
|
|
487
487
|
return this.steps.push({ type: "splice", args: [t, e] }), this.offset = t, this.limit = e, this.already_limit = !0, this.already_offset = !0, this;
|
|
488
488
|
};
|
|
489
|
-
const
|
|
490
|
-
const
|
|
491
|
-
return r.data_path =
|
|
492
|
-
},
|
|
493
|
-
const r = e;
|
|
494
|
-
let
|
|
495
|
-
const
|
|
489
|
+
const Z = (t, e, r = F) => {
|
|
490
|
+
const s = new b(e);
|
|
491
|
+
return s._queryFn = r, s.data_path = ct + t, s;
|
|
492
|
+
}, V = (t, e = {}, r = {}) => {
|
|
493
|
+
const s = r.mutation || g, n = r.createList || v, h = r.createCollection || Z, l = e;
|
|
494
|
+
let f = "list" + t;
|
|
495
|
+
const p = (o) => l[o] ? l[o] : null;
|
|
496
496
|
return {
|
|
497
|
-
field:
|
|
498
|
-
$fields:
|
|
499
|
-
setDataPath(
|
|
500
|
-
return
|
|
497
|
+
field: p,
|
|
498
|
+
$fields: l,
|
|
499
|
+
setDataPath(o) {
|
|
500
|
+
return f = o, f;
|
|
501
501
|
},
|
|
502
502
|
getDataPath() {
|
|
503
|
-
return
|
|
503
|
+
return f;
|
|
504
504
|
},
|
|
505
|
-
gqlFields(
|
|
506
|
-
let
|
|
507
|
-
for (const
|
|
508
|
-
if (typeof
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
} else typeof
|
|
512
|
-
return
|
|
505
|
+
gqlFields(o) {
|
|
506
|
+
let i = {};
|
|
507
|
+
for (const a of o)
|
|
508
|
+
if (typeof a == "string") {
|
|
509
|
+
const c = p(a);
|
|
510
|
+
c && (i = U(i, c.gqlField ? typeof c.gqlField == "string" ? { [c.gqlField]: !0 } : c.gqlField : { [c.name || a]: !0 }));
|
|
511
|
+
} else typeof a == "object" && (i = U(i, a));
|
|
512
|
+
return i;
|
|
513
513
|
},
|
|
514
|
-
update(
|
|
515
|
-
return
|
|
514
|
+
update(o, i) {
|
|
515
|
+
return s({
|
|
516
516
|
["update" + t]: {
|
|
517
|
-
__args: { id:
|
|
517
|
+
__args: { id: o, data: i }
|
|
518
518
|
}
|
|
519
|
-
}).then((
|
|
519
|
+
}).then((a) => a["update" + t]);
|
|
520
520
|
},
|
|
521
|
-
async delete(
|
|
522
|
-
return
|
|
521
|
+
async delete(o) {
|
|
522
|
+
return s({
|
|
523
523
|
["delete" + t]: {
|
|
524
|
-
__args: { id:
|
|
524
|
+
__args: { id: o }
|
|
525
525
|
}
|
|
526
|
-
}).then((
|
|
526
|
+
}).then((i) => i["delete" + t]);
|
|
527
527
|
},
|
|
528
|
-
add(
|
|
529
|
-
return
|
|
528
|
+
add(o) {
|
|
529
|
+
return s({
|
|
530
530
|
["add" + t]: {
|
|
531
|
-
__args: { data:
|
|
531
|
+
__args: { data: o }
|
|
532
532
|
}
|
|
533
|
-
}).then((
|
|
533
|
+
}).then((i) => i["add" + t]);
|
|
534
534
|
},
|
|
535
|
-
fields(
|
|
536
|
-
let
|
|
537
|
-
for (let
|
|
538
|
-
const
|
|
539
|
-
|
|
535
|
+
fields(o) {
|
|
536
|
+
let i = [];
|
|
537
|
+
for (let a of o) {
|
|
538
|
+
const c = p(a);
|
|
539
|
+
c && i.push(c);
|
|
540
540
|
}
|
|
541
|
-
return
|
|
541
|
+
return i;
|
|
542
542
|
},
|
|
543
|
-
async get(
|
|
544
|
-
const
|
|
545
|
-
for (const [
|
|
546
|
-
|
|
547
|
-
return await
|
|
543
|
+
async get(o, i) {
|
|
544
|
+
const a = h(t, Zt(i));
|
|
545
|
+
for (const [c, m] of Object.entries(o))
|
|
546
|
+
a.where(c, "==", m);
|
|
547
|
+
return await a.first();
|
|
548
548
|
},
|
|
549
|
-
list(
|
|
550
|
-
let
|
|
551
|
-
const
|
|
552
|
-
Object.entries(
|
|
553
|
-
|
|
549
|
+
list(o) {
|
|
550
|
+
let i = o;
|
|
551
|
+
const a = {};
|
|
552
|
+
Object.entries(o).forEach(([w]) => {
|
|
553
|
+
l[w] && (a[w] = l[w], l[w].gqlField && (delete i[w], i = U(i, l[w].gqlField)), l[w].gql && (delete i[w], i = U(i, l[w].gql)));
|
|
554
554
|
});
|
|
555
|
-
const
|
|
555
|
+
const c = n(t, i).dataPath(f), m = c.fetch.bind(c);
|
|
556
556
|
return {
|
|
557
|
-
...
|
|
557
|
+
...c,
|
|
558
558
|
async fetch() {
|
|
559
|
-
return (await
|
|
560
|
-
const
|
|
561
|
-
return Object.entries(
|
|
562
|
-
|
|
563
|
-
}),
|
|
559
|
+
return (await m()).map((u) => {
|
|
560
|
+
const _ = { ...u };
|
|
561
|
+
return Object.entries(a).forEach(([d, y]) => {
|
|
562
|
+
y.field && typeof y.field == "function" && (_[d] = y.field(u[d], u));
|
|
563
|
+
}), _;
|
|
564
564
|
});
|
|
565
565
|
},
|
|
566
566
|
async fetchFirst() {
|
|
567
|
-
const
|
|
568
|
-
if (!
|
|
569
|
-
const
|
|
570
|
-
return Object.entries(
|
|
571
|
-
|
|
572
|
-
}),
|
|
567
|
+
const u = await c.fetchFirst.bind(c)();
|
|
568
|
+
if (!u) return u;
|
|
569
|
+
const _ = { ...u };
|
|
570
|
+
return Object.entries(a).forEach(([d, y]) => {
|
|
571
|
+
y.field && typeof y.field == "function" && (_[d] = y.field(u[d], u));
|
|
572
|
+
}), _;
|
|
573
573
|
}
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
576
|
};
|
|
577
|
-
},
|
|
578
|
-
const r =
|
|
579
|
-
return
|
|
580
|
-
},
|
|
581
|
-
Object.keys(
|
|
582
|
-
},
|
|
577
|
+
}, D = {}, I = (t, e) => {
|
|
578
|
+
const r = V(t, e);
|
|
579
|
+
return D[t] = r, r;
|
|
580
|
+
}, q = (t) => D[t] ? D[t] : I(t, {}), re = (t) => !!D[t], se = () => Object.keys(D), ne = () => {
|
|
581
|
+
Object.keys(D).forEach((t) => delete D[t]);
|
|
582
|
+
}, oe = (t) => {
|
|
583
583
|
Object.entries(t).forEach(([e, r]) => {
|
|
584
|
-
|
|
584
|
+
I(e, r);
|
|
585
585
|
});
|
|
586
|
-
},
|
|
586
|
+
}, ie = () => F({
|
|
587
587
|
app: {
|
|
588
588
|
permissions: !0
|
|
589
589
|
}
|
|
590
|
-
}).then((t) => t.app.permissions),
|
|
591
|
-
const
|
|
592
|
-
app: {
|
|
593
|
-
|
|
594
|
-
|
|
590
|
+
}).then((t) => t.app.permissions), $ = (t, e) => {
|
|
591
|
+
const r = async () => {
|
|
592
|
+
const { app: l } = await t({
|
|
593
|
+
app: {
|
|
594
|
+
auth: {
|
|
595
|
+
webAuthnRequestOptions: !0
|
|
596
|
+
}
|
|
595
597
|
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
598
|
+
}), f = l.auth.webAuthnRequestOptions, p = PublicKeyCredential.parseRequestOptionsFromJSON(f);
|
|
599
|
+
return await navigator.credentials.get({ publicKey: p });
|
|
600
|
+
}, s = async () => {
|
|
601
|
+
const { app: l } = await t({
|
|
602
|
+
app: {
|
|
603
|
+
auth: {
|
|
604
|
+
webAuthnCreationOptions: !0
|
|
605
|
+
}
|
|
604
606
|
}
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
607
|
+
}), f = PublicKeyCredential.parseCreationOptionsFromJSON(l.auth.webAuthnCreationOptions);
|
|
608
|
+
return await navigator.credentials.create({ publicKey: f });
|
|
609
|
+
};
|
|
610
|
+
return { assertion: r, attestation: s, login: async () => {
|
|
611
|
+
const l = await r();
|
|
612
|
+
return await e({
|
|
613
|
+
webAuthnAssertion: {
|
|
614
|
+
__args: {
|
|
615
|
+
assertion: l.toJSON()
|
|
616
|
+
}
|
|
614
617
|
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
618
|
+
}).then((f) => f.webAuthnAssertion);
|
|
619
|
+
}, register: async () => {
|
|
620
|
+
const l = await s();
|
|
621
|
+
return await e({
|
|
622
|
+
webAuthnRegister: {
|
|
623
|
+
__args: {
|
|
624
|
+
registration: l.toJSON()
|
|
625
|
+
}
|
|
623
626
|
}
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
},
|
|
627
|
+
}).then((f) => f.webAuthnRegister);
|
|
628
|
+
} };
|
|
629
|
+
}, N = $(F, g), pt = N.assertion, ft = N.attestation, gt = N.login, dt = N.register, _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
627
630
|
__proto__: null,
|
|
628
|
-
assertion:
|
|
629
|
-
attestation:
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
assertion: pt,
|
|
632
|
+
attestation: ft,
|
|
633
|
+
createWebAuthn: $,
|
|
634
|
+
login: gt,
|
|
635
|
+
register: dt
|
|
636
|
+
}, Symbol.toStringTag, { value: "Module" })), yt = (t, e) => ({
|
|
637
|
+
getCurrentUser: (r = B) => t({ my: r }).then((s) => s.my),
|
|
638
|
+
login: (r, s, n = "") => e({ login: { __args: { username: r, password: s, code: n } } }).then((h) => h.login),
|
|
639
|
+
logout: () => e({ logout: !0 }).then((r) => r.logout),
|
|
640
|
+
changeExpiredPassword: (r, s, n) => e({ changeExpiredPassword: { __args: { username: r, old_password: s, new_password: n } } }).then((h) => h.changeExpiredPassword),
|
|
641
|
+
updatePassword: (r, s) => e({ changeUserPassword: { __args: { old_password: r, new_password: s } } }).then((n) => n.changeUserPassword),
|
|
642
|
+
resetPassword: (r, s, n) => e({ resetPassword: { __args: { jwt: r, password: s, code: n } } }).then((h) => h.resetPassword),
|
|
643
|
+
forgetPassword: (r, s) => e({ forgetPassword: { __args: { username: r, email: s } } }).then((n) => n.forgetPassword),
|
|
644
|
+
verifyCode: (r, s) => e({ forgetPasswordVerifyCode: { __args: { jwt: r, code: s } } }).then((n) => n.forgetPasswordVerifyCode),
|
|
645
|
+
grantedRights: (r) => t({
|
|
646
|
+
my: { grantedRights: { __args: { rights: r } } }
|
|
647
|
+
}).then((s) => s.my.grantedRights),
|
|
648
|
+
isGranted: (r) => t({
|
|
649
|
+
my: { granted: { __args: { right: r } } }
|
|
650
|
+
}).then((s) => s.my.granted),
|
|
651
|
+
webAuthn: $(t, e),
|
|
652
|
+
google: {
|
|
653
|
+
unlink: () => e({ lightAuthUnlinkGoogle: !0 }).then((r) => r.lightAuthUnlinkGoogle),
|
|
654
|
+
login: (r) => e({ lightAuthLoginGoogle: { __args: { credential: r } } }).then((s) => s.lightAuthLoginGoogle),
|
|
655
|
+
register: (r) => e({ lightAuthRegisterGoogle: { __args: { credential: r } } }).then((s) => s.lightAuthRegisterGoogle)
|
|
656
|
+
},
|
|
657
|
+
facebook: {
|
|
658
|
+
unlink: () => e({ lightAuthUnlinkFacebook: !0 }).then((r) => r.lightAuthUnlinkFacebook),
|
|
659
|
+
login: (r) => e({ lightAuthLoginFacebook: { __args: { access_token: r } } }).then((s) => s.lightAuthLoginFacebook),
|
|
660
|
+
register: (r) => e({ lightAuthRegisterFacebook: { __args: { access_token: r } } }).then((s) => s.lightAuthRegisterFacebook)
|
|
661
|
+
},
|
|
662
|
+
microsoft: {
|
|
663
|
+
unlink: () => e({ lightAuthUnlinkMicrosoft: !0 }).then((r) => r.lightAuthUnlinkMicrosoft),
|
|
664
|
+
login: (r) => e({ lightAuthLoginMicrosoft: { __args: { access_token: r } } }).then((s) => s.lightAuthLoginMicrosoft),
|
|
665
|
+
register: (r) => e({ lightAuthRegisterMicrosoft: { __args: { account_id: r } } }).then((s) => s.lightAuthRegisterMicrosoft)
|
|
666
|
+
}
|
|
667
|
+
}), wt = (t = B) => F({ my: t }).then((e) => e.my), bt = (t, e, r = "") => g({ login: { __args: { username: t, password: e, code: r } } }).then((s) => s.login), mt = () => g({ logout: !0 }).then((t) => t.logout), Ft = (t, e, r) => g({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((s) => s.changeExpiredPassword), At = (t, e) => g({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), Ct = (t, e, r) => g({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((s) => s.resetPassword), Ot = (t, e) => g({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), Ut = (t, e) => g({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), kt = (t) => F({
|
|
633
668
|
my: {
|
|
634
669
|
granted: {
|
|
635
670
|
__args: {
|
|
@@ -637,7 +672,7 @@ const L = (t, e) => {
|
|
|
637
672
|
}
|
|
638
673
|
}
|
|
639
674
|
}
|
|
640
|
-
}).then((e) => e.my.granted),
|
|
675
|
+
}).then((e) => e.my.granted), Dt = (t) => F({
|
|
641
676
|
my: {
|
|
642
677
|
grantedRights: {
|
|
643
678
|
__args: {
|
|
@@ -645,40 +680,40 @@ const L = (t, e) => {
|
|
|
645
680
|
}
|
|
646
681
|
}
|
|
647
682
|
}
|
|
648
|
-
}).then((e) => e.my.grantedRights),
|
|
649
|
-
getCurrentUser:
|
|
650
|
-
webAuthn:
|
|
683
|
+
}).then((e) => e.my.grantedRights), ae = {
|
|
684
|
+
getCurrentUser: wt,
|
|
685
|
+
webAuthn: _t,
|
|
651
686
|
google: {
|
|
652
|
-
unlink: () =>
|
|
653
|
-
login: (t) =>
|
|
654
|
-
register: (t) =>
|
|
687
|
+
unlink: () => g({ lightAuthUnlinkGoogle: !0 }).then((t) => t.lightAuthUnlinkGoogle),
|
|
688
|
+
login: (t) => g({ lightAuthLoginGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthLoginGoogle),
|
|
689
|
+
register: (t) => g({ lightAuthRegisterGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthRegisterGoogle)
|
|
655
690
|
},
|
|
656
691
|
facebook: {
|
|
657
|
-
unlink: () =>
|
|
658
|
-
login: (t) =>
|
|
659
|
-
register: (t) =>
|
|
692
|
+
unlink: () => g({ lightAuthUnlinkFacebook: !0 }).then((t) => t.lightAuthUnlinkFacebook),
|
|
693
|
+
login: (t) => g({ lightAuthLoginFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginFacebook),
|
|
694
|
+
register: (t) => g({ lightAuthRegisterFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthRegisterFacebook)
|
|
660
695
|
},
|
|
661
696
|
microsoft: {
|
|
662
|
-
unlink: () =>
|
|
663
|
-
login: (t) =>
|
|
664
|
-
register: (t) =>
|
|
697
|
+
unlink: () => g({ lightAuthUnlinkMicrosoft: !0 }).then((t) => t.lightAuthUnlinkMicrosoft),
|
|
698
|
+
login: (t) => g({ lightAuthLoginMicrosoft: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginMicrosoft),
|
|
699
|
+
register: (t) => g({ lightAuthRegisterMicrosoft: { __args: { account_id: t } } }).then((e) => e.lightAuthRegisterMicrosoft)
|
|
665
700
|
},
|
|
666
|
-
login:
|
|
667
|
-
logout:
|
|
668
|
-
changeExpiredPassword:
|
|
669
|
-
updatePassword:
|
|
670
|
-
resetPassword:
|
|
671
|
-
forgetPassword:
|
|
672
|
-
verifyCode:
|
|
673
|
-
grantedRights:
|
|
674
|
-
isGranted:
|
|
675
|
-
},
|
|
701
|
+
login: bt,
|
|
702
|
+
logout: mt,
|
|
703
|
+
changeExpiredPassword: Ft,
|
|
704
|
+
updatePassword: At,
|
|
705
|
+
resetPassword: Ct,
|
|
706
|
+
forgetPassword: Ot,
|
|
707
|
+
verifyCode: Ut,
|
|
708
|
+
grantedRights: Dt,
|
|
709
|
+
isGranted: kt
|
|
710
|
+
}, K = {
|
|
676
711
|
name: !0,
|
|
677
712
|
path: !0,
|
|
678
713
|
size: !0,
|
|
679
714
|
mime: !0,
|
|
680
715
|
url: !0
|
|
681
|
-
},
|
|
716
|
+
}, le = (t, e, r = K) => F({
|
|
682
717
|
app: {
|
|
683
718
|
drive: {
|
|
684
719
|
__args: { index: t },
|
|
@@ -688,7 +723,7 @@ const L = (t, e) => {
|
|
|
688
723
|
}
|
|
689
724
|
}
|
|
690
725
|
}
|
|
691
|
-
}).then((s) => s.app.drive.files),
|
|
726
|
+
}).then((s) => s.app.drive.files), ce = (t, e) => F({
|
|
692
727
|
app: {
|
|
693
728
|
drive: {
|
|
694
729
|
__args: {
|
|
@@ -702,15 +737,15 @@ const L = (t, e) => {
|
|
|
702
737
|
}
|
|
703
738
|
}
|
|
704
739
|
}
|
|
705
|
-
}).then((r) => r.app.drive?.file?.base64Content),
|
|
706
|
-
list: (
|
|
707
|
-
get: (
|
|
740
|
+
}).then((r) => r.app.drive?.file?.base64Content), Pt = (t, e = F, r = g) => ({
|
|
741
|
+
list: (s, n = K) => e({ app: { drive: { __args: { index: t }, files: { __args: { path: s }, ...n } } } }).then((h) => h.app.drive.files),
|
|
742
|
+
get: (s, n = {
|
|
708
743
|
name: !0,
|
|
709
744
|
path: !0,
|
|
710
745
|
size: !0,
|
|
711
746
|
mime: !0,
|
|
712
747
|
url: !0
|
|
713
|
-
}) =>
|
|
748
|
+
}) => e({
|
|
714
749
|
app: {
|
|
715
750
|
drive: {
|
|
716
751
|
__args: {
|
|
@@ -718,18 +753,18 @@ const L = (t, e) => {
|
|
|
718
753
|
},
|
|
719
754
|
file: {
|
|
720
755
|
__args: {
|
|
721
|
-
path:
|
|
756
|
+
path: s
|
|
722
757
|
},
|
|
723
|
-
...
|
|
758
|
+
...n
|
|
724
759
|
}
|
|
725
760
|
}
|
|
726
761
|
}
|
|
727
|
-
}).then((
|
|
728
|
-
readFileAsBase64(
|
|
729
|
-
return
|
|
762
|
+
}).then((h) => h.app.drive.file),
|
|
763
|
+
readFileAsBase64(s) {
|
|
764
|
+
return e({ app: { drive: { __args: { index: t }, file: { __args: { path: s }, base64Content: !0 } } } }).then((n) => n.app.drive?.file?.base64Content);
|
|
730
765
|
},
|
|
731
|
-
read: async (
|
|
732
|
-
let
|
|
766
|
+
read: async (s) => {
|
|
767
|
+
let n = await e({
|
|
733
768
|
app: {
|
|
734
769
|
drive: {
|
|
735
770
|
__args: {
|
|
@@ -737,25 +772,25 @@ const L = (t, e) => {
|
|
|
737
772
|
},
|
|
738
773
|
file: {
|
|
739
774
|
__args: {
|
|
740
|
-
path:
|
|
775
|
+
path: s
|
|
741
776
|
},
|
|
742
777
|
base64Content: !0
|
|
743
778
|
}
|
|
744
779
|
}
|
|
745
780
|
}
|
|
746
781
|
});
|
|
747
|
-
if (!
|
|
748
|
-
throw new Error(`File not found or cannot read content: ${
|
|
749
|
-
return typeof window < "u" && window.atob ? window.atob(
|
|
782
|
+
if (!n.app.drive.file || !n.app.drive.file.base64Content)
|
|
783
|
+
throw new Error(`File not found or cannot read content: ${s}`);
|
|
784
|
+
return typeof window < "u" && window.atob ? window.atob(n.app.drive.file.base64Content) : n.app.drive.file.base64Content;
|
|
750
785
|
},
|
|
751
|
-
write: (
|
|
752
|
-
delete: (
|
|
753
|
-
rename: (
|
|
754
|
-
move: (
|
|
755
|
-
}),
|
|
786
|
+
write: (s, n) => r({ lightDriveWriteFile: { __args: { index: t, path: s, content: n } } }).then((h) => h.lightDriveWriteFile),
|
|
787
|
+
delete: (s) => r({ lightDriveDeleteFile: { __args: { index: t, path: s } } }).then((n) => n.lightDriveDeleteFile),
|
|
788
|
+
rename: (s, n) => r({ lightDriveRenameFile: { __args: { index: t, path: s, name: n } } }).then((h) => h.lightDriveRenameFile),
|
|
789
|
+
move: (s, n) => r({ lightDriveMoveFile: { __args: { index: t, source: s, destination: n } } }).then((h) => h.lightDriveMoveFile)
|
|
790
|
+
}), x = {
|
|
756
791
|
name: !0,
|
|
757
792
|
path: !0
|
|
758
|
-
},
|
|
793
|
+
}, he = (t, e, r = x) => F({
|
|
759
794
|
app: {
|
|
760
795
|
drive: {
|
|
761
796
|
__args: { index: t },
|
|
@@ -765,73 +800,79 @@ const L = (t, e) => {
|
|
|
765
800
|
}
|
|
766
801
|
}
|
|
767
802
|
}
|
|
768
|
-
}).then((s) => s.app.drive.folders),
|
|
769
|
-
list: (
|
|
770
|
-
create: (
|
|
771
|
-
delete: (
|
|
772
|
-
rename: (
|
|
773
|
-
}),
|
|
803
|
+
}).then((s) => s.app.drive.folders), St = (t, e = F, r = g) => ({
|
|
804
|
+
list: (s, n = x) => e({ app: { drive: { __args: { index: t }, folders: { __args: { path: s }, ...n } } } }).then((h) => h.app.drive.folders),
|
|
805
|
+
create: (s) => r({ lightDriveCreateFolder: { __args: { index: t, path: s } } }).then((n) => n.lightDriveCreateFolder),
|
|
806
|
+
delete: (s) => r({ lightDriveDeleteFolder: { __args: { index: t, path: s } } }).then((n) => n.lightDriveDeleteFolder),
|
|
807
|
+
rename: (s, n) => r({ lightDriveRenameFolder: { __args: { index: t, path: s, name: n } } }).then((h) => h.lightDriveRenameFolder)
|
|
808
|
+
}), ue = () => F({
|
|
774
809
|
app: {
|
|
775
810
|
drives: {
|
|
776
811
|
index: !0,
|
|
777
812
|
name: !0
|
|
778
813
|
}
|
|
779
814
|
}
|
|
780
|
-
}).then((t) => t.app.drives),
|
|
781
|
-
const
|
|
815
|
+
}).then((t) => t.app.drives), pe = (t) => tt(F, g)(t), tt = (t, e) => (r) => {
|
|
816
|
+
const s = Pt(r, t, e), n = St(r, t, e);
|
|
782
817
|
return {
|
|
783
|
-
folders:
|
|
784
|
-
files:
|
|
785
|
-
listFiles:
|
|
786
|
-
getFile:
|
|
787
|
-
readFile:
|
|
788
|
-
writeFile:
|
|
789
|
-
deleteFile:
|
|
790
|
-
renameFile:
|
|
791
|
-
moveFile:
|
|
792
|
-
listFolders:
|
|
793
|
-
createFolder:
|
|
794
|
-
deleteFolder:
|
|
795
|
-
renameFolder:
|
|
796
|
-
uploadTempFile: (
|
|
818
|
+
folders: n,
|
|
819
|
+
files: s,
|
|
820
|
+
listFiles: s.list,
|
|
821
|
+
getFile: s.get,
|
|
822
|
+
readFile: s.read,
|
|
823
|
+
writeFile: s.write,
|
|
824
|
+
deleteFile: s.delete,
|
|
825
|
+
renameFile: s.rename,
|
|
826
|
+
moveFile: s.move,
|
|
827
|
+
listFolders: n.list,
|
|
828
|
+
createFolder: n.create,
|
|
829
|
+
deleteFolder: n.delete,
|
|
830
|
+
renameFolder: n.rename,
|
|
831
|
+
uploadTempFile: (h) => e({
|
|
797
832
|
lightDriveUploadTempFile: {
|
|
798
|
-
__args: { index:
|
|
833
|
+
__args: { index: r, file: h },
|
|
799
834
|
name: !0,
|
|
800
835
|
path: !0,
|
|
801
836
|
size: !0,
|
|
802
837
|
mime: !0
|
|
803
838
|
}
|
|
804
|
-
}).then((
|
|
839
|
+
}).then((l) => l.lightDriveUploadTempFile)
|
|
805
840
|
};
|
|
806
|
-
},
|
|
841
|
+
}, B = {
|
|
807
842
|
user_id: !0,
|
|
808
843
|
username: !0,
|
|
809
844
|
first_name: !0,
|
|
810
845
|
last_name: !0,
|
|
811
846
|
status: !0
|
|
812
|
-
},
|
|
847
|
+
}, fe = (t) => g({
|
|
813
848
|
addUser: {
|
|
814
849
|
__args: t
|
|
815
850
|
}
|
|
816
|
-
}).then((e) => e.addUser),
|
|
851
|
+
}).then((e) => e.addUser), ge = (t) => g({
|
|
817
852
|
deleteUser: {
|
|
818
853
|
__args: { id: t }
|
|
819
854
|
}
|
|
820
|
-
}).then((e) => e.deleteUser),
|
|
855
|
+
}).then((e) => e.deleteUser), de = (t = B) => v("Users", t).dataPath("app.listUser").fetch(), _e = (t, e) => g({
|
|
821
856
|
updateUser: {
|
|
822
857
|
__args: { id: t, data: e }
|
|
823
858
|
}
|
|
824
|
-
}).then((r) => r.updateUser),
|
|
825
|
-
list:
|
|
826
|
-
create:
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
859
|
+
}).then((r) => r.updateUser), jt = (t, e) => ({
|
|
860
|
+
list: (r = B) => e("Users", r).dataPath("app.listUser").fetch(),
|
|
861
|
+
create: (r) => t({
|
|
862
|
+
addUser: { __args: r }
|
|
863
|
+
}).then((s) => s.addUser),
|
|
864
|
+
delete: (r) => t({
|
|
865
|
+
deleteUser: { __args: { id: r } }
|
|
866
|
+
}).then((s) => s.deleteUser),
|
|
867
|
+
update: (r, s) => t({
|
|
868
|
+
updateUser: { __args: { id: r, data: s } }
|
|
869
|
+
}).then((n) => n.updateUser)
|
|
870
|
+
}), et = (t) => (e) => t({
|
|
830
871
|
app: {
|
|
831
872
|
listConfig: {
|
|
832
873
|
__args: {
|
|
833
874
|
filters: {
|
|
834
|
-
name:
|
|
875
|
+
name: e
|
|
835
876
|
}
|
|
836
877
|
},
|
|
837
878
|
data: {
|
|
@@ -840,13 +881,13 @@ const L = (t, e) => {
|
|
|
840
881
|
}
|
|
841
882
|
}
|
|
842
883
|
}
|
|
843
|
-
}).then((
|
|
884
|
+
}).then((r) => r.app.listConfig.data[0]?.value), ye = et(F), rt = {
|
|
844
885
|
name: !0
|
|
845
|
-
},
|
|
886
|
+
}, we = (t = rt) => F({
|
|
846
887
|
app: {
|
|
847
888
|
roles: t
|
|
848
889
|
}
|
|
849
|
-
}).then((e) => e.app.roles),
|
|
890
|
+
}).then((e) => e.app.roles), be = (t, e) => g({
|
|
850
891
|
addRole: {
|
|
851
892
|
__args: {
|
|
852
893
|
data: {
|
|
@@ -855,93 +896,111 @@ const L = (t, e) => {
|
|
|
855
896
|
}
|
|
856
897
|
}
|
|
857
898
|
}
|
|
858
|
-
}).then((r) => r.addRole),
|
|
899
|
+
}).then((r) => r.addRole), me = (t) => g({
|
|
859
900
|
deleteRole: {
|
|
860
901
|
__args: { name: t }
|
|
861
902
|
}
|
|
862
|
-
}).then((e) => e.deleteRole),
|
|
863
|
-
list:
|
|
864
|
-
|
|
865
|
-
|
|
903
|
+
}).then((e) => e.deleteRole), Et = (t, e) => ({
|
|
904
|
+
list: (r = rt) => t({
|
|
905
|
+
app: { roles: r }
|
|
906
|
+
}).then((s) => s.app.roles),
|
|
907
|
+
create: (r, s) => e({
|
|
908
|
+
addRole: { __args: { data: { name: r, childs: s } } }
|
|
909
|
+
}).then((n) => n.addRole),
|
|
910
|
+
delete: (r) => e({
|
|
911
|
+
deleteRole: { __args: { name: r } }
|
|
912
|
+
}).then((s) => s.deleteRole)
|
|
866
913
|
});
|
|
867
|
-
function
|
|
914
|
+
function G(t) {
|
|
915
|
+
if (Array.isArray(t))
|
|
916
|
+
return t.map((e) => G(e)).filter((e) => e !== void 0);
|
|
917
|
+
if (t !== null && typeof t == "object") {
|
|
918
|
+
const e = Object.getPrototypeOf(t);
|
|
919
|
+
if (e === Object.prototype || e === null)
|
|
920
|
+
return Object.fromEntries(
|
|
921
|
+
Object.entries(t).filter(([, r]) => r !== void 0).map(([r, s]) => [r, G(s)])
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
return t;
|
|
925
|
+
}
|
|
926
|
+
function st(t, e, r, s, n) {
|
|
868
927
|
if (!(!t || typeof t != "object"))
|
|
869
|
-
for (let
|
|
870
|
-
const
|
|
871
|
-
if (
|
|
872
|
-
if ("__args" in
|
|
873
|
-
const
|
|
874
|
-
Object.entries(
|
|
875
|
-
if (
|
|
876
|
-
|
|
877
|
-
let
|
|
878
|
-
|
|
879
|
-
|
|
928
|
+
for (let h in t) {
|
|
929
|
+
const l = t[h];
|
|
930
|
+
if (l && typeof l == "object") {
|
|
931
|
+
if ("__args" in l) {
|
|
932
|
+
const f = G(l.__args), p = {};
|
|
933
|
+
Object.entries(f).forEach(([o, i]) => {
|
|
934
|
+
if (i instanceof Array && S(i)) {
|
|
935
|
+
p[o] = new O(o);
|
|
936
|
+
let a = 0;
|
|
937
|
+
i.forEach((c) => {
|
|
938
|
+
c instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + o + "." + a), s.append(n.current.toString(), c), n.current++, a++);
|
|
880
939
|
}), e[o] = "[Upload!]!";
|
|
881
|
-
} else
|
|
882
|
-
if (
|
|
883
|
-
|
|
884
|
-
let
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
}), e[
|
|
888
|
-
} else
|
|
889
|
-
})) :
|
|
890
|
-
}),
|
|
940
|
+
} else i instanceof File ? (p[o] = new O(o), r[n.current] = ["variables." + o], s.append(n.current.toString(), i), e[o] = "Upload!", n.current++) : i instanceof Object && W(i) ? (p[o] = {}, Object.entries(i).forEach(([a, c]) => {
|
|
941
|
+
if (c instanceof Array && S(c)) {
|
|
942
|
+
p[o][a] = new O(a);
|
|
943
|
+
let m = 0;
|
|
944
|
+
c.forEach((w) => {
|
|
945
|
+
w instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + a + "." + m), s.append(n.current.toString(), w), n.current++, m++);
|
|
946
|
+
}), e[a] = "[Upload!]!";
|
|
947
|
+
} else c instanceof File ? (p[o][a] = new O(a), r[n.current] = ["variables." + a], s.append(n.current.toString(), c), e[a] = "Upload!", n.current++) : p[o][a] = c;
|
|
948
|
+
})) : i != null && (p[o] = i);
|
|
949
|
+
}), l.__args = p;
|
|
891
950
|
}
|
|
892
|
-
|
|
951
|
+
st(l, e, r, s, n);
|
|
893
952
|
}
|
|
894
953
|
}
|
|
895
954
|
}
|
|
896
|
-
const
|
|
897
|
-
const
|
|
898
|
-
let
|
|
899
|
-
const
|
|
900
|
-
|
|
901
|
-
let
|
|
902
|
-
const
|
|
903
|
-
if (
|
|
904
|
-
query:
|
|
905
|
-
})),
|
|
906
|
-
query:
|
|
907
|
-
}),
|
|
908
|
-
throw new Error(
|
|
909
|
-
return
|
|
910
|
-
},
|
|
911
|
-
send:
|
|
912
|
-
},
|
|
955
|
+
const nt = (t) => async (e) => {
|
|
956
|
+
const r = e, s = new FormData();
|
|
957
|
+
let n = !1;
|
|
958
|
+
const h = {}, l = {};
|
|
959
|
+
st(r, h, l, s, { current: 0 }), n = Object.keys(h).length > 0, n && (r.__variables = h);
|
|
960
|
+
let p = null;
|
|
961
|
+
const i = Q({ mutation: r });
|
|
962
|
+
if (n ? (s.append("map", JSON.stringify(l)), s.append("operations", JSON.stringify({
|
|
963
|
+
query: i
|
|
964
|
+
})), p = await t.post("", s)) : p = await t.post("", {
|
|
965
|
+
query: i
|
|
966
|
+
}), p.data.errors)
|
|
967
|
+
throw new Error(p.data.errors[0].message);
|
|
968
|
+
return p.data.data;
|
|
969
|
+
}, g = async (t) => nt(z().axios)(t), Fe = (t, e, r) => g({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((s) => s.sendMail), Mt = (t) => ({
|
|
970
|
+
send: (e, r, s) => t({ sendMail: { __args: { email: e, subject: r, message: s } } }).then((n) => n.sendMail)
|
|
971
|
+
}), vt = (t) => g({
|
|
913
972
|
lightFSCreateFolder: {
|
|
914
973
|
__args: { location: t }
|
|
915
974
|
}
|
|
916
|
-
}).then((e) => e.lightFSCreateFolder),
|
|
975
|
+
}).then((e) => e.lightFSCreateFolder), Nt = (t) => g({
|
|
917
976
|
lightFSDeleteFolder: {
|
|
918
977
|
__args: { location: t }
|
|
919
978
|
}
|
|
920
|
-
}).then((e) => e.lightFSDeleteFolder),
|
|
979
|
+
}).then((e) => e.lightFSDeleteFolder), Bt = (t, e) => g({
|
|
921
980
|
lightFSRenameFolder: {
|
|
922
981
|
__args: { location: t, newName: e }
|
|
923
982
|
}
|
|
924
|
-
}).then((r) => r.lightFSRenameFolder),
|
|
983
|
+
}).then((r) => r.lightFSRenameFolder), Rt = (t, e) => g({
|
|
925
984
|
lightFSRenameFile: {
|
|
926
985
|
__args: { location: t, newName: e }
|
|
927
986
|
}
|
|
928
|
-
}).then((r) => r.lightFSRenameFile),
|
|
987
|
+
}).then((r) => r.lightFSRenameFile), qt = (t, e) => g({
|
|
929
988
|
lightFSWriteFile: {
|
|
930
989
|
__args: { location: t, content: e }
|
|
931
990
|
}
|
|
932
|
-
}).then((r) => r.lightFSWriteFile), Lt = (t, e) =>
|
|
991
|
+
}).then((r) => r.lightFSWriteFile), Lt = (t, e, r = !1) => g({
|
|
933
992
|
lightFSUploadFile: {
|
|
934
|
-
__args: { location: t, file: e }
|
|
993
|
+
__args: { location: t, file: e, rename: r }
|
|
935
994
|
}
|
|
936
|
-
}).then((
|
|
995
|
+
}).then((s) => s.lightFSUploadFile), Tt = (t) => g({
|
|
937
996
|
lightFSDeleteFile: {
|
|
938
997
|
__args: { location: t }
|
|
939
998
|
}
|
|
940
|
-
}).then((e) => e.lightFSDeleteFile),
|
|
999
|
+
}).then((e) => e.lightFSDeleteFile), Gt = (t, e) => g({
|
|
941
1000
|
lightFSMove: {
|
|
942
1001
|
__args: { from: t, to: e }
|
|
943
1002
|
}
|
|
944
|
-
}).then((r) => r.lightFSMove),
|
|
1003
|
+
}).then((r) => r.lightFSMove), Jt = (t) => F({
|
|
945
1004
|
app: {
|
|
946
1005
|
fs: {
|
|
947
1006
|
exists: {
|
|
@@ -951,7 +1010,7 @@ const f = async (t) => {
|
|
|
951
1010
|
}
|
|
952
1011
|
}).then((e) => e.app.fs.exists), $t = (t, e) => {
|
|
953
1012
|
const r = {};
|
|
954
|
-
return t && (r.search = t), e && (r.label = e),
|
|
1013
|
+
return t && (r.search = t), e && (r.label = e), F({
|
|
955
1014
|
app: {
|
|
956
1015
|
fs: {
|
|
957
1016
|
find: {
|
|
@@ -973,7 +1032,7 @@ const f = async (t) => {
|
|
|
973
1032
|
}
|
|
974
1033
|
}
|
|
975
1034
|
}).then((s) => s.app.fs.find);
|
|
976
|
-
},
|
|
1035
|
+
}, Qt = (t) => F({
|
|
977
1036
|
app: {
|
|
978
1037
|
fs: {
|
|
979
1038
|
node: {
|
|
@@ -1003,7 +1062,7 @@ const f = async (t) => {
|
|
|
1003
1062
|
}
|
|
1004
1063
|
}
|
|
1005
1064
|
}
|
|
1006
|
-
}).then((r) => r.app.fs.node),
|
|
1065
|
+
}).then((r) => r.app.fs.node), zt = (t, e = "text") => F({
|
|
1007
1066
|
app: {
|
|
1008
1067
|
fs: {
|
|
1009
1068
|
node: {
|
|
@@ -1020,10 +1079,9 @@ const f = async (t) => {
|
|
|
1020
1079
|
}).then((r) => {
|
|
1021
1080
|
const s = r.app.fs.node;
|
|
1022
1081
|
return s?.__typename === "File" ? e === "text" ? s.content : s.base64Content : null;
|
|
1023
|
-
}), Wt = (t, e) =>
|
|
1082
|
+
}), Wt = (t, e) => g({
|
|
1024
1083
|
lightFSUploadBase64: {
|
|
1025
1084
|
__args: { location: t, base64: e },
|
|
1026
|
-
// 回傳 File 物件的欄位,方便前端立即顯示
|
|
1027
1085
|
__typename: !0,
|
|
1028
1086
|
name: !0,
|
|
1029
1087
|
path: !0,
|
|
@@ -1035,26 +1093,60 @@ const f = async (t) => {
|
|
|
1035
1093
|
lastModified: !0
|
|
1036
1094
|
}]
|
|
1037
1095
|
}
|
|
1038
|
-
}).then((r) => r.lightFSUploadBase64),
|
|
1096
|
+
}).then((r) => r.lightFSUploadBase64), Ht = (t) => g({
|
|
1097
|
+
lightFSDuplicateFile: {
|
|
1098
|
+
__args: { location: t }
|
|
1099
|
+
}
|
|
1100
|
+
}).then((e) => e.lightFSDuplicateFile), Xt = (t, e) => g({
|
|
1101
|
+
lightFSUploadTempFile: {
|
|
1102
|
+
__args: { location: t, file: e },
|
|
1103
|
+
name: !0,
|
|
1104
|
+
path: !0,
|
|
1105
|
+
location: !0,
|
|
1106
|
+
size: !0,
|
|
1107
|
+
mimeType: !0
|
|
1108
|
+
}
|
|
1109
|
+
}).then((r) => r.lightFSUploadTempFile), Yt = (t, e, r) => {
|
|
1110
|
+
const s = { location: t };
|
|
1111
|
+
return e && (s.type = e), r && (s.search = r), F({
|
|
1112
|
+
app: {
|
|
1113
|
+
fs: {
|
|
1114
|
+
listFiles: {
|
|
1115
|
+
__args: s,
|
|
1116
|
+
name: !0,
|
|
1117
|
+
path: !0,
|
|
1118
|
+
location: !0,
|
|
1119
|
+
size: !0,
|
|
1120
|
+
mimeType: !0,
|
|
1121
|
+
publicUrl: !0,
|
|
1122
|
+
lastModified: !0
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}).then((n) => n.app.fs.listFiles);
|
|
1127
|
+
}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1039
1128
|
__proto__: null,
|
|
1040
|
-
createFolder:
|
|
1129
|
+
createFolder: vt,
|
|
1041
1130
|
deleteFile: Tt,
|
|
1042
|
-
deleteFolder:
|
|
1043
|
-
|
|
1131
|
+
deleteFolder: Nt,
|
|
1132
|
+
duplicateFile: Ht,
|
|
1133
|
+
exists: Jt,
|
|
1044
1134
|
find: $t,
|
|
1045
|
-
list:
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1135
|
+
list: Qt,
|
|
1136
|
+
listFiles: Yt,
|
|
1137
|
+
move: Gt,
|
|
1138
|
+
readFile: zt,
|
|
1139
|
+
renameFile: Rt,
|
|
1140
|
+
renameFolder: Bt,
|
|
1050
1141
|
uploadBase64: Wt,
|
|
1051
1142
|
uploadFile: Lt,
|
|
1052
|
-
|
|
1053
|
-
|
|
1143
|
+
uploadTempFile: Xt,
|
|
1144
|
+
writeFile: qt
|
|
1145
|
+
}, Symbol.toStringTag, { value: "Module" })), J = (t) => {
|
|
1054
1146
|
let e = {};
|
|
1055
1147
|
return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
|
|
1056
|
-
Object.entries(
|
|
1057
|
-
e[s] =
|
|
1148
|
+
Object.entries(J(r)).forEach(([s, n]) => {
|
|
1149
|
+
e[s] = n;
|
|
1058
1150
|
});
|
|
1059
1151
|
}), e) : (Object.entries(t).forEach(([r, s]) => {
|
|
1060
1152
|
if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
|
|
@@ -1065,152 +1157,168 @@ const f = async (t) => {
|
|
|
1065
1157
|
e[r] = s;
|
|
1066
1158
|
return;
|
|
1067
1159
|
}
|
|
1068
|
-
e[r] =
|
|
1160
|
+
e[r] = J(s);
|
|
1069
1161
|
}), e);
|
|
1070
|
-
},
|
|
1162
|
+
}, Zt = (t) => J(t), Ce = (t) => {
|
|
1071
1163
|
const e = typeof window > "u";
|
|
1072
1164
|
let r = [];
|
|
1073
|
-
const s =
|
|
1165
|
+
const s = ot.create({
|
|
1074
1166
|
baseURL: t,
|
|
1075
1167
|
withCredentials: !0
|
|
1076
1168
|
});
|
|
1077
|
-
let
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
}),
|
|
1169
|
+
let n = !1, h = [];
|
|
1170
|
+
const l = (u, _ = null) => {
|
|
1171
|
+
h.forEach((d) => {
|
|
1172
|
+
u ? d.reject(u) : d.resolve(_);
|
|
1173
|
+
}), h = [];
|
|
1082
1174
|
};
|
|
1083
1175
|
s.interceptors.response.use(
|
|
1084
|
-
(
|
|
1085
|
-
const
|
|
1086
|
-
if (
|
|
1087
|
-
const
|
|
1088
|
-
return
|
|
1089
|
-
|
|
1090
|
-
}).then(() => s(
|
|
1176
|
+
(u) => {
|
|
1177
|
+
const _ = u.data.errors;
|
|
1178
|
+
if (_ && _.some((d) => d.extensions?.code === "TOKEN_EXPIRED")) {
|
|
1179
|
+
const d = u.config;
|
|
1180
|
+
return n ? new Promise((y, A) => {
|
|
1181
|
+
h.push({ resolve: y, reject: A });
|
|
1182
|
+
}).then(() => s(d)).catch((y) => Promise.reject(y)) : (n = !0, f().then(() => (n = !1, l(null), s(d))).catch((y) => (n = !1, l(y), Promise.reject(y))));
|
|
1091
1183
|
}
|
|
1092
|
-
return
|
|
1184
|
+
return u;
|
|
1093
1185
|
},
|
|
1094
|
-
(
|
|
1186
|
+
(u) => Promise.reject(u)
|
|
1095
1187
|
);
|
|
1096
|
-
function
|
|
1188
|
+
function f() {
|
|
1097
1189
|
return s.post("/refresh_token");
|
|
1098
1190
|
}
|
|
1099
|
-
e && (s.interceptors.request.use((
|
|
1100
|
-
if (
|
|
1101
|
-
const
|
|
1102
|
-
r.forEach((
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1105
|
-
}),
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1108
|
-
}), r = Array.from(
|
|
1191
|
+
e && (s.interceptors.request.use((u) => (u.withCredentials = !0, r.length > 0 && (u.headers.Cookie = r.join("; ")), u)), s.interceptors.response.use((u) => {
|
|
1192
|
+
if (u.headers["set-cookie"]) {
|
|
1193
|
+
const _ = u.headers["set-cookie"].map((y) => y.split(";")[0]), d = /* @__PURE__ */ new Map();
|
|
1194
|
+
r.forEach((y) => {
|
|
1195
|
+
const A = y.split("=")[0];
|
|
1196
|
+
d.set(A, y);
|
|
1197
|
+
}), _.forEach((y) => {
|
|
1198
|
+
const A = y.split("=")[0];
|
|
1199
|
+
d.set(A, y);
|
|
1200
|
+
}), r = Array.from(d.values());
|
|
1109
1201
|
}
|
|
1110
|
-
return
|
|
1202
|
+
return u;
|
|
1111
1203
|
}));
|
|
1112
|
-
const
|
|
1113
|
-
|
|
1204
|
+
const p = Y(s), o = nt(s), i = (u, _) => v(u, _, p), a = (u, _) => Z(u, _, p), c = (u) => {
|
|
1205
|
+
const _ = q(u), d = V(u, _.$fields, {
|
|
1206
|
+
mutation: o,
|
|
1207
|
+
createList: i,
|
|
1208
|
+
createCollection: a
|
|
1209
|
+
});
|
|
1210
|
+
return d.setDataPath(_.getDataPath()), d;
|
|
1211
|
+
}, m = yt(p, o), w = {
|
|
1212
|
+
post: s.post.bind(s),
|
|
1114
1213
|
baseURL: t,
|
|
1115
1214
|
axios: s,
|
|
1116
|
-
auth:
|
|
1117
|
-
mutation:
|
|
1118
|
-
query:
|
|
1119
|
-
config:
|
|
1120
|
-
mail:
|
|
1121
|
-
users:
|
|
1122
|
-
model(
|
|
1123
|
-
return
|
|
1215
|
+
auth: m,
|
|
1216
|
+
mutation: o,
|
|
1217
|
+
query: p,
|
|
1218
|
+
config: et(p),
|
|
1219
|
+
mail: Mt(o),
|
|
1220
|
+
users: jt(o, i),
|
|
1221
|
+
model(u) {
|
|
1222
|
+
return c(u);
|
|
1124
1223
|
},
|
|
1125
|
-
roles:
|
|
1126
|
-
collect: (
|
|
1127
|
-
const
|
|
1128
|
-
return
|
|
1224
|
+
roles: Et(p, o),
|
|
1225
|
+
collect: (u, _) => {
|
|
1226
|
+
const d = a(u, _);
|
|
1227
|
+
return d.data_path = q(u).getDataPath(), d;
|
|
1129
1228
|
},
|
|
1130
|
-
list: (
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1229
|
+
list: (u, _) => i(u, _).dataPath(q(u).getDataPath()),
|
|
1230
|
+
/**
|
|
1231
|
+
* @deprecated Use `fs.*` from `filesystem` instead.
|
|
1232
|
+
*/
|
|
1233
|
+
drive: tt(p, o),
|
|
1234
|
+
async collects(u) {
|
|
1235
|
+
const _ = {}, d = {};
|
|
1236
|
+
for (const A in u) {
|
|
1237
|
+
const k = u[A].getQueryPayload();
|
|
1238
|
+
d[A] = k.data_path, _[A] = {};
|
|
1239
|
+
const P = k.data_path.split(".");
|
|
1240
|
+
let j = P[P.length - 1], C = _[A];
|
|
1241
|
+
for (const E of P) {
|
|
1242
|
+
if (E === j) {
|
|
1243
|
+
C[E] = k.query;
|
|
1142
1244
|
break;
|
|
1143
1245
|
}
|
|
1144
|
-
|
|
1246
|
+
C[E] = C[E] || {};
|
|
1145
1247
|
}
|
|
1146
|
-
|
|
1248
|
+
_[A].__aliasFor = P[0];
|
|
1147
1249
|
}
|
|
1148
|
-
const
|
|
1149
|
-
for (const
|
|
1150
|
-
const
|
|
1151
|
-
let
|
|
1152
|
-
for (const
|
|
1153
|
-
if (
|
|
1154
|
-
|
|
1250
|
+
const y = await p(_);
|
|
1251
|
+
for (const A in u) {
|
|
1252
|
+
const k = d[A].split(".");
|
|
1253
|
+
let P = k[k.length - 1], j = y[A];
|
|
1254
|
+
for (const C of k) {
|
|
1255
|
+
if (C === P) {
|
|
1256
|
+
u[A]._batchData = y[A][C];
|
|
1155
1257
|
break;
|
|
1156
1258
|
}
|
|
1157
|
-
|
|
1259
|
+
j[C] = j[C] || {};
|
|
1158
1260
|
}
|
|
1159
1261
|
}
|
|
1160
|
-
return
|
|
1262
|
+
return u;
|
|
1161
1263
|
}
|
|
1162
1264
|
};
|
|
1163
|
-
return
|
|
1164
|
-
},
|
|
1265
|
+
return at(w), w;
|
|
1266
|
+
}, Oe = v;
|
|
1165
1267
|
export {
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
xt as
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1268
|
+
S as arrayHasFile,
|
|
1269
|
+
ae as auth,
|
|
1270
|
+
Ft as changeExpiredPassword,
|
|
1271
|
+
ne as clearModels,
|
|
1272
|
+
yt as createAuth,
|
|
1273
|
+
Ce as createClient,
|
|
1274
|
+
Z as createCollection,
|
|
1275
|
+
et as createConfig,
|
|
1276
|
+
tt as createDrive,
|
|
1277
|
+
te as createFileFromBase64,
|
|
1278
|
+
ee as createFileFromBase85,
|
|
1279
|
+
H as createFileFromString,
|
|
1280
|
+
v as createList,
|
|
1281
|
+
Mt as createMail,
|
|
1282
|
+
be as createRole,
|
|
1283
|
+
Et as createRoles,
|
|
1284
|
+
fe as createUser,
|
|
1285
|
+
jt as createUsers,
|
|
1286
|
+
B as defaultUserFields,
|
|
1287
|
+
I as defineModel,
|
|
1288
|
+
oe as defineModels,
|
|
1289
|
+
me as deleteRole,
|
|
1290
|
+
ge as deleteUser,
|
|
1291
|
+
Ot as forgetPassword,
|
|
1292
|
+
Ae as fs,
|
|
1293
|
+
z as getApiClient,
|
|
1294
|
+
xt as getApiClientOptional,
|
|
1295
|
+
ye as getConfig,
|
|
1296
|
+
wt as getCurrentUser,
|
|
1297
|
+
pe as getDrive,
|
|
1298
|
+
Dt as getGrantedRights,
|
|
1299
|
+
q as getModel,
|
|
1300
|
+
re as hasModel,
|
|
1301
|
+
kt as isGranted,
|
|
1302
|
+
Oe as list,
|
|
1303
|
+
ue as listDrives,
|
|
1304
|
+
le as listFiles,
|
|
1305
|
+
he as listFolders,
|
|
1306
|
+
se as listModels,
|
|
1307
|
+
ie as listPermissions,
|
|
1308
|
+
we as listRoles,
|
|
1309
|
+
de as listUsers,
|
|
1310
|
+
bt as login,
|
|
1311
|
+
mt as logout,
|
|
1312
|
+
g as mutation,
|
|
1313
|
+
W as objectHasFile,
|
|
1314
|
+
F as query,
|
|
1315
|
+
ce as readFileAsBase64,
|
|
1316
|
+
Ct as resetPassword,
|
|
1317
|
+
Fe as sendMail,
|
|
1318
|
+
at as setApiClient,
|
|
1319
|
+
Zt as toQuery,
|
|
1320
|
+
At as updatePassword,
|
|
1321
|
+
_e as updateUser,
|
|
1322
|
+
Ut as verifyCode,
|
|
1323
|
+
_t as webAuthn
|
|
1216
1324
|
};
|