@hostlink/light 1.2.5 → 2.0.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.
@@ -1 +1 @@
1
- (function(s,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):(s=typeof globalThis<"u"?globalThis:s||self,S(s.light={},s.axios,s.jsonToGraphqlQuery))})(this,function(s,S,R){"use strict";const Q=(e,t,n="")=>u("login",{username:e,password:t,code:n}),B=()=>u("logout"),W=(e,t)=>u("updatePassword",{old_password:e,new_password:t}),$=(e,t,n)=>u("resetPassword",{email:e,password:t,code:n}),z=e=>u("forgetPassword",{email:e});let q;const G=e=>{q=e},j=()=>(q||(q=S.create({withCredentials:!0})),q),H=async e=>(await h({granted:{__args:{rights:e}}})).granted,A={},I=(e,t)=>{A[e]={};for(const n of Object.entries(t)){const[i,r]=n;A[e][i]=()=>({name:r.name?r.name:i,raw:r,getName:()=>r.name?r.name:i,getGQLField:()=>r.gqlField!==void 0?r.gqlField:r.name||i,getRaw(){return r},getValue(o){return r.field&&typeof r.field=="function"?r.field(o):r.field&&typeof r.field=="string"?o[r.field]:o[this.getName()]},getFormattedValue(o){const f=this.getValue(o);return r.format?r.format(f):f}})}},N=(e,t)=>!A[e]||!A[e][t]?null:A[e][t](),X=(e,t)=>{const n=[];for(const i of t)if(typeof i=="string"){const r=N(e,i);r&&n.push(r.getGQLField())}else typeof i=="object"&&n.push(i);return n},Y=e=>{const t=e;return{name:t,$fields:A[e],async update(n,i){return await u("update"+t,{id:n,data:i})},async delete(n){return await u("delete"+t,{id:n})},async add(n){return await u("add"+t,{data:n})},fields(n){let i=[];for(let r of n){const o=N(t,r);o&&i.push(o)}return i},async get(n,i){return(await h({["list"+t]:{__args:{filters:n},data:{__args:{limit:1},...v(i)}}}))["list"+t].data[0]},async list(n,i){return(await h({["list"+t]:{__args:{filters:n},data:{...v(i)}}}))["list"+t].data}}};function Z(e){e="<~"+e+"~>";var t,n,i,r,o,f=String,p=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,i=[],r=0,o=e.length;o>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),i.push(p&n>>24,p&n>>16,p&n>>8,p&n);return function(w,F){for(var y=F;y>0;y--)w.pop()}(i,t.length),f.fromCharCode.apply(f,i)}const E=(e="")=>{const t=e,n=(i="application/octet-stream")=>{const r=new Uint8Array(t.length);for(let p=0;p<t.length;p++)r[p]=t.charCodeAt(p);const o=new Blob([r],{type:i});return URL.createObjectURL(o)};return{getContent:()=>t,getURL:n,download:i=>{const r=document.createElement("a");r.download=i,r.href=n(),document.body.appendChild(r),r.click(),document.body.removeChild(r)},open:i=>{window.open(n(i),"_blank")}}},x={fromBase85:e=>E(Z(e)),fromBase64:e=>E(atob(e)),fromString:e=>E(e)},P=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(n=>{Object.entries(P(n)).forEach(([i,r])=>{t[i]=r})}),t):(Object.entries(e).forEach(([n,i])=>{if(n=="__args"||n=="__aliasFor"||n=="__variables"||n=="__directives"||n=="__all_on"||n=="__name"){t[n]=i;return}if(typeof i=="boolean"){t[n]=i;return}t[n]=P(i)}),t)},v=e=>P(e),h=async e=>{let t=R.jsonToGraphQLQuery(v(e));const n=await j().post(L(),{query:`{ ${t} }`});if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data};function k(e){for(let t=0;t<e.length;t++)if(e[t]instanceof File)return!0;return!1}function ee(e){for(let t in e)if(e[t]instanceof File)return!0;return!1}const u=async(e,t=null,n=[])=>{let i={[e]:{}};const r=new FormData;let o=!1;if(t){const w={},F={},y={};let b=0;Object.entries(t).forEach(([g,m])=>{if(m instanceof Array&&k(m)){o=!0;let _=0;m.forEach(O=>{O instanceof File&&(w[g]=new R.VariableType(g),F[b]=["variables."+g+"."+_],r.append(b.toString(),O),b++)}),y[g]="[Upload!]!"}else m instanceof File?(o=!0,w[g]=new R.VariableType(g),F[b]=["variables."+g],r.append(b.toString(),m),y[g]="Upload!",b++):m instanceof Object&&ee(m)?(o=!0,w[g]===void 0&&(w[g]={}),Object.entries(m).forEach(([_,O])=>{O instanceof File?(w[g][_]=new R.VariableType(_),F[b]=["variables."+_],r.append(b.toString(),O),y[_]="Upload!",b++):w[g][_]=O})):w[g]=m}),i[e].__args=w,i.__variables=y,o&&r.append("map",JSON.stringify(F))}Object.entries(v(n)).forEach(([w,F])=>{i[e][w]=F}),Object.entries(i[e]).length===0&&(i[e]=!0);let f=null;const p=R.jsonToGraphQLQuery({mutation:i});if(o?(r.append("operations",JSON.stringify({query:p})),f=await j().post(L(),r)):f=await j().post(L(),{query:p}),f.data.errors)throw new Error(f.data.errors[0].message);return f.data.data[e]};let J="/api/";const te=e=>{J=e},L=()=>J;async function ne(e){return u("fsUploadTempFile",{file:e},{name:!0,path:!0,size:!0,mime:!0})}const re=(e,t,n)=>u("sendMail",{email:e,subject:t,message:n}),ie=async e=>(await h({config:{__args:{name:e}}})).config;function M(e){const t="==".slice(0,(4-e.length%4)%4),n=e.replace(/-/g,"+").replace(/_/g,"/")+t,i=atob(n),r=new ArrayBuffer(i.length),o=new Uint8Array(r);for(let f=0;f<i.length;f++)o[f]=i.charCodeAt(f);return r}function D(e){const t=new Uint8Array(e);let n="";for(const o of t)n+=String.fromCharCode(o);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var a="copy",d="convert";function C(e,t,n){if(t===a)return n;if(t===d)return e(n);if(t instanceof Array)return n.map(i=>C(e,t[0],i));if(t instanceof Object){const i={};for(const[r,o]of Object.entries(t)){if(o.derive){const f=o.derive(n);f!==void 0&&(n[r]=f)}if(!(r in n)){if(o.required)throw new Error(`Missing key: ${r}`);continue}if(n[r]==null){i[r]=null;continue}i[r]=C(e,o.schema,n[r])}return i}}function U(e,t){return{required:!0,schema:e,derive:t}}function l(e){return{required:!0,schema:e}}function c(e){return{required:!1,schema:e}}var T={type:l(a),id:l(d),transports:c(a)},V={appid:c(a),appidExclude:c(a),credProps:c(a)},K={appid:c(a),appidExclude:c(a),credProps:c(a)},se={publicKey:l({rp:l(a),user:l({id:l(d),name:l(a),displayName:l(a)}),challenge:l(d),pubKeyCredParams:l(a),timeout:c(a),excludeCredentials:c([T]),authenticatorSelection:c(a),attestation:c(a),extensions:c(V)}),signal:c(a)},ae={type:l(a),id:l(a),rawId:l(d),authenticatorAttachment:c(a),response:l({clientDataJSON:l(d),attestationObject:l(d),transports:U(a,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:U(K,e=>e.getClientExtensionResults())},oe={mediation:c(a),publicKey:l({challenge:l(d),timeout:c(a),rpId:c(a),allowCredentials:c([T]),userVerification:c(a),extensions:c(V)}),signal:c(a)},le={type:l(a),id:l(a),rawId:l(d),authenticatorAttachment:c(a),response:l({clientDataJSON:l(d),authenticatorData:l(d),signature:l(d),userHandle:l(d)}),clientExtensionResults:U(K,e=>e.getClientExtensionResults())};function ce(e){return C(M,se,e)}function ue(e){return C(D,ae,e)}function fe(e){return C(M,oe,e)}function de(e){return C(D,le,e)}async function ge(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>ue(t),t}async function pe(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>de(t),t}async function we(e){const n=(await h({webAuthnRequestOptions:{__args:{username:e}}})).webAuthnRequestOptions,i=fe({publicKey:n}),r=await pe(i);await u("webAuthnAssertion",{username:e,assertion:r.toJSON()})}async function he(){const e=await h({webAuthnCreationOptions:!0}),t=ce({publicKey:e.webAuthnCreationOptions}),n=await ge(t);await u("webAuthnRegister",{registration:n.toJSON()})}const be=async e=>(await h({fsListFiles:{__args:{path:e},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,me=async e=>(await h({fsListFolders:{__args:{path:e},name:!0,path:!0}})).fsListFolders,Fe=async e=>{let t=await h({fsFile:{__args:{path:e},base64Content:!0}});return window.atob(t.fsFile.base64Content)},ye=(e,t)=>u("fsWriteFile",{path:e,content:t}),_e=e=>u("fsDeleteFile",{path:e}),Ae=e=>u("fsCreateFolder",{path:e}),Ce=e=>u("fsDeleteFolder",{path:e}),Oe=(e,t)=>u("fsRenameFile",{path:e,name:t}),Se=(e,t)=>u("fsRenameFolder",{path:e,name:t}),Re=(e,t)=>u("fsMoveFile",{source:e,target:t});s.File=x,s.defineModel=I,s.file=E,s.forgetPassword=z,s.fsCreateFolder=Ae,s.fsDeleteFile=_e,s.fsDeleteFolder=Ce,s.fsListFiles=be,s.fsListFolders=me,s.fsMoveFile=Re,s.fsReadFile=Fe,s.fsRenameFile=Oe,s.fsRenameFolder=Se,s.fsWriteFile=ye,s.getApiUrl=L,s.getAxios=j,s.getConfig=ie,s.getGQLFields=X,s.getModelField=N,s.granted=H,s.login=Q,s.logout=B,s.model=Y,s.mutation=u,s.query=h,s.resetPassword=$,s.sendMail=re,s.setApiUrl=te,s.setAxios=G,s.toQuery=v,s.updatePassword=W,s.uploadFile=ne,s.webauthnLogin=we,s.webauthnRegister=he,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
1
+ (function(h,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("json-to-graphql-query"),require("axios")):typeof define=="function"&&define.amd?define(["exports","json-to-graphql-query","axios"],y):(h=typeof globalThis<"u"?globalThis:h||self,y(h.light={},h.jsonToGraphqlQuery,h.axios))})(this,function(h,y,U){"use strict";function E(e){const t="==".slice(0,(4-e.length%4)%4),r=e.replace(/-/g,"+").replace(/_/g,"/")+t,n=atob(r),s=new ArrayBuffer(n.length),a=new Uint8Array(s);for(let u=0;u<n.length;u++)a[u]=n.charCodeAt(u);return s}function N(e){const t=new Uint8Array(e);let r="";for(const a of t)r+=String.fromCharCode(a);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var o="copy",m="convert";function O(e,t,r){if(t===o)return r;if(t===m)return e(r);if(t instanceof Array)return r.map(n=>O(e,t[0],n));if(t instanceof Object){const n={};for(const[s,a]of Object.entries(t)){if(a.derive){const u=a.derive(r);u!==void 0&&(r[s]=u)}if(!(s in r)){if(a.required)throw new Error(`Missing key: ${s}`);continue}if(r[s]==null){n[s]=null;continue}n[s]=O(e,a.schema,r[s])}return n}}function j(e,t){return{required:!0,schema:e,derive:t}}function l(e){return{required:!0,schema:e}}function c(e){return{required:!1,schema:e}}var J={type:l(o),id:l(m),transports:c(o)},P={appid:c(o),appidExclude:c(o),credProps:c(o)},T={appid:c(o),appidExclude:c(o),credProps:c(o)},V={publicKey:l({rp:l(o),user:l({id:l(m),name:l(o),displayName:l(o)}),challenge:l(m),pubKeyCredParams:l(o),timeout:c(o),excludeCredentials:c([J]),authenticatorSelection:c(o),attestation:c(o),extensions:c(P)}),signal:c(o)},L={type:l(o),id:l(o),rawId:l(m),authenticatorAttachment:c(o),response:l({clientDataJSON:l(m),attestationObject:l(m),transports:j(o,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:j(T,e=>e.getClientExtensionResults())},K={mediation:c(o),publicKey:l({challenge:l(m),timeout:c(o),rpId:c(o),allowCredentials:c([J]),userVerification:c(o),extensions:c(P)}),signal:c(o)},D={type:l(o),id:l(o),rawId:l(m),authenticatorAttachment:c(o),response:l({clientDataJSON:l(m),authenticatorData:l(m),signature:l(m),userHandle:l(m)}),clientExtensionResults:j(T,e=>e.getClientExtensionResults())};function B(e){return O(E,V,e)}function Q(e){return O(N,L,e)}function W(e){return O(E,K,e)}function M(e){return O(N,D,e)}async function $(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>Q(t),t}async function z(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>M(t),t}const H=e=>({login:async t=>{const n=(await w(e,{webAuthnRequestOptions:{__args:{username:t}}})).webAuthnRequestOptions,s=W({publicKey:n}),a=await z(s);await d(e,"webAuthnAssertion",{username:t,assertion:a.toJSON()})},register:async()=>{const t=await w(e,{webAuthnCreationOptions:!0}),r=B({publicKey:t.webAuthnCreationOptions}),n=await $(r);await d(e,"webAuthnRegister",{registration:n.toJSON()})}}),I=e=>({WebAuthn:H(e),login:(t,r,n="")=>d(e,"login",{username:t,password:r,code:n}),logout:()=>d(e,"logout"),updatePassword:(t,r)=>d(e,"updatePassword",{old_password:t,new_password:r}),resetPassword:(t,r,n)=>d(e,"resetPassword",{email:t,password:r,code:n}),forgetPassword:t=>d(e,"forgetPassword",{email:t}),granted:async t=>(await w(e,{granted:{__args:{rights:t}}})).granted}),G=(e,t,r)=>{const n=t,s=e,a=r,u=i=>a[i]?a[i]():null;return{field:u,$fields:a,gqlFields(i){const p=[];for(const f of i)if(typeof f=="string"){const g=u(f);g&&p.push(g.getGQLField())}else typeof f=="object"&&p.push(f);return p},async update(i,p){return await d(s,"update"+n,{id:i,data:p})},async delete(i){return await d(s,"delete"+n,{id:i})},async add(i){return await d(s,"add"+n,{data:i})},fields(i){let p=[];for(let f of i){const g=u(f);g&&p.push(g)}return p},async get(i,p){return(await w(s,{["list"+n]:{__args:{filters:i},data:{__args:{limit:1},...S(p)}}}))["list"+n].data[0]},async list(i,p){return(await w(s,{["list"+n]:{__args:{filters:i},data:{...S(p)}}}))["list"+n].data}}};function X(e){e="<~"+e+"~>";var t,r,n,s,a,u=String,i=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,n=[],s=0,a=e.length;a>s;s+=5)r=52200625*(e.charCodeAt(s)-33)+614125*(e.charCodeAt(s+1)-33)+7225*(e.charCodeAt(s+2)-33)+85*(e.charCodeAt(s+3)-33)+(e.charCodeAt(s+4)-33),n.push(i&r>>24,i&r>>16,i&r>>8,i&r);return function(p,f){for(var g=f;g>0;g--)p.pop()}(n,t.length),u.fromCharCode.apply(u,n)}const q=(e="")=>{const t=e,r=(n="application/octet-stream")=>{const s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i);const a=new Blob([s],{type:n});return URL.createObjectURL(a)};return{getContent:()=>t,getURL:r,download:n=>{const s=document.createElement("a");s.download=n,s.href=r(),document.body.appendChild(s),s.click(),document.body.removeChild(s)},open:n=>{window.open(r(n),"_blank")}}},Y={fromBase85:e=>q(X(e)),fromBase64:e=>q(atob(e)),fromString:e=>q(e)},R=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(r=>{Object.entries(R(r)).forEach(([n,s])=>{t[n]=s})}),t):(Object.entries(e).forEach(([r,n])=>{if(r=="__args"||r=="__aliasFor"||r=="__variables"||r=="__directives"||r=="__all_on"||r=="__name"){t[r]=n;return}if(typeof n=="boolean"){t[r]=n;return}t[r]=R(n)}),t)},S=e=>R(e),w=async(e,t)=>{let r=y.jsonToGraphQLQuery(S(t));const n=await e.post("",{query:`{ ${r} }`});if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data};function Z(e){for(let t=0;t<e.length;t++)if(e[t]instanceof File)return!0;return!1}function x(e){for(let t in e)if(e[t]instanceof File)return!0;return!1}const d=async(e,t,r=null,n=[])=>{let s={[t]:{}};const a=new FormData;let u=!1;if(r){const f={},g={},v={};let F=0;Object.entries(r).forEach(([b,_])=>{if(_ instanceof Array&&Z(_)){u=!0;let C=0;_.forEach(A=>{A instanceof File&&(f[b]=new y.VariableType(b),g[F]=["variables."+b+"."+C],a.append(F.toString(),A),F++)}),v[b]="[Upload!]!"}else _ instanceof File?(u=!0,f[b]=new y.VariableType(b),g[F]=["variables."+b],a.append(F.toString(),_),v[b]="Upload!",F++):_ instanceof Object&&x(_)?(u=!0,f[b]={},Object.entries(_).forEach(([C,A])=>{A instanceof File?(f[b][C]=new y.VariableType(C),g[F]=["variables."+C],a.append(F.toString(),A),v[C]="Upload!",F++):f[b][C]=A})):_!==void 0&&(f[b]=_)}),s[t].__args=f,s.__variables=v,u&&a.append("map",JSON.stringify(g))}Object.entries(S(n)).forEach(([f,g])=>{s[t][f]=g}),Object.entries(s[t]).length===0&&(s[t]=!0);let i=null;const p=y.jsonToGraphQLQuery({mutation:s});if(u?(a.append("operations",JSON.stringify({query:p})),i=await e.post("",a)):i=await e.post("",{query:p}),i.data.errors)throw new Error(i.data.errors[0].message);return i.data.data[t]},k=e=>({uploadTempFile:t=>d(e,"fsUploadTempFile",{file:t},{name:!0,path:!0,size:!0,mime:!0}),folders:{list:async t=>(await w(e,{fsListFolders:{__args:{path:t},name:!0,path:!0}})).fsListFolders,create:t=>d(e,"fsCreateFolder",{path:t}),delete:t=>d(e,"fsDeleteFolder",{path:t}),rename:(t,r)=>d(e,"fsRenameFolder",{path:t,name:r})},files:{list:async t=>(await w(e,{fsListFiles:{__args:{path:t},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,read:async t=>{let r=await w(e,{fsFile:{__args:{path:t},base64Content:!0}});return window.atob(r.fsFile.base64Content)},write:(t,r)=>d(e,"fsWriteFile",{path:t,content:r}),delete:t=>d(e,"fsDeleteFile",{path:t}),rename:(t,r)=>d(e,"fsRenameFile",{path:t,name:r}),move:(t,r)=>d(e,"fsMoveFile",{source:t,target:r})}}),ee=e=>({get:async t=>(await e({config:{__args:{name:t}}})).config}),te=e=>({send:(t,r,n)=>d(e,"sendMail",{email:t,subject:r,message:n})}),re=e=>({list:async()=>(await w(e,{listUser:{data:{user_id:!0,username:!0,first_name:!0,last_name:!0,status:!0}}})).listUser.data}),ne=()=>{const e={};return{create(t,r){e[t]={};for(const n of Object.entries(r)){const[s,a]=n;e[t][s]=()=>({name:a.name?a.name:s,raw:a,getName:()=>a.name?a.name:s,getGQLField:()=>a.gqlField!==void 0?a.gqlField:a.name||s,getRaw(){return a},getValue(u){return a.field&&typeof a.field=="function"?a.field(u):a.field&&typeof a.field=="string"?u[a.field]:u[this.getName()]},getFormattedValue(u){const i=this.getValue(u);return a.format?a.format(i):i}})}return e[t]},get(t){return e[t]}}},se=e=>({list:async()=>(await w(e,{listRole:{name:!0}})).listRole}),ae=e=>{const t=U.create({baseURL:e,withCredentials:!0}),r=(a,u=null,i=[])=>d(t,a,u,i),n=a=>w(t,a),s=ne();return{baseURL:e,axios:t,auth:I(t),mutation:r,query:n,config:ee(n),mail:te(t),users:re(t),fs:k(t),models:s,model(a){return G(t,a,s.get(a))},roles:se(t)}};h.File=Y,h.createClient=ae,h.file=q,h.mutation=d,h.query=w,h.toQuery=S,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
package/dist/mail.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { AxiosInstance } from 'axios';
2
+ declare const _default: (axios: AxiosInstance) => {
3
+ send: (email: string, subject: string, message: string) => Promise<any>;
4
+ };
5
+ export default _default;
package/dist/model.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { type Fields } from ".";
1
+ import { AxiosInstance } from 'axios';
2
+ import { Fields } from '.';
2
3
  export type ModelField = {
3
4
  name: string;
4
5
  raw: FieldOption;
@@ -19,14 +20,10 @@ export type FieldOption = {
19
20
  field?: any;
20
21
  format?: any;
21
22
  };
22
- export declare const defineModel: (name: string, fields: {
23
- [key: string]: FieldOption;
24
- }) => void;
25
- export declare const getModelField: (name: string, field: string) => ModelField | null;
26
- export declare const getGQLFields: (model: string, fields: (string | object)[]) => any[];
27
- export declare const model: (name: string) => {
28
- name: string;
23
+ declare const _default: (axios: AxiosInstance, name: string, fields: any) => {
24
+ field: (f: string) => ModelField | null;
29
25
  $fields: any;
26
+ gqlFields(fields: (string | object)[]): any[];
30
27
  update(id: number, data: Object): Promise<any>;
31
28
  delete(id: number): Promise<any>;
32
29
  add(data: Object): Promise<any>;
@@ -34,3 +31,4 @@ export declare const model: (name: string) => {
34
31
  get(filters: any, fields: Fields): Promise<any>;
35
32
  list(filters: any, fields: Fields): Promise<any>;
36
33
  };
34
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { FieldOption } from './model';
2
+ declare const _default: () => {
3
+ create(name: string, fields: {
4
+ [key: string]: FieldOption;
5
+ }): any;
6
+ get(name: string): any;
7
+ };
8
+ export default _default;
@@ -1,5 +1,6 @@
1
+ import { AxiosInstance } from 'axios';
1
2
  import { Fields } from '.';
2
- declare const _default: (operation: string, args?: {
3
+ declare const _default: (axios: AxiosInstance, operation: string, args?: {
3
4
  [key: string]: any;
4
5
  } | null, fields?: Fields) => Promise<any>;
5
6
  export default _default;
package/dist/query.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- declare const _default: (q: Object | Array<string | Object | string>) => Promise<any>;
1
+ import { AxiosInstance } from 'axios';
2
+ declare const _default: (axios: AxiosInstance, q: Object | Array<string | Object>) => Promise<any>;
2
3
  export default _default;
@@ -0,0 +1,5 @@
1
+ import { AxiosInstance } from 'axios';
2
+ declare const _default: (axios: AxiosInstance) => {
3
+ list: () => Promise<any>;
4
+ };
5
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
package/dist/toQuery.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { Fields } from ".";
1
+ import { Fields } from '.';
2
2
  declare const _default: (query: Fields) => any;
3
3
  export default _default;
@@ -0,0 +1,5 @@
1
+ import { AxiosInstance } from 'axios';
2
+ declare const _default: (axios: AxiosInstance) => {
3
+ list: () => Promise<any>;
4
+ };
5
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { AxiosInstance } from 'axios';
2
+ declare const _default: (axios: AxiosInstance) => {
3
+ login: (username: string) => Promise<void>;
4
+ register: () => Promise<void>;
5
+ };
6
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/light",
3
- "version": "1.2.5",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -10,6 +10,7 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
+ "types": "./dist/index.d.ts",
13
14
  "import": "./dist/light.js"
14
15
  }
15
16
  },
@@ -23,8 +24,8 @@
23
24
  "devDependencies": {
24
25
  "typescript": "^5.3.3",
25
26
  "vite": "^5.1.4",
26
- "vite-plugin-dts": "^3.7.3",
27
- "vitest": "^1.3.1"
27
+ "vite-plugin-dts": "^4.0.3",
28
+ "vitest": "^2.0.5"
28
29
  },
29
30
  "dependencies": {
30
31
  "@github/webauthn-json": "^2.1.1",
package/dist/apiUrl.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const setApiUrl: (url: string) => void;
2
- export declare const getApiUrl: () => string;
package/dist/axios.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- declare const setAxios: (a: AxiosInstance) => void;
3
- declare const getAxios: () => AxiosInstance;
4
- export { setAxios, getAxios };
@@ -1,2 +0,0 @@
1
- declare const _default: (name: string) => Promise<any>;
2
- export default _default;
package/dist/granted.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const granted: (rights: string[]) => Promise<string[]>;
@@ -1,2 +0,0 @@
1
- declare const _default: (email: string, subject: string, message: string) => Promise<any>;
2
- export default _default;
@@ -1 +0,0 @@
1
- export default function (file: File): Promise<any>;
@@ -1 +0,0 @@
1
- export default function (username: string): Promise<void>;
@@ -1 +0,0 @@
1
- export default function (): Promise<void>;
File without changes