@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 +26 -0
- package/dist/fs.d.ts +3 -3
- package/dist/index.d.ts +9 -9
- package/dist/light.js +316 -247
- package/dist/light.umd.cjs +1 -1
- package/dist/model.d.ts +1 -0
- package/dist/mutation.d.ts +2 -3
- package/package.json +1 -1
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
|
|
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
|
|
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<
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
2
|
-
import { VariableType as A, jsonToGraphQLQuery as
|
|
3
|
-
const
|
|
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
|
-
}),
|
|
7
|
+
}), ne = () => f("logout"), se = (e, t) => f("updatePassword", {
|
|
8
8
|
old_password: e,
|
|
9
9
|
new_password: t
|
|
10
|
-
}),
|
|
10
|
+
}), ae = (e, t, r) => f("resetPassword", {
|
|
11
11
|
email: e,
|
|
12
12
|
password: t,
|
|
13
13
|
code: r
|
|
14
|
-
}),
|
|
14
|
+
}), ie = (e) => f("forgetPassword", {
|
|
15
15
|
email: e
|
|
16
16
|
});
|
|
17
|
-
let
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
},
|
|
17
|
+
let S;
|
|
18
|
+
const oe = (e) => {
|
|
19
|
+
S = e;
|
|
20
|
+
}, v = () => (S || (S = K.create({
|
|
21
21
|
withCredentials: !0
|
|
22
|
-
})),
|
|
22
|
+
})), S), le = async (e) => (await h({
|
|
23
23
|
granted: {
|
|
24
24
|
__args: {
|
|
25
25
|
rights: e
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
})).granted,
|
|
29
|
-
|
|
28
|
+
})).granted, y = {}, ce = (e, t) => {
|
|
29
|
+
y[e] = {};
|
|
30
30
|
for (const r of Object.entries(t)) {
|
|
31
|
-
const [
|
|
32
|
-
|
|
33
|
-
name:
|
|
34
|
-
raw:
|
|
35
|
-
getName: () =>
|
|
36
|
-
getGQLField: () =>
|
|
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
|
|
38
|
+
return n;
|
|
39
39
|
},
|
|
40
|
-
getValue(
|
|
41
|
-
return
|
|
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(
|
|
44
|
-
const
|
|
45
|
-
return
|
|
43
|
+
getFormattedValue(a) {
|
|
44
|
+
const l = this.getValue(a);
|
|
45
|
+
return n.format ? n.format(l) : l;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
},
|
|
49
|
+
}, J = (e, t) => !y[e] || !y[e][t] ? null : y[e][t](), ue = (e, t) => {
|
|
50
50
|
const r = [];
|
|
51
|
-
for (const
|
|
52
|
-
if (typeof
|
|
53
|
-
const
|
|
54
|
-
|
|
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
|
|
56
|
+
typeof s == "object" && r.push(s);
|
|
57
57
|
return r;
|
|
58
|
-
},
|
|
59
|
-
const t = new FormData(), r = {},
|
|
60
|
-
let
|
|
61
|
-
return Object.entries(e).forEach(([
|
|
62
|
-
|
|
63
|
-
}),
|
|
64
|
-
data:
|
|
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:
|
|
67
|
+
__variables: s
|
|
68
68
|
}
|
|
69
69
|
}) : {
|
|
70
|
-
data:
|
|
70
|
+
data: n,
|
|
71
71
|
formData: null,
|
|
72
72
|
mutation: {}
|
|
73
73
|
};
|
|
74
|
-
},
|
|
74
|
+
}, de = (e) => {
|
|
75
75
|
const t = e;
|
|
76
76
|
return {
|
|
77
77
|
name: t,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return await
|
|
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
|
|
83
|
+
return await f("delete" + t, { id: r });
|
|
84
84
|
},
|
|
85
85
|
async add(r) {
|
|
86
|
-
|
|
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
|
|
91
|
-
for (let
|
|
92
|
-
const
|
|
93
|
-
|
|
89
|
+
let s = [];
|
|
90
|
+
for (let n of r) {
|
|
91
|
+
const a = J(t, n);
|
|
92
|
+
a && s.push(a);
|
|
94
93
|
}
|
|
95
|
-
return
|
|
94
|
+
return s;
|
|
96
95
|
},
|
|
97
|
-
async get(r,
|
|
98
|
-
return (await
|
|
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
|
-
...
|
|
106
|
+
...R(s)
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
109
|
}))["list" + t].data[0];
|
|
111
110
|
},
|
|
112
|
-
async list(r,
|
|
113
|
-
return (await
|
|
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
|
-
...
|
|
118
|
+
...R(s)
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
}))["list" + t].data;
|
|
123
122
|
}
|
|
124
123
|
};
|
|
125
|
-
}
|
|
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(
|
|
129
|
-
t[
|
|
161
|
+
Object.entries(q(r)).forEach(([s, n]) => {
|
|
162
|
+
t[s] = n;
|
|
130
163
|
});
|
|
131
|
-
}), t) : (Object.entries(e).forEach(([r,
|
|
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] =
|
|
166
|
+
t[r] = s;
|
|
134
167
|
return;
|
|
135
168
|
}
|
|
136
|
-
if (typeof
|
|
137
|
-
t[r] =
|
|
169
|
+
if (typeof s == "boolean") {
|
|
170
|
+
t[r] = s;
|
|
138
171
|
return;
|
|
139
172
|
}
|
|
140
|
-
t[r] =
|
|
173
|
+
t[r] = q(s);
|
|
141
174
|
}), t);
|
|
142
|
-
},
|
|
143
|
-
let t =
|
|
144
|
-
const r = await
|
|
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
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
})),
|
|
225
|
+
})), l = await v().post(E(), n)) : l = await v().post(E(), {
|
|
159
226
|
query: u
|
|
160
|
-
}),
|
|
161
|
-
throw new Error(
|
|
162
|
-
return
|
|
227
|
+
}), l.data.errors)
|
|
228
|
+
throw new Error(l.data.errors[0].message);
|
|
229
|
+
return l.data.data[e];
|
|
163
230
|
};
|
|
164
|
-
let
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
},
|
|
168
|
-
async function
|
|
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:
|
|
251
|
+
query: x({ mutation: t })
|
|
185
252
|
})), r.append("map", JSON.stringify({ 0: ["variables.file"] })), r.append("0", e);
|
|
186
|
-
const
|
|
187
|
-
if (
|
|
188
|
-
throw new Error(
|
|
189
|
-
return
|
|
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
|
|
258
|
+
const me = (e, t, r) => f("sendMail", {
|
|
192
259
|
email: e,
|
|
193
260
|
subject: t,
|
|
194
261
|
message: r
|
|
195
|
-
}),
|
|
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
|
|
203
|
-
const t = "==".slice(0, (4 - e.length % 4) % 4), r = e.replace(/-/g, "+").replace(/_/g, "/") + t,
|
|
204
|
-
for (let
|
|
205
|
-
|
|
206
|
-
return
|
|
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
|
|
275
|
+
function U(e) {
|
|
209
276
|
const t = new Uint8Array(e);
|
|
210
277
|
let r = "";
|
|
211
|
-
for (const
|
|
212
|
-
r += String.fromCharCode(
|
|
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
|
|
219
|
-
function
|
|
220
|
-
if (t ===
|
|
285
|
+
var i = "copy", p = "convert";
|
|
286
|
+
function O(e, t, r) {
|
|
287
|
+
if (t === i)
|
|
221
288
|
return r;
|
|
222
|
-
if (t ===
|
|
289
|
+
if (t === p)
|
|
223
290
|
return e(r);
|
|
224
291
|
if (t instanceof Array)
|
|
225
|
-
return r.map((
|
|
292
|
+
return r.map((s) => O(e, t[0], s));
|
|
226
293
|
if (t instanceof Object) {
|
|
227
|
-
const
|
|
228
|
-
for (const [
|
|
229
|
-
if (
|
|
230
|
-
const
|
|
231
|
-
|
|
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 (!(
|
|
234
|
-
if (
|
|
235
|
-
throw new Error(`Missing key: ${
|
|
300
|
+
if (!(n in r)) {
|
|
301
|
+
if (a.required)
|
|
302
|
+
throw new Error(`Missing key: ${n}`);
|
|
236
303
|
continue;
|
|
237
304
|
}
|
|
238
|
-
if (r[
|
|
239
|
-
n
|
|
305
|
+
if (r[n] == null) {
|
|
306
|
+
s[n] = null;
|
|
240
307
|
continue;
|
|
241
308
|
}
|
|
242
|
-
n
|
|
309
|
+
s[n] = O(
|
|
243
310
|
e,
|
|
244
|
-
|
|
245
|
-
r[
|
|
311
|
+
a.schema,
|
|
312
|
+
r[n]
|
|
246
313
|
);
|
|
247
314
|
}
|
|
248
|
-
return
|
|
315
|
+
return s;
|
|
249
316
|
}
|
|
250
317
|
}
|
|
251
|
-
function
|
|
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
|
|
331
|
+
function c(e) {
|
|
265
332
|
return {
|
|
266
333
|
required: !1,
|
|
267
334
|
schema: e
|
|
268
335
|
};
|
|
269
336
|
}
|
|
270
|
-
var
|
|
271
|
-
type: o(
|
|
272
|
-
id: o(
|
|
273
|
-
transports:
|
|
274
|
-
},
|
|
275
|
-
appid:
|
|
276
|
-
appidExclude:
|
|
277
|
-
credProps:
|
|
278
|
-
},
|
|
279
|
-
appid:
|
|
280
|
-
appidExclude:
|
|
281
|
-
credProps:
|
|
282
|
-
},
|
|
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(
|
|
351
|
+
rp: o(i),
|
|
285
352
|
user: o({
|
|
286
|
-
id: o(
|
|
287
|
-
name: o(
|
|
288
|
-
displayName: o(
|
|
353
|
+
id: o(p),
|
|
354
|
+
name: o(i),
|
|
355
|
+
displayName: o(i)
|
|
289
356
|
}),
|
|
290
|
-
challenge: o(
|
|
291
|
-
pubKeyCredParams: o(
|
|
292
|
-
timeout:
|
|
293
|
-
excludeCredentials:
|
|
294
|
-
authenticatorSelection:
|
|
295
|
-
attestation:
|
|
296
|
-
extensions:
|
|
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:
|
|
299
|
-
},
|
|
300
|
-
type: o(
|
|
301
|
-
id: o(
|
|
302
|
-
rawId: o(
|
|
303
|
-
authenticatorAttachment:
|
|
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(
|
|
306
|
-
attestationObject: o(
|
|
307
|
-
transports:
|
|
308
|
-
|
|
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:
|
|
316
|
-
|
|
382
|
+
clientExtensionResults: N(
|
|
383
|
+
V,
|
|
317
384
|
(e) => e.getClientExtensionResults()
|
|
318
385
|
)
|
|
319
|
-
},
|
|
320
|
-
mediation:
|
|
386
|
+
}, $ = {
|
|
387
|
+
mediation: c(i),
|
|
321
388
|
publicKey: o({
|
|
322
|
-
challenge: o(
|
|
323
|
-
timeout:
|
|
324
|
-
rpId:
|
|
325
|
-
allowCredentials:
|
|
326
|
-
userVerification:
|
|
327
|
-
extensions:
|
|
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:
|
|
330
|
-
},
|
|
331
|
-
type: o(
|
|
332
|
-
id: o(
|
|
333
|
-
rawId: o(
|
|
334
|
-
authenticatorAttachment:
|
|
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(
|
|
337
|
-
authenticatorData: o(
|
|
338
|
-
signature: o(
|
|
339
|
-
userHandle: o(
|
|
403
|
+
clientDataJSON: o(p),
|
|
404
|
+
authenticatorData: o(p),
|
|
405
|
+
signature: o(p),
|
|
406
|
+
userHandle: o(p)
|
|
340
407
|
}),
|
|
341
|
-
clientExtensionResults:
|
|
342
|
-
|
|
408
|
+
clientExtensionResults: N(
|
|
409
|
+
V,
|
|
343
410
|
(e) => e.getClientExtensionResults()
|
|
344
411
|
)
|
|
345
412
|
};
|
|
346
|
-
function
|
|
347
|
-
return
|
|
413
|
+
function H(e) {
|
|
414
|
+
return O(L, G, e);
|
|
348
415
|
}
|
|
349
|
-
function
|
|
350
|
-
return
|
|
351
|
-
|
|
352
|
-
|
|
416
|
+
function I(e) {
|
|
417
|
+
return O(
|
|
418
|
+
U,
|
|
419
|
+
W,
|
|
353
420
|
e
|
|
354
421
|
);
|
|
355
422
|
}
|
|
356
|
-
function
|
|
357
|
-
return
|
|
423
|
+
function X(e) {
|
|
424
|
+
return O(L, $, e);
|
|
358
425
|
}
|
|
359
|
-
function
|
|
360
|
-
return
|
|
361
|
-
|
|
362
|
-
|
|
426
|
+
function Y(e) {
|
|
427
|
+
return O(
|
|
428
|
+
U,
|
|
429
|
+
z,
|
|
363
430
|
e
|
|
364
431
|
);
|
|
365
432
|
}
|
|
366
|
-
async function
|
|
433
|
+
async function Z(e) {
|
|
367
434
|
const t = await navigator.credentials.create(
|
|
368
435
|
e
|
|
369
436
|
);
|
|
370
|
-
return t.toJSON = () =>
|
|
437
|
+
return t.toJSON = () => I(t), t;
|
|
371
438
|
}
|
|
372
|
-
async function
|
|
439
|
+
async function k(e) {
|
|
373
440
|
const t = await navigator.credentials.get(
|
|
374
441
|
e
|
|
375
442
|
);
|
|
376
|
-
return t.toJSON = () =>
|
|
443
|
+
return t.toJSON = () => Y(t), t;
|
|
377
444
|
}
|
|
378
|
-
async function
|
|
379
|
-
const r = (await
|
|
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,
|
|
452
|
+
})).webAuthnRequestOptions, s = X({
|
|
386
453
|
publicKey: r
|
|
387
|
-
}),
|
|
388
|
-
await
|
|
454
|
+
}), n = await k(s);
|
|
455
|
+
await f("webAuthnAssertion", {
|
|
389
456
|
username: e,
|
|
390
|
-
assertion:
|
|
457
|
+
assertion: n.toJSON()
|
|
391
458
|
});
|
|
392
459
|
}
|
|
393
|
-
async function
|
|
394
|
-
const e = await
|
|
460
|
+
async function _e() {
|
|
461
|
+
const e = await h({ webAuthnCreationOptions: !0 }), t = H({
|
|
395
462
|
publicKey: e.webAuthnCreationOptions
|
|
396
|
-
}), r = await
|
|
397
|
-
await
|
|
463
|
+
}), r = await Z(t);
|
|
464
|
+
await f("webAuthnRegister", {
|
|
398
465
|
registration: r.toJSON()
|
|
399
466
|
});
|
|
400
467
|
}
|
|
401
|
-
const
|
|
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,
|
|
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,
|
|
422
|
-
let t = await
|
|
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
|
-
},
|
|
498
|
+
}, Ce = (e, t) => f("fsWriteFile", {
|
|
432
499
|
path: e,
|
|
433
500
|
content: t
|
|
434
|
-
}),
|
|
501
|
+
}), Ae = (e) => f("fsDeleteFile", {
|
|
435
502
|
path: e
|
|
436
|
-
}),
|
|
503
|
+
}), Se = (e) => f("fsCreateFolder", {
|
|
437
504
|
path: e
|
|
438
|
-
}),
|
|
505
|
+
}), ve = (e) => f("fsDeleteFolder", {
|
|
439
506
|
path: e
|
|
440
|
-
}),
|
|
507
|
+
}), Re = (e, t) => f("fsRenameFile", {
|
|
441
508
|
path: e,
|
|
442
509
|
name: t
|
|
443
|
-
}),
|
|
510
|
+
}), Ee = (e, t) => f("fsRenameFolder", {
|
|
444
511
|
path: e,
|
|
445
512
|
name: t
|
|
446
|
-
}),
|
|
513
|
+
}), je = (e, t) => f("fsMoveFile", {
|
|
447
514
|
source: e,
|
|
448
515
|
target: t
|
|
449
516
|
});
|
|
450
517
|
export {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
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
|
};
|
package/dist/light.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
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>;
|
package/dist/mutation.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Fields } from '.';
|
|
2
|
-
|
|
3
|
-
declare const _default: (operation: string, args?: any, fields?: Fields, mutation?: {
|
|
2
|
+
declare const _default: (operation: string, args?: {
|
|
4
3
|
[key: string]: any;
|
|
5
|
-
},
|
|
4
|
+
} | null, fields?: Fields) => Promise<any>;
|
|
6
5
|
export default _default;
|