@neuctra/authix 1.1.52 → 1.1.55

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.
@@ -1829,20 +1829,16 @@ class pa {
1829
1829
  });
1830
1830
  }
1831
1831
  /**
1832
- * 🔐 Check current authentication session
1833
- * Uses stored token and validates it with backend
1832
+ * 🔐 Check current authentication session (cookie-based)
1833
+ * Automatically detects logged-in / logged-out state
1834
1834
  */
1835
1835
  async checkSession() {
1836
1836
  if (typeof window > "u")
1837
- return console.warn("[Authix] checkSession called on server"), { authenticated: !1 };
1837
+ return { authenticated: !1 };
1838
1838
  try {
1839
- const e = await this.request(
1840
- "GET",
1841
- "/users/session"
1842
- );
1843
- return !e || typeof e.authenticated != "boolean" ? (console.warn("[Authix] Invalid session response format:", e), { authenticated: !1 }) : e;
1844
- } catch (e) {
1845
- return console.error("[Authix] Session check failed", e), { authenticated: !1 };
1839
+ return await this.request("GET", "/users/session");
1840
+ } catch {
1841
+ return { authenticated: !1 };
1846
1842
  }
1847
1843
  }
1848
1844
  /**
@@ -3,7 +3,7 @@
3
3
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const s=new this(e);return r.forEach(a=>s.set(a)),s}static accessor(e){const s=(this[Pt]=this[Pt]={accessors:{}}).accessors,a=this.prototype;function i(o){const l=Ce(o);s[l]||(dn(a,o),s[l]=!0)}return p.isArray(e)?e.forEach(i):i(e),this}};ne.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),p.reduceDescriptors(ne.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[r]=s}}}),p.freezeMethods(ne);function Xe(t,e){const r=this||ke,s=e||r,a=ne.from(s.headers);let i=s.data;return p.forEach(t,function(l){i=l.call(r,i,a.normalize(),e?e.status:void 0)}),a.normalize(),i}function Ot(t){return!!(t&&t.__CANCEL__)}function be(t,e,r){D.call(this,t??"canceled",D.ERR_CANCELED,e,r),this.name="CanceledError"}p.inherits(be,D,{__CANCEL__:!0});function At(t,e,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?t(r):e(new D("Request failed with status code "+r.status,[D.ERR_BAD_REQUEST,D.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function cn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function un(t,e){t=t||10;const r=new Array(t),s=new Array(t);let a=0,i=0,o;return e=e!==void 0?e:1e3,function(h){const d=Date.now(),c=s[i];o||(o=d),r[a]=h,s[a]=d;let y=i,b=0;for(;y!==a;)b+=r[y++],y=y%t;if(a=(a+1)%t,a===i&&(i=(i+1)%t),d-o<e)return;const S=c&&d-c;return S?Math.round(b*1e3/S):void 0}}function pn(t,e){let r=0,s=1e3/e,a,i;const o=(d,c=Date.now())=>{r=c,a=null,i&&(clearTimeout(i),i=null),t(...d)};return[(...d)=>{const c=Date.now(),y=c-r;y>=s?o(d,c):(a=d,i||(i=setTimeout(()=>{i=null,o(a)},s-y)))},()=>a&&o(a)]}const Ue=(t,e,r=3)=>{let s=0;const a=un(50,250);return pn(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,h=o-s,d=a(h),c=o<=l;s=o;const y={loaded:o,total:l,progress:l?o/l:void 0,bytes:h,rate:d||void 0,estimated:d&&l&&c?(l-o)/d:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(y)},r)},Rt=(t,e)=>{const r=t!=null;return[s=>e[0]({lengthComputable:r,total:t,loaded:s}),e[1]]},zt=t=>(...e)=>p.asap(()=>t(...e)),fn=ee.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,ee.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(ee.origin),ee.navigator&&/(msie|trident)/i.test(ee.navigator.userAgent)):()=>!0,xn=ee.hasStandardBrowserEnv?{write(t,e,r,s,a,i){const o=[t+"="+encodeURIComponent(e)];p.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),p.isString(s)&&o.push("path="+s),p.isString(a)&&o.push("domain="+a),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function hn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function gn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function _t(t,e,r){let s=!hn(e);return t&&(s||r==!1)?gn(t,e):e}const $t=t=>t instanceof ne?{...t}:t;function fe(t,e){e=e||{};const r={};function s(d,c,y,b){return p.isPlainObject(d)&&p.isPlainObject(c)?p.merge.call({caseless:b},d,c):p.isPlainObject(c)?p.merge({},c):p.isArray(c)?c.slice():c}function a(d,c,y,b){if(p.isUndefined(c)){if(!p.isUndefined(d))return s(void 0,d,y,b)}else return s(d,c,y,b)}function i(d,c){if(!p.isUndefined(c))return s(void 0,c)}function o(d,c){if(p.isUndefined(c)){if(!p.isUndefined(d))return s(void 0,d)}else return s(void 0,c)}function l(d,c,y){if(y in e)return s(d,c);if(y in t)return s(void 0,d)}const h={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(d,c,y)=>a($t(d),$t(c),y,!0)};return p.forEach(Object.keys({...t,...e}),function(c){const y=h[c]||a,b=y(t[c],e[c],c);p.isUndefined(b)&&y!==l||(r[c]=b)}),r}const Nt=t=>{const e=fe({},t);let{data:r,withXSRFToken:s,xsrfHeaderName:a,xsrfCookieName:i,headers:o,auth:l}=e;if(e.headers=o=ne.from(o),e.url=kt(_t(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),p.isFormData(r)){if(ee.hasStandardBrowserEnv||ee.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(p.isFunction(r.getHeaders)){const h=r.getHeaders(),d=["content-type","content-length"];Object.entries(h).forEach(([c,y])=>{d.includes(c.toLowerCase())&&o.set(c,y)})}}if(ee.hasStandardBrowserEnv&&(s&&p.isFunction(s)&&(s=s(e)),s||s!==!1&&fn(e.url))){const h=a&&i&&xn.read(i);h&&o.set(a,h)}return e},mn=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,s){const a=Nt(t);let i=a.data;const o=ne.from(a.headers).normalize();let{responseType:l,onUploadProgress:h,onDownloadProgress:d}=a,c,y,b,S,u;function j(){S&&S(),u&&u(),a.cancelToken&&a.cancelToken.unsubscribe(c),a.signal&&a.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(a.method.toUpperCase(),a.url,!0),m.timeout=a.timeout;function _(){if(!m)return;const z=ne.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),q={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:z,config:t,request:m};At(function(O){r(O),j()},function(O){s(O),j()},q),m=null}"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(_)},m.onabort=function(){m&&(s(new D("Request aborted",D.ECONNABORTED,t,m)),m=null)},m.onerror=function(T){const q=T&&T.message?T.message:"Network Error",g=new D(q,D.ERR_NETWORK,t,m);g.event=T||null,s(g),m=null},m.ontimeout=function(){let T=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const q=a.transitional||Tt;a.timeoutErrorMessage&&(T=a.timeoutErrorMessage),s(new D(T,q.clarifyTimeoutError?D.ETIMEDOUT:D.ECONNABORTED,t,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&p.forEach(o.toJSON(),function(T,q){m.setRequestHeader(q,T)}),p.isUndefined(a.withCredentials)||(m.withCredentials=!!a.withCredentials),l&&l!=="json"&&(m.responseType=a.responseType),d&&([b,u]=Ue(d,!0),m.addEventListener("progress",b)),h&&m.upload&&([y,S]=Ue(h),m.upload.addEventListener("progress",y),m.upload.addEventListener("loadend",S)),(a.cancelToken||a.signal)&&(c=z=>{m&&(s(!z||z.type?new be(null,t,m):z),m.abort(),m=null)},a.cancelToken&&a.cancelToken.subscribe(c),a.signal&&(a.signal.aborted?c():a.signal.addEventListener("abort",c)));const P=cn(a.url);if(P&&ee.protocols.indexOf(P)===-1){s(new D("Unsupported protocol "+P+":",D.ERR_BAD_REQUEST,t));return}m.send(i||null)})},yn=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let s=new AbortController,a;const i=function(d){if(!a){a=!0,l();const c=d instanceof Error?d:this.reason;s.abort(c instanceof D?c:new be(c instanceof Error?c.message:c))}};let o=e&&setTimeout(()=>{o=null,i(new D(`timeout ${e} of ms exceeded`,D.ETIMEDOUT))},e);const l=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(i):d.removeEventListener("abort",i)}),t=null)};t.forEach(d=>d.addEventListener("abort",i));const{signal:h}=s;return h.unsubscribe=()=>p.asap(l),h}},bn=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let s=0,a;for(;s<r;)a=s+e,yield t.slice(s,a),s=a},wn=async function*(t,e){for await(const r of Sn(t))yield*bn(r,e)},Sn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:s}=await e.read();if(r)break;yield s}}finally{await e.cancel()}},Ut=(t,e,r,s)=>{const a=wn(t,e);let i=0,o,l=h=>{o||(o=!0,s&&s(h))};return new ReadableStream({async pull(h){try{const{done:d,value:c}=await a.next();if(d){l(),h.close();return}let y=c.byteLength;if(r){let b=i+=y;r(b)}h.enqueue(new Uint8Array(c))}catch(d){throw l(d),d}},cancel(h){return l(h),a.return()}},{highWaterMark:2})},Dt=64*1024,{isFunction:De}=p,jn=(({Request:t,Response:e})=>({Request:t,Response:e}))(p.global),{ReadableStream:Lt,TextEncoder:Ft}=p.global,qt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},vn=t=>{t=p.merge.call({skipUndefined:!0},jn,t);const{fetch:e,Request:r,Response:s}=t,a=e?De(e):typeof fetch=="function",i=De(r),o=De(s);if(!a)return!1;const l=a&&De(Lt),h=a&&(typeof Ft=="function"?(u=>j=>u.encode(j))(new Ft):async u=>new Uint8Array(await new r(u).arrayBuffer())),d=i&&l&&qt(()=>{let u=!1;const j=new r(ee.origin,{body:new Lt,method:"POST",get duplex(){return u=!0,"half"}}).headers.has("Content-Type");return u&&!j}),c=o&&l&&qt(()=>p.isReadableStream(new s("").body)),y={stream:c&&(u=>u.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(u=>{!y[u]&&(y[u]=(j,m)=>{let _=j&&j[u];if(_)return _.call(j);throw new D(`Response type '${u}' is not supported`,D.ERR_NOT_SUPPORT,m)})});const b=async u=>{if(u==null)return 0;if(p.isBlob(u))return u.size;if(p.isSpecCompliantForm(u))return(await new r(ee.origin,{method:"POST",body:u}).arrayBuffer()).byteLength;if(p.isArrayBufferView(u)||p.isArrayBuffer(u))return u.byteLength;if(p.isURLSearchParams(u)&&(u=u+""),p.isString(u))return(await h(u)).byteLength},S=async(u,j)=>{const m=p.toFiniteNumber(u.getContentLength());return m??b(j)};return async u=>{let{url:j,method:m,data:_,signal:P,cancelToken:z,timeout:T,onDownloadProgress:q,onUploadProgress:g,responseType:O,headers:v,withCredentials:U="same-origin",fetchOptions:B}=Nt(u),F=e||fetch;O=O?(O+"").toLowerCase():"text";let V=yn([P,z&&z.toAbortSignal()],T),Z=null;const I=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let J;try{if(g&&d&&m!=="get"&&m!=="head"&&(J=await S(v,_))!==0){let f=new r(j,{method:"POST",body:_,duplex:"half"}),E;if(p.isFormData(_)&&(E=f.headers.get("content-type"))&&v.setContentType(E),f.body){const[x,k]=Rt(J,Ue(zt(g)));_=Ut(f.body,Dt,x,k)}}p.isString(U)||(U=U?"include":"omit");const R=i&&"credentials"in r.prototype,A={...B,signal:V,method:m.toUpperCase(),headers:v.normalize().toJSON(),body:_,duplex:"half",credentials:R?U:void 0};Z=i&&new r(j,A);let K=await(i?F(Z,B):F(j,A));const te=c&&(O==="stream"||O==="response");if(c&&(q||te&&I)){const f={};["status","statusText","headers"].forEach($=>{f[$]=K[$]});const E=p.toFiniteNumber(K.headers.get("content-length")),[x,k]=q&&Rt(E,Ue(zt(q),!0))||[];K=new s(Ut(K.body,Dt,x,()=>{k&&k(),I&&I()}),f)}O=O||"text";let G=await y[p.findKey(y,O)||"text"](K,u);return!te&&I&&I(),await new Promise((f,E)=>{At(f,E,{data:G,headers:ne.from(K.headers),status:K.status,statusText:K.statusText,config:u,request:Z})})}catch(R){throw I&&I(),R&&R.name==="TypeError"&&/Load failed|fetch/i.test(R.message)?Object.assign(new D("Network Error",D.ERR_NETWORK,u,Z),{cause:R.cause||R}):D.from(R,R&&R.code,u,Z)}}},En=new Map,Mt=t=>{let e=t?t.env:{};const{fetch:r,Request:s,Response:a}=e,i=[s,a,r];let o=i.length,l=o,h,d,c=En;for(;l--;)h=i[l],d=c.get(h),d===void 0&&c.set(h,d=l?new Map:vn(e)),c=d;return d};Mt();const Ze={http:Hr,xhr:mn,fetch:{get:Mt}};p.forEach(Ze,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Bt=t=>`- ${t}`,kn=t=>p.isFunction(t)||t===null||t===!1,Wt={getAdapter:(t,e)=>{t=p.isArray(t)?t:[t];const{length:r}=t;let s,a;const i={};for(let o=0;o<r;o++){s=t[o];let l;if(a=s,!kn(s)&&(a=Ze[(l=String(s)).toLowerCase()],a===void 0))throw new D(`Unknown adapter '${l}'`);if(a&&(p.isFunction(a)||(a=a.get(e))))break;i[l||"#"+o]=a}if(!a){const o=Object.entries(i).map(([h,d])=>`adapter ${h} `+(d===!1?"is not supported by the environment":"is not available in the build"));let l=r?o.length>1?`since :
4
4
  `+o.map(Bt).join(`
5
5
  `):" "+Bt(o[0]):"as no adapter specified";throw new D("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return a},adapters:Ze};function Qe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new be(null,t)}function Ht(t){return Qe(t),t.headers=ne.from(t.headers),t.data=Xe.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Wt.getAdapter(t.adapter||ke.adapter,t)(t).then(function(s){return Qe(t),s.data=Xe.call(t,t.transformResponse,s),s.headers=ne.from(s.headers),s},function(s){return Ot(s)||(Qe(t),s&&s.response&&(s.response.data=Xe.call(t,t.transformResponse,s.response),s.response.headers=ne.from(s.response.headers))),Promise.reject(s)})}const Vt="1.12.2",Le={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Le[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});const Yt={};Le.transitional=function(e,r,s){function a(i,o){return"[Axios v"+Vt+"] Transitional option '"+i+"'"+o+(s?". "+s:"")}return(i,o,l)=>{if(e===!1)throw new D(a(o," has been removed"+(r?" in "+r:"")),D.ERR_DEPRECATED);return r&&!Yt[o]&&(Yt[o]=!0,console.warn(a(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(i,o,l):!0}},Le.spelling=function(e){return(r,s)=>(console.warn(`${s} is likely a misspelling of ${e}`),!0)};function Cn(t,e,r){if(typeof t!="object")throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);const s=Object.keys(t);let a=s.length;for(;a-- >0;){const i=s[a],o=e[i];if(o){const l=t[i],h=l===void 0||o(l,i,t);if(h!==!0)throw new D("option "+i+" must be "+h,D.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new D("Unknown option "+i,D.ERR_BAD_OPTION)}}const Fe={assertOptions:Cn,validators:Le},ie=Fe.validators;let xe=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ct,response:new Ct}}async request(e,r){try{return await this._request(e,r)}catch(s){if(s instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const i=a.stack?a.stack.replace(/^.+\n/,""):"";try{s.stack?i&&!String(s.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(s.stack+=`
6
- `+i):s.stack=i}catch{}}throw s}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=fe(this.defaults,r);const{transitional:s,paramsSerializer:a,headers:i}=r;s!==void 0&&Fe.assertOptions(s,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1),a!=null&&(p.isFunction(a)?r.paramsSerializer={serialize:a}:Fe.assertOptions(a,{encode:ie.function,serialize:ie.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Fe.assertOptions(r,{baseUrl:ie.spelling("baseURL"),withXsrfToken:ie.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&p.merge(i.common,i[r.method]);i&&p.forEach(["delete","get","head","post","put","patch","common"],u=>{delete i[u]}),r.headers=ne.concat(o,i);const l=[];let h=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(r)===!1||(h=h&&j.synchronous,l.unshift(j.fulfilled,j.rejected))});const d=[];this.interceptors.response.forEach(function(j){d.push(j.fulfilled,j.rejected)});let c,y=0,b;if(!h){const u=[Ht.bind(this),void 0];for(u.unshift(...l),u.push(...d),b=u.length,c=Promise.resolve(r);y<b;)c=c.then(u[y++],u[y++]);return c}b=l.length;let S=r;for(;y<b;){const u=l[y++],j=l[y++];try{S=u(S)}catch(m){j.call(this,m);break}}try{c=Ht.call(this,S)}catch(u){return Promise.reject(u)}for(y=0,b=d.length;y<b;)c=c.then(d[y++],d[y++]);return c}getUri(e){e=fe(this.defaults,e);const r=_t(e.baseURL,e.url,e.allowAbsoluteUrls);return kt(r,e.params,e.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(e){xe.prototype[e]=function(r,s){return this.request(fe(s||{},{method:e,url:r,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(e){function r(s){return function(i,o,l){return this.request(fe(l||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}xe.prototype[e]=r(),xe.prototype[e+"Form"]=r(!0)});let Tn=class or{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const s=this;this.promise.then(a=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](a);s._listeners=null}),this.promise.then=a=>{let i;const o=new Promise(l=>{s.subscribe(l),i=l}).then(a);return o.cancel=function(){s.unsubscribe(i)},o},e(function(i,o,l){s.reason||(s.reason=new be(i,o,l),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=s=>{e.abort(s)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new or(function(a){e=a}),cancel:e}}};function In(t){return function(r){return t.apply(null,r)}}function Pn(t){return p.isObject(t)&&t.isAxiosError===!0}const et={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(et).forEach(([t,e])=>{et[e]=t});function Kt(t){const e=new xe(t),r=ct(xe.prototype.request,e);return p.extend(r,xe.prototype,e,{allOwnKeys:!0}),p.extend(r,e,null,{allOwnKeys:!0}),r.create=function(a){return Kt(fe(t,a))},r}const M=Kt(ke);M.Axios=xe,M.CanceledError=be,M.CancelToken=Tn,M.isCancel=Ot,M.VERSION=Vt,M.toFormData=$e,M.AxiosError=D,M.Cancel=M.CanceledError,M.all=function(e){return Promise.all(e)},M.spread=In,M.isAxiosError=Pn,M.mergeConfig=fe,M.AxiosHeaders=ne,M.formToJSON=t=>It(p.isHTMLForm(t)?new FormData(t):t),M.getAdapter=Wt.getAdapter,M.HttpStatusCode=et,M.default=M;const{Axios:Ss,AxiosError:js,CanceledError:vs,isCancel:Es,CancelToken:ks,VERSION:Cs,all:Ts,Cancel:Is,isAxiosError:Ps,spread:Os,toFormData:As,AxiosHeaders:Rs,HttpStatusCode:zs,formToJSON:_s,getAdapter:$s,mergeConfig:Ns}=M;class On{baseUrl;apiKey;appId;client;constructor(e){if(!e||!e.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey||null,this.appId=e.appId||null,this.client=M.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:3e4,withCredentials:!0})}async request(e,r,s,a={}){if(!e)throw new Error("HTTP method is required");if(!r)throw new Error("Request path is required");try{const i={...this.appId?{appId:this.appId}:{},...s||{}};return(await this.client.request({url:r,method:e,data:i,headers:a})).data}catch(i){if(console.error("❌ [Request Error]:",i),i.isAxiosError){const o=i.response?.status||0,l=i.response?.data?.message||i.message||"Unknown Axios error occurred";throw new Error(`Request failed (${o}): ${l}`)}throw new Error(`Unexpected error: ${i.message||"Unknown failure"}`)}}async signup(e){const{name:r,email:s,password:a}=e;if(!r||!s||!a)throw new Error("signup: 'name', 'email', and 'password' are required");return this.request("POST","/users/signup",e)}async login(e){const{email:r,password:s,appId:a}=e;if(!r||!s)throw new Error("login: 'email' and 'password' are required");return this.request("POST","/users/login",{email:r,password:s,appId:a||this.appId})}async checkSession(){if(typeof window>"u")return console.warn("[Authix] checkSession called on server"),{authenticated:!1};try{const e=await this.request("GET","/users/session");return!e||typeof e.authenticated!="boolean"?(console.warn("[Authix] Invalid session response format:",e),{authenticated:!1}):e}catch(e){return console.error("[Authix] Session check failed",e),{authenticated:!1}}}async updateUser(e){const{userId:r,appId:s}=e;if(!r)throw new Error("updateUser: 'userId' is required");return this.request("PUT",`/users/update/${r}`,{...e,appId:s||this.appId})}async changePassword(e){const{userId:r,currentPassword:s,newPassword:a,appId:i}=e;if(!r)throw new Error("changePassword: 'userId' is required");if(!s||!a)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return this.request("PUT",`/users/change-password/${r}`,{currentPassword:s,newPassword:a,appId:i||this.appId})}async deleteUser(e){const{userId:r,appId:s}=e;if(!r)throw new Error("deleteUser: 'userId' is required");return this.request("DELETE",`/users/delete/${r}`,{appId:s||this.appId})}async getProfile(e){const{token:r}=e;if(!r)throw new Error("getProfile: 'token' is required");return this.request("GET","/users/profile",{},{Authorization:`Bearer ${r}`})}async sendVerifyOTP(e){const{token:r,appId:s}=e;if(!r)throw new Error("sendVerifyOTP: 'token' is required");return this.request("POST","/users/send-verify-otp",{appId:s||this.appId},{Authorization:`Bearer ${r}`})}async verifyEmail(e){const{token:r,otp:s,appId:a}=e;if(!r)throw new Error("verifyEmail: 'token' is required");if(!s)throw new Error("verifyEmail: 'otp' is required");return this.request("POST","/users/verify-email",{otp:s,appId:a||this.appId},{Authorization:`Bearer ${r}`})}async forgotPassword(e){const{email:r,appId:s}=e;if(!r)throw new Error("forgotPassword: 'email' is required");return this.request("POST","/users/forgot-password",{email:r,appId:s||this.appId})}async resetPassword(e){const{email:r,otp:s,newPassword:a,appId:i}=e;if(!r||!s||!a)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return this.request("POST","/users/reset-password",{email:r,otp:s,newPassword:a,appId:i||this.appId})}async checkUser(e){if(!e)throw new Error("checkUser: 'userId' is required");if(!this.appId)throw new Error("checkUser: SDK 'appId' is missing in config");return this.request("GET",`/users/check-user/${e}?appId=${this.appId}`)}async searchAllUsersData(e){if(!this.appId)throw new Error("searchAllUsersData: appId missing");const r=new URLSearchParams(e).toString();return this.request("GET",`/users/${this.appId}/data/search?${r}`)}async searchUserData(e){const{userId:r,...s}=e;if(!r)throw new Error("userId required");const a=new URLSearchParams(s).toString();return this.request("GET",`/users/${r}/data/search?${a}`)}async searchUserDataByKeys(e){const{userId:r,...s}=e;if(!r)throw new Error("searchUserDataByKeys: 'userId' is required");const a=new URLSearchParams(Object.entries(s).reduce((i,[o,l])=>(l!=null&&(i[o]=String(l)),i),{})).toString();return this.request("GET",`/users/${r}/data/searchbyref?${a}`)}async searchAllUsersDataByKeys(e){const r=this.appId;if(!r)throw new Error("searchAllUsersDataByKeys: 'appId' is required on SDK initialization");const s=new URLSearchParams(Object.entries(e).reduce((a,[i,o])=>(o!=null&&(a[i]=String(o)),a),{})).toString();return this.request("GET",`/users/${encodeURIComponent(r)}/data/searchbyref/all?${s}`)}async getAllUsersData(){if(!this.appId)throw new Error("getAllUsersData: SDK 'appId' is missing in config");return this.request("GET",`/users/all-data/${this.appId}/data`)}async getUserData(e){const{userId:r}=e;if(!r)throw new Error("getUserData: 'userId' is required");return this.request("GET",`/users/${r}/data`)}async getSingleUserData(e){const{userId:r,dataId:s}=e;if(!r||!s)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return this.request("GET",`/users/${r}/data/${s}`)}async addUserData(e){const{userId:r,dataCategory:s,data:a}=e;if(!r)throw new Error("addUserData: 'userId' is required");if(!s)throw new Error("addUserData: 'dataCategory' is required");if(!a)throw new Error("addUserData: 'data' is required");return this.request("POST",`/users/${r}/data`,{dataCategory:s,...a})}async updateUserData(e){const{userId:r,dataId:s,data:a}=e;if(!r||!s)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!a)throw new Error("updateUserData: 'data' is required");return this.request("PUT",`/users/${r}/data/${s}`,a)}async deleteUserData(e){const{userId:r,dataId:s}=e;if(!r||!s)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return this.request("DELETE",`/users/${r}/data/${s}`)}async getAppData(e){const r=this.appId;if(!r)throw new Error("getAppData: 'appId' is required");const s=e?`?category=${encodeURIComponent(e)}`:"";return(await this.request("GET",`/app/${r}/data${s}`))?.data||[]}async getSingleAppData(e){const r=this.appId;if(!r)throw new Error("getSingleAppData: 'appId' is required");if(!e.dataId)throw new Error("getSingleAppData: 'dataId' is required");return(await this.request("GET",`/app/${r}/data/${e.dataId}`))?.data}async searchAppDataByKeys(e){const r=this.appId;if(!r)throw new Error("searchAppDataByKeys: 'appId' is required");if(!e||typeof e!="object")throw new Error("searchAppDataByKeys: params object is required");return(await this.request("POST",`/app/${encodeURIComponent(r)}/data/search/bykeys`,e))?.data||[]}async addAppData(e){const r=this.appId;if(!r)throw new Error("addAppData: 'appId' is required");const{dataCategory:s,data:a}=e;if(!s)throw new Error("addAppData: 'dataCategory' is required");if(!a||typeof a!="object")throw new Error("addAppData: 'data' is required");return(await this.request("POST",`/app/${r}/data/${encodeURIComponent(s)}`,{item:a}))?.data}async updateAppData(e){const r=this.appId;if(!r)throw new Error("updateAppData: 'appId' is required");if(!e.dataId)throw new Error("updateAppData: 'dataId' is required");if(!e.data)throw new Error("updateAppData: 'data' is required");return(await this.request("PATCH",`/app/${r}/data/${e.dataId}`,e.data))?.data}async deleteAppData(e){const r=this.appId;if(!r)throw new Error("deleteAppData: 'appId' is required");if(!e.dataId)throw new Error("deleteAppData: 'dataId' is required");return(await this.request("DELETE",`/app/${r}/data/${e.dataId}`))?.data}}var qe={exports:{}},Te={};/**
6
+ `+i):s.stack=i}catch{}}throw s}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=fe(this.defaults,r);const{transitional:s,paramsSerializer:a,headers:i}=r;s!==void 0&&Fe.assertOptions(s,{silentJSONParsing:ie.transitional(ie.boolean),forcedJSONParsing:ie.transitional(ie.boolean),clarifyTimeoutError:ie.transitional(ie.boolean)},!1),a!=null&&(p.isFunction(a)?r.paramsSerializer={serialize:a}:Fe.assertOptions(a,{encode:ie.function,serialize:ie.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Fe.assertOptions(r,{baseUrl:ie.spelling("baseURL"),withXsrfToken:ie.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=i&&p.merge(i.common,i[r.method]);i&&p.forEach(["delete","get","head","post","put","patch","common"],u=>{delete i[u]}),r.headers=ne.concat(o,i);const l=[];let h=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(r)===!1||(h=h&&j.synchronous,l.unshift(j.fulfilled,j.rejected))});const d=[];this.interceptors.response.forEach(function(j){d.push(j.fulfilled,j.rejected)});let c,y=0,b;if(!h){const u=[Ht.bind(this),void 0];for(u.unshift(...l),u.push(...d),b=u.length,c=Promise.resolve(r);y<b;)c=c.then(u[y++],u[y++]);return c}b=l.length;let S=r;for(;y<b;){const u=l[y++],j=l[y++];try{S=u(S)}catch(m){j.call(this,m);break}}try{c=Ht.call(this,S)}catch(u){return Promise.reject(u)}for(y=0,b=d.length;y<b;)c=c.then(d[y++],d[y++]);return c}getUri(e){e=fe(this.defaults,e);const r=_t(e.baseURL,e.url,e.allowAbsoluteUrls);return kt(r,e.params,e.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(e){xe.prototype[e]=function(r,s){return this.request(fe(s||{},{method:e,url:r,data:(s||{}).data}))}}),p.forEach(["post","put","patch"],function(e){function r(s){return function(i,o,l){return this.request(fe(l||{},{method:e,headers:s?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}xe.prototype[e]=r(),xe.prototype[e+"Form"]=r(!0)});let Tn=class or{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(i){r=i});const s=this;this.promise.then(a=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](a);s._listeners=null}),this.promise.then=a=>{let i;const o=new Promise(l=>{s.subscribe(l),i=l}).then(a);return o.cancel=function(){s.unsubscribe(i)},o},e(function(i,o,l){s.reason||(s.reason=new be(i,o,l),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=s=>{e.abort(s)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new or(function(a){e=a}),cancel:e}}};function In(t){return function(r){return t.apply(null,r)}}function Pn(t){return p.isObject(t)&&t.isAxiosError===!0}const et={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(et).forEach(([t,e])=>{et[e]=t});function Kt(t){const e=new xe(t),r=ct(xe.prototype.request,e);return p.extend(r,xe.prototype,e,{allOwnKeys:!0}),p.extend(r,e,null,{allOwnKeys:!0}),r.create=function(a){return Kt(fe(t,a))},r}const M=Kt(ke);M.Axios=xe,M.CanceledError=be,M.CancelToken=Tn,M.isCancel=Ot,M.VERSION=Vt,M.toFormData=$e,M.AxiosError=D,M.Cancel=M.CanceledError,M.all=function(e){return Promise.all(e)},M.spread=In,M.isAxiosError=Pn,M.mergeConfig=fe,M.AxiosHeaders=ne,M.formToJSON=t=>It(p.isHTMLForm(t)?new FormData(t):t),M.getAdapter=Wt.getAdapter,M.HttpStatusCode=et,M.default=M;const{Axios:Ss,AxiosError:js,CanceledError:vs,isCancel:Es,CancelToken:ks,VERSION:Cs,all:Ts,Cancel:Is,isAxiosError:Ps,spread:Os,toFormData:As,AxiosHeaders:Rs,HttpStatusCode:zs,formToJSON:_s,getAdapter:$s,mergeConfig:Ns}=M;class On{baseUrl;apiKey;appId;client;constructor(e){if(!e||!e.baseUrl)throw new Error("NeuctraAuthixClient: 'baseUrl' is required in config");this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey||null,this.appId=e.appId||null,this.client=M.create({baseURL:this.baseUrl,headers:{"Content-Type":"application/json",...this.apiKey?{"x-api-key":this.apiKey}:{}},timeout:3e4,withCredentials:!0})}async request(e,r,s,a={}){if(!e)throw new Error("HTTP method is required");if(!r)throw new Error("Request path is required");try{const i={...this.appId?{appId:this.appId}:{},...s||{}};return(await this.client.request({url:r,method:e,data:i,headers:a})).data}catch(i){if(console.error("❌ [Request Error]:",i),i.isAxiosError){const o=i.response?.status||0,l=i.response?.data?.message||i.message||"Unknown Axios error occurred";throw new Error(`Request failed (${o}): ${l}`)}throw new Error(`Unexpected error: ${i.message||"Unknown failure"}`)}}async signup(e){const{name:r,email:s,password:a}=e;if(!r||!s||!a)throw new Error("signup: 'name', 'email', and 'password' are required");return this.request("POST","/users/signup",e)}async login(e){const{email:r,password:s,appId:a}=e;if(!r||!s)throw new Error("login: 'email' and 'password' are required");return this.request("POST","/users/login",{email:r,password:s,appId:a||this.appId})}async checkSession(){if(typeof window>"u")return{authenticated:!1};try{return await this.request("GET","/users/session")}catch{return{authenticated:!1}}}async updateUser(e){const{userId:r,appId:s}=e;if(!r)throw new Error("updateUser: 'userId' is required");return this.request("PUT",`/users/update/${r}`,{...e,appId:s||this.appId})}async changePassword(e){const{userId:r,currentPassword:s,newPassword:a,appId:i}=e;if(!r)throw new Error("changePassword: 'userId' is required");if(!s||!a)throw new Error("changePassword: both 'currentPassword' and 'newPassword' are required");return this.request("PUT",`/users/change-password/${r}`,{currentPassword:s,newPassword:a,appId:i||this.appId})}async deleteUser(e){const{userId:r,appId:s}=e;if(!r)throw new Error("deleteUser: 'userId' is required");return this.request("DELETE",`/users/delete/${r}`,{appId:s||this.appId})}async getProfile(e){const{token:r}=e;if(!r)throw new Error("getProfile: 'token' is required");return this.request("GET","/users/profile",{},{Authorization:`Bearer ${r}`})}async sendVerifyOTP(e){const{token:r,appId:s}=e;if(!r)throw new Error("sendVerifyOTP: 'token' is required");return this.request("POST","/users/send-verify-otp",{appId:s||this.appId},{Authorization:`Bearer ${r}`})}async verifyEmail(e){const{token:r,otp:s,appId:a}=e;if(!r)throw new Error("verifyEmail: 'token' is required");if(!s)throw new Error("verifyEmail: 'otp' is required");return this.request("POST","/users/verify-email",{otp:s,appId:a||this.appId},{Authorization:`Bearer ${r}`})}async forgotPassword(e){const{email:r,appId:s}=e;if(!r)throw new Error("forgotPassword: 'email' is required");return this.request("POST","/users/forgot-password",{email:r,appId:s||this.appId})}async resetPassword(e){const{email:r,otp:s,newPassword:a,appId:i}=e;if(!r||!s||!a)throw new Error("resetPassword: 'email', 'otp' and 'newPassword' are required");return this.request("POST","/users/reset-password",{email:r,otp:s,newPassword:a,appId:i||this.appId})}async checkUser(e){if(!e)throw new Error("checkUser: 'userId' is required");if(!this.appId)throw new Error("checkUser: SDK 'appId' is missing in config");return this.request("GET",`/users/check-user/${e}?appId=${this.appId}`)}async searchAllUsersData(e){if(!this.appId)throw new Error("searchAllUsersData: appId missing");const r=new URLSearchParams(e).toString();return this.request("GET",`/users/${this.appId}/data/search?${r}`)}async searchUserData(e){const{userId:r,...s}=e;if(!r)throw new Error("userId required");const a=new URLSearchParams(s).toString();return this.request("GET",`/users/${r}/data/search?${a}`)}async searchUserDataByKeys(e){const{userId:r,...s}=e;if(!r)throw new Error("searchUserDataByKeys: 'userId' is required");const a=new URLSearchParams(Object.entries(s).reduce((i,[o,l])=>(l!=null&&(i[o]=String(l)),i),{})).toString();return this.request("GET",`/users/${r}/data/searchbyref?${a}`)}async searchAllUsersDataByKeys(e){const r=this.appId;if(!r)throw new Error("searchAllUsersDataByKeys: 'appId' is required on SDK initialization");const s=new URLSearchParams(Object.entries(e).reduce((a,[i,o])=>(o!=null&&(a[i]=String(o)),a),{})).toString();return this.request("GET",`/users/${encodeURIComponent(r)}/data/searchbyref/all?${s}`)}async getAllUsersData(){if(!this.appId)throw new Error("getAllUsersData: SDK 'appId' is missing in config");return this.request("GET",`/users/all-data/${this.appId}/data`)}async getUserData(e){const{userId:r}=e;if(!r)throw new Error("getUserData: 'userId' is required");return this.request("GET",`/users/${r}/data`)}async getSingleUserData(e){const{userId:r,dataId:s}=e;if(!r||!s)throw new Error("getSingleUserData: 'userId' and 'dataId' are required");return this.request("GET",`/users/${r}/data/${s}`)}async addUserData(e){const{userId:r,dataCategory:s,data:a}=e;if(!r)throw new Error("addUserData: 'userId' is required");if(!s)throw new Error("addUserData: 'dataCategory' is required");if(!a)throw new Error("addUserData: 'data' is required");return this.request("POST",`/users/${r}/data`,{dataCategory:s,...a})}async updateUserData(e){const{userId:r,dataId:s,data:a}=e;if(!r||!s)throw new Error("updateUserData: 'userId' and 'dataId' are required");if(!a)throw new Error("updateUserData: 'data' is required");return this.request("PUT",`/users/${r}/data/${s}`,a)}async deleteUserData(e){const{userId:r,dataId:s}=e;if(!r||!s)throw new Error("deleteUserData: 'userId' and 'dataId' are required");return this.request("DELETE",`/users/${r}/data/${s}`)}async getAppData(e){const r=this.appId;if(!r)throw new Error("getAppData: 'appId' is required");const s=e?`?category=${encodeURIComponent(e)}`:"";return(await this.request("GET",`/app/${r}/data${s}`))?.data||[]}async getSingleAppData(e){const r=this.appId;if(!r)throw new Error("getSingleAppData: 'appId' is required");if(!e.dataId)throw new Error("getSingleAppData: 'dataId' is required");return(await this.request("GET",`/app/${r}/data/${e.dataId}`))?.data}async searchAppDataByKeys(e){const r=this.appId;if(!r)throw new Error("searchAppDataByKeys: 'appId' is required");if(!e||typeof e!="object")throw new Error("searchAppDataByKeys: params object is required");return(await this.request("POST",`/app/${encodeURIComponent(r)}/data/search/bykeys`,e))?.data||[]}async addAppData(e){const r=this.appId;if(!r)throw new Error("addAppData: 'appId' is required");const{dataCategory:s,data:a}=e;if(!s)throw new Error("addAppData: 'dataCategory' is required");if(!a||typeof a!="object")throw new Error("addAppData: 'data' is required");return(await this.request("POST",`/app/${r}/data/${encodeURIComponent(s)}`,{item:a}))?.data}async updateAppData(e){const r=this.appId;if(!r)throw new Error("updateAppData: 'appId' is required");if(!e.dataId)throw new Error("updateAppData: 'dataId' is required");if(!e.data)throw new Error("updateAppData: 'data' is required");return(await this.request("PATCH",`/app/${r}/data/${e.dataId}`,e.data))?.data}async deleteAppData(e){const r=this.appId;if(!r)throw new Error("deleteAppData: 'appId' is required");if(!e.dataId)throw new Error("deleteAppData: 'dataId' is required");return(await this.request("DELETE",`/app/${r}/data/${e.dataId}`))?.data}}var qe={exports:{}},Te={};/**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
9
9
  *
@@ -1,134 +1,4 @@
1
- /**
2
- * SDK configuration options
3
- */
4
- interface NeuctraAuthixConfig {
5
- /** Base URL of the Authix API (required) */
6
- baseUrl: string;
7
- /** API key for authentication */
8
- apiKey: string;
9
- /** App ID for scoping user operations */
10
- appId: string;
11
- }
12
- /**
13
- * Parameters for signing up a new user
14
- */
15
- interface SignupParams {
16
- name: string;
17
- email: string;
18
- password: string;
19
- phone?: string | null;
20
- address?: string | null;
21
- avatarUrl?: string | null;
22
- isActive?: boolean;
23
- role?: string;
24
- adminId?: string | null;
25
- }
26
- /**
27
- * Parameters for logging in a user
28
- */
29
- interface LoginParams {
30
- email: string;
31
- password: string;
32
- appId: string;
33
- }
34
- /**
35
- * Parameters for updating an existing user
36
- */
37
- interface UpdateUserParams {
38
- userId: string;
39
- name?: string;
40
- email?: string;
41
- password?: string;
42
- phone?: string | null;
43
- address?: string | null;
44
- avatarUrl?: string | null;
45
- isActive?: boolean;
46
- role?: string;
47
- appId?: string | null;
48
- }
49
- /**
50
- * Parameters for changing a user password (Admin action)
51
- */
52
- interface ChangePasswordParams {
53
- userId: string;
54
- currentPassword: string;
55
- newPassword: string;
56
- appId?: string | null;
57
- }
58
- /**
59
- * Parameters for deleting a user
60
- */
61
- interface DeleteUserParams {
62
- userId: string;
63
- appId?: string | null;
64
- }
65
- /**
66
- * Parameters for fetching a user profile
67
- */
68
- interface GetProfileParams {
69
- /** JWT access token */
70
- token: string;
71
- }
72
- /**
73
- * Fetch all extra data objects for a user
74
- */
75
- interface GetUserDataParams {
76
- userId: string;
77
- }
78
- /**
79
- * Fetch a single data object from a user's extra data
80
- */
81
- interface GetSingleUserDataParams {
82
- userId: string;
83
- dataId: string;
84
- }
85
- /**
86
- * Add a new object to a user's extra data
87
- */
88
- interface AddUserDataParams {
89
- userId: string;
90
- dataCategory: string;
91
- /** The object to add */
92
- data: Record<string, any>;
93
- }
94
- /**
95
- * Update an existing object in a user's extra data
96
- */
97
- interface UpdateUserDataParams {
98
- userId: string;
99
- dataId: string;
100
- /** Fields to update */
101
- data: Record<string, any>;
102
- }
103
- /**
104
- * Delete an object from a user's extra data
105
- */
106
- interface DeleteUserDataParams {
107
- userId: string;
108
- dataId: string;
109
- }
110
- interface CheckUserResponse {
111
- success: boolean;
112
- exists: boolean;
113
- }
114
- interface CheckSessionResponse {
115
- authenticated: boolean;
116
- user?: Record<string, any>;
117
- }
118
- export interface AppDataItem {
119
- id: string;
120
- [key: string]: any;
121
- }
122
- export interface AddAppDataParams {
123
- data: Record<string, any>;
124
- }
125
- export interface UpdateAppDataParams {
126
- dataId: string;
127
- data: Record<string, any>;
128
- }
129
- export interface DeleteAppDataParams {
130
- dataId: string;
131
- }
1
+ import { AddUserDataParams, AppDataItem, ChangePasswordParams, CheckSessionResponse, CheckUserResponse, DeleteUserDataParams, DeleteUserParams, GetProfileParams, GetSingleUserDataParams, GetUserDataParams, LoginParams, NeuctraAuthixConfig, SignupParams, UpdateUserDataParams, UpdateUserParams } from "./interfaces.js";
132
2
  /**
133
3
  * Main SDK class for interacting with Neuctra Authix API
134
4
  */
@@ -161,8 +31,8 @@ export declare class NeuctraAuthix {
161
31
  */
162
32
  login(params: LoginParams): Promise<any>;
163
33
  /**
164
- * 🔐 Check current authentication session
165
- * Uses stored token and validates it with backend
34
+ * 🔐 Check current authentication session (cookie-based)
35
+ * Automatically detects logged-in / logged-out state
166
36
  */
167
37
  checkSession(): Promise<CheckSessionResponse>;
168
38
  /**
@@ -343,5 +213,4 @@ export declare class NeuctraAuthix {
343
213
  dataId: string;
344
214
  }): Promise<AppDataItem>;
345
215
  }
346
- export {};
347
216
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,UAAU,mBAAmB;IAC3B,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,UAAU,WA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,EAAE,uBAAuB;IAQvD;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAc3C;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IASjD;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAUjD;;;OAGG;IACG,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAc3D;;OAEG;IACG,gBAAgB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAcxE;;;;;;;;;OASG;IACG,mBAAmB,CAAC,MAAM,EAAE;QAChC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAwB1B;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3B,GAAG,OAAO,CAAC,WAAW,CAAC;IAsBxB;;OAEG;IACG,aAAa,CAAC,MAAM,EAAE;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC3B,GAAG,OAAO,CAAC,WAAW,CAAC;IAexB;;OAEG;IACG,aAAa,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;CAYtE"}
@@ -0,0 +1,103 @@
1
+ import { Method } from "axios";
2
+ export interface NeuctraAuthixConfig {
3
+ /** Base URL of the Authix API (required) */
4
+ baseUrl: string;
5
+ /** API key for authentication */
6
+ apiKey: string;
7
+ /** App ID for scoping user operations */
8
+ appId: string;
9
+ }
10
+ export interface SignupParams {
11
+ name: string;
12
+ email: string;
13
+ password: string;
14
+ phone?: string | null;
15
+ address?: string | null;
16
+ avatarUrl?: string | null;
17
+ isActive?: boolean;
18
+ role?: string;
19
+ adminId?: string | null;
20
+ }
21
+ export interface LoginParams {
22
+ email: string;
23
+ password: string;
24
+ appId: string;
25
+ }
26
+ export interface UpdateUserParams {
27
+ userId: string;
28
+ name?: string;
29
+ email?: string;
30
+ password?: string;
31
+ phone?: string | null;
32
+ address?: string | null;
33
+ avatarUrl?: string | null;
34
+ isActive?: boolean;
35
+ role?: string;
36
+ appId?: string | null;
37
+ }
38
+ export interface ChangePasswordParams {
39
+ userId: string;
40
+ currentPassword: string;
41
+ newPassword: string;
42
+ appId?: string | null;
43
+ }
44
+ export interface DeleteUserParams {
45
+ userId: string;
46
+ appId?: string | null;
47
+ }
48
+ export interface GetProfileParams {
49
+ /** JWT access token */
50
+ token: string;
51
+ }
52
+ export interface CheckUserResponse {
53
+ success: boolean;
54
+ exists: boolean;
55
+ }
56
+ export interface CheckSessionResponse {
57
+ authenticated: boolean;
58
+ user?: Record<string, any>;
59
+ }
60
+ export interface GetUserDataParams {
61
+ userId: string;
62
+ }
63
+ export interface GetSingleUserDataParams {
64
+ userId: string;
65
+ dataId: string;
66
+ }
67
+ export interface AddUserDataParams {
68
+ userId: string;
69
+ dataCategory: string;
70
+ /** Object to add */
71
+ data: Record<string, any>;
72
+ }
73
+ export interface UpdateUserDataParams {
74
+ userId: string;
75
+ dataId: string;
76
+ /** Fields to update */
77
+ data: Record<string, any>;
78
+ }
79
+ export interface DeleteUserDataParams {
80
+ userId: string;
81
+ dataId: string;
82
+ }
83
+ export interface AppDataItem {
84
+ id: string;
85
+ [key: string]: any;
86
+ }
87
+ export interface AddAppDataParams {
88
+ data: Record<string, any>;
89
+ }
90
+ export interface UpdateAppDataParams {
91
+ dataId: string;
92
+ data: Record<string, any>;
93
+ }
94
+ export interface DeleteAppDataParams {
95
+ dataId: string;
96
+ }
97
+ export interface SDKRequestOptions<D = any> {
98
+ method: Method;
99
+ path: string;
100
+ data?: D;
101
+ extraHeaders?: Record<string, string>;
102
+ }
103
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/sdk/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;CACf;AAKD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE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WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAKD,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,GAAG;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuctra/authix",
3
- "version": "1.1.52",
3
+ "version": "1.1.55",
4
4
  "description": "Universal authentication SDK and UI components for React (v16–v19) with TailwindCSS.",
5
5
  "author": "Taha Asif",
6
6
  "license": "MIT",