@nhost/nhost-js 0.3.3 → 0.3.7
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/LICENSE +21 -0
- package/README.md +4 -4
- package/dist/{cjs/clients → clients}/functions.d.ts +2 -2
- package/dist/{esm/clients → clients}/graphql.d.ts +2 -2
- package/dist/{cjs/core → core}/index.d.ts +0 -0
- package/dist/{esm/core → core}/nhost-client.d.ts +3 -12
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +4507 -0
- package/dist/index.umd.js +4 -0
- package/dist/{cjs/types.d.ts → types.d.ts} +5 -5
- package/package.json +45 -33
- package/src/index.ts +6 -0
- package/dist/cjs/clients/functions.js +0 -113
- package/dist/cjs/clients/functions.js.map +0 -1
- package/dist/cjs/clients/graphql.d.ts +0 -15
- package/dist/cjs/clients/graphql.js +0 -133
- package/dist/cjs/clients/graphql.js.map +0 -1
- package/dist/cjs/core/index.js +0 -14
- package/dist/cjs/core/index.js.map +0 -1
- package/dist/cjs/core/nhost-client.d.ts +0 -28
- package/dist/cjs/core/nhost-client.js +0 -59
- package/dist/cjs/core/nhost-client.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -14
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/types.js +0 -3
- package/dist/cjs/types.js.map +0 -1
- package/dist/esm/clients/functions.d.ts +0 -13
- package/dist/esm/clients/functions.js +0 -107
- package/dist/esm/clients/functions.js.map +0 -1
- package/dist/esm/clients/graphql.js +0 -127
- package/dist/esm/clients/graphql.js.map +0 -1
- package/dist/esm/core/index.d.ts +0 -1
- package/dist/esm/core/index.js +0 -2
- package/dist/esm/core/index.js.map +0 -1
- package/dist/esm/core/nhost-client.js +0 -56
- package/dist/esm/core/nhost-client.js.map +0 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types.d.ts +0 -19
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var Fi=Object.defineProperty,Di=Object.defineProperties;var Bi=Object.getOwnPropertyDescriptors;var Ft=Object.getOwnPropertySymbols;var qi=Object.prototype.hasOwnProperty,Hi=Object.prototype.propertyIsEnumerable;var Dt=(S,E,k)=>E in S?Fi(S,E,{enumerable:!0,configurable:!0,writable:!0,value:k}):S[E]=k,z=(S,E)=>{for(var k in E||(E={}))qi.call(E,k)&&Dt(S,k,E[k]);if(Ft)for(var k of Ft(E))Hi.call(E,k)&&Dt(S,k,E[k]);return S},hr=(S,E)=>Di(S,Bi(E));(function(S,E){typeof exports=="object"&&typeof module!="undefined"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(S=typeof globalThis!="undefined"?globalThis:S||self,E(S["@nhost/nhost-js"]={}))})(this,function(S){"use strict";var E=Object.defineProperty,k=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable,dr=(t,e,r)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pr=(t,e)=>{for(var r in e||(e={}))Bt.call(e,r)&&dr(t,r,e[r]);if(k)for(var r of k(e))qt.call(e,r)&&dr(t,r,e[r]);return t},Pe={exports:{}},mr=function(e,r){return function(){for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];return e.apply(r,s)}},Ht=mr,q=Object.prototype.toString;function ke(t){return Array.isArray(t)}function Ue(t){return typeof t=="undefined"}function Mt(t){return t!==null&&!Ue(t)&&t.constructor!==null&&!Ue(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function vr(t){return q.call(t)==="[object ArrayBuffer]"}function Jt(t){return q.call(t)==="[object FormData]"}function zt(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&vr(t.buffer),e}function Vt(t){return typeof t=="string"}function Wt(t){return typeof t=="number"}function yr(t){return t!==null&&typeof t=="object"}function se(t){if(q.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Xt(t){return q.call(t)==="[object Date]"}function Kt(t){return q.call(t)==="[object File]"}function Gt(t){return q.call(t)==="[object Blob]"}function gr(t){return q.call(t)==="[object Function]"}function Qt(t){return yr(t)&&gr(t.pipe)}function Yt(t){return q.call(t)==="[object URLSearchParams]"}function Zt(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function en(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Ie(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),ke(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}function _e(){var t={};function e(s,a){se(t[a])&&se(s)?t[a]=_e(t[a],s):se(s)?t[a]=_e({},s):ke(s)?t[a]=s.slice():t[a]=s}for(var r=0,n=arguments.length;r<n;r++)Ie(arguments[r],e);return t}function rn(t,e,r){return Ie(e,function(s,a){r&&typeof s=="function"?t[a]=Ht(s,r):t[a]=s}),t}function tn(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}var P={isArray:ke,isArrayBuffer:vr,isBuffer:Mt,isFormData:Jt,isArrayBufferView:zt,isString:Vt,isNumber:Wt,isObject:yr,isPlainObject:se,isUndefined:Ue,isDate:Xt,isFile:Kt,isBlob:Gt,isFunction:gr,isStream:Qt,isURLSearchParams:Yt,isStandardBrowserEnv:en,forEach:Ie,merge:_e,extend:rn,trim:Zt,stripBOM:tn},V=P;function wr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var $r=function(e,r,n){if(!r)return e;var s;if(n)s=n(r);else if(V.isURLSearchParams(r))s=r.toString();else{var a=[];V.forEach(r,function(c,g){c===null||typeof c=="undefined"||(V.isArray(c)?g=g+"[]":c=[c],V.forEach(c,function(d){V.isDate(d)?d=d.toISOString():V.isObject(d)&&(d=JSON.stringify(d)),a.push(wr(g)+"="+wr(d))}))}),s=a.join("&")}if(s){var i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e},nn=P;function ae(){this.handlers=[]}ae.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1},ae.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},ae.prototype.forEach=function(e){nn.forEach(this.handlers,function(n){n!==null&&e(n)})};var sn=ae,an=P,on=function(e,r){an.forEach(e,function(s,a){a!==r&&a.toUpperCase()===r.toUpperCase()&&(e[r]=s,delete e[a])})},br=function(e,r,n,s,a){return e.config=r,n&&(e.code=n),e.request=s,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},un=br,Sr=function(e,r,n,s,a){var i=new Error(e);return un(i,r,n,s,a)},cn=Sr,ln=function(e,r,n){var s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):r(cn("Request failed with status code "+n.status,n.config,null,n.request,n))},ie=P,fn=ie.isStandardBrowserEnv()?function(){return{write:function(r,n,s,a,i,u){var c=[];c.push(r+"="+encodeURIComponent(n)),ie.isNumber(s)&&c.push("expires="+new Date(s).toGMTString()),ie.isString(a)&&c.push("path="+a),ie.isString(i)&&c.push("domain="+i),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),hn=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},dn=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e},pn=hn,mn=dn,vn=function(e,r){return e&&!pn(r)?mn(e,r):r},je=P,yn=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],gn=function(e){var r={},n,s,a;return e&&je.forEach(e.split(`
|
|
2
|
+
`),function(u){if(a=u.indexOf(":"),n=je.trim(u.substr(0,a)).toLowerCase(),s=je.trim(u.substr(a+1)),n){if(r[n]&&yn.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([s]):r[n]=r[n]?r[n]+", "+s:s}}),r},Er=P,wn=Er.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function s(a){var i=a;return e&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(i){var u=Er.isString(i)?s(i):i;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}();function Le(t){this.message=t}Le.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Le.prototype.__CANCEL__=!0;var oe=Le,ue=P,$n=ln,bn=fn,Sn=$r,En=vn,Cn=gn,An=wn,Fe=Sr,On=le,Tn=oe,Cr=function(e){return new Promise(function(n,s){var a=e.data,i=e.headers,u=e.responseType,c;function g(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}ue.isFormData(a)&&delete i["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.Authorization="Basic "+btoa(d+":"+y)}var v=En(e.baseURL,e.url);o.open(e.method.toUpperCase(),Sn(v,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function N(){if(!!o){var $="getAllResponseHeaders"in o?Cn(o.getAllResponseHeaders()):null,R=!u||u==="text"||u==="json"?o.responseText:o.response,l={data:R,status:o.status,statusText:o.statusText,headers:$,config:e,request:o};$n(function(h){n(h),g()},function(h){s(h),g()},l),o=null}}if("onloadend"in o?o.onloadend=N:o.onreadystatechange=function(){!o||o.readyState!==4||o.status===0&&!(o.responseURL&&o.responseURL.indexOf("file:")===0)||setTimeout(N)},o.onabort=function(){!o||(s(Fe("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){s(Fe("Network Error",e,null,o)),o=null},o.ontimeout=function(){var R=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",l=e.transitional||On.transitional;e.timeoutErrorMessage&&(R=e.timeoutErrorMessage),s(Fe(R,e,l.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},ue.isStandardBrowserEnv()){var T=(e.withCredentials||An(v))&&e.xsrfCookieName?bn.read(e.xsrfCookieName):void 0;T&&(i[e.xsrfHeaderName]=T)}"setRequestHeader"in o&&ue.forEach(i,function(R,l){typeof a=="undefined"&&l.toLowerCase()==="content-type"?delete i[l]:o.setRequestHeader(l,R)}),ue.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),u&&u!=="json"&&(o.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&o.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function($){!o||(s(!$||$&&$.type?new Tn("canceled"):$),o.abort(),o=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),a||(a=null),o.send(a)})},C=P,Ar=on,xn=br,Rn={"Content-Type":"application/x-www-form-urlencoded"};function Or(t,e){!C.isUndefined(t)&&C.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Nn(){var t;return(typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(t=Cr),t}function Pn(t,e,r){if(C.isString(t))try{return(e||JSON.parse)(t),C.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var ce={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Nn(),transformRequest:[function(e,r){return Ar(r,"Accept"),Ar(r,"Content-Type"),C.isFormData(e)||C.isArrayBuffer(e)||C.isBuffer(e)||C.isStream(e)||C.isFile(e)||C.isBlob(e)?e:C.isArrayBufferView(e)?e.buffer:C.isURLSearchParams(e)?(Or(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):C.isObject(e)||r&&r["Content-Type"]==="application/json"?(Or(r,"application/json"),Pn(e)):e}],transformResponse:[function(e){var r=this.transitional||ce.transitional,n=r&&r.silentJSONParsing,s=r&&r.forcedJSONParsing,a=!n&&this.responseType==="json";if(a||s&&C.isString(e)&&e.length)try{return JSON.parse(e)}catch(i){if(a)throw i.name==="SyntaxError"?xn(i,this,"E_JSON_PARSE"):i}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};C.forEach(["delete","get","head"],function(e){ce.headers[e]={}}),C.forEach(["post","put","patch"],function(e){ce.headers[e]=C.merge(Rn)});var le=ce,kn=P,Un=le,In=function(e,r,n){var s=this||Un;return kn.forEach(n,function(i){e=i.call(s,e,r)}),e},Tr=function(e){return!!(e&&e.__CANCEL__)},xr=P,De=In,_n=Tr,jn=le,Ln=oe;function Be(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ln("canceled")}var Fn=function(e){Be(e),e.headers=e.headers||{},e.data=De.call(e,e.data,e.headers,e.transformRequest),e.headers=xr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),xr.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var r=e.adapter||jn.adapter;return r(e).then(function(s){return Be(e),s.data=De.call(e,s.data,s.headers,e.transformResponse),s},function(s){return _n(s)||(Be(e),s&&s.response&&(s.response.data=De.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})},U=P,Rr=function(e,r){r=r||{};var n={};function s(o,d){return U.isPlainObject(o)&&U.isPlainObject(d)?U.merge(o,d):U.isPlainObject(d)?U.merge({},d):U.isArray(d)?d.slice():d}function a(o){if(U.isUndefined(r[o])){if(!U.isUndefined(e[o]))return s(void 0,e[o])}else return s(e[o],r[o])}function i(o){if(!U.isUndefined(r[o]))return s(void 0,r[o])}function u(o){if(U.isUndefined(r[o])){if(!U.isUndefined(e[o]))return s(void 0,e[o])}else return s(void 0,r[o])}function c(o){if(o in r)return s(e[o],r[o]);if(o in e)return s(void 0,e[o])}var g={url:i,method:i,data:i,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return U.forEach(Object.keys(e).concat(Object.keys(r)),function(d){var y=g[d]||a,v=y(d);U.isUndefined(v)&&y!==c||(n[d]=v)}),n},Nr={version:"0.25.0"},Dn=Nr.version,qe={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){qe[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Pr={};qe.transitional=function(e,r,n){function s(a,i){return"[Axios v"+Dn+"] Transitional option '"+a+"'"+i+(n?". "+n:"")}return function(a,i,u){if(e===!1)throw new Error(s(i," has been removed"+(r?" in "+r:"")));return r&&!Pr[i]&&(Pr[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(a,i,u):!0}};function Bn(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var a=n[s],i=e[a];if(i){var u=t[a],c=u===void 0||i(u,a,t);if(c!==!0)throw new TypeError("option "+a+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+a)}}var qn={assertOptions:Bn,validators:qe},kr=P,Hn=$r,Ur=sn,Ir=Fn,fe=Rr,_r=qn,W=_r.validators;function ee(t){this.defaults=t,this.interceptors={request:new Ur,response:new Ur}}ee.prototype.request=function(e,r){if(typeof e=="string"?(r=r||{},r.url=e):r=e||{},!r.url)throw new Error("Provided config url is not valid");r=fe(this.defaults,r),r.method?r.method=r.method.toLowerCase():this.defaults.method?r.method=this.defaults.method.toLowerCase():r.method="get";var n=r.transitional;n!==void 0&&_r.assertOptions(n,{silentJSONParsing:W.transitional(W.boolean),forcedJSONParsing:W.transitional(W.boolean),clarifyTimeoutError:W.transitional(W.boolean)},!1);var s=[],a=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(r)===!1||(a=a&&v.synchronous,s.unshift(v.fulfilled,v.rejected))});var i=[];this.interceptors.response.forEach(function(v){i.push(v.fulfilled,v.rejected)});var u;if(!a){var c=[Ir,void 0];for(Array.prototype.unshift.apply(c,s),c=c.concat(i),u=Promise.resolve(r);c.length;)u=u.then(c.shift(),c.shift());return u}for(var g=r;s.length;){var o=s.shift(),d=s.shift();try{g=o(g)}catch(y){d(y);break}}try{u=Ir(g)}catch(y){return Promise.reject(y)}for(;i.length;)u=u.then(i.shift(),i.shift());return u},ee.prototype.getUri=function(e){if(!e.url)throw new Error("Provided config url is not valid");return e=fe(this.defaults,e),Hn(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},kr.forEach(["delete","get","head","options"],function(e){ee.prototype[e]=function(r,n){return this.request(fe(n||{},{method:e,url:r,data:(n||{}).data}))}}),kr.forEach(["post","put","patch"],function(e){ee.prototype[e]=function(r,n,s){return this.request(fe(s||{},{method:e,url:r,data:n}))}});var Mn=ee,Jn=oe;function X(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var r=this;this.promise.then(function(n){if(!!r._listeners){var s,a=r._listeners.length;for(s=0;s<a;s++)r._listeners[s](n);r._listeners=null}}),this.promise.then=function(n){var s,a=new Promise(function(i){r.subscribe(i),s=i}).then(n);return a.cancel=function(){r.unsubscribe(s)},a},t(function(s){r.reason||(r.reason=new Jn(s),e(r.reason))})}X.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},X.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]},X.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}},X.source=function(){var e,r=new X(function(s){e=s});return{token:r,cancel:e}};var zn=X,Vn=function(e){return function(n){return e.apply(null,n)}},Wn=P,Xn=function(e){return Wn.isObject(e)&&e.isAxiosError===!0},jr=P,Kn=mr,he=Mn,Gn=Rr,Qn=le;function Lr(t){var e=new he(t),r=Kn(he.prototype.request,e);return jr.extend(r,he.prototype,e),jr.extend(r,e),r.create=function(s){return Lr(Gn(t,s))},r}var D=Lr(Qn);D.Axios=he,D.Cancel=oe,D.CancelToken=zn,D.isCancel=Tr,D.VERSION=Nr.version,D.all=function(e){return Promise.all(e)},D.spread=Vn,D.isAxiosError=Xn,Pe.exports=D,Pe.exports.default=D;var Yn=Pe.exports;const Zn=500;class es{constructor({url:e=""}){this.url=e,this.httpClient=Yn.create({baseURL:this.url}),this.httpClient.interceptors.response.use(r=>r,r=>{var n,s,a,i,u,c;return Promise.reject({message:(i=(a=(s=(n=r.response)==null?void 0:n.data)==null?void 0:s.message)!=null?a:r.message)!=null?i:JSON.stringify(r),status:(c=(u=r.response)==null?void 0:u.status)!=null?c:Zn})})}async signUpEmailPassword(e){try{return{data:(await this.httpClient.post("/signup/email-password",e)).data,error:null}}catch(r){return{data:null,error:r}}}async signInEmailPassword(e){try{return{data:(await this.httpClient.post("/signin/email-password",e)).data,error:null}}catch(r){return{data:null,error:r}}}async signInPasswordlessEmail(e){try{return{data:(await this.httpClient.post("/signin/passwordless/email",e)).data,error:null}}catch(r){return{data:null,error:r}}}async signInPasswordlessSms(e){try{return{data:(await this.httpClient.post("/signin/passwordless/sms",e)).data,error:null}}catch(r){return{data:null,error:r}}}async signInPasswordlessSmsOtp(e){try{return{data:(await this.httpClient.post("/signin/passwordless/sms/otp",e)).data,error:null}}catch(r){return{data:null,error:r}}}async signOut(e){try{return await this.httpClient.post("/signout",e),{error:null}}catch(r){return{error:r}}}async refreshToken(e){try{const r=await this.httpClient.post("/token",e);return{error:null,session:r.data}}catch(r){return{error:r,session:null}}}async resetPassword(e){try{return await this.httpClient.post("/user/password/reset",e),{error:null}}catch(r){return{error:r}}}async changePassword(e){try{return await this.httpClient.post("/user/password",e,{headers:pr({},this.generateAuthHeaders())}),{error:null}}catch(r){return{error:r}}}async sendVerificationEmail(e){try{return await this.httpClient.post("/user/email/send-verification-email",e),{error:null}}catch(r){return{error:r}}}async changeEmail(e){try{return await this.httpClient.post("/user/email/change",e,{headers:pr({},this.generateAuthHeaders())}),{error:null}}catch(r){return{error:r}}}async deanonymize(e){try{return await this.httpClient.post("/user/deanonymize",e),{error:null}}catch(r){return{error:r}}}async verifyEmail(e){try{return{data:(await this.httpClient.post("/user/email/verify",e)).data,error:null}}catch(r){return{data:null,error:r}}}setAccessToken(e){this.accessToken=e}generateAuthHeaders(){return this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:null}}var Fr={},rs=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Dr="%[a-f0-9]{2}",Br=new RegExp(Dr,"gi"),qr=new RegExp("("+Dr+")+","gi");function He(t,e){try{return decodeURIComponent(t.join(""))}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],He(r),He(n))}function ts(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(Br),r=1;r<e.length;r++)t=He(e,r).join(""),e=t.match(Br);return t}}function ns(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=qr.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=ts(r[0]);n!==r[0]&&(e[r[0]]=n)}r=qr.exec(t)}e["%C2"]="\uFFFD";for(var s=Object.keys(e),a=0;a<s.length;a++){var i=s[a];t=t.replace(new RegExp(i,"g"),e[i])}return t}var ss=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return ns(t)}},as=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},is=function(t,e){for(var r={},n=Object.keys(t),s=Array.isArray(e),a=0;a<n.length;a++){var i=n[a],u=t[i];(s?e.indexOf(i)!==-1:e(i,u,t))&&(r[i]=u)}return r};(function(t){const e=rs,r=ss,n=as,s=is,a=l=>l==null,i=Symbol("encodeFragmentIdentifier");function u(l){switch(l.arrayFormat){case"index":return f=>(h,p)=>{const m=h.length;return p===void 0||l.skipNull&&p===null||l.skipEmptyString&&p===""?h:p===null?[...h,[o(f,l),"[",m,"]"].join("")]:[...h,[o(f,l),"[",o(m,l),"]=",o(p,l)].join("")]};case"bracket":return f=>(h,p)=>p===void 0||l.skipNull&&p===null||l.skipEmptyString&&p===""?h:p===null?[...h,[o(f,l),"[]"].join("")]:[...h,[o(f,l),"[]=",o(p,l)].join("")];case"colon-list-separator":return f=>(h,p)=>p===void 0||l.skipNull&&p===null||l.skipEmptyString&&p===""?h:p===null?[...h,[o(f,l),":list="].join("")]:[...h,[o(f,l),":list=",o(p,l)].join("")];case"comma":case"separator":case"bracket-separator":{const f=l.arrayFormat==="bracket-separator"?"[]=":"=";return h=>(p,m)=>m===void 0||l.skipNull&&m===null||l.skipEmptyString&&m===""?p:(m=m===null?"":m,p.length===0?[[o(h,l),f,o(m,l)].join("")]:[[p,o(m,l)].join(l.arrayFormatSeparator)])}default:return f=>(h,p)=>p===void 0||l.skipNull&&p===null||l.skipEmptyString&&p===""?h:p===null?[...h,o(f,l)]:[...h,[o(f,l),"=",o(p,l)].join("")]}}function c(l){let f;switch(l.arrayFormat){case"index":return(h,p,m)=>{if(f=/\[(\d*)\]$/.exec(h),h=h.replace(/\[\d*\]$/,""),!f){m[h]=p;return}m[h]===void 0&&(m[h]={}),m[h][f[1]]=p};case"bracket":return(h,p,m)=>{if(f=/(\[\])$/.exec(h),h=h.replace(/\[\]$/,""),!f){m[h]=p;return}if(m[h]===void 0){m[h]=[p];return}m[h]=[].concat(m[h],p)};case"colon-list-separator":return(h,p,m)=>{if(f=/(:list)$/.exec(h),h=h.replace(/:list$/,""),!f){m[h]=p;return}if(m[h]===void 0){m[h]=[p];return}m[h]=[].concat(m[h],p)};case"comma":case"separator":return(h,p,m)=>{const b=typeof p=="string"&&p.includes(l.arrayFormatSeparator),w=typeof p=="string"&&!b&&d(p,l).includes(l.arrayFormatSeparator);p=w?d(p,l):p;const L=b||w?p.split(l.arrayFormatSeparator).map(Li=>d(Li,l)):p===null?p:d(p,l);m[h]=L};case"bracket-separator":return(h,p,m)=>{const b=/(\[\])$/.test(h);if(h=h.replace(/\[\]$/,""),!b){m[h]=p&&d(p,l);return}const w=p===null?[]:p.split(l.arrayFormatSeparator).map(L=>d(L,l));if(m[h]===void 0){m[h]=w;return}m[h]=[].concat(m[h],w)};default:return(h,p,m)=>{if(m[h]===void 0){m[h]=p;return}m[h]=[].concat(m[h],p)}}}function g(l){if(typeof l!="string"||l.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function o(l,f){return f.encode?f.strict?e(l):encodeURIComponent(l):l}function d(l,f){return f.decode?r(l):l}function y(l){return Array.isArray(l)?l.sort():typeof l=="object"?y(Object.keys(l)).sort((f,h)=>Number(f)-Number(h)).map(f=>l[f]):l}function v(l){const f=l.indexOf("#");return f!==-1&&(l=l.slice(0,f)),l}function N(l){let f="";const h=l.indexOf("#");return h!==-1&&(f=l.slice(h)),f}function T(l){l=v(l);const f=l.indexOf("?");return f===-1?"":l.slice(f+1)}function $(l,f){return f.parseNumbers&&!Number.isNaN(Number(l))&&typeof l=="string"&&l.trim()!==""?l=Number(l):f.parseBooleans&&l!==null&&(l.toLowerCase()==="true"||l.toLowerCase()==="false")&&(l=l.toLowerCase()==="true"),l}function R(l,f){f=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},f),g(f.arrayFormatSeparator);const h=c(f),p=Object.create(null);if(typeof l!="string"||(l=l.trim().replace(/^[?#&]/,""),!l))return p;for(const m of l.split("&")){if(m==="")continue;let[b,w]=n(f.decode?m.replace(/\+/g," "):m,"=");w=w===void 0?null:["comma","separator","bracket-separator"].includes(f.arrayFormat)?w:d(w,f),h(d(b,f),w,p)}for(const m of Object.keys(p)){const b=p[m];if(typeof b=="object"&&b!==null)for(const w of Object.keys(b))b[w]=$(b[w],f);else p[m]=$(b,f)}return f.sort===!1?p:(f.sort===!0?Object.keys(p).sort():Object.keys(p).sort(f.sort)).reduce((m,b)=>{const w=p[b];return Boolean(w)&&typeof w=="object"&&!Array.isArray(w)?m[b]=y(w):m[b]=w,m},Object.create(null))}t.extract=T,t.parse=R,t.stringify=(l,f)=>{if(!l)return"";f=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},f),g(f.arrayFormatSeparator);const h=w=>f.skipNull&&a(l[w])||f.skipEmptyString&&l[w]==="",p=u(f),m={};for(const w of Object.keys(l))h(w)||(m[w]=l[w]);const b=Object.keys(m);return f.sort!==!1&&b.sort(f.sort),b.map(w=>{const L=l[w];return L===void 0?"":L===null?o(w,f):Array.isArray(L)?L.length===0&&f.arrayFormat==="bracket-separator"?o(w,f)+"[]":L.reduce(p(w),[]).join("&"):o(w,f)+"="+o(L,f)}).filter(w=>w.length>0).join("&")},t.parseUrl=(l,f)=>{f=Object.assign({decode:!0},f);const[h,p]=n(l,"#");return Object.assign({url:h.split("?")[0]||"",query:R(T(l),f)},f&&f.parseFragmentIdentifier&&p?{fragmentIdentifier:d(p,f)}:{})},t.stringifyUrl=(l,f)=>{f=Object.assign({encode:!0,strict:!0,[i]:!0},f);const h=v(l.url).split("?")[0]||"",p=t.extract(l.url),m=t.parse(p,{sort:!1}),b=Object.assign(m,l.query);let w=t.stringify(b,f);w&&(w=`?${w}`);let L=N(l.url);return l.fragmentIdentifier&&(L=`#${f[i]?o(l.fragmentIdentifier,f):l.fragmentIdentifier}`),`${h}${w}${L}`},t.pick=(l,f,h)=>{h=Object.assign({parseFragmentIdentifier:!0,[i]:!1},h);const{url:p,query:m,fragmentIdentifier:b}=t.parseUrl(l,h);return t.stringifyUrl({url:p,query:s(m,f),fragmentIdentifier:b},h)},t.exclude=(l,f,h)=>{const p=Array.isArray(f)?m=>!f.includes(m):(m,b)=>!f(m,b);return t.pick(l,p,h)}})(Fr);const H="nhostRefreshToken",de=()=>typeof window!="undefined";class os{constructor(){this.memory={}}setItem(e,r){this.memory[e]=r}getItem(e){return this.memory[e]}removeItem(e){delete this.memory[e]}}class us{constructor({url:e,autoRefreshToken:r=!0,autoLogin:n=!0,refreshIntervalTime:s,clientStorage:a,clientStorageType:i="web"}){this.refreshIntervalTime=s,a?this.clientStorage=a:this.clientStorage=de()?localStorage:new os,this.clientStorageType=i,this.onTokenChangedFunctions=[],this.onAuthChangedFunctions=[],this.refreshInterval,this.refreshSleepCheckInterval=0,this.refreshIntervalSleepCheckLastSample=Date.now(),this.sampleRate=2e3,this.url=e,this.autoRefreshToken=r,this.initAuthLoading=!0,this.session=null,this.api=new es({url:this.url});let u=null,c=!1;if(n&&de()&&window.location){const g=Fr.parse(window.location.toString().split("#")[1]);if("refreshToken"in g&&(u=g.refreshToken),"otp"in g&&"email"in g){const{otp:o,email:d}=g;this.signIn({otp:o,email:d}),c=!0}}!c&&n?this._autoLogin(u):u&&this._setItem(H,u)}async signUp(e){const{email:r,password:n}=e;if(r&&n){const{data:s,error:a}=await this.api.signUpEmailPassword(e);if(a)return{session:null,error:a};if(!s)return{session:null,error:{message:"An error occurred on sign up.",status:500}};const{session:i}=s;return i&&await this._setSession(i),{session:i,error:null}}return{session:null,error:{message:"Incorrect parameters",status:500}}}async signIn(e){if("provider"in e){const{provider:r}=e,n=`${this.url}/signin/provider/${r}`;return de()&&(window.location.href=n),{providerUrl:n,provider:r,session:null,mfa:null,error:null}}if("email"in e&&"password"in e){const{data:r,error:n}=await this.api.signInEmailPassword(e);if(n)return{session:null,mfa:null,error:n};if(!r)return{session:null,mfa:null,error:{message:"Incorrect Data",status:500}};const{session:s,mfa:a}=r;return s&&await this._setSession(s),{session:s,mfa:a,error:null}}if("email"in e&&!("otp"in e)){const{error:r}=await this.api.signInPasswordlessEmail(e);return r?{session:null,mfa:null,error:r}:{session:null,mfa:null,error:null}}if("phoneNumber"in e&&!("otp"in e)){const{error:r}=await this.api.signInPasswordlessSms(e);return r?{session:null,mfa:null,error:r}:{session:null,mfa:null,error:null}}if("otp"in e){const{data:r,error:n}=await this.api.signInPasswordlessSmsOtp(e);if(n)return{session:null,mfa:null,error:n};if(!r)return{session:null,mfa:null,error:{message:"Incorrect data",status:500}};const{session:s,mfa:a}=r;return s&&await this._setSession(s),{session:s,mfa:a,error:null}}return{session:null,mfa:null,error:{message:"Incorrect parameters",status:500}}}async signOut(e){const r=await this._getItem(H);this._clearSession();const{error:n}=await this.api.signOut({refreshToken:r,all:e==null?void 0:e.all});return{error:n}}async verifyEmail(e){const{data:r,error:n}=await this.api.verifyEmail(e);return{data:r,error:n}}async resetPassword(e){const{error:r}=await this.api.resetPassword(e);return{error:r}}async changePassword(e){const{error:r}=await this.api.changePassword(e);return{error:r}}async sendVerificationEmail(e){const{error:r}=await this.api.sendVerificationEmail(e);return{error:r}}async changeEmail(e){const{error:r}=await this.api.changeEmail(e);return{error:r}}async deanonymize(e){const{error:r}=await this.api.deanonymize(e);return{error:r}}onTokenChanged(e){this.onTokenChangedFunctions.push(e);const r=this.onTokenChangedFunctions.length-1;return()=>{try{this.onTokenChangedFunctions[r]=()=>{}}catch{console.warn("Unable to unsubscribe onTokenChanged function. Maybe the functions is already unsubscribed?")}}}onAuthStateChanged(e){this.onAuthChangedFunctions.push(e);const r=this.onAuthChangedFunctions.length-1;return()=>{try{this.onAuthChangedFunctions[r]=()=>{}}catch{console.warn("Unable to unsubscribe onAuthStateChanged function. Maybe you already did?")}}}isAuthenticated(){return this.session!==null}async isAuthenticatedAsync(){return new Promise(e=>{if(!this.initAuthLoading)e(this.isAuthenticated());else{const r=this.onAuthStateChanged((n,s)=>{e(n==="SIGNED_IN"),r()})}})}getAuthenticationStatus(){return this.initAuthLoading?{isAuthenticated:!1,isLoading:!0}:{isAuthenticated:this.session!==null,isLoading:!1}}getJWTToken(){return this.getAccessToken()}getAccessToken(){if(!!this.session)return this.session.accessToken}async refreshSession(e){const r=e||await this._getItem(H);return r||console.warn("no refresh token found. No way of refreshing session"),this._refreshTokens(r)}getSession(){return this.session}getUser(){return this.session?this.session.user:null}async _setItem(e,r){if(typeof r!="string"){console.error('value is not of type "string"');return}switch(this.clientStorageType){case"web":if(typeof this.clientStorage.setItem!="function"){console.error("this.clientStorage.setItem is not a function");break}this.clientStorage.setItem(e,r);break;case"custom":case"react-native":if(typeof this.clientStorage.setItem!="function"){console.error("this.clientStorage.setItem is not a function");break}await this.clientStorage.setItem(e,r);break;case"capacitor":if(typeof this.clientStorage.set!="function"){console.error("this.clientStorage.set is not a function");break}await this.clientStorage.set({key:e,value:r});break;case"expo-secure-storage":if(typeof this.clientStorage.setItemAsync!="function"){console.error("this.clientStorage.setItemAsync is not a function");break}this.clientStorage.setItemAsync(e,r);break}}async _getItem(e){switch(this.clientStorageType){case"web":if(typeof this.clientStorage.getItem!="function"){console.error("this.clientStorage.getItem is not a function");break}return this.clientStorage.getItem(e);case"custom":case"react-native":if(typeof this.clientStorage.getItem!="function"){console.error("this.clientStorage.getItem is not a function");break}return await this.clientStorage.getItem(e);case"capacitor":if(typeof this.clientStorage.get!="function"){console.error("this.clientStorage.get is not a function");break}return(await this.clientStorage.get({key:e})).value;case"expo-secure-storage":if(typeof this.clientStorage.getItemAsync!="function"){console.error("this.clientStorage.getItemAsync is not a function");break}return this.clientStorage.getItemAsync(e);default:return""}return""}async _removeItem(e){switch(this.clientStorageType){case"web":if(typeof this.clientStorage.removeItem!="function"){console.error("this.clientStorage.removeItem is not a function");break}return void this.clientStorage.removeItem(e);case"custom":case"react-native":if(typeof this.clientStorage.removeItem!="function"){console.error("this.clientStorage.removeItem is not a function");break}return void this.clientStorage.removeItem(e);case"capacitor":if(typeof this.clientStorage.remove!="function"){console.error("this.clientStorage.remove is not a function");break}await this.clientStorage.remove({key:e});break;case"expo-secure-storage":if(typeof this.clientStorage.deleteItemAsync!="function"){console.error("this.clientStorage.deleteItemAsync is not a function");break}this.clientStorage.deleteItemAsync(e);break}}_autoLogin(e){!de()||this._refreshTokens(e)}async _refreshTokens(e){const r=e||await this._getItem(H);if(!r){setTimeout(async()=>{await this._clearSession()},0);return}try{const{session:n,error:s}=await this.api.refreshToken({refreshToken:r});if(s&&s.status===401){await this._clearSession();return}if(!n)throw new Error("Invalid session data");await this._setSession(n),this.tokenChanged()}catch{}}tokenChanged(){for(const e of this.onTokenChangedFunctions)e(this.session)}authStateChanged({event:e,session:r}){e==="SIGNED_IN"&&r?this.api.setAccessToken(r.accessToken):this.api.setAccessToken(void 0);for(const n of this.onAuthChangedFunctions)n(e,r)}async _clearSession(){const{isLoading:e,isAuthenticated:r}=this.getAuthenticationStatus();this.session=null,this.initAuthLoading=!1,await this._removeItem(H),(e||r)&&(clearInterval(this.refreshInterval),clearInterval(this.refreshSleepCheckInterval),this.authStateChanged({event:"SIGNED_OUT",session:null}))}async _setSession(e){const{isAuthenticated:r}=this.getAuthenticationStatus();if(this.session=e,await this._setItem(H,e.refreshToken),this.autoRefreshToken&&!r){const n=e.accessTokenExpiresIn,s=this.refreshIntervalTime?this.refreshIntervalTime:Math.max(1,n-1);this.refreshInterval=setInterval(async()=>{const a=await this._getItem(H);await this._refreshTokens(a)},s*1e3),this.refreshIntervalSleepCheckLastSample=Date.now(),this.refreshSleepCheckInterval=setInterval(async()=>{if(Date.now()-this.refreshIntervalSleepCheckLastSample>=this.sampleRate*2){const a=await this._getItem(H);await this._refreshTokens(a)}this.refreshIntervalSleepCheckLastSample=Date.now()},this.sampleRate),this.authStateChanged({event:"SIGNED_IN",session:this.session})}this.initAuthLoading=!1}}var cs=Object.defineProperty,ls=Object.defineProperties,fs=Object.getOwnPropertyDescriptors,Hr=Object.getOwnPropertySymbols,hs=Object.prototype.hasOwnProperty,ds=Object.prototype.propertyIsEnumerable,Mr=(t,e,r)=>e in t?cs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,re=(t,e)=>{for(var r in e||(e={}))hs.call(e,r)&&Mr(t,r,e[r]);if(Hr)for(var r of Hr(e))ds.call(e,r)&&Mr(t,r,e[r]);return t},ps=(t,e)=>ls(t,fs(e)),Me={exports:{}},Jr=function(e,r){return function(){for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];return e.apply(r,s)}},ms=Jr,M=Object.prototype.toString;function Je(t){return M.call(t)==="[object Array]"}function ze(t){return typeof t=="undefined"}function vs(t){return t!==null&&!ze(t)&&t.constructor!==null&&!ze(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function ys(t){return M.call(t)==="[object ArrayBuffer]"}function gs(t){return typeof FormData!="undefined"&&t instanceof FormData}function ws(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function $s(t){return typeof t=="string"}function bs(t){return typeof t=="number"}function zr(t){return t!==null&&typeof t=="object"}function pe(t){if(M.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Ss(t){return M.call(t)==="[object Date]"}function Es(t){return M.call(t)==="[object File]"}function Cs(t){return M.call(t)==="[object Blob]"}function Vr(t){return M.call(t)==="[object Function]"}function As(t){return zr(t)&&Vr(t.pipe)}function Os(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function Ts(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function xs(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function Ve(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Je(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}function We(){var t={};function e(s,a){pe(t[a])&&pe(s)?t[a]=We(t[a],s):pe(s)?t[a]=We({},s):Je(s)?t[a]=s.slice():t[a]=s}for(var r=0,n=arguments.length;r<n;r++)Ve(arguments[r],e);return t}function Rs(t,e,r){return Ve(e,function(s,a){r&&typeof s=="function"?t[a]=ms(s,r):t[a]=s}),t}function Ns(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}var I={isArray:Je,isArrayBuffer:ys,isBuffer:vs,isFormData:gs,isArrayBufferView:ws,isString:$s,isNumber:bs,isObject:zr,isPlainObject:pe,isUndefined:ze,isDate:Ss,isFile:Es,isBlob:Cs,isFunction:Vr,isStream:As,isURLSearchParams:Os,isStandardBrowserEnv:xs,forEach:Ve,merge:We,extend:Rs,trim:Ts,stripBOM:Ns},K=I;function Wr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Xr=function(e,r,n){if(!r)return e;var s;if(n)s=n(r);else if(K.isURLSearchParams(r))s=r.toString();else{var a=[];K.forEach(r,function(c,g){c===null||typeof c=="undefined"||(K.isArray(c)?g=g+"[]":c=[c],K.forEach(c,function(d){K.isDate(d)?d=d.toISOString():K.isObject(d)&&(d=JSON.stringify(d)),a.push(Wr(g)+"="+Wr(d))}))}),s=a.join("&")}if(s){var i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e},Ps=I;function me(){this.handlers=[]}me.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1},me.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},me.prototype.forEach=function(e){Ps.forEach(this.handlers,function(n){n!==null&&e(n)})};var ks=me,Us=I,Is=function(e,r){Us.forEach(e,function(s,a){a!==r&&a.toUpperCase()===r.toUpperCase()&&(e[r]=s,delete e[a])})},Kr=function(e,r,n,s,a){return e.config=r,n&&(e.code=n),e.request=s,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},_s=Kr,Gr=function(e,r,n,s,a){var i=new Error(e);return _s(i,r,n,s,a)},js=Gr,Ls=function(e,r,n){var s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):r(js("Request failed with status code "+n.status,n.config,null,n.request,n))},ve=I,Fs=ve.isStandardBrowserEnv()?function(){return{write:function(r,n,s,a,i,u){var c=[];c.push(r+"="+encodeURIComponent(n)),ve.isNumber(s)&&c.push("expires="+new Date(s).toGMTString()),ve.isString(a)&&c.push("path="+a),ve.isString(i)&&c.push("domain="+i),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Ds=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},Bs=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e},qs=Ds,Hs=Bs,Ms=function(e,r){return e&&!qs(r)?Hs(e,r):r},Xe=I,Js=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],zs=function(e){var r={},n,s,a;return e&&Xe.forEach(e.split(`
|
|
3
|
+
`),function(u){if(a=u.indexOf(":"),n=Xe.trim(u.substr(0,a)).toLowerCase(),s=Xe.trim(u.substr(a+1)),n){if(r[n]&&Js.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([s]):r[n]=r[n]?r[n]+", "+s:s}}),r},Qr=I,Vs=Qr.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function s(a){var i=a;return e&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(i){var u=Qr.isString(i)?s(i):i;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}(),ye=I,Ws=Ls,Xs=Fs,Ks=Xr,Gs=Ms,Qs=zs,Ys=Vs,Ke=Gr,Yr=function(e){return new Promise(function(n,s){var a=e.data,i=e.headers,u=e.responseType;ye.isFormData(a)&&delete i["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var g=e.auth.username||"",o=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.Authorization="Basic "+btoa(g+":"+o)}var d=Gs(e.baseURL,e.url);c.open(e.method.toUpperCase(),Ks(d,e.params,e.paramsSerializer),!0),c.timeout=e.timeout;function y(){if(!!c){var N="getAllResponseHeaders"in c?Qs(c.getAllResponseHeaders()):null,T=!u||u==="text"||u==="json"?c.responseText:c.response,$={data:T,status:c.status,statusText:c.statusText,headers:N,config:e,request:c};Ws(n,s,$),c=null}}if("onloadend"in c?c.onloadend=y:c.onreadystatechange=function(){!c||c.readyState!==4||c.status===0&&!(c.responseURL&&c.responseURL.indexOf("file:")===0)||setTimeout(y)},c.onabort=function(){!c||(s(Ke("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){s(Ke("Network Error",e,null,c)),c=null},c.ontimeout=function(){var T="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(T=e.timeoutErrorMessage),s(Ke(T,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},ye.isStandardBrowserEnv()){var v=(e.withCredentials||Ys(d))&&e.xsrfCookieName?Xs.read(e.xsrfCookieName):void 0;v&&(i[e.xsrfHeaderName]=v)}"setRequestHeader"in c&&ye.forEach(i,function(T,$){typeof a=="undefined"&&$.toLowerCase()==="content-type"?delete i[$]:c.setRequestHeader($,T)}),ye.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),u&&u!=="json"&&(c.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&c.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(T){!c||(c.abort(),s(T),c=null)}),a||(a=null),c.send(a)})},A=I,Zr=Is,Zs=Kr,ea={"Content-Type":"application/x-www-form-urlencoded"};function et(t,e){!A.isUndefined(t)&&A.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function ra(){var t;return(typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(t=Yr),t}function ta(t,e,r){if(A.isString(t))try{return(e||JSON.parse)(t),A.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var ge={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:ra(),transformRequest:[function(e,r){return Zr(r,"Accept"),Zr(r,"Content-Type"),A.isFormData(e)||A.isArrayBuffer(e)||A.isBuffer(e)||A.isStream(e)||A.isFile(e)||A.isBlob(e)?e:A.isArrayBufferView(e)?e.buffer:A.isURLSearchParams(e)?(et(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):A.isObject(e)||r&&r["Content-Type"]==="application/json"?(et(r,"application/json"),ta(e)):e}],transformResponse:[function(e){var r=this.transitional,n=r&&r.silentJSONParsing,s=r&&r.forcedJSONParsing,a=!n&&this.responseType==="json";if(a||s&&A.isString(e)&&e.length)try{return JSON.parse(e)}catch(i){if(a)throw i.name==="SyntaxError"?Zs(i,this,"E_JSON_PARSE"):i}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};ge.headers={common:{Accept:"application/json, text/plain, */*"}},A.forEach(["delete","get","head"],function(e){ge.headers[e]={}}),A.forEach(["post","put","patch"],function(e){ge.headers[e]=A.merge(ea)});var Ge=ge,na=I,sa=Ge,aa=function(e,r,n){var s=this||sa;return na.forEach(n,function(i){e=i.call(s,e,r)}),e},rt=function(e){return!!(e&&e.__CANCEL__)},tt=I,Qe=aa,ia=rt,oa=Ge;function Ye(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var ua=function(e){Ye(e),e.headers=e.headers||{},e.data=Qe.call(e,e.data,e.headers,e.transformRequest),e.headers=tt.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),tt.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var r=e.adapter||oa.adapter;return r(e).then(function(s){return Ye(e),s.data=Qe.call(e,s.data,s.headers,e.transformResponse),s},function(s){return ia(s)||(Ye(e),s&&s.response&&(s.response.data=Qe.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})},x=I,nt=function(e,r){r=r||{};var n={},s=["url","method","data"],a=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],u=["validateStatus"];function c(y,v){return x.isPlainObject(y)&&x.isPlainObject(v)?x.merge(y,v):x.isPlainObject(v)?x.merge({},v):x.isArray(v)?v.slice():v}function g(y){x.isUndefined(r[y])?x.isUndefined(e[y])||(n[y]=c(void 0,e[y])):n[y]=c(e[y],r[y])}x.forEach(s,function(v){x.isUndefined(r[v])||(n[v]=c(void 0,r[v]))}),x.forEach(a,g),x.forEach(i,function(v){x.isUndefined(r[v])?x.isUndefined(e[v])||(n[v]=c(void 0,e[v])):n[v]=c(void 0,r[v])}),x.forEach(u,function(v){v in r?n[v]=c(e[v],r[v]):v in e&&(n[v]=c(void 0,e[v]))});var o=s.concat(a).concat(i).concat(u),d=Object.keys(e).concat(Object.keys(r)).filter(function(v){return o.indexOf(v)===-1});return x.forEach(d,g),n},ca={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},st=ca,Ze={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){Ze[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var at={},la=st.version.split(".");function it(t,e){for(var r=e?e.split("."):la,n=t.split("."),s=0;s<3;s++){if(r[s]>n[s])return!0;if(r[s]<n[s])return!1}return!1}Ze.transitional=function(e,r,n){var s=r&&it(r);function a(i,u){return"[Axios v"+st.version+"] Transitional option '"+i+"'"+u+(n?". "+n:"")}return function(i,u,c){if(e===!1)throw new Error(a(u," has been removed in "+r));return s&&!at[u]&&(at[u]=!0,console.warn(a(u," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,u,c):!0}};function fa(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var a=n[s],i=e[a];if(i){var u=t[a],c=u===void 0||i(u,a,t);if(c!==!0)throw new TypeError("option "+a+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+a)}}var ha={isOlderVersion:it,assertOptions:fa,validators:Ze},ot=I,da=Xr,ut=ks,ct=ua,we=nt,lt=ha,G=lt.validators;function te(t){this.defaults=t,this.interceptors={request:new ut,response:new ut}}te.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=we(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&<.assertOptions(r,{silentJSONParsing:G.transitional(G.boolean,"1.0.0"),forcedJSONParsing:G.transitional(G.boolean,"1.0.0"),clarifyTimeoutError:G.transitional(G.boolean,"1.0.0")},!1);var n=[],s=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(e)===!1||(s=s&&y.synchronous,n.unshift(y.fulfilled,y.rejected))});var a=[];this.interceptors.response.forEach(function(y){a.push(y.fulfilled,y.rejected)});var i;if(!s){var u=[ct,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(a),i=Promise.resolve(e);u.length;)i=i.then(u.shift(),u.shift());return i}for(var c=e;n.length;){var g=n.shift(),o=n.shift();try{c=g(c)}catch(d){o(d);break}}try{i=ct(c)}catch(d){return Promise.reject(d)}for(;a.length;)i=i.then(a.shift(),a.shift());return i},te.prototype.getUri=function(e){return e=we(this.defaults,e),da(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},ot.forEach(["delete","get","head","options"],function(e){te.prototype[e]=function(r,n){return this.request(we(n||{},{method:e,url:r,data:(n||{}).data}))}}),ot.forEach(["post","put","patch"],function(e){te.prototype[e]=function(r,n,s){return this.request(we(s||{},{method:e,url:r,data:n}))}});var pa=te;function er(t){this.message=t}er.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},er.prototype.__CANCEL__=!0;var ft=er,ma=ft;function $e(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var r=this;t(function(s){r.reason||(r.reason=new ma(s),e(r.reason))})}$e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},$e.source=function(){var e,r=new $e(function(s){e=s});return{token:r,cancel:e}};var va=$e,ya=function(e){return function(n){return e.apply(null,n)}},ga=function(e){return typeof e=="object"&&e.isAxiosError===!0},ht=I,wa=Jr,be=pa,$a=nt,ba=Ge;function dt(t){var e=new be(t),r=wa(be.prototype.request,e);return ht.extend(r,be.prototype,e),ht.extend(r,e),r}var F=dt(ba);F.Axios=be,F.create=function(e){return dt($a(F.defaults,e))},F.Cancel=ft,F.CancelToken=va,F.isCancel=rt,F.all=function(e){return Promise.all(e)},F.spread=ya,F.isAxiosError=ga,Me.exports=F,Me.exports.default=F;var Sa=Me.exports;class Ea{constructor({url:e}){this.url=e,this.httpClient=Sa.create({baseURL:this.url})}async upload(e){try{return{fileMetadata:(await this.httpClient.post("/files",e.file,{headers:re(re({},this.generateUploadHeaders(e)),this.generateAuthHeaders())})).data,error:null}}catch(r){return{fileMetadata:null,error:r}}}async getPresignedUrl(e){try{const{fileId:r}=e;return{presignedUrl:(await this.httpClient.get(`/files/${r}/presignedurl`,{headers:re({},this.generateAuthHeaders())})).data,error:null}}catch(r){return{presignedUrl:null,error:r}}}async delete(e){try{const{fileId:r}=e;return await this.httpClient.delete(`/files/${r}`,{headers:re({},this.generateAuthHeaders())}),{error:null}}catch(r){return{error:r}}}setAccessToken(e){this.accessToken=e}generateUploadHeaders(e){const{bucketId:r,name:n,id:s}=e,a={};return r&&(a["x-nhost-bucket-id"]=r),s&&(a["x-nhost-file-id"]=s),n&&(a["x-nhost-file-name"]=n),a}generateAuthHeaders(){return this.accessToken?{Authorization:`Bearer ${this.accessToken}`}:null}}class Ca{constructor({url:e}){this.url=e,this.api=new Ea({url:e})}async upload(e){const r=new FormData;r.append("file",e.file);const{fileMetadata:n,error:s}=await this.api.upload(ps(re({},e),{file:r}));return s?{fileMetadata:null,error:s}:n?{fileMetadata:n,error:null}:{fileMetadata:null,error:new Error("Invalid file returned")}}getUrl(e){const{fileId:r}=e;return`${this.url}/files/${r}`}async getPresignedUrl(e){const{presignedUrl:r,error:n}=await this.api.getPresignedUrl(e);return n?{presignedUrl:null,error:n}:r?{presignedUrl:r,error:null}:{presignedUrl:null,error:new Error("Invalid file id")}}async delete(e){const{error:r}=await this.api.delete(e);return r?{error:r}:{error:null}}setAccessToken(e){this.api.setAccessToken(e)}}var rr={exports:{}},pt=function(e,r){return function(){for(var s=new Array(arguments.length),a=0;a<s.length;a++)s[a]=arguments[a];return e.apply(r,s)}},Aa=pt,J=Object.prototype.toString;function tr(t){return J.call(t)==="[object Array]"}function nr(t){return typeof t=="undefined"}function Oa(t){return t!==null&&!nr(t)&&t.constructor!==null&&!nr(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Ta(t){return J.call(t)==="[object ArrayBuffer]"}function xa(t){return typeof FormData!="undefined"&&t instanceof FormData}function Ra(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Na(t){return typeof t=="string"}function Pa(t){return typeof t=="number"}function mt(t){return t!==null&&typeof t=="object"}function Se(t){if(J.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ka(t){return J.call(t)==="[object Date]"}function Ua(t){return J.call(t)==="[object File]"}function Ia(t){return J.call(t)==="[object Blob]"}function vt(t){return J.call(t)==="[object Function]"}function _a(t){return mt(t)&&vt(t.pipe)}function ja(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function La(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Fa(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function sr(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),tr(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.call(null,t[s],s,t)}function ar(){var t={};function e(s,a){Se(t[a])&&Se(s)?t[a]=ar(t[a],s):Se(s)?t[a]=ar({},s):tr(s)?t[a]=s.slice():t[a]=s}for(var r=0,n=arguments.length;r<n;r++)sr(arguments[r],e);return t}function Da(t,e,r){return sr(e,function(s,a){r&&typeof s=="function"?t[a]=Aa(s,r):t[a]=s}),t}function Ba(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}var _={isArray:tr,isArrayBuffer:Ta,isBuffer:Oa,isFormData:xa,isArrayBufferView:Ra,isString:Na,isNumber:Pa,isObject:mt,isPlainObject:Se,isUndefined:nr,isDate:ka,isFile:Ua,isBlob:Ia,isFunction:vt,isStream:_a,isURLSearchParams:ja,isStandardBrowserEnv:Fa,forEach:sr,merge:ar,extend:Da,trim:La,stripBOM:Ba},Q=_;function yt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var gt=function(e,r,n){if(!r)return e;var s;if(n)s=n(r);else if(Q.isURLSearchParams(r))s=r.toString();else{var a=[];Q.forEach(r,function(c,g){c===null||typeof c=="undefined"||(Q.isArray(c)?g=g+"[]":c=[c],Q.forEach(c,function(d){Q.isDate(d)?d=d.toISOString():Q.isObject(d)&&(d=JSON.stringify(d)),a.push(yt(g)+"="+yt(d))}))}),s=a.join("&")}if(s){var i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e},qa=_;function Ee(){this.handlers=[]}Ee.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1},Ee.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},Ee.prototype.forEach=function(e){qa.forEach(this.handlers,function(n){n!==null&&e(n)})};var Ha=Ee,Ma=_,Ja=function(e,r){Ma.forEach(e,function(s,a){a!==r&&a.toUpperCase()===r.toUpperCase()&&(e[r]=s,delete e[a])})},wt=function(e,r,n,s,a){return e.config=r,n&&(e.code=n),e.request=s,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},za=wt,$t=function(e,r,n,s,a){var i=new Error(e);return za(i,r,n,s,a)},Va=$t,Wa=function(e,r,n){var s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):r(Va("Request failed with status code "+n.status,n.config,null,n.request,n))},Ce=_,Xa=Ce.isStandardBrowserEnv()?function(){return{write:function(r,n,s,a,i,u){var c=[];c.push(r+"="+encodeURIComponent(n)),Ce.isNumber(s)&&c.push("expires="+new Date(s).toGMTString()),Ce.isString(a)&&c.push("path="+a),Ce.isString(i)&&c.push("domain="+i),u===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Ka=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},Ga=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e},Qa=Ka,Ya=Ga,Za=function(e,r){return e&&!Qa(r)?Ya(e,r):r},ir=_,ei=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],ri=function(e){var r={},n,s,a;return e&&ir.forEach(e.split(`
|
|
4
|
+
`),function(u){if(a=u.indexOf(":"),n=ir.trim(u.substr(0,a)).toLowerCase(),s=ir.trim(u.substr(a+1)),n){if(r[n]&&ei.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([s]):r[n]=r[n]?r[n]+", "+s:s}}),r},bt=_,ti=bt.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function s(a){var i=a;return e&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=s(window.location.href),function(i){var u=bt.isString(i)?s(i):i;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}();function or(t){this.message=t}or.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},or.prototype.__CANCEL__=!0;var Ae=or,Oe=_,ni=Wa,si=Xa,ai=gt,ii=Za,oi=ri,ui=ti,ur=$t,ci=xe,li=Ae,St=function(e){return new Promise(function(n,s){var a=e.data,i=e.headers,u=e.responseType,c;function g(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}Oe.isFormData(a)&&delete i["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.Authorization="Basic "+btoa(d+":"+y)}var v=ii(e.baseURL,e.url);o.open(e.method.toUpperCase(),ai(v,e.params,e.paramsSerializer),!0),o.timeout=e.timeout;function N(){if(!!o){var $="getAllResponseHeaders"in o?oi(o.getAllResponseHeaders()):null,R=!u||u==="text"||u==="json"?o.responseText:o.response,l={data:R,status:o.status,statusText:o.statusText,headers:$,config:e,request:o};ni(function(h){n(h),g()},function(h){s(h),g()},l),o=null}}if("onloadend"in o?o.onloadend=N:o.onreadystatechange=function(){!o||o.readyState!==4||o.status===0&&!(o.responseURL&&o.responseURL.indexOf("file:")===0)||setTimeout(N)},o.onabort=function(){!o||(s(ur("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){s(ur("Network Error",e,null,o)),o=null},o.ontimeout=function(){var R=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",l=e.transitional||ci.transitional;e.timeoutErrorMessage&&(R=e.timeoutErrorMessage),s(ur(R,e,l.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",o)),o=null},Oe.isStandardBrowserEnv()){var T=(e.withCredentials||ui(v))&&e.xsrfCookieName?si.read(e.xsrfCookieName):void 0;T&&(i[e.xsrfHeaderName]=T)}"setRequestHeader"in o&&Oe.forEach(i,function(R,l){typeof a=="undefined"&&l.toLowerCase()==="content-type"?delete i[l]:o.setRequestHeader(l,R)}),Oe.isUndefined(e.withCredentials)||(o.withCredentials=!!e.withCredentials),u&&u!=="json"&&(o.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&o.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(c=function($){!o||(s(!$||$&&$.type?new li("canceled"):$),o.abort(),o=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c))),a||(a=null),o.send(a)})},O=_,Et=Ja,fi=wt,hi={"Content-Type":"application/x-www-form-urlencoded"};function Ct(t,e){!O.isUndefined(t)&&O.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function di(){var t;return(typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(t=St),t}function pi(t,e,r){if(O.isString(t))try{return(e||JSON.parse)(t),O.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var Te={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:di(),transformRequest:[function(e,r){return Et(r,"Accept"),Et(r,"Content-Type"),O.isFormData(e)||O.isArrayBuffer(e)||O.isBuffer(e)||O.isStream(e)||O.isFile(e)||O.isBlob(e)?e:O.isArrayBufferView(e)?e.buffer:O.isURLSearchParams(e)?(Ct(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):O.isObject(e)||r&&r["Content-Type"]==="application/json"?(Ct(r,"application/json"),pi(e)):e}],transformResponse:[function(e){var r=this.transitional||Te.transitional,n=r&&r.silentJSONParsing,s=r&&r.forcedJSONParsing,a=!n&&this.responseType==="json";if(a||s&&O.isString(e)&&e.length)try{return JSON.parse(e)}catch(i){if(a)throw i.name==="SyntaxError"?fi(i,this,"E_JSON_PARSE"):i}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};O.forEach(["delete","get","head"],function(e){Te.headers[e]={}}),O.forEach(["post","put","patch"],function(e){Te.headers[e]=O.merge(hi)});var xe=Te,mi=_,vi=xe,yi=function(e,r,n){var s=this||vi;return mi.forEach(n,function(i){e=i.call(s,e,r)}),e},At=function(e){return!!(e&&e.__CANCEL__)},Ot=_,cr=yi,gi=At,wi=xe,$i=Ae;function lr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new $i("canceled")}var bi=function(e){lr(e),e.headers=e.headers||{},e.data=cr.call(e,e.data,e.headers,e.transformRequest),e.headers=Ot.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Ot.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var r=e.adapter||wi.adapter;return r(e).then(function(s){return lr(e),s.data=cr.call(e,s.data,s.headers,e.transformResponse),s},function(s){return gi(s)||(lr(e),s&&s.response&&(s.response.data=cr.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})},j=_,Tt=function(e,r){r=r||{};var n={};function s(o,d){return j.isPlainObject(o)&&j.isPlainObject(d)?j.merge(o,d):j.isPlainObject(d)?j.merge({},d):j.isArray(d)?d.slice():d}function a(o){if(j.isUndefined(r[o])){if(!j.isUndefined(e[o]))return s(void 0,e[o])}else return s(e[o],r[o])}function i(o){if(!j.isUndefined(r[o]))return s(void 0,r[o])}function u(o){if(j.isUndefined(r[o])){if(!j.isUndefined(e[o]))return s(void 0,e[o])}else return s(void 0,r[o])}function c(o){if(o in r)return s(e[o],r[o]);if(o in e)return s(void 0,e[o])}var g={url:i,method:i,data:i,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c};return j.forEach(Object.keys(e).concat(Object.keys(r)),function(d){var y=g[d]||a,v=y(d);j.isUndefined(v)&&y!==c||(n[d]=v)}),n},xt={version:"0.23.0"},Si=xt.version,fr={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){fr[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Rt={};fr.transitional=function(e,r,n){function s(a,i){return"[Axios v"+Si+"] Transitional option '"+a+"'"+i+(n?". "+n:"")}return function(a,i,u){if(e===!1)throw new Error(s(i," has been removed"+(r?" in "+r:"")));return r&&!Rt[i]&&(Rt[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(a,i,u):!0}};function Ei(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),s=n.length;s-- >0;){var a=n[s],i=e[a];if(i){var u=t[a],c=u===void 0||i(u,a,t);if(c!==!0)throw new TypeError("option "+a+" must be "+c);continue}if(r!==!0)throw Error("Unknown option "+a)}}var Ci={assertOptions:Ei,validators:fr},Nt=_,Ai=gt,Pt=Ha,kt=bi,Re=Tt,Ut=Ci,Y=Ut.validators;function ne(t){this.defaults=t,this.interceptors={request:new Pt,response:new Pt}}ne.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=Re(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&Ut.assertOptions(r,{silentJSONParsing:Y.transitional(Y.boolean),forcedJSONParsing:Y.transitional(Y.boolean),clarifyTimeoutError:Y.transitional(Y.boolean)},!1);var n=[],s=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(e)===!1||(s=s&&y.synchronous,n.unshift(y.fulfilled,y.rejected))});var a=[];this.interceptors.response.forEach(function(y){a.push(y.fulfilled,y.rejected)});var i;if(!s){var u=[kt,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(a),i=Promise.resolve(e);u.length;)i=i.then(u.shift(),u.shift());return i}for(var c=e;n.length;){var g=n.shift(),o=n.shift();try{c=g(c)}catch(d){o(d);break}}try{i=kt(c)}catch(d){return Promise.reject(d)}for(;a.length;)i=i.then(a.shift(),a.shift());return i},ne.prototype.getUri=function(e){return e=Re(this.defaults,e),Ai(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Nt.forEach(["delete","get","head","options"],function(e){ne.prototype[e]=function(r,n){return this.request(Re(n||{},{method:e,url:r,data:(n||{}).data}))}}),Nt.forEach(["post","put","patch"],function(e){ne.prototype[e]=function(r,n,s){return this.request(Re(s||{},{method:e,url:r,data:n}))}});var Oi=ne,Ti=Ae;function Z(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var r=this;this.promise.then(function(n){if(!!r._listeners){var s,a=r._listeners.length;for(s=0;s<a;s++)r._listeners[s](n);r._listeners=null}}),this.promise.then=function(n){var s,a=new Promise(function(i){r.subscribe(i),s=i}).then(n);return a.cancel=function(){r.unsubscribe(s)},a},t(function(s){r.reason||(r.reason=new Ti(s),e(r.reason))})}Z.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Z.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]},Z.prototype.unsubscribe=function(e){if(!!this._listeners){var r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}},Z.source=function(){var e,r=new Z(function(s){e=s});return{token:r,cancel:e}};var xi=Z,Ri=function(e){return function(n){return e.apply(null,n)}},Ni=function(e){return typeof e=="object"&&e.isAxiosError===!0},It=_,Pi=pt,Ne=Oi,ki=Tt,Ui=xe;function _t(t){var e=new Ne(t),r=Pi(Ne.prototype.request,e);return It.extend(r,Ne.prototype,e),It.extend(r,e),r.create=function(s){return _t(ki(t,s))},r}var B=_t(Ui);B.Axios=Ne,B.Cancel=Ae,B.CancelToken=xi,B.isCancel=At,B.VERSION=xt.version,B.all=function(e){return Promise.all(e)},B.spread=Ri,B.isAxiosError=Ni,rr.exports=B,rr.exports.default=B;var jt=rr.exports;class Ii{constructor(e){const{url:r}=e;this.accessToken=null,this.instance=jt.create({baseURL:r})}async call(e,r,n){const s=z(z({},this.generateAccessTokenHeaders()),n==null?void 0:n.headers);let a;try{a=await this.instance.post(e,r,hr(z({},n),{headers:s}))}catch(i){if(i instanceof Error)return{res:null,error:i}}return a?{res:a,error:null}:{res:null,error:new Error("Unable to make post request to funtion")}}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}}class _i{constructor(e){const{url:r}=e;this.url=r,this.accessToken=null,this.instance=jt.create({baseURL:r})}async request(e,r,n){const s=z(z({},n==null?void 0:n.headers),this.generateAccessTokenHeaders()),a="";let i;try{i=(await this.instance.post("",{operationName:a||void 0,query:e,variables:r},hr(z({},n),{headers:s}))).data}catch(u){return u instanceof Error?{data:null,error:u}:(console.error(u),{data:null,error:new Error("Unable to get do GraphQL request")})}return typeof i!="object"||Array.isArray(i)||i===null?{data:null,error:new Error("incorrect response data from GraphQL server")}:(i=i,i.errors?{data:null,error:i.errors}:{data:i.data,error:null})}getUrl(){return this.url}setAccessToken(e){if(!e){this.accessToken=null;return}this.accessToken=e}generateAccessTokenHeaders(){if(!!this.accessToken)return{Authorization:`Bearer ${this.accessToken}`}}}class Lt{constructor(e){if(!e.backendUrl)throw new Error("Please specify a `backendUrl`. Docs: [todo]!");const{backendUrl:r,refreshIntervalTime:n,clientStorage:s,clientStorageType:a,autoRefreshToken:i,autoLogin:u}=e;this.auth=new us({url:`${r}/v1/auth`,refreshIntervalTime:n,clientStorage:s,clientStorageType:a,autoRefreshToken:i,autoLogin:u}),this.storage=new Ca({url:`${r}/v1/storage`}),this.functions=new Ii({url:`${r}/v1/functions`}),this.graphql=new _i({url:`${r}/v1/graphql`}),this.storage.setAccessToken(this.auth.getAccessToken()),this.functions.setAccessToken(this.auth.getAccessToken()),this.graphql.setAccessToken(this.auth.getAccessToken()),this.auth.onAuthStateChanged((c,g)=>{this.storage.setAccessToken(g==null?void 0:g.accessToken),this.functions.setAccessToken(g==null?void 0:g.accessToken),this.graphql.setAccessToken(g==null?void 0:g.accessToken)}),this.auth.onTokenChanged(c=>{this.storage.setAccessToken(c==null?void 0:c.accessToken),this.functions.setAccessToken(c==null?void 0:c.accessToken),this.graphql.setAccessToken(c==null?void 0:c.accessToken)})}}const ji=t=>new Lt(t);S.NhostClient=Lt,S.createClient=ji,Object.defineProperty(S,"__esModule",{value:!0}),S[Symbol.toStringTag]="Module"});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
export declare type GraphqlRequestResponse = {
|
|
3
|
-
data: unknown;
|
|
4
|
-
error: null;
|
|
5
|
-
} | {
|
|
6
3
|
data: null;
|
|
7
4
|
error: Error | object;
|
|
5
|
+
} | {
|
|
6
|
+
data: unknown;
|
|
7
|
+
error: null;
|
|
8
8
|
};
|
|
9
9
|
export declare type FunctionCallResponse = {
|
|
10
10
|
res: AxiosResponse;
|
|
@@ -13,7 +13,7 @@ export declare type FunctionCallResponse = {
|
|
|
13
13
|
res: null;
|
|
14
14
|
error: Error;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export interface GraphqlResponse {
|
|
17
17
|
errors?: object[];
|
|
18
18
|
data?: object;
|
|
19
|
-
}
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,48 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nhost/nhost-js",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Nhost JavaScript SDK",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"keywords": [
|
|
6
|
-
"nhost"
|
|
7
|
+
"nhost",
|
|
8
|
+
"hasura",
|
|
9
|
+
"storage",
|
|
10
|
+
"auth",
|
|
11
|
+
"authentication",
|
|
12
|
+
"graphql",
|
|
13
|
+
"postgresql",
|
|
14
|
+
"realtime"
|
|
7
15
|
],
|
|
8
16
|
"author": "Nhost",
|
|
9
|
-
"homepage": "https://
|
|
10
|
-
"bugs": "https://github.com/nhost/nhost
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
"homepage": "https://nhost.io",
|
|
18
|
+
"bugs": "https://github.com/nhost/nhost/issues",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/nhost/nhost.git"
|
|
22
|
+
},
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": "./dist/index.es.js",
|
|
26
|
+
"require": "./dist/index.umd.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"main": "dist/index.umd.js",
|
|
15
30
|
"publishConfig": {
|
|
16
|
-
"access": "public"
|
|
31
|
+
"access": "public",
|
|
32
|
+
"main": "dist/index.umd.js",
|
|
33
|
+
"module": "dist/index.es.js",
|
|
34
|
+
"typings": "./dist/index.d.ts"
|
|
17
35
|
},
|
|
18
36
|
"files": [
|
|
19
|
-
"dist
|
|
37
|
+
"dist"
|
|
20
38
|
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "run-p build:esm build:cjs",
|
|
23
|
-
"build:esm": "tsc",
|
|
24
|
-
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
|
|
25
|
-
"test:backend:start": "cd test/backend; nhost dev -d",
|
|
26
|
-
"test": "jest --runInBand",
|
|
27
|
-
"semantic-release": "semantic-release"
|
|
28
|
-
},
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/nhost/nhost-js.git"
|
|
32
|
-
},
|
|
33
39
|
"dependencies": {
|
|
34
|
-
"@nhost/hasura-auth-js": "
|
|
35
|
-
"@nhost/hasura-storage-js": "
|
|
40
|
+
"@nhost/hasura-auth-js": "0.1.11",
|
|
41
|
+
"@nhost/hasura-storage-js": "0.0.7",
|
|
36
42
|
"axios": "^0.23.0",
|
|
37
43
|
"jwt-decode": "^3.1.2",
|
|
38
44
|
"query-string": "^7.0.1"
|
|
39
45
|
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
"devDependencies": {},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "vite build --config ../../vite.lib.js",
|
|
49
|
+
"test": "pnpm jest --runInBand --config ../../jest.config.base.js",
|
|
50
|
+
"prettier": "prettier --check src/",
|
|
51
|
+
"prettier:fix": "prettier --write src/",
|
|
52
|
+
"lint": "eslint . --ext .ts,.tsx",
|
|
53
|
+
"lint:fix": "eslint . --ext .ts,.tsx --fix",
|
|
54
|
+
"verify": "run-p prettier lint",
|
|
55
|
+
"verify:fix": "run-p prettier:fix lint:fix"
|
|
56
|
+
},
|
|
57
|
+
"module": "dist/index.es.js",
|
|
58
|
+
"typings": "./dist/index.d.ts",
|
|
59
|
+
"readme": "<h1 align=\"center\">@nhost/nhost-js</h1>\n<h2 align=\"center\">Nhost JavaScript SDK</h2>\n\n<p align=\"center\">\n <img alt=\"npm\" src=\"https://img.shields.io/npm/v/@nhost/nhost-js\">\n <img alt=\"npm\" src=\"https://img.shields.io/npm/dm/@nhost/nhost-js\">\n <a href=\"LICENSE\">\n <img src=\"https://img.shields.io/badge/license-MIT-yellow.svg\" alt=\"license: MIT\" />\n </a>\n <a href=\"https://prettier.io\">\n <img src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg\" alt=\"code style: prettier\" />\n </a>\n</p>\n\n## Get Started\n\n### Install\n\n```\nnpm install @nhost/nhost-js\n# or yarn\nyarn add @nhost/nhost-js\n```\n\n### Initialize\n\n```js\nimport { NhostClient } from '@nhost/nhost-js'\n\nconst nhost = new NhostClient({\n backendUrl: 'https://xxx.nhost.run'\n})\n```\n\n## Features\n\n### GraphQL\n\nAccess Nhost Auth methods using `nhost.graphql`.\n\n### Authentication\n\nAccess Nhost Auth methods using `nhost.auth`.\n\n### Storage\n\nAccess Nhost Storage methods using `nhost.storage`.\n\n### Functions\n\nAccess Nhost Functions methods via `nhost.functions`.\n\n## Documentation\n\n[https://docs.nhost.io/reference/sdk](https://docs.nhost.io/reference/sdk)\n"
|
|
60
|
+
}
|
package/src/index.ts
ADDED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.NhostFunctionsClient = void 0;
|
|
54
|
-
var axios_1 = __importDefault(require("axios"));
|
|
55
|
-
var NhostFunctionsClient = /** @class */ (function () {
|
|
56
|
-
function NhostFunctionsClient(params) {
|
|
57
|
-
var url = params.url;
|
|
58
|
-
this.accessToken = null;
|
|
59
|
-
this.instance = axios_1.default.create({
|
|
60
|
-
baseURL: url,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
NhostFunctionsClient.prototype.call = function (url, data, config) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
-
var headers, res, error_1;
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
switch (_a.label) {
|
|
68
|
-
case 0:
|
|
69
|
-
headers = __assign(__assign({}, this.generateAccessTokenHeaders()), config === null || config === void 0 ? void 0 : config.headers);
|
|
70
|
-
_a.label = 1;
|
|
71
|
-
case 1:
|
|
72
|
-
_a.trys.push([1, 3, , 4]);
|
|
73
|
-
return [4 /*yield*/, this.instance.post(url, data, __assign(__assign({}, config), { headers: headers }))];
|
|
74
|
-
case 2:
|
|
75
|
-
res = _a.sent();
|
|
76
|
-
return [3 /*break*/, 4];
|
|
77
|
-
case 3:
|
|
78
|
-
error_1 = _a.sent();
|
|
79
|
-
if (error_1 instanceof Error) {
|
|
80
|
-
return [2 /*return*/, { res: null, error: error_1 }];
|
|
81
|
-
}
|
|
82
|
-
return [3 /*break*/, 4];
|
|
83
|
-
case 4:
|
|
84
|
-
if (!res) {
|
|
85
|
-
return [2 /*return*/, {
|
|
86
|
-
res: null,
|
|
87
|
-
error: Error('Unable to make post request to funtion'),
|
|
88
|
-
}];
|
|
89
|
-
}
|
|
90
|
-
return [2 /*return*/, { res: res, error: null }];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
NhostFunctionsClient.prototype.setAccessToken = function (accessToken) {
|
|
96
|
-
if (!accessToken) {
|
|
97
|
-
this.accessToken = null;
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
this.accessToken = accessToken;
|
|
101
|
-
};
|
|
102
|
-
NhostFunctionsClient.prototype.generateAccessTokenHeaders = function () {
|
|
103
|
-
if (!this.accessToken) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
Authorization: "Bearer " + this.accessToken,
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
return NhostFunctionsClient;
|
|
111
|
-
}());
|
|
112
|
-
exports.NhostFunctionsClient = NhostFunctionsClient;
|
|
113
|
-
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/clients/functions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAiE;AAOjE;IAIE,8BAAY,MAAuC;QACzC,IAAA,GAAG,GAAK,MAAM,IAAX,CAAY;QAEvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAC;YAC3B,OAAO,EAAE,GAAG;SACb,CAAC,CAAC;IACL,CAAC;IAEY,mCAAI,GAAjB,UACE,GAAW,EACX,IAAS,EACT,MAA2B;;;;;;wBAErB,OAAO,yBACR,IAAI,CAAC,0BAA0B,EAAE,GACjC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CACnB,CAAC;;;;wBAIM,qBAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,wBAAO,MAAM,KAAE,OAAO,SAAA,IAAG,EAAA;;wBAAjE,GAAG,GAAG,SAA2D,CAAC;;;;wBAElE,IAAI,OAAK,YAAY,KAAK,EAAE;4BAC1B,sBAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,SAAA,EAAE,EAAC;yBAC7B;;;wBAGH,IAAI,CAAC,GAAG,EAAE;4BACR,sBAAO;oCACL,GAAG,EAAE,IAAI;oCACT,KAAK,EAAE,KAAK,CAAC,wCAAwC,CAAC;iCACvD,EAAC;yBACH;wBAED,sBAAO,EAAE,GAAG,KAAA,EAAE,KAAK,EAAE,IAAI,EAAE,EAAC;;;;KAC7B;IAEM,6CAAc,GAArB,UAAsB,WAA+B;QACnD,IAAI,CAAC,WAAW,EAAE;YAChB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,OAAO;SACR;QAED,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEO,yDAA0B,GAAlC;QACE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,OAAO;SACR;QAED,OAAO;YACL,aAAa,EAAE,YAAU,IAAI,CAAC,WAAa;SAC5C,CAAC;IACJ,CAAC;IACH,2BAAC;AAAD,CAAC,AA5DD,IA4DC;AA5DY,oDAAoB"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { GraphqlRequestResponse } from '../types';
|
|
3
|
-
export declare type NhostGraphqlConstructorParams = {
|
|
4
|
-
url: string;
|
|
5
|
-
};
|
|
6
|
-
export declare class NhostGraphqlClient {
|
|
7
|
-
private url;
|
|
8
|
-
private instance;
|
|
9
|
-
private accessToken;
|
|
10
|
-
constructor(params: NhostGraphqlConstructorParams);
|
|
11
|
-
request(document: string, variables?: any, config?: AxiosRequestConfig): Promise<GraphqlRequestResponse>;
|
|
12
|
-
getUrl(): string;
|
|
13
|
-
setAccessToken(accessToken: string | undefined): void;
|
|
14
|
-
private generateAccessTokenHeaders;
|
|
15
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.NhostGraphqlClient = void 0;
|
|
54
|
-
var axios_1 = __importDefault(require("axios"));
|
|
55
|
-
var NhostGraphqlClient = /** @class */ (function () {
|
|
56
|
-
function NhostGraphqlClient(params) {
|
|
57
|
-
var url = params.url;
|
|
58
|
-
this.url = url;
|
|
59
|
-
this.accessToken = null;
|
|
60
|
-
this.instance = axios_1.default.create({
|
|
61
|
-
baseURL: url,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
NhostGraphqlClient.prototype.request = function (document, variables, config) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
var headers, operationName, responseData, res, error_1;
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
switch (_a.label) {
|
|
69
|
-
case 0:
|
|
70
|
-
headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), this.generateAccessTokenHeaders());
|
|
71
|
-
operationName = '';
|
|
72
|
-
_a.label = 1;
|
|
73
|
-
case 1:
|
|
74
|
-
_a.trys.push([1, 3, , 4]);
|
|
75
|
-
return [4 /*yield*/, this.instance.post('', {
|
|
76
|
-
operationName: operationName ? operationName : undefined,
|
|
77
|
-
query: document,
|
|
78
|
-
variables: variables,
|
|
79
|
-
}, __assign(__assign({}, config), { headers: headers }))];
|
|
80
|
-
case 2:
|
|
81
|
-
res = _a.sent();
|
|
82
|
-
responseData = res.data;
|
|
83
|
-
return [3 /*break*/, 4];
|
|
84
|
-
case 3:
|
|
85
|
-
error_1 = _a.sent();
|
|
86
|
-
if (error_1 instanceof Error) {
|
|
87
|
-
return [2 /*return*/, { data: null, error: error_1 }];
|
|
88
|
-
}
|
|
89
|
-
console.error(error_1);
|
|
90
|
-
return [2 /*return*/, { data: null, error: Error('Unable to get do GraphQL request') }];
|
|
91
|
-
case 4:
|
|
92
|
-
if (typeof responseData !== 'object' ||
|
|
93
|
-
Array.isArray(responseData) ||
|
|
94
|
-
responseData === null) {
|
|
95
|
-
return [2 /*return*/, {
|
|
96
|
-
data: null,
|
|
97
|
-
error: Error('incorrect response data from GraphQL server'),
|
|
98
|
-
}];
|
|
99
|
-
}
|
|
100
|
-
responseData = responseData;
|
|
101
|
-
if (responseData.errors) {
|
|
102
|
-
return [2 /*return*/, {
|
|
103
|
-
data: null,
|
|
104
|
-
error: responseData.errors,
|
|
105
|
-
}];
|
|
106
|
-
}
|
|
107
|
-
return [2 /*return*/, { data: responseData.data, error: null }];
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
NhostGraphqlClient.prototype.getUrl = function () {
|
|
113
|
-
return this.url;
|
|
114
|
-
};
|
|
115
|
-
NhostGraphqlClient.prototype.setAccessToken = function (accessToken) {
|
|
116
|
-
if (!accessToken) {
|
|
117
|
-
this.accessToken = null;
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
this.accessToken = accessToken;
|
|
121
|
-
};
|
|
122
|
-
NhostGraphqlClient.prototype.generateAccessTokenHeaders = function () {
|
|
123
|
-
if (!this.accessToken) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
Authorization: "Bearer " + this.accessToken,
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
return NhostGraphqlClient;
|
|
131
|
-
}());
|
|
132
|
-
exports.NhostGraphqlClient = NhostGraphqlClient;
|
|
133
|
-
//# sourceMappingURL=graphql.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../src/clients/graphql.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAiE;AAOjE;IAKE,4BAAY,MAAqC;QACvC,IAAA,GAAG,GAAK,MAAM,IAAX,CAAY;QAEvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAC;YAC3B,OAAO,EAAE,GAAG;SACb,CAAC,CAAC;IACL,CAAC;IAEY,oCAAO,GAApB,UACE,QAAgB,EAChB,SAAe,EACf,MAA2B;;;;;;wBAGrB,OAAO,yBACR,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,GACf,IAAI,CAAC,0BAA0B,EAAE,CACrC,CAAC;wBAEI,aAAa,GAAG,EAAE,CAAC;;;;wBAIX,qBAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAClC,EAAE,EACF;gCACE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;gCACxD,KAAK,EAAE,QAAQ;gCACf,SAAS,WAAA;6BACV,wBACI,MAAM,KAAE,OAAO,SAAA,IACrB,EAAA;;wBARK,GAAG,GAAG,SAQX;wBAED,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC;;;;wBAExB,IAAI,OAAK,YAAY,KAAK,EAAE;4BAC1B,sBAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,SAAA,EAAE,EAAC;yBAC9B;wBACD,OAAO,CAAC,KAAK,CAAC,OAAK,CAAC,CAAC;wBACrB,sBAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,kCAAkC,CAAC,EAAE,EAAC;;wBAG1E,IACE,OAAO,YAAY,KAAK,QAAQ;4BAChC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;4BAC3B,YAAY,KAAK,IAAI,EACrB;4BACA,sBAAO;oCACL,IAAI,EAAE,IAAI;oCACV,KAAK,EAAE,KAAK,CAAC,6CAA6C,CAAC;iCAC5D,EAAC;yBACH;wBAED,YAAY,GAAG,YAA+B,CAAC;wBAE/C,IAAI,YAAY,CAAC,MAAM,EAAE;4BACvB,sBAAO;oCACL,IAAI,EAAE,IAAI;oCACV,KAAK,EAAE,YAAY,CAAC,MAAM;iCAC3B,EAAC;yBACH;wBAED,sBAAO,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAC;;;;KACjD;IAEM,mCAAM,GAAb;QACE,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAEM,2CAAc,GAArB,UAAsB,WAA+B;QACnD,IAAI,CAAC,WAAW,EAAE;YAChB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,OAAO;SACR;QAED,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEO,uDAA0B,GAAlC;QACE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,OAAO;SACR;QAED,OAAO;YACL,aAAa,EAAE,YAAU,IAAI,CAAC,WAAa;SAC5C,CAAC;IACJ,CAAC;IACH,yBAAC;AAAD,CAAC,AA9FD,IA8FC;AA9FY,gDAAkB"}
|
package/dist/cjs/core/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./nhost-client"), exports);
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+B"}
|