@hostlink/light 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -1
- package/dist/auth.d.ts +36 -1
- package/dist/config.d.ts +2 -0
- package/dist/createClient.d.ts +26 -16
- package/dist/createClient.test.d.ts +1 -0
- package/dist/createCollection.d.ts +3 -1
- package/dist/createList.d.ts +3 -1
- package/dist/drive.d.ts +40 -4
- package/dist/file.d.ts +2 -1
- package/dist/filesystem.d.ts +1 -1
- package/dist/folder.d.ts +3 -2
- package/dist/light.js +720 -586
- 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/light.js
CHANGED
|
@@ -1,131 +1,131 @@
|
|
|
1
|
-
import { jsonToGraphQLQuery as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { jsonToGraphQLQuery as I, VariableType as S } from "json-to-graphql-query";
|
|
2
|
+
import Q from "collect.js";
|
|
3
|
+
import gt from "axios";
|
|
4
|
+
function $(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 W(t, e, r = ".", s) {
|
|
11
|
+
if (!$(e))
|
|
12
|
+
return W(t, {}, r, s);
|
|
13
|
+
const n = Object.assign({}, e);
|
|
14
|
+
for (const c in t) {
|
|
15
|
+
if (c === "__proto__" || c === "constructor")
|
|
16
16
|
continue;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(r ? `${r}.` : "") +
|
|
17
|
+
const l = t[c];
|
|
18
|
+
l != null && (s && s(n, c, l, r) || (Array.isArray(l) && Array.isArray(n[c]) ? n[c] = [...l, ...n[c]] : $(l) && $(n[c]) ? n[c] = W(
|
|
19
|
+
l,
|
|
20
|
+
n[c],
|
|
21
|
+
(r ? `${r}.` : "") + c.toString(),
|
|
22
22
|
s
|
|
23
|
-
) :
|
|
23
|
+
) : n[c] = l));
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return n;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function dt(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) => W(r, s, "", t), {})
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
if (!
|
|
33
|
+
const j = dt();
|
|
34
|
+
let q = null;
|
|
35
|
+
const _t = (t) => {
|
|
36
|
+
q = t;
|
|
37
|
+
}, K = () => {
|
|
38
|
+
if (!q)
|
|
39
39
|
throw new Error("Api client not initialized. Call setApiClient() first.");
|
|
40
|
-
return
|
|
41
|
-
},
|
|
42
|
-
function
|
|
40
|
+
return q;
|
|
41
|
+
}, ce = () => q;
|
|
42
|
+
function N(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 x(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 && N(t[e]))
|
|
51
51
|
return !0;
|
|
52
52
|
return !1;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function yt(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, c, 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, c = t.length; c > 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 tt = (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 c = new Blob([n], { type: s });
|
|
68
|
+
return URL.createObjectURL(c);
|
|
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
|
+
}, ue = (t) => tt(atob(t)), he = (t) => tt(yt(t));
|
|
82
|
+
function et(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
|
-
|
|
95
|
-
}), e[
|
|
96
|
-
} else
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}), e[
|
|
103
|
-
} else
|
|
104
|
-
})) :
|
|
105
|
-
}),
|
|
84
|
+
for (let c in t) {
|
|
85
|
+
const l = t[c];
|
|
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 && N(i)) {
|
|
91
|
+
p[o] = new S(o);
|
|
92
|
+
let a = 0;
|
|
93
|
+
i.forEach((u) => {
|
|
94
|
+
u instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + o + "." + a), s.append(n.current.toString(), u), n.current++, a++);
|
|
95
|
+
}), e[o] = "[Upload!]!";
|
|
96
|
+
} else i instanceof File ? (p[o] = new S(o), r[n.current] = ["variables." + o], s.append(n.current.toString(), i), e[o] = "Upload!", n.current++) : i instanceof Object && x(i) ? (p[o] = {}, Object.entries(i).forEach(([a, u]) => {
|
|
97
|
+
if (u instanceof Array && N(u)) {
|
|
98
|
+
p[o][a] = new S(a);
|
|
99
|
+
let m = 0;
|
|
100
|
+
u.forEach((d) => {
|
|
101
|
+
d instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + a + "." + m), s.append(n.current.toString(), d), n.current++, m++);
|
|
102
|
+
}), e[a] = "[Upload!]!";
|
|
103
|
+
} else u instanceof File ? (p[o][a] = new S(a), r[n.current] = ["variables." + a], s.append(n.current.toString(), u), e[a] = "Upload!", n.current++) : p[o][a] = u;
|
|
104
|
+
})) : i != null && (p[o] = i);
|
|
105
|
+
}), l.__args = p;
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
et(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 rt = (t) => async (e) => {
|
|
112
|
+
const r = e, s = new FormData();
|
|
113
|
+
let n = !1;
|
|
114
|
+
const c = {}, l = {};
|
|
115
|
+
et(r, c, l, s, { current: 0 }), n = Object.keys(c).length > 0, n && (r.__variables = c);
|
|
116
|
+
let p = null;
|
|
117
|
+
const i = I({ 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) => rt(K().axios)(t);
|
|
126
|
+
function L(t, e, r = F) {
|
|
127
|
+
let s, n = [], c, 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();
|
|
@@ -138,40 +138,40 @@ function j(t, e) {
|
|
|
138
138
|
return Array.isArray(i) && i.length > 0 ? i[0] : null;
|
|
139
139
|
},
|
|
140
140
|
async fetchWithMeta() {
|
|
141
|
-
let i = await
|
|
142
|
-
if (
|
|
143
|
-
const a =
|
|
144
|
-
for (const
|
|
145
|
-
i = i[
|
|
141
|
+
let i = await r(this.toQuery(!0));
|
|
142
|
+
if (l) {
|
|
143
|
+
const a = l.split(".");
|
|
144
|
+
for (const u of a)
|
|
145
|
+
i = i[u];
|
|
146
146
|
return i;
|
|
147
147
|
}
|
|
148
148
|
return i[`list${t}`];
|
|
149
149
|
},
|
|
150
150
|
async fetch() {
|
|
151
|
-
let i = await
|
|
152
|
-
if (
|
|
153
|
-
const a =
|
|
154
|
-
for (const
|
|
155
|
-
i = i[
|
|
151
|
+
let i = await r(this.toQuery());
|
|
152
|
+
if (l) {
|
|
153
|
+
const a = l.split(".");
|
|
154
|
+
for (const u of a)
|
|
155
|
+
i = i[u];
|
|
156
156
|
return i.data;
|
|
157
157
|
}
|
|
158
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" && (c = 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 u = (m, d, b) => {
|
|
174
|
+
const C = {
|
|
175
175
|
">": "_gt",
|
|
176
176
|
"<": "_lt",
|
|
177
177
|
">=": "_gte",
|
|
@@ -180,83 +180,83 @@ function j(t, e) {
|
|
|
180
180
|
in: "_in",
|
|
181
181
|
contains: "_contains"
|
|
182
182
|
}[d];
|
|
183
|
-
|
|
183
|
+
C && n.push({ [m]: { [C]: b } });
|
|
184
184
|
};
|
|
185
185
|
if (a !== void 0)
|
|
186
|
-
|
|
186
|
+
u(o, String(i), a);
|
|
187
187
|
else {
|
|
188
|
-
const
|
|
189
|
-
|
|
188
|
+
const m = p(), d = j(m, { [o]: i });
|
|
189
|
+
n[0] = d;
|
|
190
190
|
}
|
|
191
191
|
return this;
|
|
192
192
|
},
|
|
193
193
|
// whereContains adds a _contains filter for a specific field
|
|
194
194
|
// If the same field is used multiple times, it merges them into an array
|
|
195
|
-
whereContains(
|
|
196
|
-
if (
|
|
197
|
-
const a = p(),
|
|
198
|
-
a[
|
|
195
|
+
whereContains(o, i) {
|
|
196
|
+
if (o && typeof o == "string") {
|
|
197
|
+
const a = p(), u = { _contains: i };
|
|
198
|
+
a[o] ? Array.isArray(a[o]) ? a[o].push(u) : a[o] = [a[o], u] : a[o] = [u], 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(), u = { _in: i };
|
|
208
|
+
a[o] ? Array.isArray(a[o]) ? a[o].push(u) : a[o] = [a[o], u] : a[o] = [u], 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 u = p(), m = { _between: [i, a] };
|
|
216
|
+
u[o] ? Array.isArray(u[o]) ? u[o].push(m) : u[o] = [u[o], m] : u[o] = m, n[0] = u;
|
|
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 = j(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 = j(s || {}, { offset: o })), this;
|
|
227
227
|
},
|
|
228
|
-
toQuery(
|
|
228
|
+
toQuery(o = !1) {
|
|
229
229
|
let i;
|
|
230
|
-
const a =
|
|
231
|
-
a &&
|
|
232
|
-
const d =
|
|
233
|
-
|
|
230
|
+
const a = n.length > 0 && Object.keys(n[0] || {}).length > 0, u = a ? 1 : 0, m = n.length > u;
|
|
231
|
+
a && m ? i = n : m ? i = n.slice(u) : a && (i = n[0]);
|
|
232
|
+
const d = j(
|
|
233
|
+
c ? { sort: c } : {},
|
|
234
234
|
i ? { filters: i } : {}
|
|
235
|
-
),
|
|
235
|
+
), b = {
|
|
236
236
|
data: {
|
|
237
237
|
...e
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
|
-
if (
|
|
240
|
+
if (s && (b.data.__args = s), Object.keys(d).length > 0 && (b.__args = d), o && (b.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 O = l.split(".");
|
|
246
|
+
let C = b;
|
|
247
|
+
for (let P = O.length - 1; P >= 0; P--)
|
|
248
|
+
C = {
|
|
249
|
+
[O[P]]: C
|
|
250
250
|
};
|
|
251
|
-
return
|
|
251
|
+
return C;
|
|
252
252
|
}
|
|
253
253
|
return {
|
|
254
|
-
[`list${t}`]:
|
|
254
|
+
[`list${t}`]: b
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
-
const
|
|
259
|
+
const wt = "list", bt = [
|
|
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
|
+
], mt = [
|
|
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 w {
|
|
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
|
+
w.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
|
+
w.prototype.dataPath = function(t) {
|
|
345
345
|
const e = this.clone();
|
|
346
346
|
return e.data_path = t, e;
|
|
347
347
|
};
|
|
348
|
-
|
|
348
|
+
w.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
|
+
w.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
|
+
Q().macro("whereContains", function(t, e) {
|
|
357
357
|
return this.filter((r) => r[t].toLowerCase().includes(e.toLowerCase()));
|
|
358
358
|
});
|
|
359
|
-
|
|
359
|
+
w.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, Q(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, Q(l.data);
|
|
386
386
|
} catch (t) {
|
|
387
387
|
throw console.error("Error fetching collection data:", t), t;
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
|
-
|
|
390
|
+
w.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
|
+
w.prototype.all = async function() {
|
|
397
397
|
return (await this.processData()).all();
|
|
398
398
|
};
|
|
399
|
-
for (const t of
|
|
400
|
-
|
|
399
|
+
for (const t of bt)
|
|
400
|
+
w.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 mt)
|
|
405
|
+
w.prototype[t] = async function(...e) {
|
|
406
406
|
return (await this.clone().processData())[t](...e);
|
|
407
407
|
};
|
|
408
|
-
|
|
409
|
-
|
|
408
|
+
w.prototype.average = w.prototype.avg;
|
|
409
|
+
w.prototype.first = async function() {
|
|
410
410
|
return this.take(1), (await this.processData()).first();
|
|
411
411
|
};
|
|
412
|
-
|
|
412
|
+
w.prototype._handleBatchData = function(t, e) {
|
|
413
413
|
return this._batchData ? (this.steps.push({ type: t, args: e }), this) : null;
|
|
414
414
|
};
|
|
415
|
-
|
|
415
|
+
w.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
|
+
w.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
|
+
w.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
|
+
w.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
|
+
w.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
|
+
w.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
|
+
w.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
|
+
w.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
|
+
w.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
|
+
w.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
|
+
w.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
|
+
w.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 st = (t, e, r = F) => {
|
|
490
|
+
const s = new w(e);
|
|
491
|
+
return s._queryFn = r, s.data_path = wt + t, s;
|
|
492
|
+
}, nt = (t, e = {}, r = {}) => {
|
|
493
|
+
const s = r.mutation || g, n = r.createList || L, c = r.createCollection || st, 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 u = p(a);
|
|
510
|
+
u && (i = j(i, u.gqlField ? typeof u.gqlField == "string" ? { [u.gqlField]: !0 } : u.gqlField : { [u.name || a]: !0 }));
|
|
511
|
+
} else typeof a == "object" && (i = j(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 u = p(a);
|
|
539
|
+
u && i.push(u);
|
|
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 = c(t, ne(i));
|
|
545
|
+
for (const [u, m] of Object.entries(o))
|
|
546
|
+
a.where(u, "==", 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(([d]) => {
|
|
553
|
+
l[d] && (a[d] = l[d], l[d].gqlField && (delete i[d], i = j(i, l[d].gqlField)), l[d].gql && (delete i[d], i = j(i, l[d].gql)));
|
|
554
554
|
});
|
|
555
|
-
const
|
|
555
|
+
const u = n(t, i).dataPath(f), m = u.fetch.bind(u);
|
|
556
556
|
return {
|
|
557
|
-
...
|
|
557
|
+
...u,
|
|
558
558
|
async fetch() {
|
|
559
|
-
return (await
|
|
560
|
-
const
|
|
561
|
-
return Object.entries(
|
|
562
|
-
|
|
563
|
-
}),
|
|
559
|
+
return (await m()).map((b) => {
|
|
560
|
+
const O = { ...b };
|
|
561
|
+
return Object.entries(a).forEach(([C, P]) => {
|
|
562
|
+
P.field && typeof P.field == "function" && (O[C] = P.field(b[C], b));
|
|
563
|
+
}), O;
|
|
564
564
|
});
|
|
565
565
|
},
|
|
566
566
|
async fetchFirst() {
|
|
567
|
-
const
|
|
568
|
-
if (!
|
|
569
|
-
const
|
|
570
|
-
return Object.entries(
|
|
571
|
-
|
|
572
|
-
}),
|
|
567
|
+
const b = await u.fetchFirst.bind(u)();
|
|
568
|
+
if (!b) return b;
|
|
569
|
+
const O = { ...b };
|
|
570
|
+
return Object.entries(a).forEach(([C, P]) => {
|
|
571
|
+
P.field && typeof P.field == "function" && (O[C] = P.field(b[C], b));
|
|
572
|
+
}), O;
|
|
573
573
|
}
|
|
574
574
|
};
|
|
575
575
|
}
|
|
576
576
|
};
|
|
577
|
-
},
|
|
578
|
-
const r =
|
|
579
|
-
return
|
|
580
|
-
},
|
|
581
|
-
Object.keys(
|
|
582
|
-
},
|
|
577
|
+
}, E = {}, ot = (t, e) => {
|
|
578
|
+
const r = nt(t, e);
|
|
579
|
+
return E[t] = r, r;
|
|
580
|
+
}, z = (t) => E[t] ? E[t] : ot(t, {}), pe = (t) => !!E[t], fe = () => Object.keys(E), ge = () => {
|
|
581
|
+
Object.keys(E).forEach((t) => delete E[t]);
|
|
582
|
+
}, de = (t) => {
|
|
583
583
|
Object.entries(t).forEach(([e, r]) => {
|
|
584
|
-
|
|
584
|
+
ot(e, r);
|
|
585
585
|
});
|
|
586
|
-
},
|
|
586
|
+
}, _e = () => 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), Y = (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
|
+
}, G = Y(F, g), Ft = G.assertion, At = G.attestation, kt = G.login, Ct = G.register, Ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
627
630
|
__proto__: null,
|
|
628
|
-
assertion:
|
|
629
|
-
attestation:
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
assertion: Ft,
|
|
632
|
+
attestation: At,
|
|
633
|
+
createWebAuthn: Y,
|
|
634
|
+
login: kt,
|
|
635
|
+
register: Ct
|
|
636
|
+
}, Symbol.toStringTag, { value: "Module" })), Pt = (t, e) => ({
|
|
637
|
+
getCurrentUser: (r = J) => t({ my: r }).then((s) => s.my),
|
|
638
|
+
login: (r, s, n = "") => e({ login: { __args: { username: r, password: s, code: n } } }).then((c) => c.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((c) => c.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((c) => c.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: Y(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
|
+
}), Ut = (t = J) => F({ my: t }).then((e) => e.my), Dt = (t, e, r = "") => g({ login: { __args: { username: t, password: e, code: r } } }).then((s) => s.login), St = () => g({ logout: !0 }).then((t) => t.logout), jt = (t, e, r) => g({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((s) => s.changeExpiredPassword), vt = (t, e) => g({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), Et = (t, e, r) => g({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((s) => s.resetPassword), Mt = (t, e) => g({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), Tt = (t, e) => g({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), Nt = (t) => F({
|
|
633
668
|
my: {
|
|
634
669
|
granted: {
|
|
635
670
|
__args: {
|
|
@@ -637,7 +672,7 @@ const J = (t, e) => {
|
|
|
637
672
|
}
|
|
638
673
|
}
|
|
639
674
|
}
|
|
640
|
-
}).then((e) => e.my.granted),
|
|
675
|
+
}).then((e) => e.my.granted), Rt = (t) => F({
|
|
641
676
|
my: {
|
|
642
677
|
grantedRights: {
|
|
643
678
|
__args: {
|
|
@@ -645,40 +680,40 @@ const J = (t, e) => {
|
|
|
645
680
|
}
|
|
646
681
|
}
|
|
647
682
|
}
|
|
648
|
-
}).then((e) => e.my.grantedRights),
|
|
649
|
-
getCurrentUser:
|
|
650
|
-
webAuthn:
|
|
683
|
+
}).then((e) => e.my.grantedRights), ye = {
|
|
684
|
+
getCurrentUser: Ut,
|
|
685
|
+
webAuthn: Ot,
|
|
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: Dt,
|
|
702
|
+
logout: St,
|
|
703
|
+
changeExpiredPassword: jt,
|
|
704
|
+
updatePassword: vt,
|
|
705
|
+
resetPassword: Et,
|
|
706
|
+
forgetPassword: Mt,
|
|
707
|
+
verifyCode: Tt,
|
|
708
|
+
grantedRights: Rt,
|
|
709
|
+
isGranted: Nt
|
|
710
|
+
}, it = {
|
|
676
711
|
name: !0,
|
|
677
712
|
path: !0,
|
|
678
713
|
size: !0,
|
|
679
714
|
mime: !0,
|
|
680
715
|
url: !0
|
|
681
|
-
},
|
|
716
|
+
}, we = (t, e, r = it) => F({
|
|
682
717
|
app: {
|
|
683
718
|
drive: {
|
|
684
719
|
__args: { index: t },
|
|
@@ -688,7 +723,7 @@ const J = (t, e) => {
|
|
|
688
723
|
}
|
|
689
724
|
}
|
|
690
725
|
}
|
|
691
|
-
}).then((s) => s.app.drive.files),
|
|
726
|
+
}).then((s) => s.app.drive.files), be = (t, e) => F({
|
|
692
727
|
app: {
|
|
693
728
|
drive: {
|
|
694
729
|
__args: {
|
|
@@ -702,15 +737,15 @@ const J = (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), Bt = (t, e = F, r = g) => ({
|
|
741
|
+
list: (s, n = it) => e({ app: { drive: { __args: { index: t }, files: { __args: { path: s }, ...n } } } }).then((c) => c.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 J = (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((c) => c.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 J = (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((c) => c.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((c) => c.lightDriveRenameFile),
|
|
789
|
+
move: (s, n) => r({ lightDriveMoveFile: { __args: { index: t, source: s, destination: n } } }).then((c) => c.lightDriveMoveFile)
|
|
790
|
+
}), at = {
|
|
756
791
|
name: !0,
|
|
757
792
|
path: !0
|
|
758
|
-
},
|
|
793
|
+
}, me = (t, e, r = at) => F({
|
|
759
794
|
app: {
|
|
760
795
|
drive: {
|
|
761
796
|
__args: { index: t },
|
|
@@ -765,73 +800,79 @@ const J = (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), qt = (t, e = F, r = g) => ({
|
|
804
|
+
list: (s, n = at) => e({ app: { drive: { __args: { index: t }, folders: { __args: { path: s }, ...n } } } }).then((c) => c.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((c) => c.lightDriveRenameFolder)
|
|
808
|
+
}), Fe = () => 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), Ae = (t) => lt(F, g)(t), lt = (t, e) => (r) => {
|
|
816
|
+
const s = Bt(r, t, e), n = qt(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: (c) => e({
|
|
797
832
|
lightDriveUploadTempFile: {
|
|
798
|
-
__args: { index:
|
|
833
|
+
__args: { index: r, file: c },
|
|
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
|
+
}, J = {
|
|
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
|
+
}, ke = (t) => g({
|
|
813
848
|
addUser: {
|
|
814
849
|
__args: t
|
|
815
850
|
}
|
|
816
|
-
}).then((e) => e.addUser),
|
|
851
|
+
}).then((e) => e.addUser), Ce = (t) => g({
|
|
817
852
|
deleteUser: {
|
|
818
853
|
__args: { id: t }
|
|
819
854
|
}
|
|
820
|
-
}).then((e) => e.deleteUser),
|
|
855
|
+
}).then((e) => e.deleteUser), Oe = (t = J) => L("Users", t).dataPath("app.listUser").fetch(), Pe = (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), Lt = (t, e) => ({
|
|
860
|
+
list: (r = J) => 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
|
+
}), ct = (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 J = (t, e) => {
|
|
|
840
881
|
}
|
|
841
882
|
}
|
|
842
883
|
}
|
|
843
|
-
}).then((
|
|
884
|
+
}).then((r) => r.app.listConfig.data[0]?.value), Ue = ct(F), ut = {
|
|
844
885
|
name: !0
|
|
845
|
-
},
|
|
886
|
+
}, De = (t = ut) => F({
|
|
846
887
|
app: {
|
|
847
888
|
roles: t
|
|
848
889
|
}
|
|
849
|
-
}).then((e) => e.app.roles),
|
|
890
|
+
}).then((e) => e.app.roles), Se = (t, e) => g({
|
|
850
891
|
addRole: {
|
|
851
892
|
__args: {
|
|
852
893
|
data: {
|
|
@@ -855,93 +896,111 @@ const J = (t, e) => {
|
|
|
855
896
|
}
|
|
856
897
|
}
|
|
857
898
|
}
|
|
858
|
-
}).then((r) => r.addRole),
|
|
899
|
+
}).then((r) => r.addRole), je = (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), Gt = (t, e) => ({
|
|
904
|
+
list: (r = ut) => 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 H(t) {
|
|
915
|
+
if (Array.isArray(t))
|
|
916
|
+
return t.map((e) => H(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, H(s)])
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
return t;
|
|
925
|
+
}
|
|
926
|
+
function ht(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
|
-
|
|
880
|
-
}), e[
|
|
881
|
-
} else
|
|
882
|
-
if (
|
|
883
|
-
|
|
884
|
-
let
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
}), e[
|
|
888
|
-
} else
|
|
889
|
-
})) :
|
|
890
|
-
}),
|
|
928
|
+
for (let c in t) {
|
|
929
|
+
const l = t[c];
|
|
930
|
+
if (l && typeof l == "object") {
|
|
931
|
+
if ("__args" in l) {
|
|
932
|
+
const f = H(l.__args), p = {};
|
|
933
|
+
Object.entries(f).forEach(([o, i]) => {
|
|
934
|
+
if (i instanceof Array && N(i)) {
|
|
935
|
+
p[o] = new S(o);
|
|
936
|
+
let a = 0;
|
|
937
|
+
i.forEach((u) => {
|
|
938
|
+
u instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + o + "." + a), s.append(n.current.toString(), u), n.current++, a++);
|
|
939
|
+
}), e[o] = "[Upload!]!";
|
|
940
|
+
} else i instanceof File ? (p[o] = new S(o), r[n.current] = ["variables." + o], s.append(n.current.toString(), i), e[o] = "Upload!", n.current++) : i instanceof Object && x(i) ? (p[o] = {}, Object.entries(i).forEach(([a, u]) => {
|
|
941
|
+
if (u instanceof Array && N(u)) {
|
|
942
|
+
p[o][a] = new S(a);
|
|
943
|
+
let m = 0;
|
|
944
|
+
u.forEach((d) => {
|
|
945
|
+
d instanceof File && (r[n.current] || (r[n.current] = []), r[n.current].push("variables." + a + "." + m), s.append(n.current.toString(), d), n.current++, m++);
|
|
946
|
+
}), e[a] = "[Upload!]!";
|
|
947
|
+
} else u instanceof File ? (p[o][a] = new S(a), r[n.current] = ["variables." + a], s.append(n.current.toString(), u), e[a] = "Upload!", n.current++) : p[o][a] = u;
|
|
948
|
+
})) : i != null && (p[o] = i);
|
|
949
|
+
}), l.__args = p;
|
|
891
950
|
}
|
|
892
|
-
|
|
951
|
+
ht(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 pt = (t) => async (e) => {
|
|
956
|
+
const r = e, s = new FormData();
|
|
957
|
+
let n = !1;
|
|
958
|
+
const c = {}, l = {};
|
|
959
|
+
ht(r, c, l, s, { current: 0 }), n = Object.keys(c).length > 0, n && (r.__variables = c);
|
|
960
|
+
let p = null;
|
|
961
|
+
const i = I({ 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) => pt(K().axios)(t), ve = (t, e, r) => g({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((s) => s.sendMail), Jt = (t) => ({
|
|
970
|
+
send: (e, r, s) => t({ sendMail: { __args: { email: e, subject: r, message: s } } }).then((n) => n.sendMail)
|
|
971
|
+
}), $t = (t) => g({
|
|
913
972
|
lightFSCreateFolder: {
|
|
914
973
|
__args: { location: t }
|
|
915
974
|
}
|
|
916
|
-
}).then((e) => e.lightFSCreateFolder),
|
|
975
|
+
}).then((e) => e.lightFSCreateFolder), zt = (t) => g({
|
|
917
976
|
lightFSDeleteFolder: {
|
|
918
977
|
__args: { location: t }
|
|
919
978
|
}
|
|
920
|
-
}).then((e) => e.lightFSDeleteFolder),
|
|
979
|
+
}).then((e) => e.lightFSDeleteFolder), Qt = (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), Wt = (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), Ht = (t, e) => g({
|
|
929
988
|
lightFSWriteFile: {
|
|
930
989
|
__args: { location: t, content: e }
|
|
931
990
|
}
|
|
932
|
-
}).then((r) => r.lightFSWriteFile),
|
|
991
|
+
}).then((r) => r.lightFSWriteFile), Xt = (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), Yt = (t) => g({
|
|
937
996
|
lightFSDeleteFile: {
|
|
938
997
|
__args: { location: t }
|
|
939
998
|
}
|
|
940
|
-
}).then((e) => e.lightFSDeleteFile),
|
|
999
|
+
}).then((e) => e.lightFSDeleteFile), Zt = (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), Vt = (t) => F({
|
|
945
1004
|
app: {
|
|
946
1005
|
fs: {
|
|
947
1006
|
exists: {
|
|
@@ -949,9 +1008,9 @@ const f = async (t) => {
|
|
|
949
1008
|
}
|
|
950
1009
|
}
|
|
951
1010
|
}
|
|
952
|
-
}).then((e) => e.app.fs.exists),
|
|
1011
|
+
}).then((e) => e.app.fs.exists), It = (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
|
+
}, Kt = (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), xt = (t, e = "text") => F({
|
|
1007
1066
|
app: {
|
|
1008
1067
|
fs: {
|
|
1009
1068
|
node: {
|
|
@@ -1020,7 +1079,7 @@ 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
|
-
}),
|
|
1082
|
+
}), te = (t, e) => g({
|
|
1024
1083
|
lightFSUploadBase64: {
|
|
1025
1084
|
__args: { location: t, base64: e },
|
|
1026
1085
|
__typename: !0,
|
|
@@ -1034,11 +1093,11 @@ const f = async (t) => {
|
|
|
1034
1093
|
lastModified: !0
|
|
1035
1094
|
}]
|
|
1036
1095
|
}
|
|
1037
|
-
}).then((r) => r.lightFSUploadBase64),
|
|
1096
|
+
}).then((r) => r.lightFSUploadBase64), ee = (t) => g({
|
|
1038
1097
|
lightFSDuplicateFile: {
|
|
1039
1098
|
__args: { location: t }
|
|
1040
1099
|
}
|
|
1041
|
-
}).then((e) => e.lightFSDuplicateFile),
|
|
1100
|
+
}).then((e) => e.lightFSDuplicateFile), re = (t, e) => g({
|
|
1042
1101
|
lightFSUploadTempFile: {
|
|
1043
1102
|
__args: { location: t, file: e },
|
|
1044
1103
|
name: !0,
|
|
@@ -1047,9 +1106,9 @@ const f = async (t) => {
|
|
|
1047
1106
|
size: !0,
|
|
1048
1107
|
mimeType: !0
|
|
1049
1108
|
}
|
|
1050
|
-
}).then((r) => r.lightFSUploadTempFile),
|
|
1109
|
+
}).then((r) => r.lightFSUploadTempFile), se = (t, e, r) => {
|
|
1051
1110
|
const s = { location: t };
|
|
1052
|
-
return e && (s.type = e), r && (s.search = r),
|
|
1111
|
+
return e && (s.type = e), r && (s.search = r), F({
|
|
1053
1112
|
app: {
|
|
1054
1113
|
fs: {
|
|
1055
1114
|
listFiles: {
|
|
@@ -1064,30 +1123,30 @@ const f = async (t) => {
|
|
|
1064
1123
|
}
|
|
1065
1124
|
}
|
|
1066
1125
|
}
|
|
1067
|
-
}).then((
|
|
1068
|
-
},
|
|
1126
|
+
}).then((n) => n.app.fs.listFiles);
|
|
1127
|
+
}, Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1069
1128
|
__proto__: null,
|
|
1070
|
-
createFolder:
|
|
1071
|
-
deleteFile:
|
|
1072
|
-
deleteFolder:
|
|
1073
|
-
duplicateFile:
|
|
1074
|
-
exists:
|
|
1075
|
-
find:
|
|
1076
|
-
list:
|
|
1077
|
-
listFiles:
|
|
1078
|
-
move:
|
|
1079
|
-
readFile:
|
|
1080
|
-
renameFile:
|
|
1081
|
-
renameFolder:
|
|
1082
|
-
uploadBase64:
|
|
1083
|
-
uploadFile:
|
|
1084
|
-
uploadTempFile:
|
|
1085
|
-
writeFile:
|
|
1086
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1129
|
+
createFolder: $t,
|
|
1130
|
+
deleteFile: Yt,
|
|
1131
|
+
deleteFolder: zt,
|
|
1132
|
+
duplicateFile: ee,
|
|
1133
|
+
exists: Vt,
|
|
1134
|
+
find: It,
|
|
1135
|
+
list: Kt,
|
|
1136
|
+
listFiles: se,
|
|
1137
|
+
move: Zt,
|
|
1138
|
+
readFile: xt,
|
|
1139
|
+
renameFile: Wt,
|
|
1140
|
+
renameFolder: Qt,
|
|
1141
|
+
uploadBase64: te,
|
|
1142
|
+
uploadFile: Xt,
|
|
1143
|
+
uploadTempFile: re,
|
|
1144
|
+
writeFile: Ht
|
|
1145
|
+
}, Symbol.toStringTag, { value: "Module" })), X = (t) => {
|
|
1087
1146
|
let e = {};
|
|
1088
1147
|
return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
|
|
1089
|
-
Object.entries(
|
|
1090
|
-
e[s] =
|
|
1148
|
+
Object.entries(X(r)).forEach(([s, n]) => {
|
|
1149
|
+
e[s] = n;
|
|
1091
1150
|
});
|
|
1092
1151
|
}), e) : (Object.entries(t).forEach(([r, s]) => {
|
|
1093
1152
|
if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
|
|
@@ -1098,152 +1157,227 @@ const f = async (t) => {
|
|
|
1098
1157
|
e[r] = s;
|
|
1099
1158
|
return;
|
|
1100
1159
|
}
|
|
1101
|
-
e[r] =
|
|
1160
|
+
e[r] = X(s);
|
|
1102
1161
|
}), e);
|
|
1103
|
-
},
|
|
1162
|
+
}, ne = (t) => X(t), Me = (t) => {
|
|
1104
1163
|
const e = typeof window > "u";
|
|
1105
|
-
let r = [];
|
|
1106
|
-
const
|
|
1164
|
+
let r = [], s = null, n = null, c = null, l = null;
|
|
1165
|
+
const f = /* @__PURE__ */ new Set(), p = gt.create({
|
|
1107
1166
|
baseURL: t,
|
|
1108
1167
|
withCredentials: !0
|
|
1168
|
+
}), o = async () => s && !oe(s) || !n ? s : (c ??= n().then((h) => (s = h, h)).finally(() => {
|
|
1169
|
+
c = null;
|
|
1170
|
+
}), c);
|
|
1171
|
+
p.interceptors.request.use(async (h) => {
|
|
1172
|
+
const _ = await o();
|
|
1173
|
+
return _ && (h.headers.Authorization = `Bearer ${_}`), h;
|
|
1109
1174
|
});
|
|
1110
|
-
let
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
}),
|
|
1175
|
+
let i = !1, a = [];
|
|
1176
|
+
const u = (h, _ = null) => {
|
|
1177
|
+
a.forEach((y) => {
|
|
1178
|
+
h ? y.reject(h) : y.resolve(_);
|
|
1179
|
+
}), a = [];
|
|
1115
1180
|
};
|
|
1116
|
-
|
|
1117
|
-
(
|
|
1118
|
-
const
|
|
1119
|
-
if (
|
|
1120
|
-
const
|
|
1121
|
-
return
|
|
1122
|
-
|
|
1123
|
-
}).then(() =>
|
|
1181
|
+
p.interceptors.response.use(
|
|
1182
|
+
(h) => {
|
|
1183
|
+
const _ = h.data.errors;
|
|
1184
|
+
if (_ && _.some((y) => y.extensions?.code === "TOKEN_EXPIRED")) {
|
|
1185
|
+
const y = h.config;
|
|
1186
|
+
return y._lightTokenRetried ? h : (y._lightTokenRetried = !0, n && (s = null), i ? new Promise((A, k) => {
|
|
1187
|
+
a.push({ resolve: A, reject: k });
|
|
1188
|
+
}).then(() => p(y)).catch((A) => Promise.reject(A)) : (i = !0, m().then(() => (i = !1, u(null), p(y))).catch((A) => (i = !1, u(A), Promise.reject(A)))));
|
|
1124
1189
|
}
|
|
1125
|
-
return
|
|
1190
|
+
return h;
|
|
1126
1191
|
},
|
|
1127
|
-
(
|
|
1192
|
+
(h) => Promise.reject(h)
|
|
1128
1193
|
);
|
|
1129
|
-
function
|
|
1130
|
-
return
|
|
1194
|
+
function m() {
|
|
1195
|
+
return n ? o().then(() => {
|
|
1196
|
+
}) : p.post("/refresh_token");
|
|
1131
1197
|
}
|
|
1132
|
-
e && (
|
|
1133
|
-
if (
|
|
1134
|
-
const
|
|
1135
|
-
r.forEach((
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
}),
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1141
|
-
}), r = Array.from(
|
|
1198
|
+
e && (p.interceptors.request.use((h) => (h.withCredentials = !0, r.length > 0 && (h.headers.Cookie = r.join("; ")), h)), p.interceptors.response.use((h) => {
|
|
1199
|
+
if (h.headers["set-cookie"]) {
|
|
1200
|
+
const _ = h.headers["set-cookie"].map((A) => A.split(";")[0]), y = /* @__PURE__ */ new Map();
|
|
1201
|
+
r.forEach((A) => {
|
|
1202
|
+
const k = A.split("=")[0];
|
|
1203
|
+
y.set(k, A);
|
|
1204
|
+
}), _.forEach((A) => {
|
|
1205
|
+
const k = A.split("=")[0];
|
|
1206
|
+
y.set(k, A);
|
|
1207
|
+
}), r = Array.from(y.values());
|
|
1142
1208
|
}
|
|
1143
|
-
return
|
|
1209
|
+
return h;
|
|
1144
1210
|
}));
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1211
|
+
const d = rt(p), b = pt(p), O = (h, _) => L(h, _, d), C = (h, _) => st(h, _, d), P = (h) => {
|
|
1212
|
+
const _ = z(h), y = nt(h, _.$fields, {
|
|
1213
|
+
mutation: b,
|
|
1214
|
+
createList: O,
|
|
1215
|
+
createCollection: C
|
|
1216
|
+
});
|
|
1217
|
+
return y.setDataPath(_.getDataPath()), y;
|
|
1218
|
+
}, U = Pt(d, b), Z = () => f.forEach((h) => h()), T = (h) => (async (..._) => {
|
|
1219
|
+
const y = await h(..._);
|
|
1220
|
+
return Z(), y;
|
|
1221
|
+
}), ft = {
|
|
1222
|
+
...U,
|
|
1223
|
+
login: T(U.login),
|
|
1224
|
+
logout: (async () => {
|
|
1225
|
+
try {
|
|
1226
|
+
return await U.logout();
|
|
1227
|
+
} finally {
|
|
1228
|
+
Z();
|
|
1229
|
+
}
|
|
1230
|
+
}),
|
|
1231
|
+
google: { ...U.google, login: T(U.google.login) },
|
|
1232
|
+
facebook: { ...U.facebook, login: T(U.facebook.login) },
|
|
1233
|
+
microsoft: { ...U.microsoft, login: T(U.microsoft.login) },
|
|
1234
|
+
webAuthn: { ...U.webAuthn, login: T(U.webAuthn.login) }
|
|
1235
|
+
}, V = {
|
|
1236
|
+
post: p.post.bind(p),
|
|
1147
1237
|
baseURL: t,
|
|
1148
|
-
axios:
|
|
1238
|
+
axios: p,
|
|
1239
|
+
setAccessToken(h) {
|
|
1240
|
+
s = h;
|
|
1241
|
+
},
|
|
1242
|
+
getAccessToken() {
|
|
1243
|
+
return s;
|
|
1244
|
+
},
|
|
1245
|
+
clearAccessToken() {
|
|
1246
|
+
s = null;
|
|
1247
|
+
},
|
|
1248
|
+
setAccessTokenProvider(h) {
|
|
1249
|
+
l?.(), l = null, n = h, s = null, c = null;
|
|
1250
|
+
},
|
|
1251
|
+
onAuthChange(h) {
|
|
1252
|
+
return f.add(h), () => f.delete(h);
|
|
1253
|
+
},
|
|
1254
|
+
useAudience(h, _) {
|
|
1255
|
+
l?.(), n = async () => (await h.mutation({
|
|
1256
|
+
createAudienceAccessToken: {
|
|
1257
|
+
__args: { audience: _ }
|
|
1258
|
+
}
|
|
1259
|
+
})).createAudienceAccessToken, s = null, c = null, l = h.onAuthChange(() => {
|
|
1260
|
+
s = null, c = null;
|
|
1261
|
+
});
|
|
1262
|
+
},
|
|
1149
1263
|
auth: ft,
|
|
1150
|
-
mutation:
|
|
1151
|
-
query:
|
|
1152
|
-
config:
|
|
1153
|
-
mail:
|
|
1154
|
-
users:
|
|
1155
|
-
model(
|
|
1156
|
-
return
|
|
1264
|
+
mutation: b,
|
|
1265
|
+
query: d,
|
|
1266
|
+
config: ct(d),
|
|
1267
|
+
mail: Jt(b),
|
|
1268
|
+
users: Lt(b, O),
|
|
1269
|
+
model(h) {
|
|
1270
|
+
return P(h);
|
|
1157
1271
|
},
|
|
1158
|
-
roles:
|
|
1159
|
-
collect: (
|
|
1160
|
-
const
|
|
1161
|
-
return
|
|
1272
|
+
roles: Gt(d, b),
|
|
1273
|
+
collect: (h, _) => {
|
|
1274
|
+
const y = C(h, _);
|
|
1275
|
+
return y.data_path = z(h).getDataPath(), y;
|
|
1162
1276
|
},
|
|
1163
|
-
list: (
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1277
|
+
list: (h, _) => O(h, _).dataPath(z(h).getDataPath()),
|
|
1278
|
+
/**
|
|
1279
|
+
* @deprecated Use `fs.*` from `filesystem` instead.
|
|
1280
|
+
*/
|
|
1281
|
+
drive: lt(d, b),
|
|
1282
|
+
async collects(h) {
|
|
1283
|
+
const _ = {}, y = {};
|
|
1284
|
+
for (const k in h) {
|
|
1285
|
+
const v = h[k].getQueryPayload();
|
|
1286
|
+
y[k] = v.data_path, _[k] = {};
|
|
1287
|
+
const M = v.data_path.split(".");
|
|
1288
|
+
let R = M[M.length - 1], D = _[k];
|
|
1289
|
+
for (const B of M) {
|
|
1290
|
+
if (B === R) {
|
|
1291
|
+
D[B] = v.query;
|
|
1175
1292
|
break;
|
|
1176
1293
|
}
|
|
1177
|
-
|
|
1294
|
+
D[B] = D[B] || {};
|
|
1178
1295
|
}
|
|
1179
|
-
|
|
1296
|
+
_[k].__aliasFor = M[0];
|
|
1180
1297
|
}
|
|
1181
|
-
const
|
|
1182
|
-
for (const
|
|
1183
|
-
const
|
|
1184
|
-
let
|
|
1185
|
-
for (const
|
|
1186
|
-
if (
|
|
1187
|
-
|
|
1298
|
+
const A = await d(_);
|
|
1299
|
+
for (const k in h) {
|
|
1300
|
+
const v = y[k].split(".");
|
|
1301
|
+
let M = v[v.length - 1], R = A[k];
|
|
1302
|
+
for (const D of v) {
|
|
1303
|
+
if (D === M) {
|
|
1304
|
+
h[k]._batchData = A[k][D];
|
|
1188
1305
|
break;
|
|
1189
1306
|
}
|
|
1190
|
-
|
|
1307
|
+
R[D] = R[D] || {};
|
|
1191
1308
|
}
|
|
1192
1309
|
}
|
|
1193
|
-
return
|
|
1310
|
+
return h;
|
|
1194
1311
|
}
|
|
1195
1312
|
};
|
|
1196
|
-
return
|
|
1197
|
-
}
|
|
1313
|
+
return _t(V), V;
|
|
1314
|
+
};
|
|
1315
|
+
function oe(t, e = 30) {
|
|
1316
|
+
try {
|
|
1317
|
+
const r = t.split(".")[1];
|
|
1318
|
+
if (!r) return !0;
|
|
1319
|
+
const s = r.replace(/-/g, "+").replace(/_/g, "/"), n = s.padEnd(Math.ceil(s.length / 4) * 4, "="), c = JSON.parse(globalThis.atob(n));
|
|
1320
|
+
return typeof c.exp == "number" ? c.exp <= Math.floor(Date.now() / 1e3) + e : !1;
|
|
1321
|
+
} catch {
|
|
1322
|
+
return !0;
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
const Te = L;
|
|
1198
1326
|
export {
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1327
|
+
N as arrayHasFile,
|
|
1328
|
+
ye as auth,
|
|
1329
|
+
jt as changeExpiredPassword,
|
|
1330
|
+
ge as clearModels,
|
|
1331
|
+
Pt as createAuth,
|
|
1332
|
+
Me as createClient,
|
|
1333
|
+
st as createCollection,
|
|
1334
|
+
ct as createConfig,
|
|
1335
|
+
lt as createDrive,
|
|
1336
|
+
ue as createFileFromBase64,
|
|
1337
|
+
he as createFileFromBase85,
|
|
1338
|
+
tt as createFileFromString,
|
|
1339
|
+
L as createList,
|
|
1340
|
+
Jt as createMail,
|
|
1341
|
+
Se as createRole,
|
|
1342
|
+
Gt as createRoles,
|
|
1343
|
+
ke as createUser,
|
|
1344
|
+
Lt as createUsers,
|
|
1345
|
+
J as defaultUserFields,
|
|
1346
|
+
ot as defineModel,
|
|
1347
|
+
de as defineModels,
|
|
1348
|
+
je as deleteRole,
|
|
1349
|
+
Ce as deleteUser,
|
|
1350
|
+
Mt as forgetPassword,
|
|
1351
|
+
Ee as fs,
|
|
1352
|
+
K as getApiClient,
|
|
1353
|
+
ce as getApiClientOptional,
|
|
1354
|
+
Ue as getConfig,
|
|
1355
|
+
Ut as getCurrentUser,
|
|
1356
|
+
Ae as getDrive,
|
|
1357
|
+
Rt as getGrantedRights,
|
|
1358
|
+
z as getModel,
|
|
1359
|
+
pe as hasModel,
|
|
1360
|
+
Nt as isGranted,
|
|
1361
|
+
Te as list,
|
|
1362
|
+
Fe as listDrives,
|
|
1363
|
+
we as listFiles,
|
|
1364
|
+
me as listFolders,
|
|
1365
|
+
fe as listModels,
|
|
1366
|
+
_e as listPermissions,
|
|
1367
|
+
De as listRoles,
|
|
1368
|
+
Oe as listUsers,
|
|
1369
|
+
Dt as login,
|
|
1370
|
+
St as logout,
|
|
1371
|
+
g as mutation,
|
|
1372
|
+
x as objectHasFile,
|
|
1373
|
+
F as query,
|
|
1374
|
+
be as readFileAsBase64,
|
|
1375
|
+
Et as resetPassword,
|
|
1376
|
+
ve as sendMail,
|
|
1377
|
+
_t as setApiClient,
|
|
1378
|
+
ne as toQuery,
|
|
1379
|
+
vt as updatePassword,
|
|
1380
|
+
Pe as updateUser,
|
|
1381
|
+
Tt as verifyCode,
|
|
1382
|
+
Ot as webAuthn
|
|
1249
1383
|
};
|