@hostlink/light 0.0.23 → 0.0.24

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,26 +1,25 @@
1
- import x from "axios";
2
- import { jsonToGraphQLQuery as b, VariableType as E } from "json-to-graphql-query";
3
- import { Buffer as y } from "buffer";
4
- const W = (e, t, r = "") => u("login", {
1
+ import R from "axios";
2
+ import { jsonToGraphQLQuery as b, VariableType as x } from "json-to-graphql-query";
3
+ const M = (e, t, r = "") => c("login", {
5
4
  username: e,
6
5
  password: t,
7
6
  code: r
8
- }), I = () => u("logout"), Q = (e, t) => u("updatePassword", {
7
+ }), W = () => c("logout"), B = (e, t) => c("updatePassword", {
9
8
  old_password: e,
10
9
  new_password: t
11
- }), z = (e, t, r) => u("resetPassword", {
10
+ }), I = (e, t, r) => c("resetPassword", {
12
11
  email: e,
13
12
  password: t,
14
13
  code: r
15
- }), $ = (e) => u("forgetPassword", {
14
+ }), Q = (e) => c("forgetPassword", {
16
15
  email: e
17
16
  });
18
17
  let g;
19
- const G = (e) => {
18
+ const z = (e) => {
20
19
  g = e;
21
- }, h = () => (g || (g = x.create({
20
+ }, h = () => (g || (g = R.create({
22
21
  withCredentials: !0
23
- })), g), H = async (e) => (await d({
22
+ })), g), $ = async (e) => (await d({
24
23
  granted: {
25
24
  __args: {
26
25
  rights: e
@@ -43,19 +42,19 @@ const G = (e) => {
43
42
  }
44
43
  t[r] = w(n);
45
44
  }), t);
46
- }, F = (e) => w(e), d = async (e) => {
47
- let t = b(F(e));
45
+ }, y = (e) => w(e), d = async (e) => {
46
+ let t = b(y(e));
48
47
  const r = await h().post(_(), {
49
48
  query: `{ ${t} }`
50
49
  });
51
50
  if (r.data.errors)
52
51
  throw new Error(r.data.errors[0].message);
53
52
  return r.data.data;
54
- }, u = async (e, t = null, r = []) => {
53
+ }, c = async (e, t = null, r = []) => {
55
54
  const n = {
56
55
  mutation: {}
57
56
  };
58
- n.mutation[e] = !0, r instanceof Array && r.length != 0 && (n.mutation[e] = {}), t && (n.mutation[e] = {}, n.mutation[e].__args = t), Object.entries(F(r)).forEach(([l, f]) => {
57
+ n.mutation[e] = !0, r instanceof Array && r.length != 0 && (n.mutation[e] = {}), t && (n.mutation[e] = {}, n.mutation[e].__args = t), Object.entries(y(r)).forEach(([l, f]) => {
59
58
  n.mutation[e][l] = f;
60
59
  });
61
60
  const i = await h().post(_(), {
@@ -65,18 +64,18 @@ const G = (e) => {
65
64
  throw new Error(i.data.errors[0].message);
66
65
  return i.data.data[e];
67
66
  };
68
- let O = "/api/";
69
- const X = (e) => {
70
- O = e;
71
- }, _ = () => O;
72
- async function Y(e) {
67
+ let F = "/api/";
68
+ const G = (e) => {
69
+ F = e;
70
+ }, _ = () => F;
71
+ async function H(e) {
73
72
  const t = {
74
73
  __variables: {
75
74
  file: "Upload!"
76
75
  },
77
76
  fsUploadTempFile: {
78
77
  __args: {
79
- file: new E("file")
78
+ file: new x("file")
80
79
  },
81
80
  name: !0,
82
81
  path: !0,
@@ -92,24 +91,24 @@ async function Y(e) {
92
91
  throw new Error(n.data.errors[0].message);
93
92
  return n.data.data.fsUploadTempFile;
94
93
  }
95
- const Z = (e, t, r) => u("sendMail", {
94
+ const X = (e, t, r) => c("sendMail", {
96
95
  email: e,
97
96
  subject: t,
98
97
  message: r
99
- }), k = async (e) => (await d({
98
+ }), Y = async (e) => (await d({
100
99
  config: {
101
100
  __args: {
102
101
  name: e
103
102
  }
104
103
  }
105
104
  })).config;
106
- function v(e) {
105
+ function O(e) {
107
106
  const t = "==".slice(0, (4 - e.length % 4) % 4), r = e.replace(/-/g, "+").replace(/_/g, "/") + t, n = atob(r), i = new ArrayBuffer(n.length), l = new Uint8Array(i);
108
107
  for (let f = 0; f < n.length; f++)
109
108
  l[f] = n.charCodeAt(f);
110
109
  return i;
111
110
  }
112
- function A(e) {
111
+ function v(e) {
113
112
  const t = new Uint8Array(e);
114
113
  let r = "";
115
114
  for (const l of t)
@@ -119,11 +118,11 @@ function A(e) {
119
118
  "_"
120
119
  ).replace(/=/g, "");
121
120
  }
122
- var s = "copy", c = "convert";
121
+ var s = "copy", u = "convert";
123
122
  function p(e, t, r) {
124
123
  if (t === s)
125
124
  return r;
126
- if (t === c)
125
+ if (t === u)
127
126
  return e(r);
128
127
  if (t instanceof Array)
129
128
  return r.map((n) => p(e, t[0], n));
@@ -171,43 +170,43 @@ function o(e) {
171
170
  schema: e
172
171
  };
173
172
  }
174
- var S = {
173
+ var A = {
175
174
  type: a(s),
176
- id: a(c),
175
+ id: a(u),
177
176
  transports: o(s)
178
177
  }, C = {
179
178
  appid: o(s),
180
179
  appidExclude: o(s),
181
180
  credProps: o(s)
182
- }, R = {
181
+ }, S = {
183
182
  appid: o(s),
184
183
  appidExclude: o(s),
185
184
  credProps: o(s)
186
- }, q = {
185
+ }, E = {
187
186
  publicKey: a({
188
187
  rp: a(s),
189
188
  user: a({
190
- id: a(c),
189
+ id: a(u),
191
190
  name: a(s),
192
191
  displayName: a(s)
193
192
  }),
194
- challenge: a(c),
193
+ challenge: a(u),
195
194
  pubKeyCredParams: a(s),
196
195
  timeout: o(s),
197
- excludeCredentials: o([S]),
196
+ excludeCredentials: o([A]),
198
197
  authenticatorSelection: o(s),
199
198
  attestation: o(s),
200
199
  extensions: o(C)
201
200
  }),
202
201
  signal: o(s)
203
- }, J = {
202
+ }, q = {
204
203
  type: a(s),
205
204
  id: a(s),
206
- rawId: a(c),
205
+ rawId: a(u),
207
206
  authenticatorAttachment: o(s),
208
207
  response: a({
209
- clientDataJSON: a(c),
210
- attestationObject: a(c),
208
+ clientDataJSON: a(u),
209
+ attestationObject: a(u),
211
210
  transports: m(
212
211
  s,
213
212
  (e) => {
@@ -217,92 +216,92 @@ var S = {
217
216
  )
218
217
  }),
219
218
  clientExtensionResults: m(
220
- R,
219
+ S,
221
220
  (e) => e.getClientExtensionResults()
222
221
  )
223
- }, N = {
222
+ }, J = {
224
223
  mediation: o(s),
225
224
  publicKey: a({
226
- challenge: a(c),
225
+ challenge: a(u),
227
226
  timeout: o(s),
228
227
  rpId: o(s),
229
- allowCredentials: o([S]),
228
+ allowCredentials: o([A]),
230
229
  userVerification: o(s),
231
230
  extensions: o(C)
232
231
  }),
233
232
  signal: o(s)
234
- }, P = {
233
+ }, N = {
235
234
  type: a(s),
236
235
  id: a(s),
237
- rawId: a(c),
236
+ rawId: a(u),
238
237
  authenticatorAttachment: o(s),
239
238
  response: a({
240
- clientDataJSON: a(c),
241
- authenticatorData: a(c),
242
- signature: a(c),
243
- userHandle: a(c)
239
+ clientDataJSON: a(u),
240
+ authenticatorData: a(u),
241
+ signature: a(u),
242
+ userHandle: a(u)
244
243
  }),
245
244
  clientExtensionResults: m(
246
- R,
245
+ S,
247
246
  (e) => e.getClientExtensionResults()
248
247
  )
249
248
  };
250
- function j(e) {
251
- return p(v, q, e);
249
+ function P(e) {
250
+ return p(O, E, e);
252
251
  }
253
- function D(e) {
252
+ function j(e) {
254
253
  return p(
255
- A,
256
- J,
254
+ v,
255
+ q,
257
256
  e
258
257
  );
259
258
  }
260
- function T(e) {
261
- return p(v, N, e);
259
+ function D(e) {
260
+ return p(O, J, e);
262
261
  }
263
- function K(e) {
262
+ function T(e) {
264
263
  return p(
265
- A,
266
- P,
264
+ v,
265
+ N,
267
266
  e
268
267
  );
269
268
  }
270
- async function L(e) {
269
+ async function K(e) {
271
270
  const t = await navigator.credentials.create(
272
271
  e
273
272
  );
274
- return t.toJSON = () => D(t), t;
273
+ return t.toJSON = () => j(t), t;
275
274
  }
276
- async function U(e) {
275
+ async function L(e) {
277
276
  const t = await navigator.credentials.get(
278
277
  e
279
278
  );
280
- return t.toJSON = () => K(t), t;
279
+ return t.toJSON = () => T(t), t;
281
280
  }
282
- async function ee(e) {
281
+ async function Z(e) {
283
282
  const r = (await d({
284
283
  webAuthnRequestOptions: {
285
284
  __args: {
286
285
  username: e
287
286
  }
288
287
  }
289
- })).webAuthnRequestOptions, n = T({
288
+ })).webAuthnRequestOptions, n = D({
290
289
  publicKey: r
291
- }), i = await U(n);
292
- await u("webAuthnAssertion", {
290
+ }), i = await L(n);
291
+ await c("webAuthnAssertion", {
293
292
  username: e,
294
293
  assertion: i.toJSON()
295
294
  });
296
295
  }
297
- async function te() {
298
- const e = await d({ webAuthnCreationOptions: !0 }), t = j({
296
+ async function k() {
297
+ const e = await d({ webAuthnCreationOptions: !0 }), t = P({
299
298
  publicKey: e.webAuthnCreationOptions
300
- }), r = await L(t);
301
- await u("webAuthnRegister", {
299
+ }), r = await K(t);
300
+ await c("webAuthnRegister", {
302
301
  registration: r.toJSON()
303
302
  });
304
303
  }
305
- const re = async (e) => (await d({
304
+ const ee = async (e) => (await d({
306
305
  fsListFiles: {
307
306
  __args: {
308
307
  path: e
@@ -314,7 +313,7 @@ const re = async (e) => (await d({
314
313
  canPreview: !0,
315
314
  imagePath: !0
316
315
  }
317
- })).fsListFiles, ne = async (e) => (await d({
316
+ })).fsListFiles, te = async (e) => (await d({
318
317
  fsListFolders: {
319
318
  __args: {
320
319
  path: e
@@ -322,7 +321,7 @@ const re = async (e) => (await d({
322
321
  name: !0,
323
322
  path: !0
324
323
  }
325
- })).fsListFolders, se = async (e) => {
324
+ })).fsListFolders, re = async (e) => {
326
325
  let t = await d({
327
326
  fsFile: {
328
327
  __args: {
@@ -331,53 +330,53 @@ const re = async (e) => (await d({
331
330
  base64Content: !0
332
331
  }
333
332
  });
334
- return y.from(t.fsFile.base64Content, "base64").toString("utf-8");
335
- }, ae = (e, t) => (t = y.from(t).toString("base64"), u("fsWriteFileBase64", {
333
+ return window.atob(t.fsFile.base64Content);
334
+ }, ne = (e, t) => c("fsWriteFile", {
336
335
  path: e,
337
336
  content: t
338
- })), oe = (e) => u("fsDeleteFile", {
337
+ }), se = (e) => c("fsDeleteFile", {
339
338
  path: e
340
- }), ie = (e) => u("fsCreateFolder", {
339
+ }), ae = (e) => c("fsCreateFolder", {
341
340
  path: e
342
- }), ue = (e) => u("fsDeleteFolder", {
341
+ }), oe = (e) => c("fsDeleteFolder", {
343
342
  path: e
344
- }), ce = (e, t) => u("fsRenameFile", {
343
+ }), ie = (e, t) => c("fsRenameFile", {
345
344
  path: e,
346
345
  name: t
347
- }), le = (e, t) => u("fsRenameFolder", {
346
+ }), ce = (e, t) => c("fsRenameFolder", {
348
347
  path: e,
349
348
  name: t
350
- }), fe = (e, t) => u("fsMoveFile", {
349
+ }), ue = (e, t) => c("fsMoveFile", {
351
350
  source: e,
352
351
  target: t
353
352
  });
354
353
  export {
355
- $ as forgetPassword,
356
- ie as fsCreateFolder,
357
- oe as fsDeleteFile,
358
- ue as fsDeleteFolder,
359
- re as fsListFiles,
360
- ne as fsListFolders,
361
- fe as fsMoveFile,
362
- se as fsReadFile,
363
- ce as fsRenameFile,
364
- le as fsRenameFolder,
365
- ae as fsWriteFile,
354
+ Q as forgetPassword,
355
+ ae as fsCreateFolder,
356
+ se as fsDeleteFile,
357
+ oe as fsDeleteFolder,
358
+ ee as fsListFiles,
359
+ te as fsListFolders,
360
+ ue as fsMoveFile,
361
+ re as fsReadFile,
362
+ ie as fsRenameFile,
363
+ ce as fsRenameFolder,
364
+ ne as fsWriteFile,
366
365
  _ as getApiUrl,
367
366
  h as getAxios,
368
- k as getConfig,
369
- H as granted,
370
- W as login,
371
- I as logout,
372
- u as mutation,
367
+ Y as getConfig,
368
+ $ as granted,
369
+ M as login,
370
+ W as logout,
371
+ c as mutation,
373
372
  d as query,
374
- z as resetPassword,
375
- Z as sendMail,
376
- X as setApiUrl,
377
- G as setAxios,
378
- F as toQuery,
379
- Q as updatePassword,
380
- Y as uploadFile,
381
- ee as webauthnLogin,
382
- te as webauthnRegister
373
+ I as resetPassword,
374
+ X as sendMail,
375
+ G as setApiUrl,
376
+ z as setAxios,
377
+ y as toQuery,
378
+ B as updatePassword,
379
+ H as uploadFile,
380
+ Z as webauthnLogin,
381
+ k as webauthnRegister
383
382
  };
@@ -1 +1 @@
1
- (function(n,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("axios"),require("json-to-graphql-query"),require("buffer")):typeof define=="function"&&define.amd?define(["exports","axios","json-to-graphql-query","buffer"],w):(n=typeof globalThis<"u"?globalThis:n||self,w(n.light={},n.axios,n.jsonToGraphqlQuery,n.buffer))})(this,function(n,w,m,O){"use strict";const P=(e,t,r="")=>l("login",{username:e,password:t,code:r}),j=()=>l("logout"),J=(e,t)=>l("updatePassword",{old_password:e,new_password:t}),L=(e,t,r)=>l("resetPassword",{email:e,password:t,code:r}),N=e=>l("forgetPassword",{email:e});let h;const D=e=>{h=e},b=()=>(h||(h=w.create({withCredentials:!0})),h),T=async e=>(await g({granted:{__args:{rights:e}}})).granted,F=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(r=>{Object.entries(F(r)).forEach(([s,u])=>{t[s]=u})}),t):(Object.entries(e).forEach(([r,s])=>{if(r=="__args"||r=="__aliasFor"||r=="__variables"||r=="__directives"||r=="__all_on"||r=="__name"){t[r]=s;return}if(typeof s=="boolean"){t[r]=s;return}t[r]=F(s)}),t)},_=e=>F(e),g=async e=>{let t=m.jsonToGraphQLQuery(_(e));const r=await b().post(y(),{query:`{ ${t} }`});if(r.data.errors)throw new Error(r.data.errors[0].message);return r.data.data},l=async(e,t=null,r=[])=>{const s={mutation:{}};s.mutation[e]=!0,r instanceof Array&&r.length!=0&&(s.mutation[e]={}),t&&(s.mutation[e]={},s.mutation[e].__args=t),Object.entries(_(r)).forEach(([f,d])=>{s.mutation[e][f]=d});const u=await b().post(y(),{query:m.jsonToGraphQLQuery(s)});if(u.data.errors)throw new Error(u.data.errors[0].message);return u.data.data[e]};let v="/api/";const U=e=>{v=e},y=()=>v;async function K(e){const t={__variables:{file:"Upload!"},fsUploadTempFile:{__args:{file:new m.VariableType("file")},name:!0,path:!0,size:!0,mime:!0}},r=new FormData;r.append("operations",JSON.stringify({query:m.jsonToGraphQLQuery({mutation:t})})),r.append("map",JSON.stringify({0:["variables.file"]})),r.append("0",e);const s=await b().post(y(),r);if(s.data.errors)throw new Error(s.data.errors[0].message);return s.data.data.fsUploadTempFile}const M=(e,t,r)=>l("sendMail",{email:e,subject:t,message:r}),B=async e=>(await g({config:{__args:{name:e}}})).config;function S(e){const t="==".slice(0,(4-e.length%4)%4),r=e.replace(/-/g,"+").replace(/_/g,"/")+t,s=atob(r),u=new ArrayBuffer(s.length),f=new Uint8Array(u);for(let d=0;d<s.length;d++)f[d]=s.charCodeAt(d);return u}function C(e){const t=new Uint8Array(e);let r="";for(const f of t)r+=String.fromCharCode(f);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var a="copy",c="convert";function p(e,t,r){if(t===a)return r;if(t===c)return e(r);if(t instanceof Array)return r.map(s=>p(e,t[0],s));if(t instanceof Object){const s={};for(const[u,f]of Object.entries(t)){if(f.derive){const d=f.derive(r);d!==void 0&&(r[u]=d)}if(!(u in r)){if(f.required)throw new Error(`Missing key: ${u}`);continue}if(r[u]==null){s[u]=null;continue}s[u]=p(e,f.schema,r[u])}return s}}function A(e,t){return{required:!0,schema:e,derive:t}}function i(e){return{required:!0,schema:e}}function o(e){return{required:!1,schema:e}}var R={type:i(a),id:i(c),transports:o(a)},q={appid:o(a),appidExclude:o(a),credProps:o(a)},E={appid:o(a),appidExclude:o(a),credProps:o(a)},Q={publicKey:i({rp:i(a),user:i({id:i(c),name:i(a),displayName:i(a)}),challenge:i(c),pubKeyCredParams:i(a),timeout:o(a),excludeCredentials:o([R]),authenticatorSelection:o(a),attestation:o(a),extensions:o(q)}),signal:o(a)},V={type:i(a),id:i(a),rawId:i(c),authenticatorAttachment:o(a),response:i({clientDataJSON:i(c),attestationObject:i(c),transports:A(a,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:A(E,e=>e.getClientExtensionResults())},W={mediation:o(a),publicKey:i({challenge:i(c),timeout:o(a),rpId:o(a),allowCredentials:o([R]),userVerification:o(a),extensions:o(q)}),signal:o(a)},I={type:i(a),id:i(a),rawId:i(c),authenticatorAttachment:o(a),response:i({clientDataJSON:i(c),authenticatorData:i(c),signature:i(c),userHandle:i(c)}),clientExtensionResults:A(E,e=>e.getClientExtensionResults())};function z(e){return p(S,Q,e)}function $(e){return p(C,V,e)}function G(e){return p(S,W,e)}function H(e){return p(C,I,e)}async function X(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>$(t),t}async function Y(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>H(t),t}async function Z(e){const r=(await g({webAuthnRequestOptions:{__args:{username:e}}})).webAuthnRequestOptions,s=G({publicKey:r}),u=await Y(s);await l("webAuthnAssertion",{username:e,assertion:u.toJSON()})}async function k(){const e=await g({webAuthnCreationOptions:!0}),t=z({publicKey:e.webAuthnCreationOptions}),r=await X(t);await l("webAuthnRegister",{registration:r.toJSON()})}const x=async e=>(await g({fsListFiles:{__args:{path:e},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,ee=async e=>(await g({fsListFolders:{__args:{path:e},name:!0,path:!0}})).fsListFolders,te=async e=>{let t=await g({fsFile:{__args:{path:e},base64Content:!0}});return O.Buffer.from(t.fsFile.base64Content,"base64").toString("utf-8")},re=(e,t)=>(t=O.Buffer.from(t).toString("base64"),l("fsWriteFileBase64",{path:e,content:t})),ne=e=>l("fsDeleteFile",{path:e}),se=e=>l("fsCreateFolder",{path:e}),ae=e=>l("fsDeleteFolder",{path:e}),ie=(e,t)=>l("fsRenameFile",{path:e,name:t}),oe=(e,t)=>l("fsRenameFolder",{path:e,name:t}),ue=(e,t)=>l("fsMoveFile",{source:e,target:t});n.forgetPassword=N,n.fsCreateFolder=se,n.fsDeleteFile=ne,n.fsDeleteFolder=ae,n.fsListFiles=x,n.fsListFolders=ee,n.fsMoveFile=ue,n.fsReadFile=te,n.fsRenameFile=ie,n.fsRenameFolder=oe,n.fsWriteFile=re,n.getApiUrl=y,n.getAxios=b,n.getConfig=B,n.granted=T,n.login=P,n.logout=j,n.mutation=l,n.query=g,n.resetPassword=L,n.sendMail=M,n.setApiUrl=U,n.setAxios=D,n.toQuery=_,n.updatePassword=J,n.uploadFile=K,n.webauthnLogin=Z,n.webauthnRegister=k,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("axios"),require("json-to-graphql-query")):typeof define=="function"&&define.amd?define(["exports","axios","json-to-graphql-query"],w):(n=typeof globalThis<"u"?globalThis:n||self,w(n.light={},n.axios,n.jsonToGraphqlQuery))})(this,function(n,w,m){"use strict";const E=(e,t,r="")=>l("login",{username:e,password:t,code:r}),P=()=>l("logout"),j=(e,t)=>l("updatePassword",{old_password:e,new_password:t}),J=(e,t,r)=>l("resetPassword",{email:e,password:t,code:r}),L=e=>l("forgetPassword",{email:e});let h;const N=e=>{h=e},b=()=>(h||(h=w.create({withCredentials:!0})),h),D=async e=>(await g({granted:{__args:{rights:e}}})).granted,F=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(r=>{Object.entries(F(r)).forEach(([s,u])=>{t[s]=u})}),t):(Object.entries(e).forEach(([r,s])=>{if(r=="__args"||r=="__aliasFor"||r=="__variables"||r=="__directives"||r=="__all_on"||r=="__name"){t[r]=s;return}if(typeof s=="boolean"){t[r]=s;return}t[r]=F(s)}),t)},_=e=>F(e),g=async e=>{let t=m.jsonToGraphQLQuery(_(e));const r=await b().post(y(),{query:`{ ${t} }`});if(r.data.errors)throw new Error(r.data.errors[0].message);return r.data.data},l=async(e,t=null,r=[])=>{const s={mutation:{}};s.mutation[e]=!0,r instanceof Array&&r.length!=0&&(s.mutation[e]={}),t&&(s.mutation[e]={},s.mutation[e].__args=t),Object.entries(_(r)).forEach(([f,d])=>{s.mutation[e][f]=d});const u=await b().post(y(),{query:m.jsonToGraphQLQuery(s)});if(u.data.errors)throw new Error(u.data.errors[0].message);return u.data.data[e]};let O="/api/";const T=e=>{O=e},y=()=>O;async function U(e){const t={__variables:{file:"Upload!"},fsUploadTempFile:{__args:{file:new m.VariableType("file")},name:!0,path:!0,size:!0,mime:!0}},r=new FormData;r.append("operations",JSON.stringify({query:m.jsonToGraphQLQuery({mutation:t})})),r.append("map",JSON.stringify({0:["variables.file"]})),r.append("0",e);const s=await b().post(y(),r);if(s.data.errors)throw new Error(s.data.errors[0].message);return s.data.data.fsUploadTempFile}const K=(e,t,r)=>l("sendMail",{email:e,subject:t,message:r}),M=async e=>(await g({config:{__args:{name:e}}})).config;function v(e){const t="==".slice(0,(4-e.length%4)%4),r=e.replace(/-/g,"+").replace(/_/g,"/")+t,s=atob(r),u=new ArrayBuffer(s.length),f=new Uint8Array(u);for(let d=0;d<s.length;d++)f[d]=s.charCodeAt(d);return u}function C(e){const t=new Uint8Array(e);let r="";for(const f of t)r+=String.fromCharCode(f);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var a="copy",c="convert";function p(e,t,r){if(t===a)return r;if(t===c)return e(r);if(t instanceof Array)return r.map(s=>p(e,t[0],s));if(t instanceof Object){const s={};for(const[u,f]of Object.entries(t)){if(f.derive){const d=f.derive(r);d!==void 0&&(r[u]=d)}if(!(u in r)){if(f.required)throw new Error(`Missing key: ${u}`);continue}if(r[u]==null){s[u]=null;continue}s[u]=p(e,f.schema,r[u])}return s}}function A(e,t){return{required:!0,schema:e,derive:t}}function i(e){return{required:!0,schema:e}}function o(e){return{required:!1,schema:e}}var R={type:i(a),id:i(c),transports:o(a)},S={appid:o(a),appidExclude:o(a),credProps:o(a)},q={appid:o(a),appidExclude:o(a),credProps:o(a)},Q={publicKey:i({rp:i(a),user:i({id:i(c),name:i(a),displayName:i(a)}),challenge:i(c),pubKeyCredParams:i(a),timeout:o(a),excludeCredentials:o([R]),authenticatorSelection:o(a),attestation:o(a),extensions:o(S)}),signal:o(a)},V={type:i(a),id:i(a),rawId:i(c),authenticatorAttachment:o(a),response:i({clientDataJSON:i(c),attestationObject:i(c),transports:A(a,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:A(q,e=>e.getClientExtensionResults())},W={mediation:o(a),publicKey:i({challenge:i(c),timeout:o(a),rpId:o(a),allowCredentials:o([R]),userVerification:o(a),extensions:o(S)}),signal:o(a)},B={type:i(a),id:i(a),rawId:i(c),authenticatorAttachment:o(a),response:i({clientDataJSON:i(c),authenticatorData:i(c),signature:i(c),userHandle:i(c)}),clientExtensionResults:A(q,e=>e.getClientExtensionResults())};function I(e){return p(v,Q,e)}function z(e){return p(C,V,e)}function $(e){return p(v,W,e)}function G(e){return p(C,B,e)}async function H(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>z(t),t}async function X(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>G(t),t}async function Y(e){const r=(await g({webAuthnRequestOptions:{__args:{username:e}}})).webAuthnRequestOptions,s=$({publicKey:r}),u=await X(s);await l("webAuthnAssertion",{username:e,assertion:u.toJSON()})}async function Z(){const e=await g({webAuthnCreationOptions:!0}),t=I({publicKey:e.webAuthnCreationOptions}),r=await H(t);await l("webAuthnRegister",{registration:r.toJSON()})}const k=async e=>(await g({fsListFiles:{__args:{path:e},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,x=async e=>(await g({fsListFolders:{__args:{path:e},name:!0,path:!0}})).fsListFolders,ee=async e=>{let t=await g({fsFile:{__args:{path:e},base64Content:!0}});return window.atob(t.fsFile.base64Content)},te=(e,t)=>l("fsWriteFile",{path:e,content:t}),re=e=>l("fsDeleteFile",{path:e}),ne=e=>l("fsCreateFolder",{path:e}),se=e=>l("fsDeleteFolder",{path:e}),ae=(e,t)=>l("fsRenameFile",{path:e,name:t}),ie=(e,t)=>l("fsRenameFolder",{path:e,name:t}),oe=(e,t)=>l("fsMoveFile",{source:e,target:t});n.forgetPassword=L,n.fsCreateFolder=ne,n.fsDeleteFile=re,n.fsDeleteFolder=se,n.fsListFiles=k,n.fsListFolders=x,n.fsMoveFile=oe,n.fsReadFile=ee,n.fsRenameFile=ae,n.fsRenameFolder=ie,n.fsWriteFile=te,n.getApiUrl=y,n.getAxios=b,n.getConfig=M,n.granted=D,n.login=E,n.logout=P,n.mutation=l,n.query=g,n.resetPassword=J,n.sendMail=K,n.setApiUrl=T,n.setAxios=N,n.toQuery=_,n.updatePassword=j,n.uploadFile=U,n.webauthnLogin=Y,n.webauthnRegister=Z,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/light",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -29,7 +29,6 @@
29
29
  "dependencies": {
30
30
  "@github/webauthn-json": "^2.1.1",
31
31
  "axios": "^1.5.1",
32
- "buffer": "^6.0.3",
33
32
  "json-to-graphql-query": "^2.2.5"
34
33
  }
35
34
  }
@@ -1,2 +0,0 @@
1
- declare const _default: (url: string) => void;
2
- export default _default;