@hostlink/light 2.7.2 → 2.8.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/createCollection.d.ts +33 -7
- package/dist/createCollection.test.d.ts +1 -0
- package/dist/drive.basic.test.d.ts +1 -0
- package/dist/drive.d.ts +1 -1
- package/dist/drive.robust.test.d.ts +1 -0
- package/dist/drive.test.d.ts +1 -0
- package/dist/fs.d.ts +1 -1
- package/dist/light.js +385 -511
- package/dist/light.umd.cjs +1 -1
- package/dist/model.d.ts +1 -1
- package/package.json +9 -9
package/dist/light.js
CHANGED
|
@@ -1,384 +1,194 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsonToGraphQLQuery as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
const e = "==".slice(0, (4 - t.length % 4) % 4), r = t.replace(/-/g, "+").replace(/_/g, "/") + e, s = atob(r), n = new ArrayBuffer(s.length), i = new Uint8Array(n);
|
|
9
|
-
for (let c = 0; c < s.length; c++)
|
|
10
|
-
i[c] = s.charCodeAt(c);
|
|
11
|
-
return n;
|
|
12
|
-
}
|
|
13
|
-
function J(t) {
|
|
14
|
-
const e = new Uint8Array(t);
|
|
15
|
-
let r = "";
|
|
16
|
-
for (const i of e)
|
|
17
|
-
r += String.fromCharCode(i);
|
|
18
|
-
return btoa(r).replace(/\+/g, "-").replace(
|
|
19
|
-
/\//g,
|
|
20
|
-
"_"
|
|
21
|
-
).replace(/=/g, "");
|
|
22
|
-
}
|
|
23
|
-
var p = "copy", F = "convert";
|
|
24
|
-
function v(t, e, r) {
|
|
25
|
-
if (e === p)
|
|
26
|
-
return r;
|
|
27
|
-
if (e === F)
|
|
28
|
-
return t(r);
|
|
29
|
-
if (e instanceof Array)
|
|
30
|
-
return r.map((s) => v(t, e[0], s));
|
|
31
|
-
if (e instanceof Object) {
|
|
32
|
-
const s = {};
|
|
33
|
-
for (const [n, i] of Object.entries(e)) {
|
|
34
|
-
if (i.derive) {
|
|
35
|
-
const c = i.derive(r);
|
|
36
|
-
c !== void 0 && (r[n] = c);
|
|
37
|
-
}
|
|
38
|
-
if (!(n in r)) {
|
|
39
|
-
if (i.required)
|
|
40
|
-
throw new Error(`Missing key: ${n}`);
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (r[n] == null) {
|
|
44
|
-
s[n] = null;
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
s[n] = v(
|
|
48
|
-
t,
|
|
49
|
-
i.schema,
|
|
50
|
-
r[n]
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
return s;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function q(t, e) {
|
|
57
|
-
return {
|
|
58
|
-
required: !0,
|
|
59
|
-
schema: t,
|
|
60
|
-
derive: e
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function h(t) {
|
|
64
|
-
return {
|
|
65
|
-
required: !0,
|
|
66
|
-
schema: t
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function g(t) {
|
|
70
|
-
return {
|
|
71
|
-
required: !1,
|
|
72
|
-
schema: t
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
var B = {
|
|
76
|
-
type: h(p),
|
|
77
|
-
id: h(F),
|
|
78
|
-
transports: g(p)
|
|
79
|
-
}, j = {
|
|
80
|
-
appid: g(p),
|
|
81
|
-
appidExclude: g(p),
|
|
82
|
-
credProps: g(p)
|
|
83
|
-
}, U = {
|
|
84
|
-
appid: g(p),
|
|
85
|
-
appidExclude: g(p),
|
|
86
|
-
credProps: g(p)
|
|
87
|
-
}, K = {
|
|
88
|
-
publicKey: h({
|
|
89
|
-
rp: h(p),
|
|
90
|
-
user: h({
|
|
91
|
-
id: h(F),
|
|
92
|
-
name: h(p),
|
|
93
|
-
displayName: h(p)
|
|
94
|
-
}),
|
|
95
|
-
challenge: h(F),
|
|
96
|
-
pubKeyCredParams: h(p),
|
|
97
|
-
timeout: g(p),
|
|
98
|
-
excludeCredentials: g([B]),
|
|
99
|
-
authenticatorSelection: g(p),
|
|
100
|
-
attestation: g(p),
|
|
101
|
-
extensions: g(j)
|
|
102
|
-
}),
|
|
103
|
-
signal: g(p)
|
|
104
|
-
}, M = {
|
|
105
|
-
type: h(p),
|
|
106
|
-
id: h(p),
|
|
107
|
-
rawId: h(F),
|
|
108
|
-
authenticatorAttachment: g(p),
|
|
109
|
-
response: h({
|
|
110
|
-
clientDataJSON: h(F),
|
|
111
|
-
attestationObject: h(F),
|
|
112
|
-
transports: q(
|
|
113
|
-
p,
|
|
114
|
-
(t) => {
|
|
115
|
-
var e;
|
|
116
|
-
return ((e = t.getTransports) == null ? void 0 : e.call(t)) || [];
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
}),
|
|
120
|
-
clientExtensionResults: q(
|
|
121
|
-
U,
|
|
122
|
-
(t) => t.getClientExtensionResults()
|
|
123
|
-
)
|
|
124
|
-
}, G = {
|
|
125
|
-
mediation: g(p),
|
|
126
|
-
publicKey: h({
|
|
127
|
-
challenge: h(F),
|
|
128
|
-
timeout: g(p),
|
|
129
|
-
rpId: g(p),
|
|
130
|
-
allowCredentials: g([B]),
|
|
131
|
-
userVerification: g(p),
|
|
132
|
-
extensions: g(j)
|
|
133
|
-
}),
|
|
134
|
-
signal: g(p)
|
|
135
|
-
}, I = {
|
|
136
|
-
type: h(p),
|
|
137
|
-
id: h(p),
|
|
138
|
-
rawId: h(F),
|
|
139
|
-
authenticatorAttachment: g(p),
|
|
140
|
-
response: h({
|
|
141
|
-
clientDataJSON: h(F),
|
|
142
|
-
authenticatorData: h(F),
|
|
143
|
-
signature: h(F),
|
|
144
|
-
userHandle: h(F)
|
|
145
|
-
}),
|
|
146
|
-
clientExtensionResults: q(
|
|
147
|
-
U,
|
|
148
|
-
(t) => t.getClientExtensionResults()
|
|
149
|
-
)
|
|
150
|
-
};
|
|
151
|
-
function Q(t) {
|
|
152
|
-
return v(R, K, t);
|
|
153
|
-
}
|
|
154
|
-
function z(t) {
|
|
155
|
-
return v(
|
|
156
|
-
J,
|
|
157
|
-
M,
|
|
158
|
-
t
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
function $(t) {
|
|
162
|
-
return v(R, G, t);
|
|
163
|
-
}
|
|
164
|
-
function H(t) {
|
|
165
|
-
return v(
|
|
166
|
-
J,
|
|
167
|
-
I,
|
|
168
|
-
t
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
async function X(t) {
|
|
172
|
-
const e = await navigator.credentials.create(
|
|
173
|
-
t
|
|
174
|
-
);
|
|
175
|
-
return e.toJSON = () => z(e), e;
|
|
176
|
-
}
|
|
177
|
-
async function Y(t) {
|
|
178
|
-
const e = await navigator.credentials.get(
|
|
179
|
-
t
|
|
180
|
-
);
|
|
181
|
-
return e.toJSON = () => H(e), e;
|
|
182
|
-
}
|
|
183
|
-
const Z = (t) => ({
|
|
1
|
+
var N = Object.defineProperty;
|
|
2
|
+
var B = (t, e, r) => e in t ? N(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var m = (t, e, r) => B(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { jsonToGraphQLQuery as P, VariableType as F } from "json-to-graphql-query";
|
|
5
|
+
import R from "axios";
|
|
6
|
+
import D from "collect.js";
|
|
7
|
+
const E = (t) => ({
|
|
184
8
|
login: async () => {
|
|
185
|
-
const { app: e } = await
|
|
9
|
+
const { app: e } = await w(t, {
|
|
186
10
|
app: {
|
|
187
11
|
auth: {
|
|
188
12
|
webAuthnRequestOptions: !0
|
|
189
13
|
}
|
|
190
14
|
}
|
|
191
|
-
}), r = e.auth.webAuthnRequestOptions, s =
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
await u(t, "webAuthnAssertion", {
|
|
195
|
-
assertion: n.toJSON()
|
|
15
|
+
}), r = e.auth.webAuthnRequestOptions, s = PublicKeyCredential.parseRequestOptionsFromJSON(r), i = await navigator.credentials.get({ publicKey: s });
|
|
16
|
+
await l(t, "webAuthnAssertion", {
|
|
17
|
+
assertion: i.toJSON()
|
|
196
18
|
});
|
|
197
19
|
},
|
|
198
20
|
register: async () => {
|
|
199
|
-
const { app: e } = await
|
|
21
|
+
const { app: e } = await w(t, {
|
|
200
22
|
app: {
|
|
201
23
|
auth: {
|
|
202
24
|
webAuthnCreationOptions: !0
|
|
203
25
|
}
|
|
204
26
|
}
|
|
205
|
-
}), r =
|
|
206
|
-
|
|
207
|
-
}), s = await X(r);
|
|
208
|
-
await u(t, "webAuthnRegister", {
|
|
27
|
+
}), r = PublicKeyCredential.parseCreationOptionsFromJSON(e.auth.webAuthnCreationOptions), s = await navigator.credentials.create({ publicKey: r });
|
|
28
|
+
await l(t, "webAuthnRegister", {
|
|
209
29
|
registration: s.toJSON()
|
|
210
30
|
});
|
|
211
31
|
}
|
|
212
|
-
}),
|
|
213
|
-
WebAuthn:
|
|
32
|
+
}), j = (t) => ({
|
|
33
|
+
WebAuthn: E(t),
|
|
214
34
|
google: {
|
|
215
|
-
unlink: () =>
|
|
216
|
-
login: (e) =>
|
|
35
|
+
unlink: () => l(t, "lightAuthUnlinkGoogle"),
|
|
36
|
+
login: (e) => l(t, "lightAuthLoginGoogle", {
|
|
217
37
|
credential: e
|
|
218
38
|
}),
|
|
219
|
-
register: (e) =>
|
|
39
|
+
register: (e) => l(t, "lightAuthRegisterGoogle", {
|
|
220
40
|
credential: e
|
|
221
41
|
})
|
|
222
42
|
},
|
|
223
43
|
facebook: {
|
|
224
|
-
unlink: () =>
|
|
225
|
-
login: (e) =>
|
|
44
|
+
unlink: () => l(t, "lightAuthUnlinkFacebook"),
|
|
45
|
+
login: (e) => l(t, "lightAuthLoginFacebook", {
|
|
226
46
|
access_token: e
|
|
227
47
|
}),
|
|
228
|
-
register: (e) =>
|
|
48
|
+
register: (e) => l(t, "lightAuthRegisterFacebook", {
|
|
229
49
|
access_token: e
|
|
230
50
|
})
|
|
231
51
|
},
|
|
232
52
|
microsoft: {
|
|
233
|
-
unlink: () =>
|
|
234
|
-
login: (e) =>
|
|
53
|
+
unlink: () => l(t, "lightAuthUnlinkMicrosoft"),
|
|
54
|
+
login: (e) => l(t, "lightAuthLoginMicrosoft", {
|
|
235
55
|
access_token: e
|
|
236
56
|
}),
|
|
237
|
-
register: (e) =>
|
|
57
|
+
register: (e) => l(t, "lightAuthRegisterMicrosoft", {
|
|
238
58
|
account_id: e
|
|
239
59
|
})
|
|
240
60
|
},
|
|
241
|
-
login: (e, r, s = "") =>
|
|
61
|
+
login: (e, r, s = "") => l(t, "login", {
|
|
242
62
|
username: e,
|
|
243
63
|
password: r,
|
|
244
64
|
code: s
|
|
245
65
|
}),
|
|
246
|
-
logout: () =>
|
|
247
|
-
changeExpiredPassword: (e, r, s) =>
|
|
66
|
+
logout: () => l(t, "logout"),
|
|
67
|
+
changeExpiredPassword: (e, r, s) => l(t, "changeExpiredPassword", {
|
|
248
68
|
username: e,
|
|
249
69
|
old_password: r,
|
|
250
70
|
new_password: s
|
|
251
71
|
}),
|
|
252
|
-
updatePassword: (e, r) =>
|
|
72
|
+
updatePassword: (e, r) => l(t, "changeUserPassword", {
|
|
253
73
|
old_password: e,
|
|
254
74
|
new_password: r
|
|
255
75
|
}),
|
|
256
|
-
resetPassword: (e, r, s) =>
|
|
76
|
+
resetPassword: (e, r, s) => l(t, "resetPassword", {
|
|
257
77
|
jwt: e,
|
|
258
78
|
password: r,
|
|
259
79
|
code: s
|
|
260
80
|
}),
|
|
261
|
-
forgetPassword: (e, r) =>
|
|
81
|
+
forgetPassword: (e, r) => l(t, "forgetPassword", {
|
|
262
82
|
username: e,
|
|
263
83
|
email: r
|
|
264
84
|
}),
|
|
265
85
|
verifyCode(e, r) {
|
|
266
|
-
return
|
|
86
|
+
return l(t, "forgetPasswordVerifyCode", {
|
|
267
87
|
jwt: e,
|
|
268
88
|
code: r
|
|
269
89
|
});
|
|
270
90
|
},
|
|
271
|
-
granted: async (e) =>
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
91
|
+
granted: async (e) => {
|
|
92
|
+
const { my: r } = await w(t, {
|
|
93
|
+
my: {
|
|
94
|
+
grantedRights: {
|
|
95
|
+
__args: {
|
|
96
|
+
rights: e
|
|
97
|
+
}
|
|
98
|
+
}
|
|
275
99
|
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
100
|
+
});
|
|
101
|
+
return r.grantedRights;
|
|
102
|
+
}
|
|
103
|
+
}), S = (t, e, r) => {
|
|
104
|
+
const s = e, i = t, g = r;
|
|
105
|
+
let h = "list" + e;
|
|
106
|
+
const n = (a) => g[a] ? g[a]() : null;
|
|
282
107
|
return {
|
|
283
|
-
field:
|
|
284
|
-
$fields:
|
|
108
|
+
field: n,
|
|
109
|
+
$fields: g,
|
|
285
110
|
setDataPath(a) {
|
|
286
|
-
return
|
|
111
|
+
return h = a, h;
|
|
287
112
|
},
|
|
288
113
|
getDataPath() {
|
|
289
|
-
return
|
|
114
|
+
return h;
|
|
290
115
|
},
|
|
291
116
|
gqlFields(a) {
|
|
292
|
-
const
|
|
293
|
-
for (const
|
|
294
|
-
if (typeof
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
} else typeof
|
|
298
|
-
return
|
|
117
|
+
const o = [];
|
|
118
|
+
for (const c of a)
|
|
119
|
+
if (typeof c == "string") {
|
|
120
|
+
const u = n(c);
|
|
121
|
+
u && o.push(u.getGQLField());
|
|
122
|
+
} else typeof c == "object" && o.push(c);
|
|
123
|
+
return o;
|
|
299
124
|
},
|
|
300
|
-
async update(a,
|
|
301
|
-
return await
|
|
125
|
+
async update(a, o) {
|
|
126
|
+
return await l(i, "update" + s, { id: a, data: o });
|
|
302
127
|
},
|
|
303
128
|
async delete(a) {
|
|
304
|
-
return await
|
|
129
|
+
return await l(i, "delete" + s, { id: a });
|
|
305
130
|
},
|
|
306
131
|
async add(a) {
|
|
307
|
-
return await
|
|
132
|
+
return await l(i, "add" + s, { data: a });
|
|
308
133
|
},
|
|
309
134
|
fields(a) {
|
|
310
|
-
let
|
|
311
|
-
for (let
|
|
312
|
-
const
|
|
313
|
-
|
|
135
|
+
let o = [];
|
|
136
|
+
for (let c of a) {
|
|
137
|
+
const u = n(c);
|
|
138
|
+
u && o.push(u);
|
|
314
139
|
}
|
|
315
|
-
return
|
|
140
|
+
return o;
|
|
316
141
|
},
|
|
317
|
-
async get(a,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
},
|
|
323
|
-
data: {
|
|
324
|
-
__args: {
|
|
325
|
-
limit: 1
|
|
326
|
-
},
|
|
327
|
-
...O(l)
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}))["list" + s].data[0];
|
|
142
|
+
async get(a, o) {
|
|
143
|
+
const c = (await Promise.resolve().then(() => A)).default, u = c(s, i, C(o));
|
|
144
|
+
for (const [p, d] of Object.entries(a))
|
|
145
|
+
u.where(p, "==", d);
|
|
146
|
+
return await u.first();
|
|
331
147
|
},
|
|
332
|
-
async list(a,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
},
|
|
338
|
-
data: {
|
|
339
|
-
...O(l)
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}))["list" + s].data;
|
|
148
|
+
async list(a, o) {
|
|
149
|
+
const c = (await Promise.resolve().then(() => A)).default, u = c(s, i, C(o));
|
|
150
|
+
for (const [p, d] of Object.entries(a))
|
|
151
|
+
u.where(p, "==", d);
|
|
152
|
+
return await u.all();
|
|
343
153
|
}
|
|
344
154
|
};
|
|
345
155
|
};
|
|
346
|
-
function
|
|
156
|
+
function q(t) {
|
|
347
157
|
t = "<~" + t + "~>";
|
|
348
|
-
var e, r, s,
|
|
349
|
-
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 = [],
|
|
350
|
-
return function(a,
|
|
351
|
-
for (var
|
|
352
|
-
}(s, e.length),
|
|
158
|
+
var e, r, s, i, g, h = String, n = 255;
|
|
159
|
+
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, g = t.length; g > 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(n & r >> 24, n & r >> 16, n & r >> 8, n & r);
|
|
160
|
+
return function(a, o) {
|
|
161
|
+
for (var c = o; c > 0; c--) a.pop();
|
|
162
|
+
}(s, e.length), h.fromCharCode.apply(h, s);
|
|
353
163
|
}
|
|
354
164
|
const k = (t = "") => {
|
|
355
165
|
const e = t, r = (s = "application/octet-stream") => {
|
|
356
|
-
const
|
|
357
|
-
for (let
|
|
358
|
-
n
|
|
359
|
-
const
|
|
360
|
-
return URL.createObjectURL(
|
|
166
|
+
const i = new Uint8Array(e.length);
|
|
167
|
+
for (let n = 0; n < e.length; n++)
|
|
168
|
+
i[n] = e.charCodeAt(n);
|
|
169
|
+
const g = new Blob([i], { type: s });
|
|
170
|
+
return URL.createObjectURL(g);
|
|
361
171
|
};
|
|
362
172
|
return {
|
|
363
173
|
getContent: () => e,
|
|
364
174
|
getURL: r,
|
|
365
175
|
download: (s) => {
|
|
366
|
-
const
|
|
367
|
-
|
|
176
|
+
const i = document.createElement("a");
|
|
177
|
+
i.download = s, i.href = r(), document.body.appendChild(i), i.click(), document.body.removeChild(i);
|
|
368
178
|
},
|
|
369
179
|
open: (s) => {
|
|
370
180
|
window.open(r(s), "_blank");
|
|
371
181
|
}
|
|
372
182
|
};
|
|
373
|
-
},
|
|
374
|
-
fromBase85: (t) => k(
|
|
183
|
+
}, Z = {
|
|
184
|
+
fromBase85: (t) => k(q(t)),
|
|
375
185
|
fromBase64: (t) => k(atob(t)),
|
|
376
186
|
fromString: (t) => k(t)
|
|
377
|
-
},
|
|
187
|
+
}, v = (t) => {
|
|
378
188
|
let e = {};
|
|
379
189
|
return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
|
|
380
|
-
Object.entries(
|
|
381
|
-
e[s] =
|
|
190
|
+
Object.entries(v(r)).forEach(([s, i]) => {
|
|
191
|
+
e[s] = i;
|
|
382
192
|
});
|
|
383
193
|
}), e) : (Object.entries(t).forEach(([r, s]) => {
|
|
384
194
|
if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
|
|
@@ -389,10 +199,10 @@ const k = (t = "") => {
|
|
|
389
199
|
e[r] = s;
|
|
390
200
|
return;
|
|
391
201
|
}
|
|
392
|
-
e[r] =
|
|
202
|
+
e[r] = v(s);
|
|
393
203
|
}), e);
|
|
394
|
-
},
|
|
395
|
-
let r =
|
|
204
|
+
}, C = (t) => v(t), w = async (t, e) => {
|
|
205
|
+
let r = P(C(e));
|
|
396
206
|
const s = await t.post("", {
|
|
397
207
|
query: `{ ${r} }`
|
|
398
208
|
});
|
|
@@ -400,53 +210,53 @@ const k = (t = "") => {
|
|
|
400
210
|
throw new Error(s.data.errors[0].message);
|
|
401
211
|
return s.data.data;
|
|
402
212
|
};
|
|
403
|
-
function
|
|
213
|
+
function U(t) {
|
|
404
214
|
for (let e = 0; e < t.length; e++)
|
|
405
215
|
if (t[e] instanceof File)
|
|
406
216
|
return !0;
|
|
407
217
|
return !1;
|
|
408
218
|
}
|
|
409
|
-
function
|
|
219
|
+
function L(t) {
|
|
410
220
|
for (let e in t)
|
|
411
221
|
if (t[e] instanceof File)
|
|
412
222
|
return !0;
|
|
413
223
|
return !1;
|
|
414
224
|
}
|
|
415
|
-
const
|
|
416
|
-
let
|
|
225
|
+
const l = async (t, e, r = null, s = []) => {
|
|
226
|
+
let i = {
|
|
417
227
|
[e]: {}
|
|
418
228
|
};
|
|
419
|
-
const
|
|
420
|
-
let
|
|
229
|
+
const g = new FormData();
|
|
230
|
+
let h = !1;
|
|
421
231
|
if (r) {
|
|
422
|
-
const
|
|
423
|
-
let
|
|
424
|
-
Object.entries(r).forEach(([
|
|
425
|
-
if (
|
|
426
|
-
|
|
427
|
-
let
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}),
|
|
431
|
-
} else
|
|
432
|
-
|
|
433
|
-
})) :
|
|
434
|
-
}),
|
|
232
|
+
const o = {}, c = {}, u = {};
|
|
233
|
+
let p = 0;
|
|
234
|
+
Object.entries(r).forEach(([d, y]) => {
|
|
235
|
+
if (y instanceof Array && U(y)) {
|
|
236
|
+
h = !0;
|
|
237
|
+
let _ = 0;
|
|
238
|
+
y.forEach((b) => {
|
|
239
|
+
b instanceof File && (o[d] = new F(d), c[p] = ["variables." + d + "." + _], g.append(p.toString(), b), p++);
|
|
240
|
+
}), u[d] = "[Upload!]!";
|
|
241
|
+
} else y instanceof File ? (h = !0, o[d] = new F(d), c[p] = ["variables." + d], g.append(p.toString(), y), u[d] = "Upload!", p++) : y instanceof Object && L(y) ? (h = !0, o[d] = {}, Object.entries(y).forEach(([_, b]) => {
|
|
242
|
+
b instanceof File ? (o[d][_] = new F(_), c[p] = ["variables." + _], g.append(p.toString(), b), u[_] = "Upload!", p++) : o[d][_] = b;
|
|
243
|
+
})) : y !== void 0 && (o[d] = y);
|
|
244
|
+
}), i[e].__args = o, i.__variables = u, h && g.append("map", JSON.stringify(c));
|
|
435
245
|
}
|
|
436
|
-
Object.entries(
|
|
437
|
-
|
|
438
|
-
}), Object.entries(
|
|
439
|
-
let
|
|
440
|
-
const a =
|
|
441
|
-
if (
|
|
246
|
+
Object.entries(C(s)).forEach(([o, c]) => {
|
|
247
|
+
i[e][o] = c;
|
|
248
|
+
}), Object.entries(i[e]).length === 0 && (i[e] = !0);
|
|
249
|
+
let n = null;
|
|
250
|
+
const a = P({ mutation: i });
|
|
251
|
+
if (h ? (g.append("operations", JSON.stringify({
|
|
442
252
|
query: a
|
|
443
|
-
})),
|
|
253
|
+
})), n = await t.post("", g)) : n = await t.post("", {
|
|
444
254
|
query: a
|
|
445
|
-
}),
|
|
446
|
-
throw new Error(
|
|
447
|
-
return
|
|
448
|
-
},
|
|
449
|
-
uploadTempFile: (e) =>
|
|
255
|
+
}), n.data.errors)
|
|
256
|
+
throw new Error(n.data.errors[0].message);
|
|
257
|
+
return n.data.data[e];
|
|
258
|
+
}, J = (t) => ({
|
|
259
|
+
uploadTempFile: (e) => l(t, "fsUploadTempFile", {
|
|
450
260
|
file: e
|
|
451
261
|
}, {
|
|
452
262
|
name: !0,
|
|
@@ -455,7 +265,7 @@ const u = async (t, e, r = null, s = []) => {
|
|
|
455
265
|
mime: !0
|
|
456
266
|
}),
|
|
457
267
|
folders: {
|
|
458
|
-
list: async (e) => (await
|
|
268
|
+
list: async (e) => (await w(t, {
|
|
459
269
|
fsListFolders: {
|
|
460
270
|
__args: {
|
|
461
271
|
path: e
|
|
@@ -464,44 +274,55 @@ const u = async (t, e, r = null, s = []) => {
|
|
|
464
274
|
path: !0
|
|
465
275
|
}
|
|
466
276
|
})).fsListFolders,
|
|
467
|
-
create: (e) =>
|
|
468
|
-
delete: (e) =>
|
|
469
|
-
rename: (e, r) =>
|
|
277
|
+
create: (e) => l(t, "fsCreateFolder", { path: e }),
|
|
278
|
+
delete: (e) => l(t, "fsDeleteFolder", { path: e }),
|
|
279
|
+
rename: (e, r) => l(t, "fsRenameFolder", { path: e, name: r })
|
|
470
280
|
},
|
|
471
281
|
files: {
|
|
472
|
-
list: async (e) =>
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
282
|
+
list: async (e) => {
|
|
283
|
+
let { app: r } = await w(t, {
|
|
284
|
+
app: {
|
|
285
|
+
drive: {
|
|
286
|
+
files: {
|
|
287
|
+
__args: {
|
|
288
|
+
path: e
|
|
289
|
+
},
|
|
290
|
+
name: !0,
|
|
291
|
+
path: !0,
|
|
292
|
+
size: !0,
|
|
293
|
+
mime: !0,
|
|
294
|
+
canPreview: !0,
|
|
295
|
+
imagePath: !0
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
return r.drive.files;
|
|
301
|
+
},
|
|
485
302
|
read: async (e) => {
|
|
486
|
-
let r = await
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
303
|
+
let { app: r } = await w(t, {
|
|
304
|
+
app: {
|
|
305
|
+
drive: {
|
|
306
|
+
files: {
|
|
307
|
+
__args: {
|
|
308
|
+
path: e
|
|
309
|
+
},
|
|
310
|
+
base64Content: !0
|
|
311
|
+
}
|
|
312
|
+
}
|
|
492
313
|
}
|
|
493
314
|
});
|
|
494
|
-
return window.atob(r.
|
|
315
|
+
return window.atob(r.drive.files[0].base64Content);
|
|
495
316
|
},
|
|
496
|
-
write: (e, r) =>
|
|
317
|
+
write: (e, r) => l(t, "fsWriteFile", {
|
|
497
318
|
path: e,
|
|
498
319
|
content: r
|
|
499
320
|
}),
|
|
500
|
-
delete: (e) =>
|
|
501
|
-
rename: (e, r) =>
|
|
502
|
-
move: (e, r) =>
|
|
321
|
+
delete: (e) => l(t, "fsDeleteFile", { path: e }),
|
|
322
|
+
rename: (e, r) => l(t, "fsRenameFile", { path: e, name: r }),
|
|
323
|
+
move: (e, r) => l(t, "fsMoveFile", { source: e, target: r })
|
|
503
324
|
}
|
|
504
|
-
}),
|
|
325
|
+
}), T = (t) => ({
|
|
505
326
|
get: async (e) => (await t({
|
|
506
327
|
config: {
|
|
507
328
|
__args: {
|
|
@@ -509,13 +330,13 @@ const u = async (t, e, r = null, s = []) => {
|
|
|
509
330
|
}
|
|
510
331
|
}
|
|
511
332
|
})).config
|
|
512
|
-
}),
|
|
513
|
-
send: (e, r, s) =>
|
|
333
|
+
}), M = (t) => ({
|
|
334
|
+
send: (e, r, s) => l(t, "sendMail", {
|
|
514
335
|
email: e,
|
|
515
336
|
subject: r,
|
|
516
337
|
message: s
|
|
517
338
|
})
|
|
518
|
-
}),
|
|
339
|
+
}), W = (t) => ({
|
|
519
340
|
list: async (e = {
|
|
520
341
|
user_id: !0,
|
|
521
342
|
username: !0,
|
|
@@ -523,52 +344,52 @@ const u = async (t, e, r = null, s = []) => {
|
|
|
523
344
|
last_name: !0,
|
|
524
345
|
status: !0
|
|
525
346
|
}) => {
|
|
526
|
-
const r =
|
|
347
|
+
const r = O("Users", t, e);
|
|
527
348
|
return r.data_path = "app.users", r.all();
|
|
528
349
|
}
|
|
529
|
-
}),
|
|
350
|
+
}), z = (t) => {
|
|
530
351
|
const e = t, r = {};
|
|
531
352
|
return {
|
|
532
|
-
create(s,
|
|
353
|
+
create(s, i) {
|
|
533
354
|
r[s] = null;
|
|
534
|
-
let
|
|
535
|
-
for (const
|
|
536
|
-
const [
|
|
537
|
-
|
|
538
|
-
name: a.name ? a.name :
|
|
355
|
+
let g = {};
|
|
356
|
+
for (const h of Object.entries(i)) {
|
|
357
|
+
const [n, a] = h;
|
|
358
|
+
g[n] = () => ({
|
|
359
|
+
name: a.name ? a.name : n,
|
|
539
360
|
raw: a,
|
|
540
|
-
getName: () => a.name ? a.name :
|
|
541
|
-
getGQLField: () => a.gqlField !== void 0 ? a.gqlField : a.name ||
|
|
361
|
+
getName: () => a.name ? a.name : n,
|
|
362
|
+
getGQLField: () => a.gqlField !== void 0 ? a.gqlField : a.name || n,
|
|
542
363
|
getRaw() {
|
|
543
364
|
return a;
|
|
544
365
|
},
|
|
545
|
-
getValue(
|
|
546
|
-
return a.field && typeof a.field == "function" ? a.field(
|
|
366
|
+
getValue(o) {
|
|
367
|
+
return a.field && typeof a.field == "function" ? a.field(o) : a.field && typeof a.field == "string" ? o[a.field] : o[this.getName()];
|
|
547
368
|
},
|
|
548
|
-
getFormattedValue(
|
|
549
|
-
const
|
|
550
|
-
return a.format ? a.format(
|
|
369
|
+
getFormattedValue(o) {
|
|
370
|
+
const c = this.getValue(o);
|
|
371
|
+
return a.format ? a.format(c) : c;
|
|
551
372
|
}
|
|
552
373
|
});
|
|
553
374
|
}
|
|
554
|
-
r[s] =
|
|
375
|
+
r[s] = S(e, s, g);
|
|
555
376
|
},
|
|
556
377
|
get(s) {
|
|
557
378
|
return r[s] || this.create(s, {}), r[s];
|
|
558
379
|
}
|
|
559
380
|
};
|
|
560
|
-
},
|
|
381
|
+
}, G = (t) => ({
|
|
561
382
|
list: async (e = {
|
|
562
383
|
name: !0
|
|
563
384
|
}) => {
|
|
564
|
-
const { app: { roles: r } } = await
|
|
385
|
+
const { app: { roles: r } } = await w(t, {
|
|
565
386
|
app: {
|
|
566
387
|
roles: e
|
|
567
388
|
}
|
|
568
389
|
});
|
|
569
390
|
return r;
|
|
570
391
|
}
|
|
571
|
-
}),
|
|
392
|
+
}), Q = "list", I = [
|
|
572
393
|
"flatMap",
|
|
573
394
|
"chunk",
|
|
574
395
|
"shuffle",
|
|
@@ -594,7 +415,7 @@ const u = async (t, e, r = null, s = []) => {
|
|
|
594
415
|
"slice",
|
|
595
416
|
"tap",
|
|
596
417
|
"sort"
|
|
597
|
-
],
|
|
418
|
+
], $ = [
|
|
598
419
|
"avg",
|
|
599
420
|
"count",
|
|
600
421
|
"countBy",
|
|
@@ -620,29 +441,27 @@ const u = async (t, e, r = null, s = []) => {
|
|
|
620
441
|
"get",
|
|
621
442
|
"has",
|
|
622
443
|
"implode",
|
|
623
|
-
"partition"
|
|
624
|
-
"sole"
|
|
444
|
+
"partition"
|
|
625
445
|
];
|
|
626
|
-
class
|
|
446
|
+
class f {
|
|
627
447
|
constructor(e, r) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
C(this, "meta", {});
|
|
448
|
+
m(this, "_batchData", null);
|
|
449
|
+
m(this, "data_path", "");
|
|
450
|
+
m(this, "axios");
|
|
451
|
+
m(this, "filters");
|
|
452
|
+
m(this, "steps");
|
|
453
|
+
m(this, "fields");
|
|
454
|
+
m(this, "already_limit", !1);
|
|
455
|
+
m(this, "already_offset", !1);
|
|
456
|
+
m(this, "limit", null);
|
|
457
|
+
m(this, "offset", null);
|
|
458
|
+
m(this, "_sort", null);
|
|
459
|
+
m(this, "_sortDesc", !1);
|
|
460
|
+
m(this, "meta", {});
|
|
642
461
|
this.axios = r, this.filters = {}, this.steps = [], this.fields = e;
|
|
643
462
|
}
|
|
644
463
|
}
|
|
645
|
-
|
|
464
|
+
f.prototype.getQueryPayload = function() {
|
|
646
465
|
let t = {
|
|
647
466
|
meta: {
|
|
648
467
|
total: !0,
|
|
@@ -656,119 +475,159 @@ d.prototype.getQueryPayload = function() {
|
|
|
656
475
|
steps: this.steps
|
|
657
476
|
};
|
|
658
477
|
};
|
|
659
|
-
|
|
478
|
+
f.prototype.dataPath = function(t) {
|
|
660
479
|
const e = this.clone();
|
|
661
480
|
return e.data_path = t, e;
|
|
662
481
|
};
|
|
663
|
-
|
|
482
|
+
f.prototype.buildArgs = function() {
|
|
664
483
|
let t = {};
|
|
665
484
|
return Object.keys(this.filters).length > 0 && (t.filters = this.filters), this._sort && (t.sort = this._sort, this._sortDesc && (t.sort += ":desc")), t;
|
|
666
485
|
};
|
|
667
|
-
|
|
486
|
+
f.prototype.clone = function() {
|
|
668
487
|
const t = Object.create(this);
|
|
669
488
|
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;
|
|
670
489
|
};
|
|
671
|
-
|
|
490
|
+
D().macro("whereContains", function(t, e) {
|
|
672
491
|
return this.filter((r) => r[t].toLowerCase().includes(e.toLowerCase()));
|
|
673
492
|
});
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
let t = {
|
|
680
|
-
meta: {
|
|
681
|
-
total: !0,
|
|
682
|
-
key: !0,
|
|
683
|
-
name: !0
|
|
493
|
+
f.prototype.fetchData = async function() {
|
|
494
|
+
try {
|
|
495
|
+
if (this._batchData) {
|
|
496
|
+
const n = this._batchData;
|
|
497
|
+
return this.meta = n.meta, D(n.data);
|
|
684
498
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
499
|
+
let t = {
|
|
500
|
+
meta: {
|
|
501
|
+
total: !0,
|
|
502
|
+
key: !0,
|
|
503
|
+
name: !0
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
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);
|
|
507
|
+
const e = this.data_path.split(".");
|
|
508
|
+
let r = {}, s = r, i = e[e.length - 1];
|
|
509
|
+
for (const n of e) {
|
|
510
|
+
if (n === i) {
|
|
511
|
+
s[n] = t;
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
s[n] = {}, s = s[n];
|
|
693
515
|
}
|
|
694
|
-
|
|
516
|
+
let h = await w(this.axios, r);
|
|
517
|
+
for (const n of e)
|
|
518
|
+
h = h[n];
|
|
519
|
+
return this.meta = h.meta, D(h.data);
|
|
520
|
+
} catch (t) {
|
|
521
|
+
throw console.error("Error fetching collection data:", t), t;
|
|
695
522
|
}
|
|
696
|
-
let c = await m(this.axios, r);
|
|
697
|
-
for (const o of e)
|
|
698
|
-
c = c[o];
|
|
699
|
-
return this.meta = c.meta, N(c.data);
|
|
700
523
|
};
|
|
701
|
-
|
|
524
|
+
f.prototype.processData = async function() {
|
|
702
525
|
let t = await this.fetchData();
|
|
703
526
|
for (const e of this.steps)
|
|
704
527
|
t = t[e.type](...e.args);
|
|
705
528
|
return t;
|
|
706
529
|
};
|
|
707
|
-
|
|
530
|
+
f.prototype.all = async function() {
|
|
708
531
|
return (await this.processData()).all();
|
|
709
532
|
};
|
|
710
|
-
for (const t of
|
|
711
|
-
|
|
533
|
+
for (const t of I)
|
|
534
|
+
f.prototype[t] = function(...e) {
|
|
712
535
|
const r = this.clone();
|
|
713
536
|
return r.steps.push({ type: t, args: e }), r;
|
|
714
537
|
};
|
|
715
|
-
for (const t of
|
|
716
|
-
|
|
538
|
+
for (const t of $)
|
|
539
|
+
f.prototype[t] = async function(...e) {
|
|
717
540
|
return (await this.clone().processData())[t](...e);
|
|
718
541
|
};
|
|
719
|
-
|
|
720
|
-
|
|
542
|
+
f.prototype.average = f.prototype.avg;
|
|
543
|
+
f.prototype.first = async function() {
|
|
721
544
|
return this.take(1), (await this.processData()).first();
|
|
722
545
|
};
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
546
|
+
f.prototype._handleBatchData = function(t, e) {
|
|
547
|
+
return this._batchData ? (this.steps.push({ type: t, args: e }), this) : null;
|
|
548
|
+
};
|
|
549
|
+
f.prototype.where = function(...t) {
|
|
550
|
+
const e = this._handleBatchData("where", t);
|
|
551
|
+
if (e) return e;
|
|
552
|
+
if (t.length === 2)
|
|
727
553
|
this.filters[t[0]] = t[1];
|
|
728
|
-
else if (t.length
|
|
729
|
-
|
|
730
|
-
|
|
554
|
+
else if (t.length === 3) {
|
|
555
|
+
const r = t[0], s = t[1], i = t[2];
|
|
556
|
+
switch (s) {
|
|
557
|
+
case "==":
|
|
558
|
+
this.filters[r] = i;
|
|
559
|
+
break;
|
|
560
|
+
case "<":
|
|
561
|
+
this.filters[r] = { lt: i };
|
|
562
|
+
break;
|
|
563
|
+
case "<=":
|
|
564
|
+
this.filters[r] = { lte: i };
|
|
565
|
+
break;
|
|
566
|
+
case ">":
|
|
567
|
+
this.filters[r] = { gt: i };
|
|
568
|
+
break;
|
|
569
|
+
case ">=":
|
|
570
|
+
this.filters[r] = { gte: i };
|
|
571
|
+
break;
|
|
572
|
+
case "!==":
|
|
573
|
+
this.filters[r] = { ne: i };
|
|
574
|
+
break;
|
|
575
|
+
default:
|
|
576
|
+
throw new Error(`Unsupported operator: ${s}`);
|
|
577
|
+
}
|
|
731
578
|
}
|
|
732
579
|
return this;
|
|
733
580
|
};
|
|
734
|
-
|
|
735
|
-
|
|
581
|
+
f.prototype.whereContains = function(t, e) {
|
|
582
|
+
const r = this._handleBatchData("whereContains", [t, e]);
|
|
583
|
+
return r || (this.filters[t] = { contains: e }, this);
|
|
736
584
|
};
|
|
737
|
-
|
|
585
|
+
f.prototype.forPage = function(t, e) {
|
|
738
586
|
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);
|
|
739
587
|
};
|
|
740
|
-
|
|
741
|
-
|
|
588
|
+
f.prototype.whereIn = function(t, e) {
|
|
589
|
+
const r = this._handleBatchData("whereIn", [t, e]);
|
|
590
|
+
return r || (this.filters[t] = { in: e }, this);
|
|
742
591
|
};
|
|
743
|
-
|
|
744
|
-
|
|
592
|
+
f.prototype.whereNotIn = function(t, e) {
|
|
593
|
+
const r = this._handleBatchData("whereNotIn", [t, e]);
|
|
594
|
+
return r || (this.filters[t] = { nin: e }, this);
|
|
745
595
|
};
|
|
746
|
-
|
|
747
|
-
|
|
596
|
+
f.prototype.whereNotBetween = function(t, e) {
|
|
597
|
+
const r = this._handleBatchData("whereNotBetween", [t, e]);
|
|
598
|
+
return r || (this.filters[t] = { notBetween: e }, this);
|
|
748
599
|
};
|
|
749
|
-
|
|
750
|
-
|
|
600
|
+
f.prototype.whereBetween = function(t, e) {
|
|
601
|
+
const r = this._handleBatchData("whereBetween", [t, e]);
|
|
602
|
+
return r || (this.filters[t] = { between: e }, this);
|
|
751
603
|
};
|
|
752
|
-
|
|
604
|
+
f.prototype.sortBy = function(t) {
|
|
753
605
|
return this.steps.push({ type: "sortBy", args: [t] }), typeof t == "string" && (this._sort = t), this;
|
|
754
606
|
};
|
|
755
|
-
|
|
607
|
+
f.prototype.sortByDesc = function(t) {
|
|
756
608
|
return this.steps.push({ type: "sortByDesc", args: [t] }), typeof t == "string" && (this._sort = t, this._sortDesc = !0), this;
|
|
757
609
|
};
|
|
758
|
-
|
|
610
|
+
f.prototype.skip = function(t) {
|
|
611
|
+
if (t < 0)
|
|
612
|
+
throw new Error("Offset must be non-negative");
|
|
759
613
|
return this.already_offset && this.steps.push({ type: "skip", args: [t] }), this.offset = t, this.already_offset = !0, this;
|
|
760
614
|
};
|
|
761
|
-
|
|
615
|
+
f.prototype.take = function(t) {
|
|
616
|
+
if (t < 0)
|
|
617
|
+
throw new Error("Length must be non-negative");
|
|
762
618
|
return this.already_limit ? (this.steps.push({ type: "take", args: [t] }), this) : (this.limit = t, this.already_limit = !0, this);
|
|
763
619
|
};
|
|
764
|
-
|
|
620
|
+
f.prototype.splice = function(t, e) {
|
|
765
621
|
return this.steps.push({ type: "splice", args: [t, e] }), this.offset = t, this.limit = e, this.already_limit = !0, this.already_offset = !0, this;
|
|
766
622
|
};
|
|
767
|
-
const
|
|
768
|
-
const s = new
|
|
769
|
-
return s.data_path =
|
|
770
|
-
},
|
|
771
|
-
|
|
623
|
+
const O = (t, e, r) => {
|
|
624
|
+
const s = new f(r, e);
|
|
625
|
+
return s.data_path = Q + t, s;
|
|
626
|
+
}, A = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
627
|
+
__proto__: null,
|
|
628
|
+
default: O
|
|
629
|
+
}, Symbol.toStringTag, { value: "Module" })), K = (t, e) => ({
|
|
630
|
+
uploadTempFile: (r) => l(e, "lightDriveUploadTempFile", {
|
|
772
631
|
index: t,
|
|
773
632
|
file: r
|
|
774
633
|
}, {
|
|
@@ -781,7 +640,7 @@ const L = (t, e, r) => {
|
|
|
781
640
|
list: async (r, s = {
|
|
782
641
|
name: !0,
|
|
783
642
|
path: !0
|
|
784
|
-
}) => (await
|
|
643
|
+
}) => (await w(e, {
|
|
785
644
|
app: {
|
|
786
645
|
drive: {
|
|
787
646
|
__args: {
|
|
@@ -796,9 +655,9 @@ const L = (t, e, r) => {
|
|
|
796
655
|
}
|
|
797
656
|
}
|
|
798
657
|
})).app.drive.folders,
|
|
799
|
-
create: (r) =>
|
|
800
|
-
delete: (r) =>
|
|
801
|
-
rename: (r, s) =>
|
|
658
|
+
create: (r) => l(e, "lightDriveCreateFolder", { index: t, path: r }),
|
|
659
|
+
delete: (r) => l(e, "lightDriveDeleteFolder", { index: t, path: r }),
|
|
660
|
+
rename: (r, s) => l(e, "lightDriveRenameFolder", { index: t, path: r, name: s })
|
|
802
661
|
},
|
|
803
662
|
files: {
|
|
804
663
|
list: async (r, s = {
|
|
@@ -807,7 +666,7 @@ const L = (t, e, r) => {
|
|
|
807
666
|
size: !0,
|
|
808
667
|
mime: !0,
|
|
809
668
|
url: !0
|
|
810
|
-
}) => (await
|
|
669
|
+
}) => (await w(e, {
|
|
811
670
|
app: {
|
|
812
671
|
drive: {
|
|
813
672
|
__args: {
|
|
@@ -828,7 +687,7 @@ const L = (t, e, r) => {
|
|
|
828
687
|
size: !0,
|
|
829
688
|
mime: !0,
|
|
830
689
|
url: !0
|
|
831
|
-
}) => (await
|
|
690
|
+
}) => (await w(e, {
|
|
832
691
|
app: {
|
|
833
692
|
drive: {
|
|
834
693
|
__args: {
|
|
@@ -844,7 +703,7 @@ const L = (t, e, r) => {
|
|
|
844
703
|
}
|
|
845
704
|
})).app.drive.file,
|
|
846
705
|
read: async (r) => {
|
|
847
|
-
let s = await
|
|
706
|
+
let s = await w(e, {
|
|
848
707
|
app: {
|
|
849
708
|
drive: {
|
|
850
709
|
__args: {
|
|
@@ -859,78 +718,93 @@ const L = (t, e, r) => {
|
|
|
859
718
|
}
|
|
860
719
|
}
|
|
861
720
|
});
|
|
862
|
-
|
|
721
|
+
if (!s.app.drive.file || !s.app.drive.file.base64Content)
|
|
722
|
+
throw new Error(`File not found or cannot read content: ${r}`);
|
|
723
|
+
return typeof window < "u" && window.atob ? window.atob(s.app.drive.file.base64Content) : s.app.drive.file.base64Content;
|
|
863
724
|
},
|
|
864
|
-
write: (r, s) =>
|
|
865
|
-
delete: (r) =>
|
|
866
|
-
rename: (r, s) =>
|
|
867
|
-
move: (r, s) =>
|
|
725
|
+
write: (r, s) => l(e, "lightDriveWriteFile", { index: t, path: r, content: s }),
|
|
726
|
+
delete: (r) => l(e, "lightDriveDeleteFile", { index: t, path: r }),
|
|
727
|
+
rename: (r, s) => l(e, "lightDriveRenameFile", { index: t, path: r, name: s }),
|
|
728
|
+
move: (r, s) => l(e, "lightDriveMoveFile", { index: t, source: r, destination: s })
|
|
868
729
|
}
|
|
869
|
-
}),
|
|
870
|
-
const e =
|
|
730
|
+
}), x = (t) => {
|
|
731
|
+
const e = typeof window > "u";
|
|
732
|
+
let r = [];
|
|
733
|
+
const s = R.create({
|
|
871
734
|
baseURL: t,
|
|
872
735
|
withCredentials: !0
|
|
873
|
-
})
|
|
736
|
+
});
|
|
737
|
+
e && (s.interceptors.request.use((n) => (n.withCredentials = !0, r.length > 0 && (n.headers.Cookie = r.join("; ")), n)), s.interceptors.response.use((n) => {
|
|
738
|
+
if (n.headers["set-cookie"]) {
|
|
739
|
+
const a = n.headers["set-cookie"].map((u) => u.split(";")[0]), o = r.map((u) => u.split("=")[0]), c = a.filter((u) => {
|
|
740
|
+
const p = u.split("=")[0];
|
|
741
|
+
return !o.includes(p);
|
|
742
|
+
});
|
|
743
|
+
r = [...r, ...c];
|
|
744
|
+
}
|
|
745
|
+
return n;
|
|
746
|
+
}));
|
|
747
|
+
const i = (n, a = null, o = []) => l(s, n, a, o), g = (n) => w(s, n), h = z(s);
|
|
874
748
|
return {
|
|
875
749
|
baseURL: t,
|
|
876
|
-
axios:
|
|
877
|
-
auth:
|
|
878
|
-
mutation:
|
|
879
|
-
query:
|
|
880
|
-
config:
|
|
881
|
-
mail:
|
|
882
|
-
users:
|
|
883
|
-
fs:
|
|
884
|
-
models:
|
|
885
|
-
model(
|
|
886
|
-
return
|
|
750
|
+
axios: s,
|
|
751
|
+
auth: j(s),
|
|
752
|
+
mutation: i,
|
|
753
|
+
query: g,
|
|
754
|
+
config: T(g),
|
|
755
|
+
mail: M(s),
|
|
756
|
+
users: W(s),
|
|
757
|
+
fs: J(s),
|
|
758
|
+
models: h,
|
|
759
|
+
model(n) {
|
|
760
|
+
return h.get(n);
|
|
887
761
|
},
|
|
888
|
-
roles:
|
|
889
|
-
collect: (
|
|
890
|
-
const o =
|
|
891
|
-
return o.data_path =
|
|
762
|
+
roles: G(s),
|
|
763
|
+
collect: (n, a) => {
|
|
764
|
+
const o = O(n, s, a);
|
|
765
|
+
return o.data_path = h.get(n).getDataPath(), o;
|
|
892
766
|
},
|
|
893
|
-
drive(
|
|
894
|
-
return
|
|
767
|
+
drive(n) {
|
|
768
|
+
return K(n, s);
|
|
895
769
|
},
|
|
896
|
-
async collects(
|
|
897
|
-
const
|
|
898
|
-
for (const
|
|
899
|
-
const
|
|
900
|
-
o[
|
|
901
|
-
const
|
|
902
|
-
let
|
|
903
|
-
for (const
|
|
904
|
-
if (
|
|
905
|
-
|
|
770
|
+
async collects(n) {
|
|
771
|
+
const a = {}, o = {};
|
|
772
|
+
for (const u in n) {
|
|
773
|
+
const p = n[u].getQueryPayload();
|
|
774
|
+
o[u] = p.data_path, a[u] = {};
|
|
775
|
+
const d = p.data_path.split(".");
|
|
776
|
+
let y = d[d.length - 1], _ = a[u];
|
|
777
|
+
for (const b of d) {
|
|
778
|
+
if (b === y) {
|
|
779
|
+
_[b] = p.query;
|
|
906
780
|
break;
|
|
907
781
|
}
|
|
908
|
-
|
|
782
|
+
_[b] = _[b] || {};
|
|
909
783
|
}
|
|
910
|
-
|
|
784
|
+
a[u].__aliasFor = d[0];
|
|
911
785
|
}
|
|
912
|
-
const
|
|
913
|
-
for (const
|
|
914
|
-
const
|
|
915
|
-
let
|
|
916
|
-
for (const
|
|
917
|
-
if (
|
|
918
|
-
|
|
786
|
+
const c = await w(s, a);
|
|
787
|
+
for (const u in n) {
|
|
788
|
+
const p = o[u].split(".");
|
|
789
|
+
let d = p[p.length - 1], y = c[u];
|
|
790
|
+
for (const _ of p) {
|
|
791
|
+
if (_ === d) {
|
|
792
|
+
n[u]._batchData = c[u][_];
|
|
919
793
|
break;
|
|
920
794
|
}
|
|
921
|
-
|
|
795
|
+
y[_] = y[_] || {};
|
|
922
796
|
}
|
|
923
797
|
}
|
|
924
|
-
return
|
|
798
|
+
return n;
|
|
925
799
|
}
|
|
926
800
|
};
|
|
927
801
|
};
|
|
928
802
|
export {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
803
|
+
Z as File,
|
|
804
|
+
x as createClient,
|
|
805
|
+
O as createCollection,
|
|
932
806
|
k as file,
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
807
|
+
l as mutation,
|
|
808
|
+
w as query,
|
|
809
|
+
C as toQuery
|
|
936
810
|
};
|