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