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