@hostlink/light 1.0.2 → 1.2.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/file.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ export declare const file: (s?: string) => {
2
+ getContent: () => string;
3
+ getURL: (mime?: string) => string;
4
+ download: (filename: string) => void;
5
+ open: (mime: string) => void;
6
+ };
7
+ export declare const File: {
8
+ fromBase85: (a: string) => {
9
+ getContent: () => string;
10
+ getURL: (mime?: string) => string;
11
+ download: (filename: string) => void;
12
+ open: (mime: string) => void;
13
+ };
14
+ fromBase64: (a: string) => {
15
+ getContent: () => string;
16
+ getURL: (mime?: string) => string;
17
+ download: (filename: string) => void;
18
+ open: (mime: string) => void;
19
+ };
20
+ fromString: (a: string) => {
21
+ getContent: () => string;
22
+ getURL: (mime?: string) => string;
23
+ download: (filename: string) => void;
24
+ open: (mime: string) => void;
25
+ };
26
+ };
package/dist/fs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type File = {
1
+ export type FSFile = {
2
2
  name: string;
3
3
  path: string;
4
4
  size: number;
@@ -6,12 +6,12 @@ export type File = {
6
6
  canPreview: boolean;
7
7
  imagePath: string;
8
8
  };
9
- export type Folder = {
9
+ export type FSFolder = {
10
10
  name: String;
11
11
  path: String;
12
12
  };
13
13
  export declare const fsListFiles: (path: string) => Promise<Array<File>>;
14
- export declare const fsListFolders: (path: string) => Promise<Array<Folder>>;
14
+ export declare const fsListFolders: (path: string) => Promise<Array<FSFolder>>;
15
15
  export declare const fsReadFile: (path: string) => Promise<string>;
16
16
  export declare const fsWriteFile: (path: string, content: string) => Promise<boolean>;
17
17
  export declare const fsDeleteFile: (path: string) => Promise<boolean>;
package/dist/index.d.ts CHANGED
@@ -2,15 +2,15 @@ export * from './auth';
2
2
  export * from './axios';
3
3
  export * from './granted';
4
4
  export * from './model';
5
- import query from './query';
6
- import mutation from './mutation';
7
- import toQuery from './toQuery';
5
+ export * from './file';
6
+ export { default as query } from './query';
7
+ export { default as mutation } from './mutation';
8
+ export { default as toQuery } from './toQuery';
8
9
  export * from './apiUrl';
9
- import uploadFile from './uploadFile';
10
- import sendMail from './sendMail';
11
- import getConfig from './getConfig';
12
- import webauthnLogin from './webauthnLogin';
13
- import webauthnRegister from './webauthnRegister';
10
+ export { default as uploadFile } from './uploadFile';
11
+ export { default as sendMail } from './sendMail';
12
+ export { default as getConfig } from './getConfig';
13
+ export { default as webauthnLogin } from './webauthnLogin';
14
+ export { default as webauthnRegister } from './webauthnRegister';
14
15
  export type Fields = Object | Array<string | Object> | string;
15
16
  export * from './fs';
16
- export { toQuery, query, mutation, uploadFile, sendMail, webauthnLogin, webauthnRegister, getConfig, };
package/dist/light.js CHANGED
@@ -1,101 +1,100 @@
1
- import D from "axios";
2
- import { VariableType as A, jsonToGraphQLQuery as v } from "json-to-graphql-query";
3
- const I = (e, t, r = "") => c("login", {
1
+ import K from "axios";
2
+ import { VariableType as A, jsonToGraphQLQuery as x } from "json-to-graphql-query";
3
+ const re = (e, t, r = "") => f("login", {
4
4
  username: e,
5
5
  password: t,
6
6
  code: r
7
- }), z = () => c("logout"), $ = (e, t) => c("updatePassword", {
7
+ }), ne = () => f("logout"), se = (e, t) => f("updatePassword", {
8
8
  old_password: e,
9
9
  new_password: t
10
- }), H = (e, t, r) => c("resetPassword", {
10
+ }), ae = (e, t, r) => f("resetPassword", {
11
11
  email: e,
12
12
  password: t,
13
13
  code: r
14
- }), X = (e) => c("forgetPassword", {
14
+ }), ie = (e) => f("forgetPassword", {
15
15
  email: e
16
16
  });
17
- let b;
18
- const Y = (e) => {
19
- b = e;
20
- }, h = () => (b || (b = D.create({
17
+ let S;
18
+ const oe = (e) => {
19
+ S = e;
20
+ }, v = () => (S || (S = K.create({
21
21
  withCredentials: !0
22
- })), b), Z = async (e) => (await d({
22
+ })), S), le = async (e) => (await h({
23
23
  granted: {
24
24
  __args: {
25
25
  rights: e
26
26
  }
27
27
  }
28
- })).granted, m = {}, k = (e, t) => {
29
- m[e] = {};
28
+ })).granted, y = {}, ce = (e, t) => {
29
+ y[e] = {};
30
30
  for (const r of Object.entries(t)) {
31
- const [n, s] = r;
32
- m[e][n] = () => ({
33
- name: s.name ? s.name : n,
34
- raw: s,
35
- getName: () => s.name ? s.name : n,
36
- getGQLField: () => s.gqlField !== void 0 ? s.gqlField : s.name || n,
31
+ const [s, n] = r;
32
+ y[e][s] = () => ({
33
+ name: n.name ? n.name : s,
34
+ raw: n,
35
+ getName: () => n.name ? n.name : s,
36
+ getGQLField: () => n.gqlField !== void 0 ? n.gqlField : n.name || s,
37
37
  getRaw() {
38
- return s;
38
+ return n;
39
39
  },
40
- getValue(i) {
41
- return s.field && typeof s.field == "function" ? s.field(i) : s.field && typeof s.field == "string" ? i[s.field] : i[this.getName()];
40
+ getValue(a) {
41
+ return n.field && typeof n.field == "function" ? n.field(a) : n.field && typeof n.field == "string" ? a[n.field] : a[this.getName()];
42
42
  },
43
- getFormattedValue(i) {
44
- const u = this.getValue(i);
45
- return s.format ? s.format(u) : u;
43
+ getFormattedValue(a) {
44
+ const l = this.getValue(a);
45
+ return n.format ? n.format(l) : l;
46
46
  }
47
47
  });
48
48
  }
49
- }, C = (e, t) => !m[e] || !m[e][t] ? null : m[e][t](), ee = (e, t) => {
49
+ }, J = (e, t) => !y[e] || !y[e][t] ? null : y[e][t](), ue = (e, t) => {
50
50
  const r = [];
51
- for (const n of t)
52
- if (typeof n == "string") {
53
- const s = C(e, n);
54
- s && r.push(s.getGQLField());
51
+ for (const s of t)
52
+ if (typeof s == "string") {
53
+ const n = J(e, s);
54
+ n && r.push(n.getGQLField());
55
55
  } else
56
- typeof n == "object" && r.push(n);
56
+ typeof s == "object" && r.push(s);
57
57
  return r;
58
- }, S = (e) => {
59
- const t = new FormData(), r = {}, n = {}, s = {};
60
- let i = 0, u = !1;
61
- return Object.entries(e).forEach(([p, w]) => {
62
- w instanceof File ? (u = !0, n[p] = "Upload!", s[p] = new A(p), t.append(i.toString(), w), r[i] = ["variables." + p], i++) : s[p] = w;
63
- }), u ? (t.append("map", JSON.stringify(r)), {
64
- data: s,
58
+ }, fe = (e) => {
59
+ const t = new FormData(), r = {}, s = {}, n = {};
60
+ let a = 0, l = !1;
61
+ return Object.entries(e).forEach(([u, d]) => {
62
+ d instanceof File ? (l = !0, s[u] = "Upload!", n[u] = new A(u), t.append(a.toString(), d), r[a] = ["variables." + u], a++) : n[u] = d;
63
+ }), l ? (t.append("map", JSON.stringify(r)), {
64
+ data: n,
65
65
  formData: t,
66
66
  mutation: {
67
- __variables: n
67
+ __variables: s
68
68
  }
69
69
  }) : {
70
- data: s,
70
+ data: n,
71
71
  formData: null,
72
72
  mutation: {}
73
73
  };
74
- }, te = (e) => {
74
+ }, de = (e) => {
75
75
  const t = e;
76
76
  return {
77
77
  name: t,
78
- async update(r, n) {
79
- const s = S(n);
80
- return await c("update" + t, { id: r, data: s.data }, [], s.mutation, s.formData);
78
+ $fields: y[e],
79
+ async update(r, s) {
80
+ return await f("update" + t, { id: r, data: s });
81
81
  },
82
82
  async delete(r) {
83
- return await c("delete" + t, { id: r });
83
+ return await f("delete" + t, { id: r });
84
84
  },
85
85
  async add(r) {
86
- const n = S(r);
87
- return await c("add" + t, { data: n.data }, [], n.mutation, n.formData);
86
+ return await f("add" + t, { data: r });
88
87
  },
89
88
  fields(r) {
90
- let n = [];
91
- for (let s of r) {
92
- const i = C(t, s);
93
- i && n.push(i);
89
+ let s = [];
90
+ for (let n of r) {
91
+ const a = J(t, n);
92
+ a && s.push(a);
94
93
  }
95
- return n;
94
+ return s;
96
95
  },
97
- async get(r, n) {
98
- return (await d({
96
+ async get(r, s) {
97
+ return (await h({
99
98
  ["list" + t]: {
100
99
  __args: {
101
100
  filters: r
@@ -104,68 +103,136 @@ const Y = (e) => {
104
103
  __args: {
105
104
  limit: 1
106
105
  },
107
- ...y(n)
106
+ ...R(s)
108
107
  }
109
108
  }
110
109
  }))["list" + t].data[0];
111
110
  },
112
- async list(r, n) {
113
- return (await d({
111
+ async list(r, s) {
112
+ return (await h({
114
113
  ["list" + t]: {
115
114
  __args: {
116
115
  filters: r
117
116
  },
118
117
  data: {
119
- ...y(n)
118
+ ...R(s)
120
119
  }
121
120
  }
122
121
  }))["list" + t].data;
123
122
  }
124
123
  };
125
- }, F = (e) => {
124
+ };
125
+ function M(e) {
126
+ e = "<~" + e + "~>";
127
+ var t, r, s, n, a, l = String, u = 255;
128
+ 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)
129
+ 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(u & r >> 24, u & r >> 16, u & r >> 8, u & r);
130
+ return function(d, b) {
131
+ for (var _ = b; _ > 0; _--)
132
+ d.pop();
133
+ }(s, t.length), l.fromCharCode.apply(l, s);
134
+ }
135
+ const j = (e = "") => {
136
+ const t = e, r = (s = "application/octet-stream") => {
137
+ const n = new Uint8Array(t.length);
138
+ for (let u = 0; u < t.length; u++)
139
+ n[u] = t.charCodeAt(u);
140
+ const a = new Blob([n], { type: s });
141
+ return URL.createObjectURL(a);
142
+ };
143
+ return {
144
+ getContent: () => t,
145
+ getURL: r,
146
+ download: (s) => {
147
+ const n = document.createElement("a");
148
+ n.download = s, n.href = r(), document.body.appendChild(n), n.click(), document.body.removeChild(n);
149
+ },
150
+ open: (s) => {
151
+ window.open(r(s), "_blank");
152
+ }
153
+ };
154
+ }, pe = {
155
+ fromBase85: (e) => j(M(e)),
156
+ fromBase64: (e) => j(atob(e)),
157
+ fromString: (e) => j(e)
158
+ }, q = (e) => {
126
159
  let t = {};
127
160
  return typeof e == "string" ? (t[e] = !0, t) : e instanceof Array ? (e.forEach((r) => {
128
- Object.entries(F(r)).forEach(([n, s]) => {
129
- t[n] = s;
161
+ Object.entries(q(r)).forEach(([s, n]) => {
162
+ t[s] = n;
130
163
  });
131
- }), t) : (Object.entries(e).forEach(([r, n]) => {
164
+ }), t) : (Object.entries(e).forEach(([r, s]) => {
132
165
  if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
133
- t[r] = n;
166
+ t[r] = s;
134
167
  return;
135
168
  }
136
- if (typeof n == "boolean") {
137
- t[r] = n;
169
+ if (typeof s == "boolean") {
170
+ t[r] = s;
138
171
  return;
139
172
  }
140
- t[r] = F(n);
173
+ t[r] = q(s);
141
174
  }), t);
142
- }, y = (e) => F(e), d = async (e) => {
143
- let t = v(y(e));
144
- const r = await h().post(_(), {
175
+ }, R = (e) => q(e), h = async (e) => {
176
+ let t = x(R(e));
177
+ const r = await v().post(E(), {
145
178
  query: `{ ${t} }`
146
179
  });
147
180
  if (r.data.errors)
148
181
  throw new Error(r.data.errors[0].message);
149
182
  return r.data.data;
150
- }, c = async (e, t = null, r = [], n = {}, s = null) => {
151
- n[e] = !0, r instanceof Array && r.length != 0 && (n[e] = {}), t && (n[e] = {}, n[e].__args = t), Object.entries(y(r)).forEach(([p, w]) => {
152
- n[e][p] = w;
153
- });
154
- let i = null;
155
- const u = v({ mutation: n });
156
- if (s ? (s.append("operations", JSON.stringify({
183
+ };
184
+ function B(e) {
185
+ for (let t = 0; t < e.length; t++)
186
+ if (e[t] instanceof File)
187
+ return !0;
188
+ return !1;
189
+ }
190
+ function Q(e) {
191
+ for (let t in e)
192
+ if (e[t] instanceof File)
193
+ return !0;
194
+ return !1;
195
+ }
196
+ const f = async (e, t = null, r = []) => {
197
+ let s = {
198
+ [e]: {}
199
+ };
200
+ const n = new FormData();
201
+ let a = !1;
202
+ if (t) {
203
+ const d = {}, b = {}, _ = {};
204
+ let w = 0;
205
+ Object.entries(t).forEach(([m, g]) => {
206
+ if (g instanceof Array && B(g)) {
207
+ a = !0;
208
+ let F = 0;
209
+ g.forEach((C) => {
210
+ C instanceof File && (d[m] = new A(m), b[w] = ["variables." + m + "." + F], n.append(w.toString(), C), w++);
211
+ }), _[m] = "[Upload!]!";
212
+ } else
213
+ g instanceof File ? (a = !0, d[m] = new A(m), b[w] = ["variables." + m], n.append(w.toString(), g), _[m] = "Upload!", w++) : g instanceof Object && Q(g) ? (a = !0, Object.entries(g).forEach(([F, C]) => {
214
+ C instanceof File ? (d[F] = new A(F), b[w] = ["variables." + F], n.append(w.toString(), C), w++) : d[F] = g;
215
+ })) : d[m] = g;
216
+ }), s[e].__args = d, s.__variables = _, a && n.append("map", JSON.stringify(b));
217
+ }
218
+ Object.entries(R(r)).forEach(([d, b]) => {
219
+ s[e][d] = b;
220
+ }), Object.entries(s[e]).length === 0 && (s[e] = !0);
221
+ let l = null;
222
+ const u = x({ mutation: s });
223
+ if (a ? (n.append("operations", JSON.stringify({
157
224
  query: u
158
- })), i = await h().post(_(), s)) : i = await h().post(_(), {
225
+ })), l = await v().post(E(), n)) : l = await v().post(E(), {
159
226
  query: u
160
- }), i.data.errors)
161
- throw new Error(i.data.errors[0].message);
162
- return i.data.data[e];
227
+ }), l.data.errors)
228
+ throw new Error(l.data.errors[0].message);
229
+ return l.data.data[e];
163
230
  };
164
- let R = "/api/";
165
- const re = (e) => {
166
- R = e;
167
- }, _ = () => R;
168
- async function ne(e) {
231
+ let D = "/api/";
232
+ const ge = (e) => {
233
+ D = e;
234
+ }, E = () => D;
235
+ async function we(e) {
169
236
  const t = {
170
237
  __variables: {
171
238
  file: "Upload!"
@@ -181,74 +248,74 @@ async function ne(e) {
181
248
  }
182
249
  }, r = new FormData();
183
250
  r.append("operations", JSON.stringify({
184
- query: v({ mutation: t })
251
+ query: x({ mutation: t })
185
252
  })), r.append("map", JSON.stringify({ 0: ["variables.file"] })), r.append("0", e);
186
- const n = await h().post(_(), r);
187
- if (n.data.errors)
188
- throw new Error(n.data.errors[0].message);
189
- return n.data.data.fsUploadTempFile;
253
+ const s = await v().post(E(), r);
254
+ if (s.data.errors)
255
+ throw new Error(s.data.errors[0].message);
256
+ return s.data.data.fsUploadTempFile;
190
257
  }
191
- const se = (e, t, r) => c("sendMail", {
258
+ const me = (e, t, r) => f("sendMail", {
192
259
  email: e,
193
260
  subject: t,
194
261
  message: r
195
- }), ae = async (e) => (await d({
262
+ }), he = async (e) => (await h({
196
263
  config: {
197
264
  __args: {
198
265
  name: e
199
266
  }
200
267
  }
201
268
  })).config;
202
- function q(e) {
203
- const t = "==".slice(0, (4 - e.length % 4) % 4), r = e.replace(/-/g, "+").replace(/_/g, "/") + t, n = atob(r), s = new ArrayBuffer(n.length), i = new Uint8Array(s);
204
- for (let u = 0; u < n.length; u++)
205
- i[u] = n.charCodeAt(u);
206
- return s;
269
+ function L(e) {
270
+ 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);
271
+ for (let l = 0; l < s.length; l++)
272
+ a[l] = s.charCodeAt(l);
273
+ return n;
207
274
  }
208
- function E(e) {
275
+ function U(e) {
209
276
  const t = new Uint8Array(e);
210
277
  let r = "";
211
- for (const i of t)
212
- r += String.fromCharCode(i);
278
+ for (const a of t)
279
+ r += String.fromCharCode(a);
213
280
  return btoa(r).replace(/\+/g, "-").replace(
214
281
  /\//g,
215
282
  "_"
216
283
  ).replace(/=/g, "");
217
284
  }
218
- var a = "copy", f = "convert";
219
- function g(e, t, r) {
220
- if (t === a)
285
+ var i = "copy", p = "convert";
286
+ function O(e, t, r) {
287
+ if (t === i)
221
288
  return r;
222
- if (t === f)
289
+ if (t === p)
223
290
  return e(r);
224
291
  if (t instanceof Array)
225
- return r.map((n) => g(e, t[0], n));
292
+ return r.map((s) => O(e, t[0], s));
226
293
  if (t instanceof Object) {
227
- const n = {};
228
- for (const [s, i] of Object.entries(t)) {
229
- if (i.derive) {
230
- const u = i.derive(r);
231
- u !== void 0 && (r[s] = u);
294
+ const s = {};
295
+ for (const [n, a] of Object.entries(t)) {
296
+ if (a.derive) {
297
+ const l = a.derive(r);
298
+ l !== void 0 && (r[n] = l);
232
299
  }
233
- if (!(s in r)) {
234
- if (i.required)
235
- throw new Error(`Missing key: ${s}`);
300
+ if (!(n in r)) {
301
+ if (a.required)
302
+ throw new Error(`Missing key: ${n}`);
236
303
  continue;
237
304
  }
238
- if (r[s] == null) {
239
- n[s] = null;
305
+ if (r[n] == null) {
306
+ s[n] = null;
240
307
  continue;
241
308
  }
242
- n[s] = g(
309
+ s[n] = O(
243
310
  e,
244
- i.schema,
245
- r[s]
311
+ a.schema,
312
+ r[n]
246
313
  );
247
314
  }
248
- return n;
315
+ return s;
249
316
  }
250
317
  }
251
- function O(e, t) {
318
+ function N(e, t) {
252
319
  return {
253
320
  required: !0,
254
321
  schema: e,
@@ -261,144 +328,144 @@ function o(e) {
261
328
  schema: e
262
329
  };
263
330
  }
264
- function l(e) {
331
+ function c(e) {
265
332
  return {
266
333
  required: !1,
267
334
  schema: e
268
335
  };
269
336
  }
270
- var N = {
271
- type: o(a),
272
- id: o(f),
273
- transports: l(a)
274
- }, x = {
275
- appid: l(a),
276
- appidExclude: l(a),
277
- credProps: l(a)
278
- }, J = {
279
- appid: l(a),
280
- appidExclude: l(a),
281
- credProps: l(a)
282
- }, j = {
337
+ var P = {
338
+ type: o(i),
339
+ id: o(p),
340
+ transports: c(i)
341
+ }, T = {
342
+ appid: c(i),
343
+ appidExclude: c(i),
344
+ credProps: c(i)
345
+ }, V = {
346
+ appid: c(i),
347
+ appidExclude: c(i),
348
+ credProps: c(i)
349
+ }, G = {
283
350
  publicKey: o({
284
- rp: o(a),
351
+ rp: o(i),
285
352
  user: o({
286
- id: o(f),
287
- name: o(a),
288
- displayName: o(a)
353
+ id: o(p),
354
+ name: o(i),
355
+ displayName: o(i)
289
356
  }),
290
- challenge: o(f),
291
- pubKeyCredParams: o(a),
292
- timeout: l(a),
293
- excludeCredentials: l([N]),
294
- authenticatorSelection: l(a),
295
- attestation: l(a),
296
- extensions: l(x)
357
+ challenge: o(p),
358
+ pubKeyCredParams: o(i),
359
+ timeout: c(i),
360
+ excludeCredentials: c([P]),
361
+ authenticatorSelection: c(i),
362
+ attestation: c(i),
363
+ extensions: c(T)
297
364
  }),
298
- signal: l(a)
299
- }, L = {
300
- type: o(a),
301
- id: o(a),
302
- rawId: o(f),
303
- authenticatorAttachment: l(a),
365
+ signal: c(i)
366
+ }, W = {
367
+ type: o(i),
368
+ id: o(i),
369
+ rawId: o(p),
370
+ authenticatorAttachment: c(i),
304
371
  response: o({
305
- clientDataJSON: o(f),
306
- attestationObject: o(f),
307
- transports: O(
308
- a,
372
+ clientDataJSON: o(p),
373
+ attestationObject: o(p),
374
+ transports: N(
375
+ i,
309
376
  (e) => {
310
377
  var t;
311
378
  return ((t = e.getTransports) == null ? void 0 : t.call(e)) || [];
312
379
  }
313
380
  )
314
381
  }),
315
- clientExtensionResults: O(
316
- J,
382
+ clientExtensionResults: N(
383
+ V,
317
384
  (e) => e.getClientExtensionResults()
318
385
  )
319
- }, P = {
320
- mediation: l(a),
386
+ }, $ = {
387
+ mediation: c(i),
321
388
  publicKey: o({
322
- challenge: o(f),
323
- timeout: l(a),
324
- rpId: l(a),
325
- allowCredentials: l([N]),
326
- userVerification: l(a),
327
- extensions: l(x)
389
+ challenge: o(p),
390
+ timeout: c(i),
391
+ rpId: c(i),
392
+ allowCredentials: c([P]),
393
+ userVerification: c(i),
394
+ extensions: c(T)
328
395
  }),
329
- signal: l(a)
330
- }, T = {
331
- type: o(a),
332
- id: o(a),
333
- rawId: o(f),
334
- authenticatorAttachment: l(a),
396
+ signal: c(i)
397
+ }, z = {
398
+ type: o(i),
399
+ id: o(i),
400
+ rawId: o(p),
401
+ authenticatorAttachment: c(i),
335
402
  response: o({
336
- clientDataJSON: o(f),
337
- authenticatorData: o(f),
338
- signature: o(f),
339
- userHandle: o(f)
403
+ clientDataJSON: o(p),
404
+ authenticatorData: o(p),
405
+ signature: o(p),
406
+ userHandle: o(p)
340
407
  }),
341
- clientExtensionResults: O(
342
- J,
408
+ clientExtensionResults: N(
409
+ V,
343
410
  (e) => e.getClientExtensionResults()
344
411
  )
345
412
  };
346
- function V(e) {
347
- return g(q, j, e);
413
+ function H(e) {
414
+ return O(L, G, e);
348
415
  }
349
- function K(e) {
350
- return g(
351
- E,
352
- L,
416
+ function I(e) {
417
+ return O(
418
+ U,
419
+ W,
353
420
  e
354
421
  );
355
422
  }
356
- function U(e) {
357
- return g(q, P, e);
423
+ function X(e) {
424
+ return O(L, $, e);
358
425
  }
359
- function M(e) {
360
- return g(
361
- E,
362
- T,
426
+ function Y(e) {
427
+ return O(
428
+ U,
429
+ z,
363
430
  e
364
431
  );
365
432
  }
366
- async function Q(e) {
433
+ async function Z(e) {
367
434
  const t = await navigator.credentials.create(
368
435
  e
369
436
  );
370
- return t.toJSON = () => K(t), t;
437
+ return t.toJSON = () => I(t), t;
371
438
  }
372
- async function G(e) {
439
+ async function k(e) {
373
440
  const t = await navigator.credentials.get(
374
441
  e
375
442
  );
376
- return t.toJSON = () => M(t), t;
443
+ return t.toJSON = () => Y(t), t;
377
444
  }
378
- async function ie(e) {
379
- const r = (await d({
445
+ async function be(e) {
446
+ const r = (await h({
380
447
  webAuthnRequestOptions: {
381
448
  __args: {
382
449
  username: e
383
450
  }
384
451
  }
385
- })).webAuthnRequestOptions, n = U({
452
+ })).webAuthnRequestOptions, s = X({
386
453
  publicKey: r
387
- }), s = await G(n);
388
- await c("webAuthnAssertion", {
454
+ }), n = await k(s);
455
+ await f("webAuthnAssertion", {
389
456
  username: e,
390
- assertion: s.toJSON()
457
+ assertion: n.toJSON()
391
458
  });
392
459
  }
393
- async function oe() {
394
- const e = await d({ webAuthnCreationOptions: !0 }), t = V({
460
+ async function _e() {
461
+ const e = await h({ webAuthnCreationOptions: !0 }), t = H({
395
462
  publicKey: e.webAuthnCreationOptions
396
- }), r = await Q(t);
397
- await c("webAuthnRegister", {
463
+ }), r = await Z(t);
464
+ await f("webAuthnRegister", {
398
465
  registration: r.toJSON()
399
466
  });
400
467
  }
401
- const le = async (e) => (await d({
468
+ const Fe = async (e) => (await h({
402
469
  fsListFiles: {
403
470
  __args: {
404
471
  path: e
@@ -410,7 +477,7 @@ const le = async (e) => (await d({
410
477
  canPreview: !0,
411
478
  imagePath: !0
412
479
  }
413
- })).fsListFiles, ce = async (e) => (await d({
480
+ })).fsListFiles, ye = async (e) => (await h({
414
481
  fsListFolders: {
415
482
  __args: {
416
483
  path: e
@@ -418,8 +485,8 @@ const le = async (e) => (await d({
418
485
  name: !0,
419
486
  path: !0
420
487
  }
421
- })).fsListFolders, ue = async (e) => {
422
- let t = await d({
488
+ })).fsListFolders, Oe = async (e) => {
489
+ let t = await h({
423
490
  fsFile: {
424
491
  __args: {
425
492
  path: e
@@ -428,57 +495,59 @@ const le = async (e) => (await d({
428
495
  }
429
496
  });
430
497
  return window.atob(t.fsFile.base64Content);
431
- }, fe = (e, t) => c("fsWriteFile", {
498
+ }, Ce = (e, t) => f("fsWriteFile", {
432
499
  path: e,
433
500
  content: t
434
- }), de = (e) => c("fsDeleteFile", {
501
+ }), Ae = (e) => f("fsDeleteFile", {
435
502
  path: e
436
- }), pe = (e) => c("fsCreateFolder", {
503
+ }), Se = (e) => f("fsCreateFolder", {
437
504
  path: e
438
- }), ge = (e) => c("fsDeleteFolder", {
505
+ }), ve = (e) => f("fsDeleteFolder", {
439
506
  path: e
440
- }), we = (e, t) => c("fsRenameFile", {
507
+ }), Re = (e, t) => f("fsRenameFile", {
441
508
  path: e,
442
509
  name: t
443
- }), me = (e, t) => c("fsRenameFolder", {
510
+ }), Ee = (e, t) => f("fsRenameFolder", {
444
511
  path: e,
445
512
  name: t
446
- }), be = (e, t) => c("fsMoveFile", {
513
+ }), je = (e, t) => f("fsMoveFile", {
447
514
  source: e,
448
515
  target: t
449
516
  });
450
517
  export {
451
- S as convertData,
452
- k as defineModel,
453
- X as forgetPassword,
454
- pe as fsCreateFolder,
455
- de as fsDeleteFile,
456
- ge as fsDeleteFolder,
457
- le as fsListFiles,
458
- ce as fsListFolders,
459
- be as fsMoveFile,
460
- ue as fsReadFile,
461
- we as fsRenameFile,
462
- me as fsRenameFolder,
463
- fe as fsWriteFile,
464
- _ as getApiUrl,
465
- h as getAxios,
466
- ae as getConfig,
467
- ee as getGQLFields,
468
- C as getModelField,
469
- Z as granted,
470
- I as login,
471
- z as logout,
472
- te as model,
473
- c as mutation,
474
- d as query,
475
- H as resetPassword,
476
- se as sendMail,
477
- re as setApiUrl,
478
- Y as setAxios,
479
- y as toQuery,
480
- $ as updatePassword,
481
- ne as uploadFile,
482
- ie as webauthnLogin,
483
- oe as webauthnRegister
518
+ pe as File,
519
+ fe as convertData,
520
+ ce as defineModel,
521
+ j as file,
522
+ ie as forgetPassword,
523
+ Se as fsCreateFolder,
524
+ Ae as fsDeleteFile,
525
+ ve as fsDeleteFolder,
526
+ Fe as fsListFiles,
527
+ ye as fsListFolders,
528
+ je as fsMoveFile,
529
+ Oe as fsReadFile,
530
+ Re as fsRenameFile,
531
+ Ee as fsRenameFolder,
532
+ Ce as fsWriteFile,
533
+ E as getApiUrl,
534
+ v as getAxios,
535
+ he as getConfig,
536
+ ue as getGQLFields,
537
+ J as getModelField,
538
+ le as granted,
539
+ re as login,
540
+ ne as logout,
541
+ de as model,
542
+ f as mutation,
543
+ h as query,
544
+ ae as resetPassword,
545
+ me as sendMail,
546
+ ge as setApiUrl,
547
+ oe as setAxios,
548
+ R as toQuery,
549
+ se as updatePassword,
550
+ we as uploadFile,
551
+ be as webauthnLogin,
552
+ _e as webauthnRegister
484
553
  };
@@ -1 +1 @@
1
- (function(s,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("axios"),require("json-to-graphql-query")):typeof define=="function"&&define.amd?define(["exports","axios","json-to-graphql-query"],m):(s=typeof globalThis<"u"?globalThis:s||self,m(s.light={},s.axios,s.jsonToGraphqlQuery))})(this,function(s,m,y){"use strict";const J=(e,t,r="")=>c("login",{username:e,password:t,code:r}),P=()=>c("logout"),M=(e,t)=>c("updatePassword",{old_password:e,new_password:t}),T=(e,t,r)=>c("resetPassword",{email:e,password:t,code:r}),U=e=>c("forgetPassword",{email:e});let O;const V=e=>{O=e},h=()=>(O||(O=m.create({withCredentials:!0})),O),Q=async e=>(await g({granted:{__args:{rights:e}}})).granted,F={},K=(e,t)=>{F[e]={};for(const r of Object.entries(t)){const[n,a]=r;F[e][n]=()=>({name:a.name?a.name:n,raw:a,getName:()=>a.name?a.name:n,getGQLField:()=>a.gqlField!==void 0?a.gqlField:a.name||n,getRaw(){return a},getValue(o){return a.field&&typeof a.field=="function"?a.field(o):a.field&&typeof a.field=="string"?o[a.field]:o[this.getName()]},getFormattedValue(o){const d=this.getValue(o);return a.format?a.format(d):d}})}},A=(e,t)=>!F[e]||!F[e][t]?null:F[e][t](),W=(e,t)=>{const r=[];for(const n of t)if(typeof n=="string"){const a=A(e,n);a&&r.push(a.getGQLField())}else typeof n=="object"&&r.push(n);return r},S=e=>{const t=new FormData,r={},n={},a={};let o=0,d=!1;return Object.entries(e).forEach(([p,v])=>{v instanceof File?(d=!0,n[p]="Upload!",a[p]=new y.VariableType(p),t.append(o.toString(),v),r[o]=["variables."+p],o++):a[p]=v}),d?(t.append("map",JSON.stringify(r)),{data:a,formData:t,mutation:{__variables:n}}):{data:a,formData:null,mutation:{}}},G=e=>{const t=e;return{name:t,async update(r,n){const a=S(n);return await c("update"+t,{id:r,data:a.data},[],a.mutation,a.formData)},async delete(r){return await c("delete"+t,{id:r})},async add(r){const n=S(r);return await c("add"+t,{data:n.data},[],n.mutation,n.formData)},fields(r){let n=[];for(let a of r){const o=A(t,a);o&&n.push(o)}return n},async get(r,n){return(await g({["list"+t]:{__args:{filters:r},data:{__args:{limit:1},...b(n)}}}))["list"+t].data[0]},async list(r,n){return(await g({["list"+t]:{__args:{filters:r},data:{...b(n)}}}))["list"+t].data}}},C=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(r=>{Object.entries(C(r)).forEach(([n,a])=>{t[n]=a})}),t):(Object.entries(e).forEach(([r,n])=>{if(r=="__args"||r=="__aliasFor"||r=="__variables"||r=="__directives"||r=="__all_on"||r=="__name"){t[r]=n;return}if(typeof n=="boolean"){t[r]=n;return}t[r]=C(n)}),t)},b=e=>C(e),g=async e=>{let t=y.jsonToGraphQLQuery(b(e));const r=await h().post(_(),{query:`{ ${t} }`});if(r.data.errors)throw new Error(r.data.errors[0].message);return r.data.data},c=async(e,t=null,r=[],n={},a=null)=>{n[e]=!0,r instanceof Array&&r.length!=0&&(n[e]={}),t&&(n[e]={},n[e].__args=t),Object.entries(b(r)).forEach(([p,v])=>{n[e][p]=v});let o=null;const d=y.jsonToGraphQLQuery({mutation:n});if(a?(a.append("operations",JSON.stringify({query:d})),o=await h().post(_(),a)):o=await h().post(_(),{query:d}),o.data.errors)throw new Error(o.data.errors[0].message);return o.data.data[e]};let q="/api/";const B=e=>{q=e},_=()=>q;async function I(e){const t={__variables:{file:"Upload!"},fsUploadTempFile:{__args:{file:new y.VariableType("file")},name:!0,path:!0,size:!0,mime:!0}},r=new FormData;r.append("operations",JSON.stringify({query:y.jsonToGraphQLQuery({mutation:t})})),r.append("map",JSON.stringify({0:["variables.file"]})),r.append("0",e);const n=await h().post(_(),r);if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data.fsUploadTempFile}const z=(e,t,r)=>c("sendMail",{email:e,subject:t,message:r}),$=async e=>(await g({config:{__args:{name:e}}})).config;function D(e){const t="==".slice(0,(4-e.length%4)%4),r=e.replace(/-/g,"+").replace(/_/g,"/")+t,n=atob(r),a=new ArrayBuffer(n.length),o=new Uint8Array(a);for(let d=0;d<n.length;d++)o[d]=n.charCodeAt(d);return a}function E(e){const t=new Uint8Array(e);let r="";for(const o of t)r+=String.fromCharCode(o);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var i="copy",f="convert";function w(e,t,r){if(t===i)return r;if(t===f)return e(r);if(t instanceof Array)return r.map(n=>w(e,t[0],n));if(t instanceof Object){const n={};for(const[a,o]of Object.entries(t)){if(o.derive){const d=o.derive(r);d!==void 0&&(r[a]=d)}if(!(a in r)){if(o.required)throw new Error(`Missing key: ${a}`);continue}if(r[a]==null){n[a]=null;continue}n[a]=w(e,o.schema,r[a])}return n}}function R(e,t){return{required:!0,schema:e,derive:t}}function l(e){return{required:!0,schema:e}}function u(e){return{required:!1,schema:e}}var L={type:l(i),id:l(f),transports:u(i)},N={appid:u(i),appidExclude:u(i),credProps:u(i)},j={appid:u(i),appidExclude:u(i),credProps:u(i)},H={publicKey:l({rp:l(i),user:l({id:l(f),name:l(i),displayName:l(i)}),challenge:l(f),pubKeyCredParams:l(i),timeout:u(i),excludeCredentials:u([L]),authenticatorSelection:u(i),attestation:u(i),extensions:u(N)}),signal:u(i)},X={type:l(i),id:l(i),rawId:l(f),authenticatorAttachment:u(i),response:l({clientDataJSON:l(f),attestationObject:l(f),transports:R(i,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:R(j,e=>e.getClientExtensionResults())},Y={mediation:u(i),publicKey:l({challenge:l(f),timeout:u(i),rpId:u(i),allowCredentials:u([L]),userVerification:u(i),extensions:u(N)}),signal:u(i)},Z={type:l(i),id:l(i),rawId:l(f),authenticatorAttachment:u(i),response:l({clientDataJSON:l(f),authenticatorData:l(f),signature:l(f),userHandle:l(f)}),clientExtensionResults:R(j,e=>e.getClientExtensionResults())};function k(e){return w(D,H,e)}function x(e){return w(E,X,e)}function ee(e){return w(D,Y,e)}function te(e){return w(E,Z,e)}async function re(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>x(t),t}async function ne(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>te(t),t}async function ae(e){const r=(await g({webAuthnRequestOptions:{__args:{username:e}}})).webAuthnRequestOptions,n=ee({publicKey:r}),a=await ne(n);await c("webAuthnAssertion",{username:e,assertion:a.toJSON()})}async function se(){const e=await g({webAuthnCreationOptions:!0}),t=k({publicKey:e.webAuthnCreationOptions}),r=await re(t);await c("webAuthnRegister",{registration:r.toJSON()})}const ie=async e=>(await g({fsListFiles:{__args:{path:e},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,oe=async e=>(await g({fsListFolders:{__args:{path:e},name:!0,path:!0}})).fsListFolders,le=async e=>{let t=await g({fsFile:{__args:{path:e},base64Content:!0}});return window.atob(t.fsFile.base64Content)},ue=(e,t)=>c("fsWriteFile",{path:e,content:t}),ce=e=>c("fsDeleteFile",{path:e}),de=e=>c("fsCreateFolder",{path:e}),fe=e=>c("fsDeleteFolder",{path:e}),ge=(e,t)=>c("fsRenameFile",{path:e,name:t}),pe=(e,t)=>c("fsRenameFolder",{path:e,name:t}),we=(e,t)=>c("fsMoveFile",{source:e,target:t});s.convertData=S,s.defineModel=K,s.forgetPassword=U,s.fsCreateFolder=de,s.fsDeleteFile=ce,s.fsDeleteFolder=fe,s.fsListFiles=ie,s.fsListFolders=oe,s.fsMoveFile=we,s.fsReadFile=le,s.fsRenameFile=ge,s.fsRenameFolder=pe,s.fsWriteFile=ue,s.getApiUrl=_,s.getAxios=h,s.getConfig=$,s.getGQLFields=W,s.getModelField=A,s.granted=Q,s.login=J,s.logout=P,s.model=G,s.mutation=c,s.query=g,s.resetPassword=T,s.sendMail=z,s.setApiUrl=B,s.setAxios=V,s.toQuery=b,s.updatePassword=M,s.uploadFile=I,s.webauthnLogin=ae,s.webauthnRegister=se,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
1
+ (function(i,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("axios"),require("json-to-graphql-query")):typeof define=="function"&&define.amd?define(["exports","axios","json-to-graphql-query"],S):(i=typeof globalThis<"u"?globalThis:i||self,S(i.light={},i.axios,i.jsonToGraphqlQuery))})(this,function(i,S,F){"use strict";const B=(e,t,n="")=>f("login",{username:e,password:t,code:n}),Q=()=>f("logout"),W=(e,t)=>f("updatePassword",{old_password:e,new_password:t}),$=(e,t,n)=>f("resetPassword",{email:e,password:t,code:n}),z=e=>f("forgetPassword",{email:e});let j;const H=e=>{j=e},v=()=>(j||(j=S.create({withCredentials:!0})),j),I=async e=>(await w({granted:{__args:{rights:e}}})).granted,_={},G=(e,t)=>{_[e]={};for(const n of Object.entries(t)){const[a,r]=n;_[e][a]=()=>({name:r.name?r.name:a,raw:r,getName:()=>r.name?r.name:a,getGQLField:()=>r.gqlField!==void 0?r.gqlField:r.name||a,getRaw(){return r},getValue(s){return r.field&&typeof r.field=="function"?r.field(s):r.field&&typeof r.field=="string"?s[r.field]:s[this.getName()]},getFormattedValue(s){const c=this.getValue(s);return r.format?r.format(c):c}})}},D=(e,t)=>!_[e]||!_[e][t]?null:_[e][t](),X=(e,t)=>{const n=[];for(const a of t)if(typeof a=="string"){const r=D(e,a);r&&n.push(r.getGQLField())}else typeof a=="object"&&n.push(a);return n},Y=e=>{const t=new FormData,n={},a={},r={};let s=0,c=!1;return Object.entries(e).forEach(([d,p])=>{p instanceof File?(c=!0,a[d]="Upload!",r[d]=new F.VariableType(d),t.append(s.toString(),p),n[s]=["variables."+d],s++):r[d]=p}),c?(t.append("map",JSON.stringify(n)),{data:r,formData:t,mutation:{__variables:a}}):{data:r,formData:null,mutation:{}}},Z=e=>{const t=e;return{name:t,$fields:_[e],async update(n,a){return await f("update"+t,{id:n,data:a})},async delete(n){return await f("delete"+t,{id:n})},async add(n){return await f("add"+t,{data:n})},fields(n){let a=[];for(let r of n){const s=D(t,r);s&&a.push(s)}return a},async get(n,a){return(await w({["list"+t]:{__args:{filters:n},data:{__args:{limit:1},...R(a)}}}))["list"+t].data[0]},async list(n,a){return(await w({["list"+t]:{__args:{filters:n},data:{...R(a)}}}))["list"+t].data}}};function x(e){e="<~"+e+"~>";var t,n,a,r,s,c=String,d=255;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,a=[],r=0,s=e.length;s>r;r+=5)n=52200625*(e.charCodeAt(r)-33)+614125*(e.charCodeAt(r+1)-33)+7225*(e.charCodeAt(r+2)-33)+85*(e.charCodeAt(r+3)-33)+(e.charCodeAt(r+4)-33),a.push(d&n>>24,d&n>>16,d&n>>8,d&n);return function(p,y){for(var A=y;A>0;A--)p.pop()}(a,t.length),c.fromCharCode.apply(c,a)}const q=(e="")=>{const t=e,n=(a="application/octet-stream")=>{const r=new Uint8Array(t.length);for(let d=0;d<t.length;d++)r[d]=t.charCodeAt(d);const s=new Blob([r],{type:a});return URL.createObjectURL(s)};return{getContent:()=>t,getURL:n,download:a=>{const r=document.createElement("a");r.download=a,r.href=n(),document.body.appendChild(r),r.click(),document.body.removeChild(r)},open:a=>{window.open(n(a),"_blank")}}},k={fromBase85:e=>q(x(e)),fromBase64:e=>q(atob(e)),fromString:e=>q(e)},N=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(n=>{Object.entries(N(n)).forEach(([a,r])=>{t[a]=r})}),t):(Object.entries(e).forEach(([n,a])=>{if(n=="__args"||n=="__aliasFor"||n=="__variables"||n=="__directives"||n=="__all_on"||n=="__name"){t[n]=a;return}if(typeof a=="boolean"){t[n]=a;return}t[n]=N(a)}),t)},R=e=>N(e),w=async e=>{let t=F.jsonToGraphQLQuery(R(e));const n=await v().post(E(),{query:`{ ${t} }`});if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data};function ee(e){for(let t=0;t<e.length;t++)if(e[t]instanceof File)return!0;return!1}function te(e){for(let t in e)if(e[t]instanceof File)return!0;return!1}const f=async(e,t=null,n=[])=>{let a={[e]:{}};const r=new FormData;let s=!1;if(t){const p={},y={},A={};let h=0;Object.entries(t).forEach(([b,m])=>{if(m instanceof Array&&ee(m)){s=!0;let C=0;m.forEach(L=>{L instanceof File&&(p[b]=new F.VariableType(b),y[h]=["variables."+b+"."+C],r.append(h.toString(),L),h++)}),A[b]="[Upload!]!"}else m instanceof File?(s=!0,p[b]=new F.VariableType(b),y[h]=["variables."+b],r.append(h.toString(),m),A[b]="Upload!",h++):m instanceof Object&&te(m)?(s=!0,Object.entries(m).forEach(([C,L])=>{L instanceof File?(p[C]=new F.VariableType(C),y[h]=["variables."+C],r.append(h.toString(),L),h++):p[C]=m})):p[b]=m}),a[e].__args=p,a.__variables=A,s&&r.append("map",JSON.stringify(y))}Object.entries(R(n)).forEach(([p,y])=>{a[e][p]=y}),Object.entries(a[e]).length===0&&(a[e]=!0);let c=null;const d=F.jsonToGraphQLQuery({mutation:a});if(s?(r.append("operations",JSON.stringify({query:d})),c=await v().post(E(),r)):c=await v().post(E(),{query:d}),c.data.errors)throw new Error(c.data.errors[0].message);return c.data.data[e]};let U="/api/";const ne=e=>{U=e},E=()=>U;async function re(e){const t={__variables:{file:"Upload!"},fsUploadTempFile:{__args:{file:new F.VariableType("file")},name:!0,path:!0,size:!0,mime:!0}},n=new FormData;n.append("operations",JSON.stringify({query:F.jsonToGraphQLQuery({mutation:t})})),n.append("map",JSON.stringify({0:["variables.file"]})),n.append("0",e);const a=await v().post(E(),n);if(a.data.errors)throw new Error(a.data.errors[0].message);return a.data.data.fsUploadTempFile}const ae=(e,t,n)=>f("sendMail",{email:e,subject:t,message:n}),ie=async e=>(await w({config:{__args:{name:e}}})).config;function P(e){const t="==".slice(0,(4-e.length%4)%4),n=e.replace(/-/g,"+").replace(/_/g,"/")+t,a=atob(n),r=new ArrayBuffer(a.length),s=new Uint8Array(r);for(let c=0;c<a.length;c++)s[c]=a.charCodeAt(c);return r}function V(e){const t=new Uint8Array(e);let n="";for(const s of t)n+=String.fromCharCode(s);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var o="copy",g="convert";function O(e,t,n){if(t===o)return n;if(t===g)return e(n);if(t instanceof Array)return n.map(a=>O(e,t[0],a));if(t instanceof Object){const a={};for(const[r,s]of Object.entries(t)){if(s.derive){const c=s.derive(n);c!==void 0&&(n[r]=c)}if(!(r in n)){if(s.required)throw new Error(`Missing key: ${r}`);continue}if(n[r]==null){a[r]=null;continue}a[r]=O(e,s.schema,n[r])}return a}}function J(e,t){return{required:!0,schema:e,derive:t}}function l(e){return{required:!0,schema:e}}function u(e){return{required:!1,schema:e}}var M={type:l(o),id:l(g),transports:u(o)},T={appid:u(o),appidExclude:u(o),credProps:u(o)},K={appid:u(o),appidExclude:u(o),credProps:u(o)},se={publicKey:l({rp:l(o),user:l({id:l(g),name:l(o),displayName:l(o)}),challenge:l(g),pubKeyCredParams:l(o),timeout:u(o),excludeCredentials:u([M]),authenticatorSelection:u(o),attestation:u(o),extensions:u(T)}),signal:u(o)},oe={type:l(o),id:l(o),rawId:l(g),authenticatorAttachment:u(o),response:l({clientDataJSON:l(g),attestationObject:l(g),transports:J(o,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:J(K,e=>e.getClientExtensionResults())},le={mediation:u(o),publicKey:l({challenge:l(g),timeout:u(o),rpId:u(o),allowCredentials:u([M]),userVerification:u(o),extensions:u(T)}),signal:u(o)},ce={type:l(o),id:l(o),rawId:l(g),authenticatorAttachment:u(o),response:l({clientDataJSON:l(g),authenticatorData:l(g),signature:l(g),userHandle:l(g)}),clientExtensionResults:J(K,e=>e.getClientExtensionResults())};function ue(e){return O(P,se,e)}function fe(e){return O(V,oe,e)}function de(e){return O(P,le,e)}function pe(e){return O(V,ce,e)}async function ge(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>fe(t),t}async function we(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>pe(t),t}async function me(e){const n=(await w({webAuthnRequestOptions:{__args:{username:e}}})).webAuthnRequestOptions,a=de({publicKey:n}),r=await we(a);await f("webAuthnAssertion",{username:e,assertion:r.toJSON()})}async function he(){const e=await w({webAuthnCreationOptions:!0}),t=ue({publicKey:e.webAuthnCreationOptions}),n=await ge(t);await f("webAuthnRegister",{registration:n.toJSON()})}const be=async e=>(await w({fsListFiles:{__args:{path:e},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,Fe=async e=>(await w({fsListFolders:{__args:{path:e},name:!0,path:!0}})).fsListFolders,ye=async e=>{let t=await w({fsFile:{__args:{path:e},base64Content:!0}});return window.atob(t.fsFile.base64Content)},_e=(e,t)=>f("fsWriteFile",{path:e,content:t}),Oe=e=>f("fsDeleteFile",{path:e}),Ae=e=>f("fsCreateFolder",{path:e}),Ce=e=>f("fsDeleteFolder",{path:e}),Se=(e,t)=>f("fsRenameFile",{path:e,name:t}),ve=(e,t)=>f("fsRenameFolder",{path:e,name:t}),Re=(e,t)=>f("fsMoveFile",{source:e,target:t});i.File=k,i.convertData=Y,i.defineModel=G,i.file=q,i.forgetPassword=z,i.fsCreateFolder=Ae,i.fsDeleteFile=Oe,i.fsDeleteFolder=Ce,i.fsListFiles=be,i.fsListFolders=Fe,i.fsMoveFile=Re,i.fsReadFile=ye,i.fsRenameFile=Se,i.fsRenameFolder=ve,i.fsWriteFile=_e,i.getApiUrl=E,i.getAxios=v,i.getConfig=ie,i.getGQLFields=X,i.getModelField=D,i.granted=I,i.login=B,i.logout=Q,i.model=Z,i.mutation=f,i.query=w,i.resetPassword=$,i.sendMail=ae,i.setApiUrl=ne,i.setAxios=H,i.toQuery=R,i.updatePassword=W,i.uploadFile=re,i.webauthnLogin=me,i.webauthnRegister=he,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
package/dist/model.d.ts CHANGED
@@ -39,6 +39,7 @@ export declare const convertData: (data: Object) => {
39
39
  };
40
40
  export declare const model: (name: string) => {
41
41
  name: string;
42
+ $fields: any;
42
43
  update(id: number, data: Object): Promise<any>;
43
44
  delete(id: number): Promise<any>;
44
45
  add(data: Object): Promise<any>;
@@ -1,6 +1,5 @@
1
1
  import { Fields } from '.';
2
- import { Nullable } from 'vitest';
3
- declare const _default: (operation: string, args?: any, fields?: Fields, mutation?: {
2
+ declare const _default: (operation: string, args?: {
4
3
  [key: string]: any;
5
- }, formData?: Nullable<FormData>) => Promise<any>;
4
+ } | null, fields?: Fields) => Promise<any>;
6
5
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/light",
3
- "version": "1.0.2",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"