@hostlink/light 2.6.0 → 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,39 +1,39 @@
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), i = new Uint8Array(n);
9
- for (let u = 0; u < s.length; u++)
10
- i[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 i of t)
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 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, i] of Object.entries(t)) {
33
+ for (const [n, i] of Object.entries(e)) {
34
34
  if (i.derive) {
35
- const u = i.derive(r);
36
- u !== void 0 && (r[n] = u);
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] = A(
48
- e,
47
+ s[n] = D(
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 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) => ({
183
+ const Z = (t) => ({
184
184
  login: async () => {
185
- const { app: t } = await y(e, {
185
+ const { app: e } = await m(t, {
186
186
  app: {
187
187
  auth: {
188
188
  webAuthnRequestOptions: !0
189
189
  }
190
190
  }
191
- }), r = t.auth.webAuthnRequestOptions, s = H({
191
+ }), r = e.auth.webAuthnRequestOptions, s = $({
192
192
  publicKey: r
193
- }), n = await Z(s);
194
- await o(e, "webAuthnAssertion", {
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: t } = await y(e, {
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: t.auth.webAuthnCreationOptions
207
- }), s = await Y(r);
208
- await o(e, "webAuthnRegister", {
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
- }), ee = (e) => ({
213
- WebAuthn: x(e),
212
+ }), x = (t) => ({
213
+ WebAuthn: Z(t),
214
214
  google: {
215
- unlink: () => o(e, "lightAuthUnlinkGoogle"),
216
- login: (t) => o(e, "lightAuthLoginGoogle", {
217
- credential: t
215
+ unlink: () => u(t, "lightAuthUnlinkGoogle"),
216
+ login: (e) => u(t, "lightAuthLoginGoogle", {
217
+ credential: e
218
218
  }),
219
- register: (t) => o(e, "lightAuthRegisterGoogle", {
220
- credential: t
219
+ register: (e) => u(t, "lightAuthRegisterGoogle", {
220
+ credential: e
221
221
  })
222
222
  },
223
223
  facebook: {
224
- unlink: () => o(e, "lightAuthUnlinkFacebook"),
225
- login: (t) => o(e, "lightAuthLoginFacebook", {
226
- access_token: t
224
+ unlink: () => u(t, "lightAuthUnlinkFacebook"),
225
+ login: (e) => u(t, "lightAuthLoginFacebook", {
226
+ access_token: e
227
227
  }),
228
- register: (t) => o(e, "lightAuthRegisterFacebook", {
229
- access_token: t
228
+ register: (e) => u(t, "lightAuthRegisterFacebook", {
229
+ access_token: e
230
230
  })
231
231
  },
232
232
  microsoft: {
233
- unlink: () => o(e, "lightAuthUnlinkMicrosoft"),
234
- login: (t) => o(e, "lightAuthLoginMicrosoft", {
235
- access_token: t
233
+ unlink: () => u(t, "lightAuthUnlinkMicrosoft"),
234
+ login: (e) => u(t, "lightAuthLoginMicrosoft", {
235
+ access_token: e
236
236
  }),
237
- register: (t) => o(e, "lightAuthRegisterMicrosoft", {
238
- account_id: t
237
+ register: (e) => u(t, "lightAuthRegisterMicrosoft", {
238
+ account_id: e
239
239
  })
240
240
  },
241
- login: (t, r, s = "") => o(e, "login", {
242
- username: t,
241
+ login: (e, r, s = "") => u(t, "login", {
242
+ username: e,
243
243
  password: r,
244
244
  code: s
245
245
  }),
246
- logout: () => o(e, "logout"),
247
- changeExpiredPassword: (t, r, s) => o(e, "changeExpiredPassword", {
248
- username: t,
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: (t, r) => o(e, "updatePassword", {
253
- old_password: t,
252
+ updatePassword: (e, r) => u(t, "updatePassword", {
253
+ old_password: e,
254
254
  new_password: r
255
255
  }),
256
- resetPassword: (t, r, s) => o(e, "resetPassword", {
257
- username: t,
256
+ resetPassword: (e, r, s) => u(t, "resetPassword", {
257
+ jwt: e,
258
258
  password: r,
259
259
  code: s
260
260
  }),
261
- forgetPassword: (t, r) => o(e, "forgetPassword", {
262
- username: t,
261
+ forgetPassword: (e, r) => u(t, "forgetPassword", {
262
+ username: e,
263
263
  email: r
264
264
  }),
265
- verifyCode(t, r) {
266
- return o(e, "forgetPasswordVerifyCode", {
267
- username: t,
265
+ verifyCode(e, r) {
266
+ return u(t, "forgetPasswordVerifyCode", {
267
+ jwt: e,
268
268
  code: r
269
269
  });
270
270
  },
271
- granted: async (t) => (await y(e, {
271
+ granted: async (e) => (await m(t, {
272
272
  granted: {
273
273
  __args: {
274
- rights: t
274
+ rights: e
275
275
  }
276
276
  }
277
277
  })).granted
278
- }), te = (e, t, r) => {
279
- const s = t, n = e, i = r;
280
- let u = "list" + t;
281
- const l = (a) => i[a] ? i[a]() : 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;
282
282
  return {
283
- field: l,
283
+ field: o,
284
284
  $fields: i,
285
285
  setDataPath(a) {
286
- return u = a, u;
286
+ return c = a, c;
287
287
  },
288
288
  getDataPath() {
289
- return u;
289
+ return c;
290
290
  },
291
291
  gqlFields(a) {
292
- const c = [];
293
- for (const d of a)
294
- if (typeof d == "string") {
295
- const b = l(d);
296
- b && c.push(b.getGQLField());
297
- } else typeof d == "object" && c.push(d);
298
- return c;
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
299
  },
300
- async update(a, c) {
301
- return await o(n, "update" + s, { id: a, data: c });
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 o(n, "delete" + s, { id: a });
304
+ return await u(n, "delete" + s, { id: a });
305
305
  },
306
306
  async add(a) {
307
- return await o(n, "add" + s, { data: a });
307
+ return await u(n, "add" + s, { data: a });
308
308
  },
309
309
  fields(a) {
310
- let c = [];
311
- for (let d of a) {
312
- const b = l(d);
313
- b && c.push(b);
310
+ let l = [];
311
+ for (let p of a) {
312
+ const _ = o(p);
313
+ _ && l.push(_);
314
314
  }
315
- return c;
315
+ return l;
316
316
  },
317
- async get(a, c) {
318
- return (await y(n, {
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(c)
327
+ ...O(l)
328
328
  }
329
329
  }
330
330
  }))["list" + s].data[0];
331
331
  },
332
- async list(a, c) {
333
- return (await y(n, {
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(c)
339
+ ...O(l)
340
340
  }
341
341
  }
342
342
  }))["list" + s].data;
343
343
  }
344
344
  };
345
345
  };
346
- function re(e) {
347
- e = "<~" + e + "~>";
348
- var t, r, s, n, i, u = String, l = 255;
349
- 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, i = e.length; i > 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);
350
- return function(a, c) {
351
- for (var d = c; d > 0; d--) a.pop();
352
- }(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);
353
353
  }
354
- const B = (e = "") => {
355
- const t = e, r = (s = "application/octet-stream") => {
356
- const n = new Uint8Array(t.length);
357
- for (let l = 0; l < t.length; l++)
358
- n[l] = t.charCodeAt(l);
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: () => t,
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
- }, me = {
374
- fromBase85: (e) => B(re(e)),
375
- fromBase64: (e) => B(atob(e)),
376
- fromString: (e) => B(e)
377
- }, P = (e) => {
378
- let t = {};
379
- 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) => {
380
380
  Object.entries(P(r)).forEach(([s, n]) => {
381
- t[s] = n;
381
+ e[s] = n;
382
382
  });
383
- }), t) : (Object.entries(e).forEach(([r, s]) => {
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
- t[r] = s;
385
+ e[r] = s;
386
386
  return;
387
387
  }
388
388
  if (typeof s == "boolean") {
389
- t[r] = s;
389
+ e[r] = s;
390
390
  return;
391
391
  }
392
- t[r] = P(s);
393
- }), t);
394
- }, O = (e) => P(e), y = async (e, t) => {
395
- let r = R(O(t));
396
- 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("", {
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 se(e) {
404
- for (let t = 0; t < e.length; t++)
405
- if (e[t] instanceof File)
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 ne(e) {
410
- for (let t in e)
411
- if (e[t] instanceof File)
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 o = async (e, t, r = null, s = []) => {
415
+ const u = async (t, e, r = null, s = []) => {
416
416
  let n = {
417
- [t]: {}
417
+ [e]: {}
418
418
  };
419
419
  const i = new FormData();
420
- let u = !1;
420
+ let c = !1;
421
421
  if (r) {
422
- const c = {}, d = {}, b = {};
423
- let F = 0;
424
- Object.entries(r).forEach(([w, v]) => {
425
- if (v instanceof Array && se(v)) {
426
- u = !0;
427
- let C = 0;
428
- v.forEach((D) => {
429
- D instanceof File && (c[w] = new S(w), d[F] = ["variables." + w + "." + C], i.append(F.toString(), D), F++);
430
- }), b[w] = "[Upload!]!";
431
- } else v instanceof File ? (u = !0, c[w] = new S(w), d[F] = ["variables." + w], i.append(F.toString(), v), b[w] = "Upload!", F++) : v instanceof Object && ne(v) ? (u = !0, c[w] = {}, Object.entries(v).forEach(([C, D]) => {
432
- D instanceof File ? (c[w][C] = new S(C), d[F] = ["variables." + C], i.append(F.toString(), D), b[C] = "Upload!", F++) : c[w][C] = D;
433
- })) : v !== void 0 && (c[w] = v);
434
- }), n[t].__args = c, n.__variables = b, u && i.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));
435
435
  }
436
- Object.entries(O(s)).forEach(([c, d]) => {
437
- n[t][c] = d;
438
- }), Object.entries(n[t]).length === 0 && (n[t] = !0);
439
- let l = null;
440
- const a = R({ mutation: n });
441
- if (u ? (i.append("operations", JSON.stringify({
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
442
  query: a
443
- })), l = await e.post("", i)) : l = await e.post("", {
443
+ })), o = await t.post("", i)) : o = await t.post("", {
444
444
  query: a
445
- }), l.data.errors)
446
- throw new Error(l.data.errors[0].message);
447
- return l.data.data[t];
448
- }, ae = (e) => ({
449
- uploadTempFile: (t) => o(e, "fsUploadTempFile", {
450
- file: t
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 (t) => (await y(e, {
458
+ list: async (e) => (await m(t, {
459
459
  fsListFolders: {
460
460
  __args: {
461
- path: t
461
+ path: e
462
462
  },
463
463
  name: !0,
464
464
  path: !0
465
465
  }
466
466
  })).fsListFolders,
467
- create: (t) => o(e, "fsCreateFolder", { path: t }),
468
- delete: (t) => o(e, "fsDeleteFolder", { path: t }),
469
- 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 })
470
470
  },
471
471
  files: {
472
- list: async (t) => (await y(e, {
472
+ list: async (e) => (await m(t, {
473
473
  fsListFiles: {
474
474
  __args: {
475
- path: t
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 (t) => {
486
- let r = await y(e, {
485
+ read: async (e) => {
486
+ let r = await m(t, {
487
487
  fsFile: {
488
488
  __args: {
489
- path: t
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: (t, r) => o(e, "fsWriteFile", {
497
- path: t,
496
+ write: (e, r) => u(t, "fsWriteFile", {
497
+ path: e,
498
498
  content: r
499
499
  }),
500
- delete: (t) => o(e, "fsDeleteFile", { path: t }),
501
- rename: (t, r) => o(e, "fsRenameFile", { path: t, name: r }),
502
- 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 })
503
503
  }
504
- }), ie = (e) => ({
505
- get: async (t) => (await e({
504
+ }), it = (t) => ({
505
+ get: async (e) => (await t({
506
506
  config: {
507
507
  __args: {
508
- name: t
508
+ name: e
509
509
  }
510
510
  }
511
511
  })).config
512
- }), oe = (e) => ({
513
- send: (t, r, s) => o(e, "sendMail", {
514
- email: t,
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
- }), le = (e) => ({
519
- list: async (t = {
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 = T("Users", e, t);
526
+ const r = L("Users", t, e);
527
527
  return r.data_path = "app.users", r.all();
528
528
  }
529
- }), ue = (e) => {
530
- const t = e, r = {};
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 u of Object.entries(n)) {
536
- const [l, a] = u;
537
- i[l] = () => ({
538
- name: a.name ? a.name : l,
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 : l,
541
- getGQLField: () => a.gqlField !== void 0 ? a.gqlField : a.name || l,
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(c) {
546
- return a.field && typeof a.field == "function" ? a.field(c) : a.field && typeof a.field == "string" ? c[a.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()];
547
547
  },
548
- getFormattedValue(c) {
549
- const d = this.getValue(c);
550
- return a.format ? a.format(d) : d;
548
+ getFormattedValue(l) {
549
+ const p = this.getValue(l);
550
+ return a.format ? a.format(p) : p;
551
551
  }
552
552
  });
553
553
  }
554
- r[s] = te(t, s, i);
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
- }, ce = (e) => ({
561
- list: async (t = {
560
+ }, ut = (t) => ({
561
+ list: async (e = {
562
562
  name: !0
563
563
  }) => {
564
- const { app: { roles: r } } = await y(e, {
564
+ const { app: { roles: r } } = await m(t, {
565
565
  app: {
566
- roles: t
566
+ roles: e
567
567
  }
568
568
  });
569
569
  return r;
570
570
  }
571
- }), J = [
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
- ], fe = ["forPage", "sortByDesc", "sortBy", "skip", "take", "splice", "whereBetween", "whereIn", "whereNotBetween", "whereNotIn", "first", "where", "whereContains"], pe = [
597
+ ], pt = [
598
598
  "avg",
599
599
  "count",
600
600
  "countBy",
@@ -623,119 +623,151 @@ const o = async (e, t, r = null, s = []) => {
623
623
  "partition",
624
624
  "sole"
625
625
  ];
626
- class g {
627
- constructor(t, r) {
628
- _(this, "data_path", "");
629
- _(this, "axios");
630
- _(this, "filters");
631
- _(this, "steps");
632
- _(this, "fields");
633
- _(this, "already_limit", !1);
634
- _(this, "already_offset", !1);
635
- _(this, "limit", null);
636
- _(this, "offset", null);
637
- _(this, "_sort", null);
638
- _(this, "_sortDesc", !1);
639
- _(this, "meta", {});
640
- 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;
641
643
  }
642
644
  }
643
- g.prototype.dataPath = function(e) {
644
- const t = this.clone();
645
- 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
+ };
646
658
  };
647
- g.prototype.buildArgs = function() {
648
- let e = {};
649
- 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;
650
662
  };
651
- g.prototype.clone = function() {
652
- const e = Object.create(this);
653
- return e.steps = [...this.steps], e;
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
- k().macro("whereContains", function(e, t) {
656
- 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()));
657
673
  });
658
- g.prototype.fetchData = async function() {
659
- 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 = {
660
680
  meta: {
661
681
  total: !0,
662
682
  key: !0,
663
683
  name: !0
664
684
  }
665
685
  };
666
- 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);
667
- const t = this.data_path.split(".");
668
- let r = {}, s = r, n = t[t.length - 1];
669
- for (const l of t) {
670
- if (l === n) {
671
- 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;
672
692
  break;
673
693
  }
674
- s[l] = {}, s = s[l];
694
+ s[o] = {}, s = s[o];
675
695
  }
676
- let u = await y(this.axios, r);
677
- for (const l of t)
678
- u = u[l];
679
- 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);
680
700
  };
681
- g.prototype.processData = async function() {
682
- let e = null;
683
- for (const t of this.steps) {
684
- if (J.includes(t.type)) {
685
- e || (e = await this.fetchData()), e = e[t.type](...t.args);
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
- g.prototype.all = async function() {
707
+ d.prototype.all = async function() {
701
708
  return (await this.processData()).all();
702
709
  };
703
- for (const e of [...J, ...fe])
704
- g.prototype[e] = function(...t) {
710
+ for (const t of ct)
711
+ d.prototype[t] = function(...e) {
705
712
  const r = this.clone();
706
- return r.steps.push({ type: e, args: t }), r;
713
+ return r.steps.push({ type: t, args: e }), r;
707
714
  };
708
- for (const e of pe)
709
- g.prototype[e] = async function(...t) {
710
- 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);
711
718
  };
712
- g.prototype.average = g.prototype.avg;
713
- g.prototype.first = async function() {
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
- g.prototype.push = function(e) {
717
- 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;
746
+ };
747
+ d.prototype.whereBetween = function(t, e) {
748
+ return this.steps.push({ type: "whereBetween", args: [t, e] }), this.filters[t] = { between: e }, this;
718
749
  };
719
- g.prototype.pop = async function(...e) {
720
- const r = (await this.clone().processData()).pop(...e);
721
- return this.steps.push({ type: "pop", args: e }), r;
750
+ d.prototype.sortBy = function(t) {
751
+ return this.steps.push({ type: "sortBy", args: [t] }), typeof t == "string" && (this._sort = t), this;
722
752
  };
723
- g.prototype.prepend = function(...e) {
724
- return this.steps.push({ type: "prepend", args: e }), this;
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;
725
755
  };
726
- g.prototype.shift = async function(...e) {
727
- const r = (await this.clone().processData()).shift(...e);
728
- return this.steps.push({ type: "shift", args: e }), r;
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;
729
758
  };
730
- g.prototype.transform = function(...e) {
731
- return this.steps.push({ type: "transform", args: e }), this;
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);
732
761
  };
733
- const T = (e, t, r) => {
734
- const s = new g(r, t);
735
- return s.data_path = "list" + e, s;
736
- }, he = (e, t) => ({
737
- uploadTempFile: (r) => o(t, "lightDriveUploadTempFile", {
738
- index: e,
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,
739
771
  file: r
740
772
  }, {
741
773
  name: !0,
@@ -747,11 +779,11 @@ const T = (e, t, r) => {
747
779
  list: async (r, s = {
748
780
  name: !0,
749
781
  path: !0
750
- }) => (await y(t, {
782
+ }) => (await m(e, {
751
783
  app: {
752
784
  drive: {
753
785
  __args: {
754
- index: e
786
+ index: t
755
787
  },
756
788
  folders: {
757
789
  __args: {
@@ -762,9 +794,9 @@ const T = (e, t, r) => {
762
794
  }
763
795
  }
764
796
  })).app.drive.folders,
765
- create: (r) => o(t, "lightDriveCreateFolder", { index: e, path: r }),
766
- delete: (r) => o(t, "lightDriveDeleteFolder", { index: e, path: r }),
767
- 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 })
768
800
  },
769
801
  files: {
770
802
  list: async (r, s = {
@@ -773,11 +805,11 @@ const T = (e, t, r) => {
773
805
  size: !0,
774
806
  mime: !0,
775
807
  url: !0
776
- }) => (await y(t, {
808
+ }) => (await m(e, {
777
809
  app: {
778
810
  drive: {
779
811
  __args: {
780
- index: e
812
+ index: t
781
813
  },
782
814
  files: {
783
815
  __args: {
@@ -794,11 +826,11 @@ const T = (e, t, r) => {
794
826
  size: !0,
795
827
  mime: !0,
796
828
  url: !0
797
- }) => (await y(t, {
829
+ }) => (await m(e, {
798
830
  app: {
799
831
  drive: {
800
832
  __args: {
801
- index: e
833
+ index: t
802
834
  },
803
835
  file: {
804
836
  __args: {
@@ -810,11 +842,11 @@ const T = (e, t, r) => {
810
842
  }
811
843
  })).app.drive.file,
812
844
  read: async (r) => {
813
- let s = await y(t, {
845
+ let s = await m(e, {
814
846
  app: {
815
847
  drive: {
816
848
  __args: {
817
- index: e
849
+ index: t
818
850
  },
819
851
  file: {
820
852
  __args: {
@@ -827,46 +859,76 @@ const T = (e, t, r) => {
827
859
  });
828
860
  return window.atob(s.app.drive.file.base64Content);
829
861
  },
830
- write: (r, s) => o(t, "lightDriveWriteFile", { index: e, path: r, content: s }),
831
- delete: (r) => o(t, "lightDriveDeleteFile", { index: e, path: r }),
832
- rename: (r, s) => o(t, "lightDriveRenameFile", { index: e, path: r, name: s }),
833
- 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 })
834
866
  }
835
- }), we = (e) => {
836
- const t = W.create({
837
- baseURL: e,
867
+ }), mt = (t) => {
868
+ const e = W.create({
869
+ baseURL: t,
838
870
  withCredentials: !0
839
- }), r = (i, u = null, l = []) => o(t, i, u, l), s = (i) => y(t, i), n = ue(t);
871
+ }), r = (i, c = null, o = []) => u(e, i, c, o), s = (i) => m(e, i), n = lt(e);
840
872
  return {
841
- baseURL: e,
842
- axios: t,
843
- auth: ee(t),
873
+ baseURL: t,
874
+ axios: e,
875
+ auth: x(e),
844
876
  mutation: r,
845
877
  query: s,
846
- config: ie(s),
847
- mail: oe(t),
848
- users: le(t),
849
- fs: ae(t),
878
+ config: it(s),
879
+ mail: at(e),
880
+ users: ot(e),
881
+ fs: nt(e),
850
882
  models: n,
851
883
  model(i) {
852
884
  return n.get(i);
853
885
  },
854
- roles: ce(t),
855
- collect: (i, u) => {
856
- const l = T(i, t, u);
857
- return l.data_path = n.get(i).getDataPath(), l;
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;
858
890
  },
859
891
  drive(i) {
860
- return he(i, t);
892
+ return ft(i, e);
893
+ },
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;
861
923
  }
862
924
  };
863
925
  };
864
926
  export {
865
- me as File,
866
- we as createClient,
867
- T as createCollection,
868
- B as file,
869
- o as mutation,
870
- 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,
871
933
  O as toQuery
872
934
  };