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