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