@hostlink/light 2.13.2 → 3.0.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/dist/apiClient.d.ts +4 -0
- package/dist/auth.d.ts +12 -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 +43 -15
- package/dist/file.d.ts +16 -24
- package/dist/fileUtils.d.ts +20 -0
- package/dist/index.d.ts +7 -7
- package/dist/light.js +650 -695
- 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/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 +12 -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 q, VariableType as m } from "json-to-graphql-query";
|
|
2
|
+
import $ from "axios";
|
|
3
|
+
import C from "collect.js";
|
|
4
|
+
function k(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 P(t, e, r = ".", n) {
|
|
11
|
+
if (!k(e))
|
|
12
|
+
return P(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]] : k(a) && k(i[f]) ? i[f] = P(
|
|
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 W(t) {
|
|
53
28
|
return (...e) => (
|
|
54
29
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
55
|
-
e.reduce((r,
|
|
30
|
+
e.reduce((r, n) => P(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 = W();
|
|
34
|
+
let D = null;
|
|
35
|
+
const G = (t) => {
|
|
36
|
+
D = t;
|
|
37
|
+
}, U = () => {
|
|
38
|
+
if (!D)
|
|
39
|
+
throw new Error("Api client not initialized. Call setApiClient() first.");
|
|
40
|
+
return D;
|
|
41
|
+
}, jt = () => D;
|
|
42
|
+
function O(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 v(t) {
|
|
49
|
+
for (let e in t)
|
|
50
|
+
if (t[e] instanceof File || t[e] instanceof Array && O(t[e]))
|
|
51
|
+
return !0;
|
|
52
|
+
return !1;
|
|
53
|
+
}
|
|
54
|
+
function N(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 && O(c)) {
|
|
63
|
+
s[o] = new m(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 m(o), r[i.current] = ["variables." + o], n.append(i.current.toString(), c), e[o] = "Upload!", i.current++) : c instanceof Object && v(c) ? (s[o] = {}, Object.entries(c).forEach(([l, h]) => {
|
|
69
|
+
if (h instanceof Array && O(h)) {
|
|
70
|
+
s[o][l] = new m(l);
|
|
71
|
+
let _ = 0;
|
|
72
|
+
h.forEach((g) => {
|
|
73
|
+
g instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + l + "." + _), n.append(i.current.toString(), g), i.current++, _++);
|
|
74
|
+
}), e[l] = "[Upload!]!";
|
|
75
|
+
} else h instanceof File ? (s[o][l] = new m(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
|
+
N(a, e, r, n, i);
|
|
80
|
+
}
|
|
72
81
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
}
|
|
83
|
+
const w = async (t) => {
|
|
84
|
+
const e = U(), r = t, n = new FormData();
|
|
85
|
+
let i = !1;
|
|
86
|
+
const f = {}, a = {};
|
|
87
|
+
N(r, f, a, n, { current: 0 }), i = Object.keys(f).length > 0, i && (r.__variables = f);
|
|
88
|
+
let s = null;
|
|
89
|
+
const c = q({ 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 E(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 w(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 w(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, _, g) => {
|
|
146
|
+
const F = {
|
|
133
147
|
">": "_gt",
|
|
134
148
|
"<": "_lt",
|
|
135
149
|
">=": "_gte",
|
|
@@ -137,564 +151,579 @@ function S(t, e, r) {
|
|
|
137
151
|
"!=": "_ne",
|
|
138
152
|
in: "_in",
|
|
139
153
|
contains: "_contains"
|
|
140
|
-
}[
|
|
141
|
-
|
|
154
|
+
}[_];
|
|
155
|
+
F && n.push({ [h]: { [F]: g } });
|
|
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
|
+
), g = {
|
|
194
208
|
data: {
|
|
195
|
-
...
|
|
209
|
+
...e
|
|
196
210
|
}
|
|
197
211
|
};
|
|
198
|
-
if (
|
|
212
|
+
if (r && (g.data.__args = r), Object.keys(_).length > 0 && (g.__args = _), s && (g.meta = {
|
|
199
213
|
total: !0,
|
|
200
214
|
key: !0,
|
|
201
215
|
name: !0
|
|
202
216
|
}), f) {
|
|
203
|
-
const
|
|
204
|
-
let
|
|
205
|
-
for (let j =
|
|
206
|
-
|
|
207
|
-
[
|
|
217
|
+
const y = f.split(".");
|
|
218
|
+
let F = g;
|
|
219
|
+
for (let j = y.length - 1; j >= 0; j--)
|
|
220
|
+
F = {
|
|
221
|
+
[y[j]]: F
|
|
208
222
|
};
|
|
209
|
-
return
|
|
223
|
+
return F;
|
|
210
224
|
}
|
|
211
225
|
return {
|
|
212
|
-
[`list${
|
|
226
|
+
[`list${t}`]: g
|
|
213
227
|
};
|
|
214
228
|
}
|
|
215
229
|
};
|
|
216
230
|
}
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
let
|
|
220
|
-
const
|
|
231
|
+
const B = (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(() => yt)).default, o = s(r, ot(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 = E(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(([g, y]) => {
|
|
301
|
+
y.format && typeof y.format == "function" && (_[g] = y.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(([g, y]) => {
|
|
310
|
+
y.format && typeof y.format == "function" && (_[g] = y.format(h));
|
|
311
|
+
}), _;
|
|
286
312
|
}
|
|
287
313
|
};
|
|
288
314
|
}
|
|
289
315
|
};
|
|
290
|
-
},
|
|
291
|
-
const
|
|
316
|
+
}, b = {}, S = (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 = B(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
|
+
}, kt = () => {
|
|
360
|
+
const t = S(!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
|
+
}, Ct = () => {
|
|
390
|
+
const t = S(!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
|
+
}, Pt = () => ({
|
|
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 = B(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
|
-
const {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
assertion: s.toJSON()
|
|
439
|
-
});
|
|
440
|
-
},
|
|
441
|
-
register: async () => {
|
|
442
|
-
const s = await r();
|
|
443
|
-
await d(t, "webAuthnRegister", {
|
|
444
|
-
registration: s.toJSON()
|
|
445
|
-
});
|
|
458
|
+
}), J = async () => {
|
|
459
|
+
const { app: t } = await w({
|
|
460
|
+
app: {
|
|
461
|
+
auth: {
|
|
462
|
+
webAuthnRequestOptions: !0
|
|
463
|
+
}
|
|
446
464
|
}
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
|
|
465
|
+
}), e = t.auth.webAuthnRequestOptions, r = PublicKeyCredential.parseRequestOptionsFromJSON(e);
|
|
466
|
+
return await navigator.credentials.get({ publicKey: r });
|
|
467
|
+
}, L = async () => {
|
|
468
|
+
const { app: t } = await w({
|
|
469
|
+
app: {
|
|
470
|
+
auth: {
|
|
471
|
+
webAuthnCreationOptions: !0
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}), e = PublicKeyCredential.parseCreationOptionsFromJSON(t.auth.webAuthnCreationOptions);
|
|
475
|
+
return await navigator.credentials.create({ publicKey: e });
|
|
476
|
+
}, z = async () => {
|
|
477
|
+
const t = await J();
|
|
478
|
+
return await p({
|
|
479
|
+
webAuthnAssertion: {
|
|
480
|
+
assertion: t.toJSON()
|
|
481
|
+
}
|
|
482
|
+
}).then((e) => e.webAuthnAssertion);
|
|
483
|
+
}, R = async () => {
|
|
484
|
+
const t = await L();
|
|
485
|
+
return await p({
|
|
486
|
+
webAuthnRegister: {
|
|
487
|
+
registration: t.toJSON()
|
|
488
|
+
}
|
|
489
|
+
}).then((e) => e.webAuthnRegister);
|
|
490
|
+
}, H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
491
|
+
__proto__: null,
|
|
492
|
+
assertion: J,
|
|
493
|
+
attestation: L,
|
|
494
|
+
login: z,
|
|
495
|
+
register: R
|
|
496
|
+
}, Symbol.toStringTag, { value: "Module" })), X = (t, e, r = "") => p({ login: { __args: { username: t, password: e, code: r } } }).then((n) => n.login), Y = () => p({ logout: !0 }).then((t) => t.logout), Z = (t, e, r) => p({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((n) => n.changeExpiredPassword), V = (t, e) => p({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), K = (t, e, r) => p({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((n) => n.resetPassword), I = (t, e) => p({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), x = (t, e) => p({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), tt = (t) => w({
|
|
497
|
+
my: {
|
|
498
|
+
grantedRights: {
|
|
499
|
+
__args: {
|
|
500
|
+
rights: t
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}).then((e) => e.my.grantedRights), et = () => ({
|
|
505
|
+
webAuthn: H,
|
|
450
506
|
google: {
|
|
451
|
-
unlink: () =>
|
|
452
|
-
login: (
|
|
453
|
-
|
|
454
|
-
}),
|
|
455
|
-
register: (e) => d(t, "lightAuthRegisterGoogle", {
|
|
456
|
-
credential: e
|
|
457
|
-
})
|
|
507
|
+
unlink: () => p({ lightAuthUnlinkGoogle: !0 }).then((t) => t.lightAuthUnlinkGoogle),
|
|
508
|
+
login: (t) => p({ lightAuthLoginGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthLoginGoogle),
|
|
509
|
+
register: (t) => p({ lightAuthRegisterGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthRegisterGoogle)
|
|
458
510
|
},
|
|
459
511
|
facebook: {
|
|
460
|
-
unlink: () =>
|
|
461
|
-
login: (
|
|
462
|
-
|
|
463
|
-
}),
|
|
464
|
-
register: (e) => d(t, "lightAuthRegisterFacebook", {
|
|
465
|
-
access_token: e
|
|
466
|
-
})
|
|
512
|
+
unlink: () => p({ lightAuthUnlinkFacebook: !0 }).then((t) => t.lightAuthUnlinkFacebook),
|
|
513
|
+
login: (t) => p({ lightAuthLoginFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginFacebook),
|
|
514
|
+
register: (t) => p({ lightAuthRegisterFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthRegisterFacebook)
|
|
467
515
|
},
|
|
468
516
|
microsoft: {
|
|
469
|
-
unlink: () =>
|
|
470
|
-
login: (
|
|
471
|
-
|
|
472
|
-
}),
|
|
473
|
-
register: (e) => d(t, "lightAuthRegisterMicrosoft", {
|
|
474
|
-
account_id: e
|
|
475
|
-
})
|
|
476
|
-
},
|
|
477
|
-
login: (e, r, s = "") => d(t, "login", {
|
|
478
|
-
username: e,
|
|
479
|
-
password: r,
|
|
480
|
-
code: s
|
|
481
|
-
}),
|
|
482
|
-
logout: () => d(t, "logout"),
|
|
483
|
-
changeExpiredPassword: (e, r, s) => d(t, "changeExpiredPassword", {
|
|
484
|
-
username: e,
|
|
485
|
-
old_password: r,
|
|
486
|
-
new_password: s
|
|
487
|
-
}),
|
|
488
|
-
updatePassword: (e, r) => d(t, "changeUserPassword", {
|
|
489
|
-
old_password: e,
|
|
490
|
-
new_password: r
|
|
491
|
-
}),
|
|
492
|
-
resetPassword: (e, r, s) => d(t, "resetPassword", {
|
|
493
|
-
jwt: e,
|
|
494
|
-
password: r,
|
|
495
|
-
code: s
|
|
496
|
-
}),
|
|
497
|
-
forgetPassword: (e, r) => d(t, "forgetPassword", {
|
|
498
|
-
username: e,
|
|
499
|
-
email: r
|
|
500
|
-
}),
|
|
501
|
-
verifyCode(e, r) {
|
|
502
|
-
return d(t, "forgetPasswordVerifyCode", {
|
|
503
|
-
jwt: e,
|
|
504
|
-
code: r
|
|
505
|
-
});
|
|
517
|
+
unlink: () => p({ lightAuthUnlinkMicrosoft: !0 }).then((t) => t.lightAuthUnlinkMicrosoft),
|
|
518
|
+
login: (t) => p({ lightAuthLoginMicrosoft: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginMicrosoft),
|
|
519
|
+
register: (t) => p({ lightAuthRegisterMicrosoft: { __args: { account_id: t } } }).then((e) => e.lightAuthRegisterMicrosoft)
|
|
506
520
|
},
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
521
|
+
login: X,
|
|
522
|
+
logout: Y,
|
|
523
|
+
changeExpiredPassword: Z,
|
|
524
|
+
updatePassword: V,
|
|
525
|
+
resetPassword: K,
|
|
526
|
+
forgetPassword: I,
|
|
527
|
+
verifyCode: x,
|
|
528
|
+
granted: tt
|
|
529
|
+
}), rt = {
|
|
530
|
+
name: !0,
|
|
531
|
+
path: !0,
|
|
532
|
+
size: !0,
|
|
533
|
+
mime: !0,
|
|
534
|
+
url: !0
|
|
535
|
+
}, st = (t) => ({
|
|
536
|
+
list: (e, r = rt) => w({
|
|
537
|
+
app: {
|
|
538
|
+
drive: {
|
|
539
|
+
__args: { index: t },
|
|
540
|
+
files: {
|
|
541
|
+
__args: { path: e },
|
|
542
|
+
...r
|
|
514
543
|
}
|
|
515
544
|
}
|
|
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
545
|
}
|
|
546
|
-
}
|
|
547
|
-
|
|
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
|
-
}
|
|
585
|
-
Object.entries(E(s)).forEach(([n, o]) => {
|
|
586
|
-
i[e][n] = o;
|
|
587
|
-
}), Object.entries(i[e]).length === 0 && (i[e] = !0);
|
|
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
|
-
}, {
|
|
546
|
+
}).then((n) => n.app.drive.files),
|
|
547
|
+
get: (e, r = {
|
|
601
548
|
name: !0,
|
|
602
549
|
path: !0,
|
|
603
550
|
size: !0,
|
|
604
|
-
mime: !0
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
551
|
+
mime: !0,
|
|
552
|
+
url: !0
|
|
553
|
+
}) => w({
|
|
554
|
+
app: {
|
|
555
|
+
drive: {
|
|
609
556
|
__args: {
|
|
610
|
-
|
|
557
|
+
index: t
|
|
611
558
|
},
|
|
612
|
-
|
|
613
|
-
|
|
559
|
+
file: {
|
|
560
|
+
__args: {
|
|
561
|
+
path: e
|
|
562
|
+
},
|
|
563
|
+
...r
|
|
564
|
+
}
|
|
614
565
|
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
name: !0,
|
|
630
|
-
path: !0,
|
|
631
|
-
size: !0,
|
|
632
|
-
mime: !0,
|
|
633
|
-
canPreview: !0,
|
|
634
|
-
imagePath: !0
|
|
635
|
-
}
|
|
566
|
+
}
|
|
567
|
+
}).then((n) => n.app.drive.file),
|
|
568
|
+
read: async (e) => {
|
|
569
|
+
let r = await w({
|
|
570
|
+
app: {
|
|
571
|
+
drive: {
|
|
572
|
+
__args: {
|
|
573
|
+
index: t
|
|
574
|
+
},
|
|
575
|
+
file: {
|
|
576
|
+
__args: {
|
|
577
|
+
path: e
|
|
578
|
+
},
|
|
579
|
+
base64Content: !0
|
|
636
580
|
}
|
|
637
581
|
}
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
if (!r.app.drive.file || !r.app.drive.file.base64Content)
|
|
585
|
+
throw new Error(`File not found or cannot read content: ${e}`);
|
|
586
|
+
return typeof window < "u" && window.atob ? window.atob(r.app.drive.file.base64Content) : r.app.drive.file.base64Content;
|
|
587
|
+
},
|
|
588
|
+
write: (e, r) => p({ lightDriveWriteFile: { __args: { index: t, path: e, content: r } } }).then((n) => n.lightDriveWriteFile),
|
|
589
|
+
delete: (e) => p({ lightDriveDeleteFile: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFile),
|
|
590
|
+
rename: (e, r) => p({ lightDriveRenameFile: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFile),
|
|
591
|
+
move: (e, r) => p({ lightDriveMoveFile: { __args: { index: t, source: e, destination: r } } }).then((n) => n.lightDriveMoveFile)
|
|
592
|
+
}), Mt = () => w({
|
|
593
|
+
app: {
|
|
594
|
+
drives: {
|
|
595
|
+
index: !0,
|
|
596
|
+
name: !0
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}).then((t) => t.app.drives), nt = (t) => ({
|
|
600
|
+
uploadTempFile: (e) => p({
|
|
601
|
+
lightDriveUploadTempFile: {
|
|
602
|
+
__args: { index: t, file: e },
|
|
603
|
+
name: !0,
|
|
604
|
+
path: !0,
|
|
605
|
+
size: !0,
|
|
606
|
+
mime: !0
|
|
607
|
+
}
|
|
608
|
+
}).then((r) => r.lightDriveUploadTempFile),
|
|
609
|
+
folders: {
|
|
610
|
+
list: (e, r = { name: !0, path: !0 }) => w({
|
|
611
|
+
app: {
|
|
612
|
+
drive: {
|
|
613
|
+
__args: { index: t },
|
|
614
|
+
folders: {
|
|
615
|
+
__args: { path: e },
|
|
616
|
+
...r
|
|
651
617
|
}
|
|
652
618
|
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
},
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
619
|
+
}
|
|
620
|
+
}).then((n) => n.app.drive.folders),
|
|
621
|
+
create: (e) => p({ lightDriveCreateFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveCreateFolder),
|
|
622
|
+
delete: (e) => p({ lightDriveDeleteFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFolder),
|
|
623
|
+
rename: (e, r) => p({ lightDriveRenameFolder: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFolder)
|
|
624
|
+
},
|
|
625
|
+
files: st(t)
|
|
626
|
+
});
|
|
627
|
+
function Q(t, e, r, n, i) {
|
|
628
|
+
if (!(!t || typeof t != "object"))
|
|
629
|
+
for (let f in t) {
|
|
630
|
+
const a = t[f];
|
|
631
|
+
if (a && typeof a == "object") {
|
|
632
|
+
if ("__args" in a) {
|
|
633
|
+
const u = a.__args, s = {};
|
|
634
|
+
Object.entries(u).forEach(([o, c]) => {
|
|
635
|
+
if (c instanceof Array && O(c)) {
|
|
636
|
+
s[o] = new m(o);
|
|
637
|
+
let l = 0;
|
|
638
|
+
c.forEach((h) => {
|
|
639
|
+
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++);
|
|
640
|
+
}), e[o] = "[Upload!]!";
|
|
641
|
+
} else c instanceof File ? (s[o] = new m(o), r[i.current] = ["variables." + o], n.append(i.current.toString(), c), e[o] = "Upload!", i.current++) : c instanceof Object && v(c) ? (s[o] = {}, Object.entries(c).forEach(([l, h]) => {
|
|
642
|
+
if (h instanceof Array && O(h)) {
|
|
643
|
+
s[o][l] = new m(l);
|
|
644
|
+
let _ = 0;
|
|
645
|
+
h.forEach((g) => {
|
|
646
|
+
g instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + l + "." + _), n.append(i.current.toString(), g), i.current++, _++);
|
|
647
|
+
}), e[l] = "[Upload!]!";
|
|
648
|
+
} else h instanceof File ? (s[o][l] = new m(l), r[i.current] = ["variables." + l], n.append(i.current.toString(), h), e[l] = "Upload!", i.current++) : s[o][l] = h;
|
|
649
|
+
})) : c != null && (s[o] = c);
|
|
650
|
+
}), a.__args = s;
|
|
651
|
+
}
|
|
652
|
+
Q(a, e, r, n, i);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
const p = async (t) => {
|
|
657
|
+
const r = U().axios, n = t, i = new FormData();
|
|
658
|
+
let f = !1;
|
|
659
|
+
const a = {}, u = {};
|
|
660
|
+
Q(n, a, u, i, { current: 0 }), f = Object.keys(a).length > 0, f && (n.__variables = a);
|
|
661
|
+
let o = null;
|
|
662
|
+
const l = q({ mutation: n });
|
|
663
|
+
if (f ? (i.append("map", JSON.stringify(u)), i.append("operations", JSON.stringify({
|
|
664
|
+
query: l
|
|
665
|
+
})), o = await r.post("", i)) : o = await r.post("", {
|
|
666
|
+
query: l
|
|
667
|
+
}), o.data.errors)
|
|
668
|
+
throw new Error(o.data.errors[0].message);
|
|
669
|
+
return o.data.data;
|
|
670
|
+
}, M = (t) => {
|
|
671
|
+
let e = {};
|
|
672
|
+
return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
|
|
673
|
+
Object.entries(M(r)).forEach(([n, i]) => {
|
|
674
|
+
e[n] = i;
|
|
675
|
+
});
|
|
676
|
+
}), e) : (Object.entries(t).forEach(([r, n]) => {
|
|
677
|
+
if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
|
|
678
|
+
e[r] = n;
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
if (typeof n == "boolean") {
|
|
682
|
+
e[r] = n;
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
e[r] = M(n);
|
|
686
|
+
}), e);
|
|
687
|
+
}, ot = (t) => M(t), it = (t) => w({
|
|
688
|
+
app: {
|
|
689
|
+
listConfig: {
|
|
667
690
|
__args: {
|
|
668
|
-
|
|
691
|
+
filters: {
|
|
692
|
+
name: t
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
data: {
|
|
696
|
+
name: !0,
|
|
697
|
+
value: !0
|
|
669
698
|
}
|
|
670
699
|
}
|
|
671
|
-
}
|
|
672
|
-
}),
|
|
673
|
-
send:
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
}), Y = (t) => ({
|
|
687
|
-
list: async (e = {
|
|
688
|
-
name: !0
|
|
689
|
-
}) => {
|
|
690
|
-
const { app: { roles: r } } = await m(t, {
|
|
691
|
-
app: {
|
|
692
|
-
roles: e
|
|
700
|
+
}
|
|
701
|
+
}).then((e) => e.app.listConfig.data[0]), at = (t, e, r) => p({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((n) => n.sendMail), ct = {
|
|
702
|
+
send: at
|
|
703
|
+
}, lt = {
|
|
704
|
+
name: !0
|
|
705
|
+
}, ut = (t = lt) => w({
|
|
706
|
+
app: {
|
|
707
|
+
roles: t
|
|
708
|
+
}
|
|
709
|
+
}).then((e) => e.app.roles), ht = (t, e) => p({
|
|
710
|
+
addRole: {
|
|
711
|
+
__args: {
|
|
712
|
+
data: {
|
|
713
|
+
name: t,
|
|
714
|
+
childs: e
|
|
693
715
|
}
|
|
694
|
-
}
|
|
695
|
-
return r;
|
|
716
|
+
}
|
|
696
717
|
}
|
|
697
|
-
}),
|
|
718
|
+
}).then((r) => r.addRole), ft = (t) => p({
|
|
719
|
+
deleteRole: {
|
|
720
|
+
__args: { name: t }
|
|
721
|
+
}
|
|
722
|
+
}).then((e) => e.deleteRole), pt = () => ({
|
|
723
|
+
list: ut,
|
|
724
|
+
create: ht,
|
|
725
|
+
delete: ft
|
|
726
|
+
}), gt = "list", dt = [
|
|
698
727
|
"flatMap",
|
|
699
728
|
"chunk",
|
|
700
729
|
"shuffle",
|
|
@@ -720,7 +749,7 @@ const d = async (t, e, r = null, s = []) => {
|
|
|
720
749
|
"slice",
|
|
721
750
|
"tap",
|
|
722
751
|
"sort"
|
|
723
|
-
],
|
|
752
|
+
], _t = [
|
|
724
753
|
"avg",
|
|
725
754
|
"count",
|
|
726
755
|
"countBy",
|
|
@@ -748,25 +777,24 @@ const d = async (t, e, r = null, s = []) => {
|
|
|
748
777
|
"implode",
|
|
749
778
|
"partition"
|
|
750
779
|
];
|
|
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;
|
|
780
|
+
class d {
|
|
781
|
+
_batchData = null;
|
|
782
|
+
data_path = "";
|
|
783
|
+
filters;
|
|
784
|
+
steps;
|
|
785
|
+
fields;
|
|
786
|
+
already_limit = !1;
|
|
787
|
+
already_offset = !1;
|
|
788
|
+
limit = null;
|
|
789
|
+
offset = null;
|
|
790
|
+
_sort = null;
|
|
791
|
+
_sortDesc = !1;
|
|
792
|
+
meta = {};
|
|
793
|
+
constructor(e) {
|
|
794
|
+
this.filters = {}, this.steps = [], this.fields = e;
|
|
767
795
|
}
|
|
768
796
|
}
|
|
769
|
-
|
|
797
|
+
d.prototype.getQueryPayload = function() {
|
|
770
798
|
let t = {
|
|
771
799
|
meta: {
|
|
772
800
|
total: !0,
|
|
@@ -780,26 +808,26 @@ _.prototype.getQueryPayload = function() {
|
|
|
780
808
|
steps: this.steps
|
|
781
809
|
};
|
|
782
810
|
};
|
|
783
|
-
|
|
811
|
+
d.prototype.dataPath = function(t) {
|
|
784
812
|
const e = this.clone();
|
|
785
813
|
return e.data_path = t, e;
|
|
786
814
|
};
|
|
787
|
-
|
|
815
|
+
d.prototype.buildArgs = function() {
|
|
788
816
|
let t = {};
|
|
789
817
|
return Object.keys(this.filters).length > 0 && (t.filters = this.filters), this._sort && (t.sort = this._sort, this._sortDesc && (t.sort += ":desc")), t;
|
|
790
818
|
};
|
|
791
|
-
|
|
819
|
+
d.prototype.clone = function() {
|
|
792
820
|
const t = Object.create(this);
|
|
793
821
|
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
822
|
};
|
|
795
|
-
|
|
823
|
+
C().macro("whereContains", function(t, e) {
|
|
796
824
|
return this.filter((r) => r[t].toLowerCase().includes(e.toLowerCase()));
|
|
797
825
|
});
|
|
798
|
-
|
|
826
|
+
d.prototype.fetchData = async function() {
|
|
799
827
|
try {
|
|
800
828
|
if (this._batchData) {
|
|
801
|
-
const
|
|
802
|
-
return this.meta =
|
|
829
|
+
const u = this._batchData;
|
|
830
|
+
return this.meta = u.meta, C(u.data);
|
|
803
831
|
}
|
|
804
832
|
let t = {
|
|
805
833
|
meta: {
|
|
@@ -810,55 +838,55 @@ _.prototype.fetchData = async function() {
|
|
|
810
838
|
};
|
|
811
839
|
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
840
|
const e = this.data_path.split(".");
|
|
813
|
-
let r = {},
|
|
814
|
-
for (const
|
|
815
|
-
if (
|
|
816
|
-
|
|
841
|
+
let r = {}, n = r, i = e[e.length - 1];
|
|
842
|
+
for (const u of e) {
|
|
843
|
+
if (u === i) {
|
|
844
|
+
n[u] = t;
|
|
817
845
|
break;
|
|
818
846
|
}
|
|
819
|
-
|
|
847
|
+
n[u] = {}, n = n[u];
|
|
820
848
|
}
|
|
821
|
-
let
|
|
822
|
-
for (const
|
|
823
|
-
|
|
824
|
-
return this.meta =
|
|
849
|
+
let a = await w(r);
|
|
850
|
+
for (const u of e)
|
|
851
|
+
a = a[u];
|
|
852
|
+
return this.meta = a.meta, C(a.data);
|
|
825
853
|
} catch (t) {
|
|
826
854
|
throw console.error("Error fetching collection data:", t), t;
|
|
827
855
|
}
|
|
828
856
|
};
|
|
829
|
-
|
|
857
|
+
d.prototype.processData = async function() {
|
|
830
858
|
let t = await this.fetchData();
|
|
831
859
|
for (const e of this.steps)
|
|
832
860
|
t = t[e.type](...e.args);
|
|
833
861
|
return t;
|
|
834
862
|
};
|
|
835
|
-
|
|
863
|
+
d.prototype.all = async function() {
|
|
836
864
|
return (await this.processData()).all();
|
|
837
865
|
};
|
|
838
|
-
for (const t of
|
|
839
|
-
|
|
866
|
+
for (const t of dt)
|
|
867
|
+
d.prototype[t] = function(...e) {
|
|
840
868
|
const r = this.clone();
|
|
841
869
|
return r.steps.push({ type: t, args: e }), r;
|
|
842
870
|
};
|
|
843
|
-
for (const t of
|
|
844
|
-
|
|
871
|
+
for (const t of _t)
|
|
872
|
+
d.prototype[t] = async function(...e) {
|
|
845
873
|
return (await this.clone().processData())[t](...e);
|
|
846
874
|
};
|
|
847
|
-
|
|
848
|
-
|
|
875
|
+
d.prototype.average = d.prototype.avg;
|
|
876
|
+
d.prototype.first = async function() {
|
|
849
877
|
return this.take(1), (await this.processData()).first();
|
|
850
878
|
};
|
|
851
|
-
|
|
879
|
+
d.prototype._handleBatchData = function(t, e) {
|
|
852
880
|
return this._batchData ? (this.steps.push({ type: t, args: e }), this) : null;
|
|
853
881
|
};
|
|
854
|
-
|
|
882
|
+
d.prototype.where = function(...t) {
|
|
855
883
|
const e = this._handleBatchData("where", t);
|
|
856
884
|
if (e) return e;
|
|
857
885
|
if (t.length === 2)
|
|
858
886
|
this.filters[t[0]] = t[1];
|
|
859
887
|
else if (t.length === 3) {
|
|
860
|
-
const r = t[0],
|
|
861
|
-
switch (
|
|
888
|
+
const r = t[0], n = t[1], i = t[2];
|
|
889
|
+
switch (n) {
|
|
862
890
|
case "==":
|
|
863
891
|
this.filters[r] = i;
|
|
864
892
|
break;
|
|
@@ -878,248 +906,175 @@ _.prototype.where = function(...t) {
|
|
|
878
906
|
this.filters[r] = { ne: i };
|
|
879
907
|
break;
|
|
880
908
|
default:
|
|
881
|
-
throw new Error(`Unsupported operator: ${
|
|
909
|
+
throw new Error(`Unsupported operator: ${n}`);
|
|
882
910
|
}
|
|
883
911
|
}
|
|
884
912
|
return this;
|
|
885
913
|
};
|
|
886
|
-
|
|
914
|
+
d.prototype.whereContains = function(t, e) {
|
|
887
915
|
const r = this._handleBatchData("whereContains", [t, e]);
|
|
888
916
|
return r || (this.filters[t] = { contains: e }, this);
|
|
889
917
|
};
|
|
890
|
-
|
|
918
|
+
d.prototype.forPage = function(t, e) {
|
|
891
919
|
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
920
|
};
|
|
893
|
-
|
|
921
|
+
d.prototype.whereIn = function(t, e) {
|
|
894
922
|
const r = this._handleBatchData("whereIn", [t, e]);
|
|
895
923
|
return r || (this.filters[t] = { in: e }, this);
|
|
896
924
|
};
|
|
897
|
-
|
|
925
|
+
d.prototype.whereNotIn = function(t, e) {
|
|
898
926
|
const r = this._handleBatchData("whereNotIn", [t, e]);
|
|
899
927
|
return r || (this.filters[t] = { nin: e }, this);
|
|
900
928
|
};
|
|
901
|
-
|
|
929
|
+
d.prototype.whereNotBetween = function(t, e) {
|
|
902
930
|
const r = this._handleBatchData("whereNotBetween", [t, e]);
|
|
903
931
|
return r || (this.filters[t] = { notBetween: e }, this);
|
|
904
932
|
};
|
|
905
|
-
|
|
933
|
+
d.prototype.whereBetween = function(t, e) {
|
|
906
934
|
const r = this._handleBatchData("whereBetween", [t, e]);
|
|
907
935
|
return r || (this.filters[t] = { between: e }, this);
|
|
908
936
|
};
|
|
909
|
-
|
|
937
|
+
d.prototype.sortBy = function(t) {
|
|
910
938
|
return this.steps.push({ type: "sortBy", args: [t] }), typeof t == "string" && (this._sort = t), this;
|
|
911
939
|
};
|
|
912
|
-
|
|
940
|
+
d.prototype.sortByDesc = function(t) {
|
|
913
941
|
return this.steps.push({ type: "sortByDesc", args: [t] }), typeof t == "string" && (this._sort = t, this._sortDesc = !0), this;
|
|
914
942
|
};
|
|
915
|
-
|
|
943
|
+
d.prototype.skip = function(t) {
|
|
916
944
|
if (t < 0)
|
|
917
945
|
throw new Error("Offset must be non-negative");
|
|
918
946
|
return this.already_offset && this.steps.push({ type: "skip", args: [t] }), this.offset = t, this.already_offset = !0, this;
|
|
919
947
|
};
|
|
920
|
-
|
|
948
|
+
d.prototype.take = function(t) {
|
|
921
949
|
if (t < 0)
|
|
922
950
|
throw new Error("Length must be non-negative");
|
|
923
951
|
return this.already_limit ? (this.steps.push({ type: "take", args: [t] }), this) : (this.limit = t, this.already_limit = !0, this);
|
|
924
952
|
};
|
|
925
|
-
|
|
953
|
+
d.prototype.splice = function(t, e) {
|
|
926
954
|
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
955
|
};
|
|
928
|
-
const
|
|
929
|
-
const
|
|
930
|
-
return
|
|
931
|
-
},
|
|
956
|
+
const T = (t, e) => {
|
|
957
|
+
const r = new d(e);
|
|
958
|
+
return r.data_path = gt + t, r;
|
|
959
|
+
}, yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
932
960
|
__proto__: null,
|
|
933
|
-
default:
|
|
934
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
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 })
|
|
961
|
+
default: T
|
|
962
|
+
}, Symbol.toStringTag, { value: "Module" })), wt = {
|
|
963
|
+
user_id: !0,
|
|
964
|
+
username: !0,
|
|
965
|
+
first_name: !0,
|
|
966
|
+
last_name: !0,
|
|
967
|
+
status: !0
|
|
968
|
+
}, bt = (t) => p({
|
|
969
|
+
createUser: {
|
|
970
|
+
__args: {},
|
|
971
|
+
...t
|
|
1034
972
|
}
|
|
1035
|
-
}),
|
|
973
|
+
}).then((e) => e.createUser), mt = (t) => p({
|
|
974
|
+
deleteUser: {
|
|
975
|
+
__args: { id: t }
|
|
976
|
+
}
|
|
977
|
+
}).then((e) => e.deleteUser), At = () => ({
|
|
978
|
+
list: async (t = wt) => E("Users", t).dataPath("app.listUser").fetch(),
|
|
979
|
+
create: (t) => bt(t),
|
|
980
|
+
delete: (t) => mt(t)
|
|
981
|
+
}), Et = (t) => {
|
|
1036
982
|
const e = typeof window > "u";
|
|
1037
983
|
let r = [];
|
|
1038
|
-
const
|
|
984
|
+
const n = $.create({
|
|
1039
985
|
baseURL: t,
|
|
1040
986
|
withCredentials: !0
|
|
1041
987
|
});
|
|
1042
|
-
e && (
|
|
1043
|
-
if (
|
|
1044
|
-
const
|
|
988
|
+
e && (n.interceptors.request.use((a) => (a.withCredentials = !0, r.length > 0 && (a.headers.Cookie = r.join("; ")), a)), n.interceptors.response.use((a) => {
|
|
989
|
+
if (a.headers["set-cookie"]) {
|
|
990
|
+
const u = a.headers["set-cookie"].map((o) => o.split(";")[0]), s = /* @__PURE__ */ new Map();
|
|
1045
991
|
r.forEach((o) => {
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1048
|
-
}),
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
}), r = Array.from(
|
|
992
|
+
const c = o.split("=")[0];
|
|
993
|
+
s.set(c, o);
|
|
994
|
+
}), u.forEach((o) => {
|
|
995
|
+
const c = o.split("=")[0];
|
|
996
|
+
s.set(c, o);
|
|
997
|
+
}), r = Array.from(s.values());
|
|
1052
998
|
}
|
|
1053
|
-
return
|
|
999
|
+
return a;
|
|
1054
1000
|
}));
|
|
1055
|
-
const i = (
|
|
1056
|
-
|
|
1001
|
+
const i = S(), f = {
|
|
1002
|
+
post: n.post,
|
|
1057
1003
|
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;
|
|
1004
|
+
axios: n,
|
|
1005
|
+
auth: et(),
|
|
1006
|
+
mutation: p,
|
|
1007
|
+
query: w,
|
|
1008
|
+
config: it,
|
|
1009
|
+
mail: ct,
|
|
1010
|
+
users: At(),
|
|
1011
|
+
models: i,
|
|
1012
|
+
model(a) {
|
|
1013
|
+
return i.get(a);
|
|
1074
1014
|
},
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1015
|
+
roles: pt(),
|
|
1016
|
+
collect: (a, u) => {
|
|
1017
|
+
const s = T(a, u);
|
|
1018
|
+
return s.data_path = i.get(a).getDataPath(), s;
|
|
1078
1019
|
},
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1020
|
+
list: (a, u) => E(a, u).dataPath(i.get(a).getDataPath()),
|
|
1021
|
+
drive: nt,
|
|
1022
|
+
async collects(a) {
|
|
1023
|
+
const u = {}, s = {};
|
|
1024
|
+
for (const c in a) {
|
|
1025
|
+
const l = a[c].getQueryPayload();
|
|
1026
|
+
s[c] = l.data_path, u[c] = {};
|
|
1027
|
+
const h = l.data_path.split(".");
|
|
1028
|
+
let _ = h[h.length - 1], g = u[c];
|
|
1029
|
+
for (const y of h) {
|
|
1030
|
+
if (y === _) {
|
|
1031
|
+
g[y] = l.query;
|
|
1089
1032
|
break;
|
|
1090
1033
|
}
|
|
1091
|
-
y
|
|
1034
|
+
g[y] = g[y] || {};
|
|
1092
1035
|
}
|
|
1093
|
-
|
|
1036
|
+
u[c].__aliasFor = h[0];
|
|
1094
1037
|
}
|
|
1095
|
-
const o = await
|
|
1096
|
-
for (const
|
|
1097
|
-
const
|
|
1098
|
-
let h =
|
|
1099
|
-
for (const
|
|
1100
|
-
if (
|
|
1101
|
-
|
|
1038
|
+
const o = await w(u);
|
|
1039
|
+
for (const c in a) {
|
|
1040
|
+
const l = s[c].split(".");
|
|
1041
|
+
let h = l[l.length - 1], _ = o[c];
|
|
1042
|
+
for (const g of l) {
|
|
1043
|
+
if (g === h) {
|
|
1044
|
+
a[c]._batchData = o[c][g];
|
|
1102
1045
|
break;
|
|
1103
1046
|
}
|
|
1104
|
-
g
|
|
1047
|
+
_[g] = _[g] || {};
|
|
1105
1048
|
}
|
|
1106
1049
|
}
|
|
1107
|
-
return
|
|
1050
|
+
return a;
|
|
1108
1051
|
}
|
|
1109
1052
|
};
|
|
1053
|
+
return G(f), f;
|
|
1110
1054
|
};
|
|
1111
1055
|
export {
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1056
|
+
Z as changeExpiredPassword,
|
|
1057
|
+
Et as createClient,
|
|
1058
|
+
T as createCollection,
|
|
1059
|
+
E as createList,
|
|
1060
|
+
S as createModelManager,
|
|
1061
|
+
I as forgetPassword,
|
|
1062
|
+
U as getApiClient,
|
|
1063
|
+
jt as getApiClientOptional,
|
|
1064
|
+
nt as getDrive,
|
|
1065
|
+
tt as granted,
|
|
1066
|
+
Mt as listDrives,
|
|
1067
|
+
X as login,
|
|
1068
|
+
Y as logout,
|
|
1069
|
+
p as mutation,
|
|
1070
|
+
w as query,
|
|
1071
|
+
K as resetPassword,
|
|
1072
|
+
G as setApiClient,
|
|
1073
|
+
ot as toQuery,
|
|
1074
|
+
V as updatePassword,
|
|
1075
|
+
Ct as useGlobalModel,
|
|
1076
|
+
Pt as useGlobalModels,
|
|
1077
|
+
kt as useModel,
|
|
1078
|
+
x as verifyCode,
|
|
1079
|
+
H as webAuthn
|
|
1125
1080
|
};
|