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