@authorizerdev/authorizer-js 2.0.3 → 3.0.0-rc.1
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/lib/authorizer.min.js +13 -13
- package/lib/index.d.mts +237 -165
- package/lib/index.d.ts +237 -165
- package/lib/index.js +661 -14
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +627 -14
- package/lib/index.mjs.map +1 -0
- package/package.json +8 -14
package/lib/authorizer.min.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var authorizerdev=(()=>{var ye=Object.create;var k=Object.defineProperty,_e=Object.defineProperties,me=Object.getOwnPropertyDescriptor,ge=Object.getOwnPropertyDescriptors,we=Object.getOwnPropertyNames,G=Object.getOwnPropertySymbols,be=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var P=(n,e,o)=>e in n?k(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o,I=(n,e)=>{for(var o in e||(e={}))W.call(e,o)&&P(n,o,e[o]);if(G)for(var o of G(e))Re.call(e,o)&&P(n,o,e[o]);return n},Z=(n,e)=>_e(n,ge(e)),a=(n,e)=>k(n,"name",{value:e,configurable:!0});var ve=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ee=(n,e)=>{for(var o in e)k(n,o,{get:e[o],enumerable:!0})},X=(n,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of we(e))!W.call(n,r)&&r!==o&&k(n,r,{get:()=>e[r],enumerable:!(s=me(e,r))||s.enumerable});return n};var Te=(n,e,o)=>(o=n!=null?ye(be(n)):{},X(e||!n||!n.__esModule?k(o,"default",{value:n,enumerable:!0}):o,n)),Ue=n=>X(k({},"__esModule",{value:!0}),n);var u=(n,e,o)=>(P(n,typeof e!="symbol"?e+"":e,o),o);var l=(n,e,o)=>new Promise((s,r)=>{var c=m=>{try{w(o.next(m))}catch(_){r(_)}},g=m=>{try{w(o.throw(m))}catch(_){r(_)}},w=m=>m.done?s(m.value):Promise.resolve(m.value).then(c,g);w((o=o.apply(n,e)).next())});var ee=ve((R,Y)=>{var K=typeof self!="undefined"?self:R,$=function(){function n(){this.fetch=!1,this.DOMException=K.DOMException}return a(n,"F"),n.prototype=K,new n}();(function(n){var e=function(o){var s={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function r(t){return t&&DataView.prototype.isPrototypeOf(t)}if(a(r,"isDataView"),s.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(t){return t&&c.indexOf(Object.prototype.toString.call(t))>-1};function w(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}a(w,"normalizeName");function m(t){return typeof t!="string"&&(t=String(t)),t}a(m,"normalizeValue");function _(t){var i={next:function(){var h=t.shift();return{done:h===void 0,value:h}}};return s.iterable&&(i[Symbol.iterator]=function(){return i}),i}a(_,"iteratorFor");function p(t){this.map={},t instanceof p?t.forEach(function(i,h){this.append(h,i)},this):Array.isArray(t)?t.forEach(function(i){this.append(i[0],i[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(i){this.append(i,t[i])},this)}a(p,"Headers"),p.prototype.append=function(t,i){t=w(t),i=m(i);var h=this.map[t];this.map[t]=h?h+", "+i:i},p.prototype.delete=function(t){delete this.map[w(t)]},p.prototype.get=function(t){return t=w(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(w(t))},p.prototype.set=function(t,i){this.map[w(t)]=m(i)},p.prototype.forEach=function(t,i){for(var h in this.map)this.map.hasOwnProperty(h)&&t.call(i,this.map[h],h,this)},p.prototype.keys=function(){var t=[];return this.forEach(function(i,h){t.push(h)}),_(t)},p.prototype.values=function(){var t=[];return this.forEach(function(i){t.push(i)}),_(t)},p.prototype.entries=function(){var t=[];return this.forEach(function(i,h){t.push([h,i])}),_(t)},s.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function D(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}a(D,"consumed");function Q(t){return new Promise(function(i,h){t.onload=function(){i(t.result)},t.onerror=function(){h(t.error)}})}a(Q,"fileReaderReady");function ae(t){var i=new FileReader,h=Q(i);return i.readAsArrayBuffer(t),h}a(ae,"readBlobAsArrayBuffer");function ce(t){var i=new FileReader,h=Q(i);return i.readAsText(t),h}a(ce,"readBlobAsText");function he(t){for(var i=new Uint8Array(t),h=new Array(i.length),y=0;y<i.length;y++)h[y]=String.fromCharCode(i[y]);return h.join("")}a(he,"readArrayBufferAsText");function V(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}a(V,"bufferClone");function J(){return this.bodyUsed=!1,this._initBody=function(t){this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:s.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s.arrayBuffer&&s.blob&&r(t)?(this._bodyArrayBuffer=V(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||g(t))?this._bodyArrayBuffer=V(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s.blob&&(this.blob=function(){var t=D(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?D(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(ae)}),this.text=function(){var t=D(this);if(t)return t;if(this._bodyBlob)return ce(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(he(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s.formData&&(this.formData=function(){return this.text().then(le)}),this.json=function(){return this.text().then(JSON.parse)},this}a(J,"Body");var ue=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function de(t){var i=t.toUpperCase();return ue.indexOf(i)>-1?i:t}a(de,"normalizeMethod");function E(t,i){i=i||{};var h=i.body;if(t instanceof E){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!h&&t._bodyInit!=null&&(h=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",(i.headers||!this.headers)&&(this.headers=new p(i.headers)),this.method=de(i.method||this.method||"GET"),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&h)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(h)}a(E,"Request"),E.prototype.clone=function(){return new E(this,{body:this._bodyInit})};function le(t){var i=new FormData;return t.trim().split("&").forEach(function(h){if(h){var y=h.split("="),f=y.shift().replace(/\+/g," "),d=y.join("=").replace(/\+/g," ");i.append(decodeURIComponent(f),decodeURIComponent(d))}}),i}a(le,"decode");function pe(t){var i=new p,h=t.replace(/\r?\n[\t ]+/g," ");return h.split(/\r?\n/).forEach(function(y){var f=y.split(":"),d=f.shift().trim();if(d){var S=f.join(":").trim();i.append(d,S)}}),i}a(pe,"parseHeaders"),J.call(E.prototype);function b(t,i){i||(i={}),this.type="default",this.status=i.status===void 0?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new p(i.headers),this.url=i.url||"",this._initBody(t)}a(b,"Response"),J.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var fe=[301,302,303,307,308];b.redirect=function(t,i){if(fe.indexOf(i)===-1)throw new RangeError("Invalid status code");return new b(null,{status:i,headers:{location:t}})},o.DOMException=n.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(i,h){this.message=i,this.name=h;var y=Error(i);this.stack=y.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function B(t,i){return new Promise(function(h,y){var f=new E(t,i);if(f.signal&&f.signal.aborted)return y(new o.DOMException("Aborted","AbortError"));var d=new XMLHttpRequest;function S(){d.abort()}a(S,"abortXhr"),d.onload=function(){var L={status:d.status,statusText:d.statusText,headers:pe(d.getAllResponseHeaders()||"")};L.url="responseURL"in d?d.responseURL:L.headers.get("X-Request-URL");var C="response"in d?d.response:d.responseText;h(new b(C,L))},d.onerror=function(){y(new TypeError("Network request failed"))},d.ontimeout=function(){y(new TypeError("Network request failed"))},d.onabort=function(){y(new o.DOMException("Aborted","AbortError"))},d.open(f.method,f.url,!0),f.credentials==="include"?d.withCredentials=!0:f.credentials==="omit"&&(d.withCredentials=!1),"responseType"in d&&s.blob&&(d.responseType="blob"),f.headers.forEach(function(L,C){d.setRequestHeader(C,L)}),f.signal&&(f.signal.addEventListener("abort",S),d.onreadystatechange=function(){d.readyState===4&&f.signal.removeEventListener("abort",S)}),d.send(typeof f._bodyInit=="undefined"?null:f._bodyInit)})}return a(B,"fetch"),B.polyfill=!0,n.fetch||(n.fetch=B,n.Headers=p,n.Request=E,n.Response=b),o.Headers=p,o.Request=E,o.Response=b,o.fetch=B,Object.defineProperty(o,"__esModule",{value:!0}),o}({})})($);$.fetch.ponyfill=!0;delete $.fetch.polyfill;var A=$;R=A.fetch;R.default=A.fetch;R.fetch=A.fetch;R.Headers=A.Headers;R.Request=A.Request;R.Response=A.Response;Y.exports=R});var Le={};Ee(Le,{Authorizer:()=>H,OAuthProviders:()=>q,ResponseTypes:()=>x});var ie=Te(ee());var q;(function(n){n.Apple="apple",n.Github="github",n.Google="google",n.Facebook="facebook",n.LinkedIn="linkedin",n.Twitter="twitter",n.Microsoft="microsoft",n.Twitch="twitch",n.Roblox="roblox"})(q||(q={}));var x;(function(n){n.Code="code",n.Token="token"})(x||(x={}));var T=a(()=>typeof window!="undefined","hasWindow"),j=a(n=>{let e=n.trim();return e[e.length-1]==="/"&&(e=e.slice(0,-1)),e},"trimURL"),re=a(()=>T()?window.crypto||window.msCrypto:null,"getCrypto"),Ae=a(()=>{let n=re();return n&&n.subtle||n.webkitSubtle},"getCryptoSubtle"),U=a(()=>{let n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.",e="",o=re();return o&&Array.from(o.getRandomValues(new Uint8Array(43))).forEach(r=>e+=n[r%n.length]),e},"createRandomString"),v=a(n=>T()?btoa(n):Buffer.from(n).toString("base64"),"encode");var te=a(n=>Object.keys(n).filter(e=>typeof n[e]!="undefined").map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(n[e])}`).join("&"),"createQueryParams"),oe=a(n=>l(void 0,null,function*(){let e=Ae().digest({name:"SHA-256"},new TextEncoder().encode(n));return window.msCrypto?new Promise((o,s)=>{e.oncomplete=r=>{o(r.target.result)},e.onerror=r=>{s(r.error)},e.onabort=()=>{s(new Error("The digest operation was aborted"))}}):yield e}),"sha256"),xe=a(n=>{let e={"+":"-","/":"_","=":""};return n.replace(/[+/=]/g,o=>e[o])},"urlEncodeB64");var se=a(n=>{let e=new Uint8Array(n);return xe(window.btoa(String.fromCharCode(...Array.from(e))))},"bufferToBase64UrlEncoded"),ne=a((n,e,o=60)=>new Promise((s,r)=>{let c=window.document.createElement("iframe");c.setAttribute("id","authorizer-iframe"),c.setAttribute("width","0"),c.setAttribute("height","0"),c.style.display="none";let g=a(()=>{window.document.body.contains(c)&&(window.document.body.removeChild(c),window.removeEventListener("message",m,!1))},"removeIframe"),w=setTimeout(()=>{g()},o*1e3),m=a(function(_){if(_.origin!==e||!_.data||!_.data.response)return;let p=_.source;p&&p.close(),_.data.response.error?r(_.data.response):s(_.data.response),clearTimeout(w),window.removeEventListener("message",m,!1),setTimeout(g,2*1e3)},"iframeEventHandler");window.addEventListener("message",m,!1),window.document.body.appendChild(c),c.setAttribute("src",n)}),"executeIframe");var z="id email email_verified given_name family_name middle_name nickname preferred_username picture signup_methods gender birthdate phone_number phone_number_verified roles created_at updated_at is_multi_factor_auth_enabled app_data",O=`message access_token expires_in refresh_token id_token should_show_email_otp_screen should_show_mobile_otp_screen should_show_totp_screen authenticator_scanner_image authenticator_secret authenticator_recovery_codes user { ${z} }`,M=a(()=>T()?window.fetch:ie.default,"getFetcher"),N=class N{constructor(e){u(this,"config");u(this,"codeVerifier");u(this,"authorize",a(e=>l(this,null,function*(){if(!T())return this.errorResponse([new Error("this feature is only supported in browser")]);let o=["openid","profile","email"];e.use_refresh_token&&o.push("offline_access");let s={redirect_uri:this.config.redirectURL,response_mode:e.response_mode||"web_message",state:v(U()),nonce:v(U()),response_type:e.response_type,scope:o.join(" "),client_id:this.config.clientID};if(e.response_type===x.Code){this.codeVerifier=U();let c=yield oe(this.codeVerifier),g=se(c);s.code_challenge=g}let r=`${this.config.authorizerURL}/authorize?${te(s)}`;if(s.response_mode!=="web_message")return window.location.replace(r),this.okResponse(void 0);try{let c=yield ne(r,this.config.authorizerURL,60);if(e.response_type===x.Code){let g=yield this.getToken({code:c.code});return g.errors.length?this.errorResponse(g.errors):this.okResponse(g.data)}return this.okResponse(c)}catch(c){return c.error&&window.location.replace(`${this.config.authorizerURL}/app?state=${v(JSON.stringify(this.config))}&redirect_uri=${this.config.redirectURL}`),this.errorResponse(c)}}),"authorize"));u(this,"browserLogin",a(()=>l(this,null,function*(){try{let e=yield this.getSession();return e.errors.length?this.errorResponse(e.errors):this.okResponse(e.data)}catch(e){return T()?(window.location.replace(`${this.config.authorizerURL}/app?state=${v(JSON.stringify(this.config))}&redirect_uri=${this.config.redirectURL}`),this.errorResponse(e)):{data:void 0,errors:[new Error("browserLogin is only supported for browsers")]}}}),"browserLogin"));u(this,"forgotPassword",a(e=>l(this,null,function*(){var o;e.state||(e.state=v(U())),e.redirect_uri||(e.redirect_uri=this.config.redirectURL);try{let s=yield this.graphqlQuery({query:"mutation forgotPassword($data: ForgotPasswordInput!) { forgot_password(params: $data) { message should_show_mobile_otp_screen } }",variables:{data:e}});return(o=s==null?void 0:s.errors)!=null&&o.length?this.errorResponse(s.errors):this.okResponse(s==null?void 0:s.data.forgot_password)}catch(s){return this.errorResponse([s])}}),"forgotPassword"));u(this,"getMetaData",a(()=>l(this,null,function*(){var e;try{let o=yield this.graphqlQuery({query:"query { meta { version client_id is_google_login_enabled is_facebook_login_enabled is_github_login_enabled is_linkedin_login_enabled is_apple_login_enabled is_twitter_login_enabled is_microsoft_login_enabled is_twitch_login_enabled is_roblox_login_enabled is_email_verification_enabled is_basic_authentication_enabled is_magic_link_login_enabled is_sign_up_enabled is_strong_password_enabled is_multi_factor_auth_enabled is_mobile_basic_authentication_enabled is_phone_verification_enabled } }"});return(e=o==null?void 0:o.errors)!=null&&e.length?this.errorResponse(o.errors):this.okResponse(o.data.meta)}catch(o){return this.errorResponse([o])}}),"getMetaData"));u(this,"getProfile",a(e=>l(this,null,function*(){var o;try{let s=yield this.graphqlQuery({query:`query { profile { ${z} } }`,headers:e});return(o=s==null?void 0:s.errors)!=null&&o.length?this.errorResponse(s.errors):this.okResponse(s.data.profile)}catch(s){return this.errorResponse([s])}}),"getProfile"));u(this,"getSession",a((e,o)=>l(this,null,function*(){var s,r;try{let c=yield this.graphqlQuery({query:`query getSession($params: SessionQueryInput){session(params: $params) { ${O} } }`,headers:e,variables:{params:o}});return(s=c==null?void 0:c.errors)!=null&&s.length?this.errorResponse(c.errors):this.okResponse((r=c.data)==null?void 0:r.session)}catch(c){return this.errorResponse(c)}}),"getSession"));u(this,"getToken",a(e=>l(this,null,function*(){if(e.grant_type||(e.grant_type="authorization_code"),e.grant_type==="refresh_token"&&!e.refresh_token)return this.errorResponse([new Error("Invalid refresh_token")]);if(e.grant_type==="authorization_code"&&!this.codeVerifier)return this.errorResponse([new Error("Invalid code verifier")]);let o={client_id:this.config.clientID,code:e.code||"",code_verifier:this.codeVerifier||"",grant_type:e.grant_type||"",refresh_token:e.refresh_token||""};try{let r=yield M()(`${this.config.authorizerURL}/oauth/token`,{method:"POST",body:JSON.stringify(o),headers:I({},this.config.extraHeaders),credentials:"include"}),c=yield r.json();return r.status>=400?this.errorResponse([new Error(c.error_description||c.error)]):this.okResponse(c)}catch(s){return this.errorResponse(s)}}),"getToken"));u(this,"login",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
|
|
2
|
-
mutation login($data:
|
|
1
|
+
var authorizerdev=(()=>{var ye=Object.create;var k=Object.defineProperty,_e=Object.defineProperties,me=Object.getOwnPropertyDescriptor,ge=Object.getOwnPropertyDescriptors,we=Object.getOwnPropertyNames,G=Object.getOwnPropertySymbols,be=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var P=(n,e,o)=>e in n?k(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o,q=(n,e)=>{for(var o in e||(e={}))W.call(e,o)&&P(n,o,e[o]);if(G)for(var o of G(e))Re.call(e,o)&&P(n,o,e[o]);return n},Z=(n,e)=>_e(n,ge(e)),a=(n,e)=>k(n,"name",{value:e,configurable:!0});var ve=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ee=(n,e)=>{for(var o in e)k(n,o,{get:e[o],enumerable:!0})},X=(n,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of we(e))!W.call(n,r)&&r!==o&&k(n,r,{get:()=>e[r],enumerable:!(s=me(e,r))||s.enumerable});return n};var Te=(n,e,o)=>(o=n!=null?ye(be(n)):{},X(e||!n||!n.__esModule?k(o,"default",{value:n,enumerable:!0}):o,n)),Ue=n=>X(k({},"__esModule",{value:!0}),n);var u=(n,e,o)=>(P(n,typeof e!="symbol"?e+"":e,o),o);var l=(n,e,o)=>new Promise((s,r)=>{var c=w=>{try{p(o.next(w))}catch(m){r(m)}},g=w=>{try{p(o.throw(w))}catch(m){r(m)}},p=w=>w.done?s(w.value):Promise.resolve(w.value).then(c,g);p((o=o.apply(n,e)).next())});var ee=ve((R,Y)=>{var K=typeof self!="undefined"?self:R,I=function(){function n(){this.fetch=!1,this.DOMException=K.DOMException}return a(n,"F"),n.prototype=K,new n}();(function(n){var e=function(o){var s={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function r(t){return t&&DataView.prototype.isPrototypeOf(t)}if(a(r,"isDataView"),s.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(t){return t&&c.indexOf(Object.prototype.toString.call(t))>-1};function p(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}a(p,"normalizeName");function w(t){return typeof t!="string"&&(t=String(t)),t}a(w,"normalizeValue");function m(t){var i={next:function(){var h=t.shift();return{done:h===void 0,value:h}}};return s.iterable&&(i[Symbol.iterator]=function(){return i}),i}a(m,"iteratorFor");function f(t){this.map={},t instanceof f?t.forEach(function(i,h){this.append(h,i)},this):Array.isArray(t)?t.forEach(function(i){this.append(i[0],i[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(i){this.append(i,t[i])},this)}a(f,"Headers"),f.prototype.append=function(t,i){t=p(t),i=w(i);var h=this.map[t];this.map[t]=h?h+", "+i:i},f.prototype.delete=function(t){delete this.map[p(t)]},f.prototype.get=function(t){return t=p(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(p(t))},f.prototype.set=function(t,i){this.map[p(t)]=w(i)},f.prototype.forEach=function(t,i){for(var h in this.map)this.map.hasOwnProperty(h)&&t.call(i,this.map[h],h,this)},f.prototype.keys=function(){var t=[];return this.forEach(function(i,h){t.push(h)}),m(t)},f.prototype.values=function(){var t=[];return this.forEach(function(i){t.push(i)}),m(t)},f.prototype.entries=function(){var t=[];return this.forEach(function(i,h){t.push([h,i])}),m(t)},s.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function D(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}a(D,"consumed");function Q(t){return new Promise(function(i,h){t.onload=function(){i(t.result)},t.onerror=function(){h(t.error)}})}a(Q,"fileReaderReady");function ae(t){var i=new FileReader,h=Q(i);return i.readAsArrayBuffer(t),h}a(ae,"readBlobAsArrayBuffer");function ce(t){var i=new FileReader,h=Q(i);return i.readAsText(t),h}a(ce,"readBlobAsText");function he(t){for(var i=new Uint8Array(t),h=new Array(i.length),_=0;_<i.length;_++)h[_]=String.fromCharCode(i[_]);return h.join("")}a(he,"readArrayBufferAsText");function V(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}a(V,"bufferClone");function J(){return this.bodyUsed=!1,this._initBody=function(t){this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:s.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s.arrayBuffer&&s.blob&&r(t)?(this._bodyArrayBuffer=V(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||g(t))?this._bodyArrayBuffer=V(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s.blob&&(this.blob=function(){var t=D(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?D(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(ae)}),this.text=function(){var t=D(this);if(t)return t;if(this._bodyBlob)return ce(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(he(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s.formData&&(this.formData=function(){return this.text().then(le)}),this.json=function(){return this.text().then(JSON.parse)},this}a(J,"Body");var ue=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function de(t){var i=t.toUpperCase();return ue.indexOf(i)>-1?i:t}a(de,"normalizeMethod");function E(t,i){i=i||{};var h=i.body;if(t instanceof E){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!h&&t._bodyInit!=null&&(h=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",(i.headers||!this.headers)&&(this.headers=new f(i.headers)),this.method=de(i.method||this.method||"GET"),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&h)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(h)}a(E,"Request"),E.prototype.clone=function(){return new E(this,{body:this._bodyInit})};function le(t){var i=new FormData;return t.trim().split("&").forEach(function(h){if(h){var _=h.split("="),y=_.shift().replace(/\+/g," "),d=_.join("=").replace(/\+/g," ");i.append(decodeURIComponent(y),decodeURIComponent(d))}}),i}a(le,"decode");function fe(t){var i=new f,h=t.replace(/\r?\n[\t ]+/g," ");return h.split(/\r?\n/).forEach(function(_){var y=_.split(":"),d=y.shift().trim();if(d){var $=y.join(":").trim();i.append(d,$)}}),i}a(fe,"parseHeaders"),J.call(E.prototype);function b(t,i){i||(i={}),this.type="default",this.status=i.status===void 0?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new f(i.headers),this.url=i.url||"",this._initBody(t)}a(b,"Response"),J.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var pe=[301,302,303,307,308];b.redirect=function(t,i){if(pe.indexOf(i)===-1)throw new RangeError("Invalid status code");return new b(null,{status:i,headers:{location:t}})},o.DOMException=n.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(i,h){this.message=i,this.name=h;var _=Error(i);this.stack=_.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function B(t,i){return new Promise(function(h,_){var y=new E(t,i);if(y.signal&&y.signal.aborted)return _(new o.DOMException("Aborted","AbortError"));var d=new XMLHttpRequest;function $(){d.abort()}a($,"abortXhr"),d.onload=function(){var L={status:d.status,statusText:d.statusText,headers:fe(d.getAllResponseHeaders()||"")};L.url="responseURL"in d?d.responseURL:L.headers.get("X-Request-URL");var C="response"in d?d.response:d.responseText;h(new b(C,L))},d.onerror=function(){_(new TypeError("Network request failed"))},d.ontimeout=function(){_(new TypeError("Network request failed"))},d.onabort=function(){_(new o.DOMException("Aborted","AbortError"))},d.open(y.method,y.url,!0),y.credentials==="include"?d.withCredentials=!0:y.credentials==="omit"&&(d.withCredentials=!1),"responseType"in d&&s.blob&&(d.responseType="blob"),y.headers.forEach(function(L,C){d.setRequestHeader(C,L)}),y.signal&&(y.signal.addEventListener("abort",$),d.onreadystatechange=function(){d.readyState===4&&y.signal.removeEventListener("abort",$)}),d.send(typeof y._bodyInit=="undefined"?null:y._bodyInit)})}return a(B,"fetch"),B.polyfill=!0,n.fetch||(n.fetch=B,n.Headers=f,n.Request=E,n.Response=b),o.Headers=f,o.Request=E,o.Response=b,o.fetch=B,Object.defineProperty(o,"__esModule",{value:!0}),o}({})})(I);I.fetch.ponyfill=!0;delete I.fetch.polyfill;var x=I;R=x.fetch;R.default=x.fetch;R.fetch=x.fetch;R.Headers=x.Headers;R.Request=x.Request;R.Response=x.Response;Y.exports=R});var Le={};Ee(Le,{Authorizer:()=>H,OAuthProviders:()=>O,ResponseTypes:()=>A});var ie=Te(ee());var O;(function(n){n.Apple="apple",n.Github="github",n.Google="google",n.Facebook="facebook",n.LinkedIn="linkedin",n.Twitter="twitter",n.Microsoft="microsoft",n.Twitch="twitch",n.Roblox="roblox",n.Discord="discord"})(O||(O={}));var A;(function(n){n.Code="code",n.Token="token"})(A||(A={}));var T=a(()=>typeof window!="undefined","hasWindow"),j=a(n=>{let e=n.trim();return e[e.length-1]==="/"&&(e=e.slice(0,-1)),e},"trimURL"),re=a(()=>T()?window.crypto||window.msCrypto:null,"getCrypto"),xe=a(()=>{let n=re();return n&&n.subtle||n.webkitSubtle},"getCryptoSubtle"),U=a(()=>{let n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.",e="",o=re();return o&&Array.from(o.getRandomValues(new Uint8Array(43))).forEach(r=>e+=n[r%n.length]),e},"createRandomString"),v=a(n=>T()?btoa(n):Buffer.from(n).toString("base64"),"encode");var te=a(n=>Object.keys(n).filter(e=>typeof n[e]!="undefined").map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(n[e])}`).join("&"),"createQueryParams"),oe=a(n=>l(void 0,null,function*(){let e=xe().digest({name:"SHA-256"},new TextEncoder().encode(n));return window.msCrypto?new Promise((o,s)=>{e.oncomplete=r=>{o(r.target.result)},e.onerror=r=>{s(r.error)},e.onabort=()=>{s(new Error("The digest operation was aborted"))}}):yield e}),"sha256"),Ae=a(n=>{let e={"+":"-","/":"_","=":""};return n.replace(/[+/=]/g,o=>e[o])},"urlEncodeB64");var se=a(n=>{let e=new Uint8Array(n);return Ae(window.btoa(String.fromCharCode(...Array.from(e))))},"bufferToBase64UrlEncoded"),ne=a((n,e,o=60)=>new Promise((s,r)=>{let c=window.document.createElement("iframe");c.setAttribute("id","authorizer-iframe"),c.setAttribute("width","0"),c.setAttribute("height","0"),c.style.display="none";let g=a(()=>{window.document.body.contains(c)&&(window.document.body.removeChild(c),window.removeEventListener("message",w,!1))},"removeIframe"),p=setTimeout(()=>{g()},o*1e3),w=a(function(m){if(m.origin!==e||!m.data||!m.data.response)return;let f=m.source;f&&f.close(),m.data.response.error?r(m.data.response):s(m.data.response),clearTimeout(p),window.removeEventListener("message",w,!1),setTimeout(g,2*1e3)},"iframeEventHandler");window.addEventListener("message",w,!1),window.document.body.appendChild(c),c.setAttribute("src",n)}),"executeIframe");var z="id email email_verified given_name family_name middle_name nickname preferred_username picture signup_methods gender birthdate phone_number phone_number_verified roles created_at updated_at revoked_timestamp is_multi_factor_auth_enabled app_data",S=`message access_token expires_in refresh_token id_token should_show_email_otp_screen should_show_mobile_otp_screen should_show_totp_screen authenticator_scanner_image authenticator_secret authenticator_recovery_codes user { ${z} }`,M=a(()=>T()?window.fetch:ie.default,"getFetcher"),N=class N{constructor(e){u(this,"config");u(this,"codeVerifier");u(this,"authorize",a(e=>l(this,null,function*(){var c;if(!T())return this.errorResponse([new Error("this feature is only supported in browser")]);let o=["openid","profile","email"];e.use_refresh_token&&o.push("offline_access");let s={redirect_uri:this.config.redirectURL,response_mode:e.response_mode||"web_message",state:v(U()),nonce:v(U()),response_type:e.response_type,scope:o.join(" "),client_id:((c=this.config)==null?void 0:c.clientID)||""};if(e.response_type===A.Code){this.codeVerifier=U();let g=yield oe(this.codeVerifier),p=se(g);s.code_challenge=p}let r=`${this.config.authorizerURL}/authorize?${te(s)}`;if(s.response_mode!=="web_message")return window.location.replace(r),this.okResponse(void 0);try{let g=yield ne(r,this.config.authorizerURL,60);if(e.response_type===A.Code){let p=yield this.getToken({code:g.code});return p.errors.length?this.errorResponse(p.errors):this.okResponse(p.data)}return this.okResponse(g)}catch(g){return g.error&&window.location.replace(`${this.config.authorizerURL}/app?state=${v(JSON.stringify(this.config))}&redirect_uri=${this.config.redirectURL}`),this.errorResponse(g)}}),"authorize"));u(this,"browserLogin",a(()=>l(this,null,function*(){try{let e=yield this.getSession();return e.errors.length?this.errorResponse(e.errors):this.okResponse(e.data)}catch(e){return T()?(window.location.replace(`${this.config.authorizerURL}/app?state=${v(JSON.stringify(this.config))}&redirect_uri=${this.config.redirectURL}`),this.errorResponse(e)):{data:void 0,errors:[new Error("browserLogin is only supported for browsers")]}}}),"browserLogin"));u(this,"forgotPassword",a(e=>l(this,null,function*(){var o;e.state||(e.state=v(U())),e.redirect_uri||(e.redirect_uri=this.config.redirectURL);try{let s=yield this.graphqlQuery({query:"mutation forgotPassword($data: ForgotPasswordRequest!) { forgot_password(params: $data) { message should_show_mobile_otp_screen } }",variables:{data:e}});return(o=s==null?void 0:s.errors)!=null&&o.length?this.errorResponse(s.errors):this.okResponse(s==null?void 0:s.data.forgot_password)}catch(s){return this.errorResponse([s])}}),"forgotPassword"));u(this,"getMetaData",a(()=>l(this,null,function*(){var e;try{let o=yield this.graphqlQuery({query:"query { meta { version client_id is_google_login_enabled is_facebook_login_enabled is_github_login_enabled is_linkedin_login_enabled is_apple_login_enabled is_twitter_login_enabled is_microsoft_login_enabled is_twitch_login_enabled is_roblox_login_enabled is_email_verification_enabled is_basic_authentication_enabled is_magic_link_login_enabled is_sign_up_enabled is_strong_password_enabled is_multi_factor_auth_enabled is_mobile_basic_authentication_enabled is_phone_verification_enabled } }"});return(e=o==null?void 0:o.errors)!=null&&e.length?this.errorResponse(o.errors):this.okResponse(o.data.meta)}catch(o){return this.errorResponse([o])}}),"getMetaData"));u(this,"getProfile",a(e=>l(this,null,function*(){var o;try{let s=yield this.graphqlQuery({query:`query { profile { ${z} } }`,headers:e});return(o=s==null?void 0:s.errors)!=null&&o.length?this.errorResponse(s.errors):this.okResponse(s.data.profile)}catch(s){return this.errorResponse([s])}}),"getProfile"));u(this,"getSession",a((e,o)=>l(this,null,function*(){var s,r;try{let c=yield this.graphqlQuery({query:`query getSession($params: SessionQueryRequest){session(params: $params) { ${S} } }`,headers:e,variables:{params:o}});return(s=c==null?void 0:c.errors)!=null&&s.length?this.errorResponse(c.errors):this.okResponse((r=c.data)==null?void 0:r.session)}catch(c){return this.errorResponse(c)}}),"getSession"));u(this,"getToken",a(e=>l(this,null,function*(){if(e.grant_type||(e.grant_type="authorization_code"),e.grant_type==="refresh_token"&&!e.refresh_token)return this.errorResponse([new Error("Invalid refresh_token")]);if(e.grant_type==="authorization_code"&&!this.codeVerifier)return this.errorResponse([new Error("Invalid code verifier")]);let o={client_id:this.config.clientID,code:e.code||"",code_verifier:this.codeVerifier||"",grant_type:e.grant_type||"",refresh_token:e.refresh_token||""};try{let r=yield M()(`${this.config.authorizerURL}/oauth/token`,{method:"POST",body:JSON.stringify(o),headers:q({},this.config.extraHeaders),credentials:"include"}),c=yield r.json();return r.status>=400?this.errorResponse([new Error(c.error_description||c.error)]):this.okResponse(c)}catch(s){return this.errorResponse(s)}}),"getToken"));u(this,"login",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
|
|
2
|
+
mutation login($data: LoginRequest!) { login(params: $data) { ${S}}}
|
|
3
3
|
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.login)}catch(r){return this.errorResponse([new Error(r)])}}),"login"));u(this,"logout",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:" mutation { logout { message } } ",headers:e});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.response)}catch(r){return this.errorResponse([r])}}),"logout"));u(this,"magicLinkLogin",a(e=>l(this,null,function*(){var o,s;try{e.state||(e.state=v(U())),e.redirect_uri||(e.redirect_uri=this.config.redirectURL);let r=yield this.graphqlQuery({query:`
|
|
4
|
-
mutation magicLinkLogin($data:
|
|
5
|
-
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.magic_link_login)}catch(r){return this.errorResponse([r])}}),"magicLinkLogin"));u(this,"oauthLogin",a((e,o,s,r)=>l(this,null,function*(){let c=r;if(c||(c=v(U())),!Object.values(
|
|
4
|
+
mutation magicLinkLogin($data: MagicLinkLoginRequest!) { magic_link_login(params: $data) { message }}
|
|
5
|
+
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.magic_link_login)}catch(r){return this.errorResponse([r])}}),"magicLinkLogin"));u(this,"oauthLogin",a((e,o,s,r)=>l(this,null,function*(){let c=r;if(c||(c=v(U())),!Object.values(O).includes(e))throw new Error(`only following oauth providers are supported: ${Object.values(e).toString()}`);if(!T())throw new Error("oauthLogin is only supported for browsers");o&&o.length&&(c+=`&roles=${o.join(",")}`),window.location.replace(`${this.config.authorizerURL}/oauth_login/${e}?redirect_uri=${s||this.config.redirectURL}&state=${c}`)}),"oauthLogin"));u(this,"resendOtp",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
|
|
6
6
|
mutation resendOtp($data: ResendOTPRequest!) { resend_otp(params: $data) { message }}
|
|
7
|
-
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.resend_otp)}catch(r){return this.errorResponse([r])}}),"resendOtp"));u(this,"resetPassword",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:"mutation resetPassword($data:
|
|
8
|
-
mutation signup($data:
|
|
9
|
-
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.signup)}catch(r){return this.errorResponse([r])}}),"signup"));u(this,"updateProfile",a((e,o)=>l(this,null,function*(){var s,r;try{let c=yield this.graphqlQuery({query:"mutation updateProfile($data:
|
|
10
|
-
mutation verifyEmail($data:
|
|
7
|
+
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.resend_otp)}catch(r){return this.errorResponse([r])}}),"resendOtp"));u(this,"resetPassword",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:"mutation resetPassword($data: ResetPasswordRequest!) { reset_password(params: $data) { message } }",variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.reset_password)}catch(r){return this.errorResponse([r])}}),"resetPassword"));u(this,"revokeToken",a(e=>l(this,null,function*(){if(!e.refresh_token&&!e.refresh_token.trim())return this.errorResponse([new Error("Invalid refresh_token")]);let r=yield(yield M()(`${this.config.authorizerURL}/oauth/revoke`,{method:"POST",headers:q({},this.config.extraHeaders),body:JSON.stringify({refresh_token:e.refresh_token,client_id:this.config.clientID})})).json();return this.okResponse(r)}),"revokeToken"));u(this,"signup",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
|
|
8
|
+
mutation signup($data: SignUpRequest!) { signup(params: $data) { ${S}}}
|
|
9
|
+
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.signup)}catch(r){return this.errorResponse([r])}}),"signup"));u(this,"updateProfile",a((e,o)=>l(this,null,function*(){var s,r;try{let c=yield this.graphqlQuery({query:"mutation updateProfile($data: UpdateProfileRequest!) { update_profile(params: $data) { message } }",headers:o,variables:{data:e}});return(s=c==null?void 0:c.errors)!=null&&s.length?this.errorResponse(c.errors):this.okResponse((r=c.data)==null?void 0:r.update_profile)}catch(c){return this.errorResponse([c])}}),"updateProfile"));u(this,"deactivateAccount",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:"mutation deactivateAccount { deactivate_account { message } }",headers:e});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.deactivate_account)}catch(r){return this.errorResponse([r])}}),"deactivateAccount"));u(this,"validateJWTToken",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:"query validateJWTToken($params: ValidateJWTTokenRequest!){validate_jwt_token(params: $params) { is_valid claims } }",variables:{params:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.validate_jwt_token)}catch(r){return this.errorResponse([r])}}),"validateJWTToken"));u(this,"validateSession",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`query validateSession($params: ValidateSessionRequest){validate_session(params: $params) { is_valid user { ${z} } } }`,variables:{params:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.validate_session)}catch(r){return this.errorResponse([r])}}),"validateSession"));u(this,"verifyEmail",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
|
|
10
|
+
mutation verifyEmail($data: VerifyEmailRequest!) { verify_email(params: $data) { ${S}}}
|
|
11
11
|
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.verify_email)}catch(r){return this.errorResponse([r])}}),"verifyEmail"));u(this,"resendVerifyEmail",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
|
|
12
|
-
mutation resendVerifyEmail($data:
|
|
13
|
-
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.
|
|
14
|
-
mutation verifyOtp($data: VerifyOTPRequest!) { verify_otp(params: $data) { ${
|
|
15
|
-
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.verify_otp)}catch(r){return this.errorResponse([r])}}),"verifyOtp"));u(this,"graphqlQuery",a(e=>l(this,null,function*(){var c;let r=yield(yield M()(`${this.config.authorizerURL}/graphql`,{method:"POST",body:JSON.stringify({query:e.query,variables:e.variables||{}}),headers:
|
|
16
|
-
window.
|
|
12
|
+
mutation resendVerifyEmail($data: ResendVerifyEmailRequest!) { resend_verify_email(params: $data) { message }}
|
|
13
|
+
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.resend_verify_email)}catch(r){return this.errorResponse([r])}}),"resendVerifyEmail"));u(this,"verifyOtp",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
|
|
14
|
+
mutation verifyOtp($data: VerifyOTPRequest!) { verify_otp(params: $data) { ${S}}}
|
|
15
|
+
`,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.verify_otp)}catch(r){return this.errorResponse([r])}}),"verifyOtp"));u(this,"graphqlQuery",a(e=>l(this,null,function*(){var c;let r=yield(yield M()(`${this.config.authorizerURL}/graphql`,{method:"POST",body:JSON.stringify({query:e.query,variables:e.variables||{}}),headers:q(q({},this.config.extraHeaders),e.headers||{}),credentials:"include"})).json();return(c=r==null?void 0:r.errors)!=null&&c.length?{data:void 0,errors:r.errors}:{data:r.data,errors:[]}}),"graphqlQuery"));u(this,"errorResponse",a(e=>({data:void 0,errors:e}),"errorResponse"));u(this,"okResponse",a(e=>({data:e,errors:[]}),"okResponse"));if(!e)throw new Error("Configuration is required");if(this.config=e,!e.authorizerURL&&!e.authorizerURL.trim())throw new Error("Invalid authorizerURL");if(e.authorizerURL&&(this.config.authorizerURL=j(e.authorizerURL)),!e.redirectURL&&!e.redirectURL.trim())throw new Error("Invalid redirectURL");this.config.redirectURL=j(e.redirectURL),this.config.extraHeaders=Z(q({},e.extraHeaders||{}),{"x-authorizer-url":this.config.authorizerURL,"x-authorizer-client-id":this.config.clientID||"","Content-Type":"application/json"}),this.config.clientID=((e==null?void 0:e.clientID)||"").trim()}};a(N,"Authorizer");var H=N;return Ue(Le);})();
|
|
16
|
+
if (typeof window !== "undefined") { window.authorizerdev = authorizerdev; }
|
package/lib/index.d.mts
CHANGED
|
@@ -9,107 +9,16 @@ interface ApiResponse<T> {
|
|
|
9
9
|
interface ConfigType {
|
|
10
10
|
authorizerURL: string;
|
|
11
11
|
redirectURL: string;
|
|
12
|
-
clientID
|
|
12
|
+
clientID?: string;
|
|
13
13
|
extraHeaders?: Record<string, string>;
|
|
14
14
|
}
|
|
15
|
-
interface
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
signup_methods: string;
|
|
21
|
-
given_name?: string | null;
|
|
22
|
-
family_name?: string | null;
|
|
23
|
-
middle_name?: string | null;
|
|
24
|
-
nickname?: string | null;
|
|
25
|
-
picture?: string | null;
|
|
26
|
-
gender?: string | null;
|
|
27
|
-
birthdate?: string | null;
|
|
28
|
-
phone_number?: string | null;
|
|
29
|
-
phone_number_verified?: boolean | null;
|
|
30
|
-
roles?: string[];
|
|
31
|
-
created_at: number;
|
|
32
|
-
updated_at: number;
|
|
33
|
-
is_multi_factor_auth_enabled?: boolean;
|
|
34
|
-
app_data?: Record<string, any>;
|
|
15
|
+
interface Pagination {
|
|
16
|
+
limit: number;
|
|
17
|
+
page: number;
|
|
18
|
+
offset: number;
|
|
19
|
+
total: number;
|
|
35
20
|
}
|
|
36
|
-
interface
|
|
37
|
-
message?: string;
|
|
38
|
-
access_token: string;
|
|
39
|
-
expires_in: number;
|
|
40
|
-
id_token: string;
|
|
41
|
-
refresh_token?: string;
|
|
42
|
-
user?: User;
|
|
43
|
-
should_show_email_otp_screen?: boolean;
|
|
44
|
-
should_show_mobile_otp_screen?: boolean;
|
|
45
|
-
should_show_totp_screen?: boolean;
|
|
46
|
-
authenticator_scanner_image?: string;
|
|
47
|
-
authenticator_secret?: string;
|
|
48
|
-
authenticator_recovery_codes?: string[];
|
|
49
|
-
}
|
|
50
|
-
interface GenericResponse {
|
|
51
|
-
message: string;
|
|
52
|
-
}
|
|
53
|
-
type Headers = Record<string, string>;
|
|
54
|
-
interface LoginInput {
|
|
55
|
-
email?: string;
|
|
56
|
-
phone_number?: string;
|
|
57
|
-
password: string;
|
|
58
|
-
roles?: string[];
|
|
59
|
-
scope?: string[];
|
|
60
|
-
state?: string;
|
|
61
|
-
}
|
|
62
|
-
interface SignupInput {
|
|
63
|
-
email?: string;
|
|
64
|
-
password: string;
|
|
65
|
-
confirm_password: string;
|
|
66
|
-
given_name?: string;
|
|
67
|
-
family_name?: string;
|
|
68
|
-
middle_name?: string;
|
|
69
|
-
nickname?: string;
|
|
70
|
-
picture?: string;
|
|
71
|
-
gender?: string;
|
|
72
|
-
birthdate?: string;
|
|
73
|
-
phone_number?: string;
|
|
74
|
-
roles?: string[];
|
|
75
|
-
scope?: string[];
|
|
76
|
-
redirect_uri?: string;
|
|
77
|
-
is_multi_factor_auth_enabled?: boolean;
|
|
78
|
-
state?: string;
|
|
79
|
-
app_data?: Record<string, any>;
|
|
80
|
-
}
|
|
81
|
-
interface MagicLinkLoginInput {
|
|
82
|
-
email: string;
|
|
83
|
-
roles?: string[];
|
|
84
|
-
scopes?: string[];
|
|
85
|
-
state?: string;
|
|
86
|
-
redirect_uri?: string;
|
|
87
|
-
}
|
|
88
|
-
interface VerifyEmailInput {
|
|
89
|
-
token: string;
|
|
90
|
-
state?: string;
|
|
91
|
-
}
|
|
92
|
-
interface ResendVerifyEmailInput {
|
|
93
|
-
email: string;
|
|
94
|
-
identifier: string;
|
|
95
|
-
}
|
|
96
|
-
interface VerifyOtpInput {
|
|
97
|
-
email?: string;
|
|
98
|
-
phone_number?: string;
|
|
99
|
-
otp: string;
|
|
100
|
-
state?: string;
|
|
101
|
-
is_totp?: boolean;
|
|
102
|
-
}
|
|
103
|
-
interface ResendOtpInput {
|
|
104
|
-
email?: string;
|
|
105
|
-
phone_number?: string;
|
|
106
|
-
}
|
|
107
|
-
interface GraphqlQueryInput {
|
|
108
|
-
query: string;
|
|
109
|
-
variables?: Record<string, any>;
|
|
110
|
-
headers?: Headers;
|
|
111
|
-
}
|
|
112
|
-
interface MetaData {
|
|
21
|
+
interface Meta {
|
|
113
22
|
version: string;
|
|
114
23
|
client_id: string;
|
|
115
24
|
is_google_login_enabled: boolean;
|
|
@@ -117,6 +26,7 @@ interface MetaData {
|
|
|
117
26
|
is_github_login_enabled: boolean;
|
|
118
27
|
is_linkedin_login_enabled: boolean;
|
|
119
28
|
is_apple_login_enabled: boolean;
|
|
29
|
+
is_discord_login_enabled: boolean;
|
|
120
30
|
is_twitter_login_enabled: boolean;
|
|
121
31
|
is_microsoft_login_enabled: boolean;
|
|
122
32
|
is_twitch_login_enabled: boolean;
|
|
@@ -130,49 +40,209 @@ interface MetaData {
|
|
|
130
40
|
is_mobile_basic_authentication_enabled: boolean;
|
|
131
41
|
is_phone_verification_enabled: boolean;
|
|
132
42
|
}
|
|
133
|
-
interface
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
given_name
|
|
139
|
-
family_name
|
|
140
|
-
middle_name
|
|
141
|
-
nickname
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
43
|
+
interface User {
|
|
44
|
+
id: string;
|
|
45
|
+
email: string | null;
|
|
46
|
+
email_verified: boolean;
|
|
47
|
+
signup_methods: string;
|
|
48
|
+
given_name: string | null;
|
|
49
|
+
family_name: string | null;
|
|
50
|
+
middle_name: string | null;
|
|
51
|
+
nickname: string | null;
|
|
52
|
+
preferred_username: string | null;
|
|
53
|
+
gender: string | null;
|
|
54
|
+
birthdate: string | null;
|
|
55
|
+
phone_number: string | null;
|
|
56
|
+
phone_number_verified: boolean;
|
|
57
|
+
picture: string | null;
|
|
58
|
+
roles: string[];
|
|
59
|
+
created_at: number | null;
|
|
60
|
+
updated_at: number | null;
|
|
61
|
+
revoked_timestamp: number | null;
|
|
62
|
+
is_multi_factor_auth_enabled: boolean | null;
|
|
63
|
+
app_data: Record<string, any> | null;
|
|
64
|
+
}
|
|
65
|
+
interface Users {
|
|
66
|
+
pagination: Pagination;
|
|
67
|
+
users: User[];
|
|
68
|
+
}
|
|
69
|
+
interface VerificationRequest {
|
|
70
|
+
id: string;
|
|
71
|
+
identifier: string | null;
|
|
72
|
+
token: string | null;
|
|
73
|
+
email: string | null;
|
|
74
|
+
expires: number | null;
|
|
75
|
+
created_at: number | null;
|
|
76
|
+
updated_at: number | null;
|
|
77
|
+
nonce: string | null;
|
|
78
|
+
redirect_uri: string | null;
|
|
79
|
+
}
|
|
80
|
+
interface VerificationRequests {
|
|
81
|
+
pagination: Pagination;
|
|
82
|
+
verification_requests: VerificationRequest[];
|
|
83
|
+
}
|
|
84
|
+
interface AuthorizerError {
|
|
85
|
+
message: string;
|
|
86
|
+
reason: string;
|
|
87
|
+
}
|
|
88
|
+
interface AuthResponse {
|
|
89
|
+
message: string;
|
|
90
|
+
should_show_email_otp_screen: boolean | null;
|
|
91
|
+
should_show_mobile_otp_screen: boolean | null;
|
|
92
|
+
should_show_totp_screen: boolean | null;
|
|
93
|
+
access_token: string | null;
|
|
94
|
+
id_token: string | null;
|
|
95
|
+
refresh_token: string | null;
|
|
96
|
+
expires_in: number | null;
|
|
97
|
+
user: User | null;
|
|
98
|
+
authenticator_scanner_image: string | null;
|
|
99
|
+
authenticator_secret: string | null;
|
|
100
|
+
authenticator_recovery_codes: string[] | null;
|
|
101
|
+
}
|
|
102
|
+
type AuthToken = AuthResponse;
|
|
103
|
+
interface Response {
|
|
104
|
+
message: string;
|
|
154
105
|
}
|
|
106
|
+
type GenericResponse = Response;
|
|
155
107
|
interface ForgotPasswordResponse {
|
|
156
108
|
message: string;
|
|
157
|
-
should_show_mobile_otp_screen
|
|
109
|
+
should_show_mobile_otp_screen: boolean | null;
|
|
110
|
+
}
|
|
111
|
+
interface InviteMembersResponse {
|
|
112
|
+
message: string;
|
|
113
|
+
Users: User[];
|
|
158
114
|
}
|
|
159
|
-
interface
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
115
|
+
interface LoginRequest {
|
|
116
|
+
email?: string | null;
|
|
117
|
+
phone_number?: string | null;
|
|
118
|
+
password: string;
|
|
119
|
+
roles?: string[] | null;
|
|
120
|
+
scope?: string[] | null;
|
|
121
|
+
state?: string | null;
|
|
122
|
+
}
|
|
123
|
+
interface SignUpRequest {
|
|
124
|
+
email?: string | null;
|
|
125
|
+
given_name?: string | null;
|
|
126
|
+
family_name?: string | null;
|
|
127
|
+
middle_name?: string | null;
|
|
128
|
+
nickname?: string | null;
|
|
129
|
+
gender?: string | null;
|
|
130
|
+
birthdate?: string | null;
|
|
131
|
+
phone_number?: string | null;
|
|
132
|
+
picture?: string | null;
|
|
163
133
|
password: string;
|
|
164
134
|
confirm_password: string;
|
|
135
|
+
roles?: string[] | null;
|
|
136
|
+
scope?: string[] | null;
|
|
137
|
+
redirect_uri?: string | null;
|
|
138
|
+
is_multi_factor_auth_enabled?: boolean | null;
|
|
139
|
+
state?: string | null;
|
|
140
|
+
app_data?: Record<string, any> | null;
|
|
141
|
+
}
|
|
142
|
+
type SignupRequest = SignUpRequest;
|
|
143
|
+
interface MagicLinkLoginRequest {
|
|
144
|
+
email: string;
|
|
145
|
+
roles?: string[] | null;
|
|
146
|
+
scope?: string[] | null;
|
|
147
|
+
state?: string | null;
|
|
148
|
+
redirect_uri?: string | null;
|
|
165
149
|
}
|
|
166
|
-
interface
|
|
167
|
-
|
|
150
|
+
interface VerifyEmailRequest {
|
|
151
|
+
token: string;
|
|
152
|
+
state?: string | null;
|
|
168
153
|
}
|
|
169
|
-
interface
|
|
170
|
-
|
|
171
|
-
|
|
154
|
+
interface ResendVerifyEmailRequest {
|
|
155
|
+
email: string;
|
|
156
|
+
identifier: string;
|
|
157
|
+
state?: string | null;
|
|
172
158
|
}
|
|
173
|
-
interface
|
|
174
|
-
|
|
175
|
-
|
|
159
|
+
interface VerifyOTPRequest {
|
|
160
|
+
email?: string | null;
|
|
161
|
+
phone_number?: string | null;
|
|
162
|
+
otp: string;
|
|
163
|
+
is_totp?: boolean | null;
|
|
164
|
+
state?: string | null;
|
|
165
|
+
}
|
|
166
|
+
type VerifyOtpRequest = VerifyOTPRequest;
|
|
167
|
+
interface ResendOTPRequest {
|
|
168
|
+
email?: string | null;
|
|
169
|
+
phone_number?: string | null;
|
|
170
|
+
state?: string | null;
|
|
171
|
+
}
|
|
172
|
+
type ResendOtpRequest = ResendOTPRequest;
|
|
173
|
+
interface UpdateProfileRequest {
|
|
174
|
+
old_password?: string | null;
|
|
175
|
+
new_password?: string | null;
|
|
176
|
+
confirm_new_password?: string | null;
|
|
177
|
+
email?: string | null;
|
|
178
|
+
given_name?: string | null;
|
|
179
|
+
family_name?: string | null;
|
|
180
|
+
middle_name?: string | null;
|
|
181
|
+
nickname?: string | null;
|
|
182
|
+
gender?: string | null;
|
|
183
|
+
birthdate?: string | null;
|
|
184
|
+
phone_number?: string | null;
|
|
185
|
+
picture?: string | null;
|
|
186
|
+
is_multi_factor_auth_enabled?: boolean | null;
|
|
187
|
+
app_data?: Record<string, any> | null;
|
|
188
|
+
}
|
|
189
|
+
interface UpdateUserRequest {
|
|
190
|
+
id: string;
|
|
191
|
+
email?: string | null;
|
|
192
|
+
email_verified?: boolean | null;
|
|
193
|
+
given_name?: string | null;
|
|
194
|
+
family_name?: string | null;
|
|
195
|
+
middle_name?: string | null;
|
|
196
|
+
nickname?: string | null;
|
|
197
|
+
gender?: string | null;
|
|
198
|
+
birthdate?: string | null;
|
|
199
|
+
phone_number?: string | null;
|
|
200
|
+
phone_number_verified?: boolean | null;
|
|
201
|
+
picture?: string | null;
|
|
202
|
+
roles?: string[] | null;
|
|
203
|
+
is_multi_factor_auth_enabled?: boolean | null;
|
|
204
|
+
app_data?: Record<string, any> | null;
|
|
205
|
+
}
|
|
206
|
+
interface ForgotPasswordRequest {
|
|
207
|
+
email?: string | null;
|
|
208
|
+
phone_number?: string | null;
|
|
209
|
+
state?: string | null;
|
|
210
|
+
redirect_uri?: string | null;
|
|
211
|
+
}
|
|
212
|
+
interface ResetPasswordRequest {
|
|
213
|
+
token?: string | null;
|
|
214
|
+
otp?: string | null;
|
|
215
|
+
phone_number?: string | null;
|
|
216
|
+
password: string;
|
|
217
|
+
confirm_password: string;
|
|
218
|
+
}
|
|
219
|
+
type ResetPasswordInput = ResetPasswordRequest;
|
|
220
|
+
interface DeleteUserRequest {
|
|
221
|
+
email: string;
|
|
222
|
+
}
|
|
223
|
+
interface SessionQueryRequest {
|
|
224
|
+
roles?: string[] | null;
|
|
225
|
+
scope?: string[] | null;
|
|
226
|
+
}
|
|
227
|
+
type SessionQueryInput = SessionQueryRequest;
|
|
228
|
+
interface ValidateJWTTokenRequest {
|
|
229
|
+
token_type: string;
|
|
230
|
+
token: string;
|
|
231
|
+
roles?: string[] | null;
|
|
232
|
+
}
|
|
233
|
+
type ValidateJWTTokenInput = ValidateJWTTokenRequest;
|
|
234
|
+
interface ValidateJWTTokenResponse {
|
|
235
|
+
is_valid: boolean;
|
|
236
|
+
claims: Record<string, any>;
|
|
237
|
+
}
|
|
238
|
+
interface ValidateSessionRequest {
|
|
239
|
+
cookie: string;
|
|
240
|
+
roles?: string[] | null;
|
|
241
|
+
}
|
|
242
|
+
type ValidateSessionInput = ValidateSessionRequest;
|
|
243
|
+
interface ValidateSessionResponse {
|
|
244
|
+
is_valid: boolean;
|
|
245
|
+
user: User;
|
|
176
246
|
}
|
|
177
247
|
declare enum OAuthProviders {
|
|
178
248
|
Apple = "apple",
|
|
@@ -183,17 +253,19 @@ declare enum OAuthProviders {
|
|
|
183
253
|
Twitter = "twitter",
|
|
184
254
|
Microsoft = "microsoft",
|
|
185
255
|
Twitch = "twitch",
|
|
186
|
-
Roblox = "roblox"
|
|
256
|
+
Roblox = "roblox",
|
|
257
|
+
Discord = "discord"
|
|
187
258
|
}
|
|
188
259
|
declare enum ResponseTypes {
|
|
189
260
|
Code = "code",
|
|
190
261
|
Token = "token"
|
|
191
262
|
}
|
|
192
|
-
interface
|
|
263
|
+
interface AuthorizeRequest {
|
|
193
264
|
response_type: ResponseTypes;
|
|
194
265
|
use_refresh_token?: boolean;
|
|
195
266
|
response_mode?: string;
|
|
196
267
|
}
|
|
268
|
+
type AuthorizeInput = AuthorizeRequest;
|
|
197
269
|
interface AuthorizeResponse {
|
|
198
270
|
state: string;
|
|
199
271
|
code?: string;
|
|
@@ -203,66 +275,66 @@ interface AuthorizeResponse {
|
|
|
203
275
|
interface RevokeTokenInput {
|
|
204
276
|
refresh_token: string;
|
|
205
277
|
}
|
|
206
|
-
interface
|
|
278
|
+
interface GetTokenRequest {
|
|
207
279
|
code?: string;
|
|
208
280
|
grant_type?: string;
|
|
209
281
|
refresh_token?: string;
|
|
210
282
|
}
|
|
283
|
+
type GetTokenInput = GetTokenRequest;
|
|
211
284
|
interface GetTokenResponse {
|
|
212
285
|
access_token: string;
|
|
213
286
|
expires_in: number;
|
|
214
287
|
id_token: string;
|
|
215
288
|
refresh_token?: string;
|
|
216
289
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
interface ValidateJWTTokenResponse {
|
|
223
|
-
is_valid: boolean;
|
|
224
|
-
claims: Record<string, any>;
|
|
290
|
+
type Headers = Record<string, string>;
|
|
291
|
+
interface GraphqlQueryRequest {
|
|
292
|
+
query: string;
|
|
293
|
+
variables?: Record<string, any>;
|
|
294
|
+
headers?: Headers;
|
|
225
295
|
}
|
|
226
|
-
interface
|
|
227
|
-
|
|
296
|
+
interface IsValidJWTQueryInput {
|
|
297
|
+
jwt: string;
|
|
228
298
|
roles?: string[];
|
|
229
299
|
}
|
|
230
|
-
interface
|
|
231
|
-
|
|
232
|
-
|
|
300
|
+
interface ValidJWTResponse {
|
|
301
|
+
valid: string;
|
|
302
|
+
message: string;
|
|
233
303
|
}
|
|
304
|
+
type MetaDataResponse = Meta;
|
|
305
|
+
type MetaData = Meta;
|
|
234
306
|
|
|
235
307
|
declare class Authorizer {
|
|
236
308
|
config: ConfigType;
|
|
237
309
|
codeVerifier: string;
|
|
238
310
|
constructor(config: ConfigType);
|
|
239
|
-
authorize: (data:
|
|
311
|
+
authorize: (data: AuthorizeRequest) => Promise<ApiResponse<GetTokenResponse> | ApiResponse<AuthorizeResponse>>;
|
|
240
312
|
browserLogin: () => Promise<ApiResponse<AuthToken>>;
|
|
241
|
-
forgotPassword: (data:
|
|
313
|
+
forgotPassword: (data: ForgotPasswordRequest) => Promise<ApiResponse<ForgotPasswordResponse>>;
|
|
242
314
|
getMetaData: () => Promise<ApiResponse<MetaData>>;
|
|
243
315
|
getProfile: (headers?: Headers) => Promise<ApiResponse<User>>;
|
|
244
|
-
getSession: (headers?: Headers, params?:
|
|
245
|
-
getToken: (data:
|
|
246
|
-
login: (data:
|
|
316
|
+
getSession: (headers?: Headers, params?: SessionQueryRequest) => Promise<ApiResponse<AuthToken>>;
|
|
317
|
+
getToken: (data: GetTokenRequest) => Promise<ApiResponse<GetTokenResponse>>;
|
|
318
|
+
login: (data: LoginRequest) => Promise<ApiResponse<AuthToken>>;
|
|
247
319
|
logout: (headers?: Headers) => Promise<ApiResponse<GenericResponse>>;
|
|
248
|
-
magicLinkLogin: (data:
|
|
320
|
+
magicLinkLogin: (data: MagicLinkLoginRequest) => Promise<ApiResponse<GenericResponse>>;
|
|
249
321
|
oauthLogin: (oauthProvider: string, roles?: string[], redirect_uri?: string, state?: string) => Promise<void>;
|
|
250
|
-
resendOtp: (data:
|
|
251
|
-
resetPassword: (data:
|
|
322
|
+
resendOtp: (data: ResendOtpRequest) => Promise<ApiResponse<GenericResponse>>;
|
|
323
|
+
resetPassword: (data: ResetPasswordRequest) => Promise<ApiResponse<GenericResponse>>;
|
|
252
324
|
revokeToken: (data: {
|
|
253
325
|
refresh_token: string;
|
|
254
326
|
}) => Promise<ApiResponse<any>>;
|
|
255
|
-
signup: (data:
|
|
256
|
-
updateProfile: (data:
|
|
327
|
+
signup: (data: SignUpRequest) => Promise<ApiResponse<AuthToken>>;
|
|
328
|
+
updateProfile: (data: UpdateProfileRequest, headers?: Headers) => Promise<ApiResponse<GenericResponse>>;
|
|
257
329
|
deactivateAccount: (headers?: Headers) => Promise<ApiResponse<GenericResponse>>;
|
|
258
|
-
validateJWTToken: (params?:
|
|
259
|
-
validateSession: (params?:
|
|
260
|
-
verifyEmail: (data:
|
|
261
|
-
resendVerifyEmail: (data:
|
|
262
|
-
verifyOtp: (data:
|
|
263
|
-
graphqlQuery: (data:
|
|
330
|
+
validateJWTToken: (params?: ValidateJWTTokenRequest) => Promise<ApiResponse<ValidateJWTTokenResponse>>;
|
|
331
|
+
validateSession: (params?: ValidateSessionRequest) => Promise<ApiResponse<ValidateSessionResponse>>;
|
|
332
|
+
verifyEmail: (data: VerifyEmailRequest) => Promise<ApiResponse<AuthToken>>;
|
|
333
|
+
resendVerifyEmail: (data: ResendVerifyEmailRequest) => Promise<ApiResponse<GenericResponse>>;
|
|
334
|
+
verifyOtp: (data: VerifyOtpRequest) => Promise<ApiResponse<AuthToken>>;
|
|
335
|
+
graphqlQuery: (data: GraphqlQueryRequest) => Promise<GrapQlResponseType>;
|
|
264
336
|
errorResponse: (errors: Error[]) => ApiResponse<any>;
|
|
265
337
|
okResponse: (data: any) => ApiResponse<any>;
|
|
266
338
|
}
|
|
267
339
|
|
|
268
|
-
export { type ApiResponse, type AuthToken, type AuthorizeInput, type AuthorizeResponse, Authorizer, type ConfigType, type
|
|
340
|
+
export { type ApiResponse, type AuthResponse, type AuthToken, type AuthorizeInput, type AuthorizeRequest, type AuthorizeResponse, Authorizer, type AuthorizerError, type ConfigType, type DeleteUserRequest, type ForgotPasswordRequest, type ForgotPasswordResponse, type GenericResponse, type GetTokenInput, type GetTokenRequest, type GetTokenResponse, type GrapQlResponseType, type GraphqlQueryRequest, type Headers, type InviteMembersResponse, type IsValidJWTQueryInput, type LoginRequest, type MagicLinkLoginRequest, type Meta, type MetaData, type MetaDataResponse, OAuthProviders, type Pagination, type ResendOTPRequest, type ResendOtpRequest, type ResendVerifyEmailRequest, type ResetPasswordInput, type ResetPasswordRequest, type Response, ResponseTypes, type RevokeTokenInput, type SessionQueryInput, type SessionQueryRequest, type SignUpRequest, type SignupRequest, type UpdateProfileRequest, type UpdateUserRequest, type User, type Users, type ValidJWTResponse, type ValidateJWTTokenInput, type ValidateJWTTokenRequest, type ValidateJWTTokenResponse, type ValidateSessionInput, type ValidateSessionRequest, type ValidateSessionResponse, type VerificationRequest, type VerificationRequests, type VerifyEmailRequest, type VerifyOTPRequest, type VerifyOtpRequest };
|