@hostlink/light 0.0.19 → 0.0.20

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,3 @@
1
+ declare const setApiUrl: (url: string) => void;
2
+ declare const getApiUrl: () => string;
3
+ export { setApiUrl, getApiUrl };
package/dist/index.d.ts CHANGED
@@ -3,8 +3,7 @@ import logout from './logout';
3
3
  import query from './query';
4
4
  import mutation from './mutation';
5
5
  import toQuery from './toQuery';
6
- import getApiUrl from './getApiUrl';
7
- import setApiUrl from './setApiUrl';
6
+ import { getApiUrl, setApiUrl } from './apiUrl';
8
7
  import uploadFile from './uploadFile';
9
8
  import sendMail from './sendMail';
10
9
  import getConfig from './getConfig';
package/dist/light.js CHANGED
@@ -1,30 +1,30 @@
1
- import { jsonToGraphQLQuery as h, VariableType as x } from "json-to-graphql-query";
2
- import y from "axios";
1
+ import { jsonToGraphQLQuery as b, VariableType as x } from "json-to-graphql-query";
2
+ import R from "axios";
3
3
  let d;
4
- const _ = () => (d || (d = y.create({
4
+ const m = () => (d || (d = R.create({
5
5
  withCredentials: !0
6
- })), d), m = () => typeof localStorage > "u" ? "http://127.0.0.1:8888/api/" : localStorage.getItem("light-api-url") === null ? "/api/" : localStorage.getItem("light-api-url"), f = async (t, e = null, r = []) => {
6
+ })), d), f = async (t, e = null, r = []) => {
7
7
  const n = {
8
8
  mutation: {}
9
9
  };
10
- n.mutation[t] = !0, r instanceof Array && r.length != 0 && (n.mutation[t] = {}), e && (n.mutation[t] = {}, n.mutation[t].__args = e), Object.entries(O(r)).forEach(([u, l]) => {
10
+ n.mutation[t] = !0, r instanceof Array && r.length != 0 && (n.mutation[t] = {}), e && (n.mutation[t] = {}, n.mutation[t].__args = e), Object.entries(_(r)).forEach(([u, l]) => {
11
11
  n.mutation[t][u] = l;
12
12
  });
13
- const o = await _().post(m(), {
14
- query: h(n)
13
+ const s = await m().post(y(), {
14
+ query: b(n)
15
15
  });
16
- if (o.data.errors)
17
- throw new Error(o.data.errors[0].message);
18
- return o.data.data[t];
19
- }, B = async (t, e, r = "") => await f("login", {
16
+ if (s.data.errors)
17
+ throw new Error(s.data.errors[0].message);
18
+ return s.data.data[t];
19
+ }, M = async (t, e, r = "") => await f("login", {
20
20
  username: t,
21
21
  password: e,
22
22
  code: r
23
- }), M = async () => await f("logout"), g = (t) => {
23
+ }), P = async () => await f("logout"), g = (t) => {
24
24
  let e = {};
25
25
  return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
26
- Object.entries(g(r)).forEach(([n, o]) => {
27
- e[n] = o;
26
+ Object.entries(g(r)).forEach(([n, s]) => {
27
+ e[n] = s;
28
28
  });
29
29
  }), e) : (Object.entries(t).forEach(([r, n]) => {
30
30
  if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
@@ -37,21 +37,21 @@ const _ = () => (d || (d = y.create({
37
37
  }
38
38
  e[r] = g(n);
39
39
  }), e);
40
- }, O = (t) => g(t), b = async (t) => {
41
- let e = h(O(t));
42
- const r = await _().post(m(), {
40
+ }, _ = (t) => g(t), h = async (t) => {
41
+ let e = b(_(t));
42
+ const r = await m().post(y(), {
43
43
  query: `{ ${e} }`
44
44
  });
45
45
  if (r.data.errors)
46
46
  throw new Error(r.data.errors[0].message);
47
47
  return r.data.data;
48
- }, P = (t) => {
49
- localStorage.setItem("light-api-url", t);
50
48
  };
51
- async function Q(t) {
52
- const e = y.create({
53
- withCredentials: !0
54
- }), r = {
49
+ let O = "/api/";
50
+ const Q = (t) => {
51
+ O = t;
52
+ }, y = () => O;
53
+ async function L(t) {
54
+ const e = {
55
55
  __variables: {
56
56
  file: "Upload!"
57
57
  },
@@ -64,29 +64,29 @@ async function Q(t) {
64
64
  size: !0,
65
65
  mime: !0
66
66
  }
67
- }, n = new FormData();
68
- n.append("operations", JSON.stringify({
69
- query: h({ mutation: r })
70
- })), n.append("map", JSON.stringify({ 0: ["variables.file"] })), n.append("0", t);
71
- const o = await e.post(m(), n);
72
- if (o.data.errors)
73
- throw new Error(o.data.errors[0].message);
74
- return o.data.data.fsUploadTempFile;
67
+ }, r = new FormData();
68
+ r.append("operations", JSON.stringify({
69
+ query: b({ mutation: e })
70
+ })), r.append("map", JSON.stringify({ 0: ["variables.file"] })), r.append("0", t);
71
+ const n = await m().post(y(), r);
72
+ if (n.data.errors)
73
+ throw new Error(n.data.errors[0].message);
74
+ return n.data.data.fsUploadTempFile;
75
75
  }
76
- const L = (t, e, r) => f("sendMail", { email: t, subject: e, message: r }), W = async (t) => (await b({
76
+ const W = (t, e, r) => f("sendMail", { email: t, subject: e, message: r }), $ = async (t) => (await h({
77
77
  config: {
78
78
  __args: {
79
79
  name: t
80
80
  }
81
81
  }
82
82
  })).config;
83
- function S(t) {
84
- const e = "==".slice(0, (4 - t.length % 4) % 4), r = t.replace(/-/g, "+").replace(/_/g, "/") + e, n = atob(r), o = new ArrayBuffer(n.length), u = new Uint8Array(o);
83
+ function A(t) {
84
+ const e = "==".slice(0, (4 - t.length % 4) % 4), r = t.replace(/-/g, "+").replace(/_/g, "/") + e, n = atob(r), s = new ArrayBuffer(n.length), u = new Uint8Array(s);
85
85
  for (let l = 0; l < n.length; l++)
86
86
  u[l] = n.charCodeAt(l);
87
- return o;
87
+ return s;
88
88
  }
89
- function A(t) {
89
+ function S(t) {
90
90
  const e = new Uint8Array(t);
91
91
  let r = "";
92
92
  for (const u of e)
@@ -106,24 +106,24 @@ function p(t, e, r) {
106
106
  return r.map((n) => p(t, e[0], n));
107
107
  if (e instanceof Object) {
108
108
  const n = {};
109
- for (const [o, u] of Object.entries(e)) {
109
+ for (const [s, u] of Object.entries(e)) {
110
110
  if (u.derive) {
111
111
  const l = u.derive(r);
112
- l !== void 0 && (r[o] = l);
112
+ l !== void 0 && (r[s] = l);
113
113
  }
114
- if (!(o in r)) {
114
+ if (!(s in r)) {
115
115
  if (u.required)
116
- throw new Error(`Missing key: ${o}`);
116
+ throw new Error(`Missing key: ${s}`);
117
117
  continue;
118
118
  }
119
- if (r[o] == null) {
120
- n[o] = null;
119
+ if (r[s] == null) {
120
+ n[s] = null;
121
121
  continue;
122
122
  }
123
- n[o] = p(
123
+ n[s] = p(
124
124
  t,
125
125
  u.schema,
126
- r[o]
126
+ r[s]
127
127
  );
128
128
  }
129
129
  return n;
@@ -142,7 +142,7 @@ function i(t) {
142
142
  schema: t
143
143
  };
144
144
  }
145
- function s(t) {
145
+ function o(t) {
146
146
  return {
147
147
  required: !1,
148
148
  schema: t
@@ -151,16 +151,16 @@ function s(t) {
151
151
  var v = {
152
152
  type: i(a),
153
153
  id: i(c),
154
- transports: s(a)
154
+ transports: o(a)
155
155
  }, C = {
156
- appid: s(a),
157
- appidExclude: s(a),
158
- credProps: s(a)
156
+ appid: o(a),
157
+ appidExclude: o(a),
158
+ credProps: o(a)
159
159
  }, E = {
160
- appid: s(a),
161
- appidExclude: s(a),
162
- credProps: s(a)
163
- }, R = {
160
+ appid: o(a),
161
+ appidExclude: o(a),
162
+ credProps: o(a)
163
+ }, q = {
164
164
  publicKey: i({
165
165
  rp: i(a),
166
166
  user: i({
@@ -170,18 +170,18 @@ var v = {
170
170
  }),
171
171
  challenge: i(c),
172
172
  pubKeyCredParams: i(a),
173
- timeout: s(a),
174
- excludeCredentials: s([v]),
175
- authenticatorSelection: s(a),
176
- attestation: s(a),
177
- extensions: s(C)
173
+ timeout: o(a),
174
+ excludeCredentials: o([v]),
175
+ authenticatorSelection: o(a),
176
+ attestation: o(a),
177
+ extensions: o(C)
178
178
  }),
179
- signal: s(a)
180
- }, q = {
179
+ signal: o(a)
180
+ }, J = {
181
181
  type: i(a),
182
182
  id: i(a),
183
183
  rawId: i(c),
184
- authenticatorAttachment: s(a),
184
+ authenticatorAttachment: o(a),
185
185
  response: i({
186
186
  clientDataJSON: i(c),
187
187
  attestationObject: i(c),
@@ -197,22 +197,22 @@ var v = {
197
197
  E,
198
198
  (t) => t.getClientExtensionResults()
199
199
  )
200
- }, J = {
201
- mediation: s(a),
200
+ }, N = {
201
+ mediation: o(a),
202
202
  publicKey: i({
203
203
  challenge: i(c),
204
- timeout: s(a),
205
- rpId: s(a),
206
- allowCredentials: s([v]),
207
- userVerification: s(a),
208
- extensions: s(C)
204
+ timeout: o(a),
205
+ rpId: o(a),
206
+ allowCredentials: o([v]),
207
+ userVerification: o(a),
208
+ extensions: o(C)
209
209
  }),
210
- signal: s(a)
211
- }, N = {
210
+ signal: o(a)
211
+ }, j = {
212
212
  type: i(a),
213
213
  id: i(a),
214
214
  rawId: i(c),
215
- authenticatorAttachment: s(a),
215
+ authenticatorAttachment: o(a),
216
216
  response: i({
217
217
  clientDataJSON: i(c),
218
218
  authenticatorData: i(c),
@@ -224,72 +224,72 @@ var v = {
224
224
  (t) => t.getClientExtensionResults()
225
225
  )
226
226
  };
227
- function j(t) {
228
- return p(S, R, t);
229
- }
230
227
  function T(t) {
228
+ return p(A, q, t);
229
+ }
230
+ function K(t) {
231
231
  return p(
232
- A,
233
- q,
232
+ S,
233
+ J,
234
234
  t
235
235
  );
236
236
  }
237
- function K(t) {
238
- return p(S, J, t);
239
- }
240
237
  function U(t) {
238
+ return p(A, N, t);
239
+ }
240
+ function D(t) {
241
241
  return p(
242
- A,
243
- N,
242
+ S,
243
+ j,
244
244
  t
245
245
  );
246
246
  }
247
- async function D(t) {
247
+ async function F(t) {
248
248
  const e = await navigator.credentials.create(
249
249
  t
250
250
  );
251
- return e.toJSON = () => T(e), e;
251
+ return e.toJSON = () => K(e), e;
252
252
  }
253
- async function F(t) {
253
+ async function V(t) {
254
254
  const e = await navigator.credentials.get(
255
255
  t
256
256
  );
257
- return e.toJSON = () => U(e), e;
257
+ return e.toJSON = () => D(e), e;
258
258
  }
259
- async function $(t) {
260
- const r = (await b({
259
+ async function z(t) {
260
+ const r = (await h({
261
261
  webAuthnRequestOptions: {
262
262
  __args: {
263
263
  username: t
264
264
  }
265
265
  }
266
- })).webAuthnRequestOptions, n = K({
266
+ })).webAuthnRequestOptions, n = U({
267
267
  publicKey: r
268
- }), o = await F(n);
268
+ }), s = await V(n);
269
269
  await f("webAuthnAssertion", {
270
270
  username: t,
271
- assertion: o.toJSON()
271
+ assertion: s.toJSON()
272
272
  });
273
273
  }
274
- async function z() {
275
- const t = await b({ webAuthnCreationOptions: !0 }), e = j({
274
+ async function G() {
275
+ const t = await h({ webAuthnCreationOptions: !0 }), e = T({
276
276
  publicKey: t.webAuthnCreationOptions
277
- }), r = await D(e);
277
+ }), r = await F(e);
278
278
  await f("webAuthnRegister", {
279
279
  registration: r.toJSON()
280
280
  });
281
281
  }
282
282
  export {
283
- m as getApiUrl,
284
- W as getConfig,
285
- B as login,
286
- M as logout,
283
+ y as getApiUrl,
284
+ $ as getConfig,
285
+ M as login,
286
+ P as logout,
287
287
  f as mutation,
288
- b as query,
289
- L as sendMail,
290
- P as setApiUrl,
291
- O as toQuery,
292
- Q as uploadFile,
293
- $ as webauthnLogin,
294
- z as webauthnRegister
288
+ h as query,
289
+ W as sendMail,
290
+ Q as setApiUrl,
291
+ _ as toQuery,
292
+ L as uploadFile,
293
+ z as webauthnLogin,
294
+ G as webauthnRegister
295
295
  };
@@ -1 +1 @@
1
- (function(u,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("json-to-graphql-query"),require("axios")):typeof define=="function"&&define.amd?define(["exports","json-to-graphql-query","axios"],d):(u=typeof globalThis<"u"?globalThis:u||self,d(u.light={},u.jsonToGraphqlQuery,u.axios))})(this,function(u,d,O){"use strict";let y;const _=()=>(y||(y=O.create({withCredentials:!0})),y),h=()=>typeof localStorage>"u"?"http://127.0.0.1:8888/api/":localStorage.getItem("light-api-url")===null?"/api/":localStorage.getItem("light-api-url"),p=async(t,e=null,n=[])=>{const r={mutation:{}};r.mutation[t]=!0,n instanceof Array&&n.length!=0&&(r.mutation[t]={}),e&&(r.mutation[t]={},r.mutation[t].__args=e),Object.entries(m(n)).forEach(([l,f])=>{r.mutation[t][l]=f});const o=await _().post(h(),{query:d.jsonToGraphQLQuery(r)});if(o.data.errors)throw new Error(o.data.errors[0].message);return o.data.data[t]},R=async(t,e,n="")=>await p("login",{username:t,password:e,code:n}),j=async()=>await p("logout"),b=t=>{let e={};return typeof t=="string"?(e[t]=!0,e):t instanceof Array?(t.forEach(n=>{Object.entries(b(n)).forEach(([r,o])=>{e[r]=o})}),e):(Object.entries(t).forEach(([n,r])=>{if(n=="__args"||n=="__aliasFor"||n=="__variables"||n=="__directives"||n=="__all_on"||n=="__name"){e[n]=r;return}if(typeof r=="boolean"){e[n]=r;return}e[n]=b(r)}),e)},m=t=>b(t),w=async t=>{let e=d.jsonToGraphQLQuery(m(t));const n=await _().post(h(),{query:`{ ${e} }`});if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data},J=t=>{localStorage.setItem("light-api-url",t)};async function N(t){const e=O.create({withCredentials:!0}),n={__variables:{file:"Upload!"},fsUploadTempFile:{__args:{file:new d.VariableType("file")},name:!0,path:!0,size:!0,mime:!0}},r=new FormData;r.append("operations",JSON.stringify({query:d.jsonToGraphQLQuery({mutation:n})})),r.append("map",JSON.stringify({0:["variables.file"]})),r.append("0",t);const o=await e.post(h(),r);if(o.data.errors)throw new Error(o.data.errors[0].message);return o.data.data.fsUploadTempFile}const T=(t,e,n)=>p("sendMail",{email:t,subject:e,message:n}),U=async t=>(await w({config:{__args:{name:t}}})).config;function A(t){const e="==".slice(0,(4-t.length%4)%4),n=t.replace(/-/g,"+").replace(/_/g,"/")+e,r=atob(n),o=new ArrayBuffer(r.length),l=new Uint8Array(o);for(let f=0;f<r.length;f++)l[f]=r.charCodeAt(f);return o}function v(t){const e=new Uint8Array(t);let n="";for(const l of e)n+=String.fromCharCode(l);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var i="copy",c="convert";function g(t,e,n){if(e===i)return n;if(e===c)return t(n);if(e instanceof Array)return n.map(r=>g(t,e[0],r));if(e instanceof Object){const r={};for(const[o,l]of Object.entries(e)){if(l.derive){const f=l.derive(n);f!==void 0&&(n[o]=f)}if(!(o in n)){if(l.required)throw new Error(`Missing key: ${o}`);continue}if(n[o]==null){r[o]=null;continue}r[o]=g(t,l.schema,n[o])}return r}}function S(t,e){return{required:!0,schema:t,derive:e}}function a(t){return{required:!0,schema:t}}function s(t){return{required:!1,schema:t}}var C={type:a(i),id:a(c),transports:s(i)},q={appid:s(i),appidExclude:s(i),credProps:s(i)},E={appid:s(i),appidExclude:s(i),credProps:s(i)},K={publicKey:a({rp:a(i),user:a({id:a(c),name:a(i),displayName:a(i)}),challenge:a(c),pubKeyCredParams:a(i),timeout:s(i),excludeCredentials:s([C]),authenticatorSelection:s(i),attestation:s(i),extensions:s(q)}),signal:s(i)},F={type:a(i),id:a(i),rawId:a(c),authenticatorAttachment:s(i),response:a({clientDataJSON:a(c),attestationObject:a(c),transports:S(i,t=>{var e;return((e=t.getTransports)==null?void 0:e.call(t))||[]})}),clientExtensionResults:S(E,t=>t.getClientExtensionResults())},x={mediation:s(i),publicKey:a({challenge:a(c),timeout:s(i),rpId:s(i),allowCredentials:s([C]),userVerification:s(i),extensions:s(q)}),signal:s(i)},D={type:a(i),id:a(i),rawId:a(c),authenticatorAttachment:s(i),response:a({clientDataJSON:a(c),authenticatorData:a(c),signature:a(c),userHandle:a(c)}),clientExtensionResults:S(E,t=>t.getClientExtensionResults())};function I(t){return g(A,K,t)}function Q(t){return g(v,F,t)}function V(t){return g(A,x,t)}function L(t){return g(v,D,t)}async function M(t){const e=await navigator.credentials.create(t);return e.toJSON=()=>Q(e),e}async function P(t){const e=await navigator.credentials.get(t);return e.toJSON=()=>L(e),e}async function B(t){const n=(await w({webAuthnRequestOptions:{__args:{username:t}}})).webAuthnRequestOptions,r=V({publicKey:n}),o=await P(r);await p("webAuthnAssertion",{username:t,assertion:o.toJSON()})}async function W(){const t=await w({webAuthnCreationOptions:!0}),e=I({publicKey:t.webAuthnCreationOptions}),n=await M(e);await p("webAuthnRegister",{registration:n.toJSON()})}u.getApiUrl=h,u.getConfig=U,u.login=R,u.logout=j,u.mutation=p,u.query=w,u.sendMail=T,u.setApiUrl=J,u.toQuery=m,u.uploadFile=N,u.webauthnLogin=B,u.webauthnRegister=W,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
1
+ (function(s,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("json-to-graphql-query"),require("axios")):typeof define=="function"&&define.amd?define(["exports","json-to-graphql-query","axios"],d):(s=typeof globalThis<"u"?globalThis:s||self,d(s.light={},s.jsonToGraphqlQuery,s.axios))})(this,function(s,d,R){"use strict";let y;const b=()=>(y||(y=R.create({withCredentials:!0})),y),p=async(t,e=null,n=[])=>{const r={mutation:{}};r.mutation[t]=!0,n instanceof Array&&n.length!=0&&(r.mutation[t]={}),e&&(r.mutation[t]={},r.mutation[t].__args=e),Object.entries(_(n)).forEach(([l,f])=>{r.mutation[t][l]=f});const u=await b().post(w(),{query:d.jsonToGraphQLQuery(r)});if(u.data.errors)throw new Error(u.data.errors[0].message);return u.data.data[t]},j=async(t,e,n="")=>await p("login",{username:t,password:e,code:n}),J=async()=>await p("logout"),m=t=>{let e={};return typeof t=="string"?(e[t]=!0,e):t instanceof Array?(t.forEach(n=>{Object.entries(m(n)).forEach(([r,u])=>{e[r]=u})}),e):(Object.entries(t).forEach(([n,r])=>{if(n=="__args"||n=="__aliasFor"||n=="__variables"||n=="__directives"||n=="__all_on"||n=="__name"){e[n]=r;return}if(typeof r=="boolean"){e[n]=r;return}e[n]=m(r)}),e)},_=t=>m(t),h=async t=>{let e=d.jsonToGraphQLQuery(_(t));const n=await b().post(w(),{query:`{ ${e} }`});if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data};let A="/api/";const N=t=>{A=t},w=()=>A;async function T(t){const e={__variables:{file:"Upload!"},fsUploadTempFile:{__args:{file:new d.VariableType("file")},name:!0,path:!0,size:!0,mime:!0}},n=new FormData;n.append("operations",JSON.stringify({query:d.jsonToGraphQLQuery({mutation:e})})),n.append("map",JSON.stringify({0:["variables.file"]})),n.append("0",t);const r=await b().post(w(),n);if(r.data.errors)throw new Error(r.data.errors[0].message);return r.data.data.fsUploadTempFile}const U=(t,e,n)=>p("sendMail",{email:t,subject:e,message:n}),K=async t=>(await h({config:{__args:{name:t}}})).config;function S(t){const e="==".slice(0,(4-t.length%4)%4),n=t.replace(/-/g,"+").replace(/_/g,"/")+e,r=atob(n),u=new ArrayBuffer(r.length),l=new Uint8Array(u);for(let f=0;f<r.length;f++)l[f]=r.charCodeAt(f);return u}function v(t){const e=new Uint8Array(t);let n="";for(const l of e)n+=String.fromCharCode(l);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var i="copy",c="convert";function g(t,e,n){if(e===i)return n;if(e===c)return t(n);if(e instanceof Array)return n.map(r=>g(t,e[0],r));if(e instanceof Object){const r={};for(const[u,l]of Object.entries(e)){if(l.derive){const f=l.derive(n);f!==void 0&&(n[u]=f)}if(!(u in n)){if(l.required)throw new Error(`Missing key: ${u}`);continue}if(n[u]==null){r[u]=null;continue}r[u]=g(t,l.schema,n[u])}return r}}function O(t,e){return{required:!0,schema:t,derive:e}}function a(t){return{required:!0,schema:t}}function o(t){return{required:!1,schema:t}}var C={type:a(i),id:a(c),transports:o(i)},q={appid:o(i),appidExclude:o(i),credProps:o(i)},E={appid:o(i),appidExclude:o(i),credProps:o(i)},x={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([C]),authenticatorSelection:o(i),attestation:o(i),extensions:o(q)}),signal:o(i)},F={type:a(i),id:a(i),rawId:a(c),authenticatorAttachment:o(i),response:a({clientDataJSON:a(c),attestationObject:a(c),transports:O(i,t=>{var e;return((e=t.getTransports)==null?void 0:e.call(t))||[]})}),clientExtensionResults:O(E,t=>t.getClientExtensionResults())},D={mediation:o(i),publicKey:a({challenge:a(c),timeout:o(i),rpId:o(i),allowCredentials:o([C]),userVerification:o(i),extensions:o(q)}),signal:o(i)},Q={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:O(E,t=>t.getClientExtensionResults())};function V(t){return g(S,x,t)}function L(t){return g(v,F,t)}function M(t){return g(S,D,t)}function P(t){return g(v,Q,t)}async function B(t){const e=await navigator.credentials.create(t);return e.toJSON=()=>L(e),e}async function I(t){const e=await navigator.credentials.get(t);return e.toJSON=()=>P(e),e}async function W(t){const n=(await h({webAuthnRequestOptions:{__args:{username:t}}})).webAuthnRequestOptions,r=M({publicKey:n}),u=await I(r);await p("webAuthnAssertion",{username:t,assertion:u.toJSON()})}async function $(){const t=await h({webAuthnCreationOptions:!0}),e=V({publicKey:t.webAuthnCreationOptions}),n=await B(e);await p("webAuthnRegister",{registration:n.toJSON()})}s.getApiUrl=w,s.getConfig=K,s.login=j,s.logout=J,s.mutation=p,s.query=h,s.sendMail=U,s.setApiUrl=N,s.toQuery=_,s.uploadFile=T,s.webauthnLogin=W,s.webauthnRegister=$,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/light",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,2 +0,0 @@
1
- declare const _default: () => string;
2
- export default _default;