@descope/core-js-sdk
Advanced tools
Comparing version 0.0.41-alpha.35 to 0.0.41-alpha.36
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("jwt-decode"),t=require("lodash.get");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e),a=n(t),i={exchange:"/v1/auth/accesskey/exchange"},o={verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},r={verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},u={verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},p={start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange"},d={start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},c={verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/user/totp/update"},l={signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},g="/v1/auth/refresh",h="/v1/auth/logout",v="/v1/auth/logoutall",f="/v1/auth/me",m={start:"/v1/flow/start",next:"/v1/flow/next"};const I=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}},y=(e,t)=>{const n=t||fetch;if(!n)throw new Error("fetch is not defined");return e?async(...t)=>{e.log((e=>I().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const s=await n(...t);return e[s.ok?"log":"error"](await(async e=>{const t=await(e.clone?e.clone().text():e.text());return e.text=()=>Promise.resolve(t),e.json=()=>Promise.resolve(JSON.parse(t)),I().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(s)),s}:n};var k;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(k||(k={}));const b=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,s])=>(e[n]=s,e)),e),e}),{})),O=e=>void 0===e?void 0:JSON.stringify(e),x=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},w=({baseUrl:e,projectId:t,baseConfig:n,logger:s,hooks:a,cookiePolicy:i})=>{const o=y(s),r=async s=>{const r=(null==a?void 0:a.beforeRequest)?a.beforeRequest(s):s,{path:u,body:p,headers:d,queryParams:c,method:l,token:g}=r,h=await o((({path:e,baseUrl:t,queryParams:n})=>{const s=new URL(e,t);return n&&(s.search=new URLSearchParams(n).toString()),s})({path:u,baseUrl:e,queryParams:c}),{headers:b(x(t,g),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"0.0.41-alpha.35"},(null==n?void 0:n.baseHeaders)||{},d),method:l,body:O(p),credentials:i||"include"});return(null==a?void 0:a.afterRequest)&&a.afterRequest(s,null==h?void 0:h.clone()),h};return{get:(e,{headers:t,queryParams:n,token:s}={})=>r({path:e,headers:t,queryParams:n,body:void 0,method:k.get,token:s}),post:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:k.post,token:a}),put:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:k.put,token:a}),delete:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:k.delete,token:a})}};function U(e,t,n){var s;let a=j(e);t&&(a=null===(s=a.tenants)||void 0===s?void 0:s[t]);const i=a[n];return Array.isArray(i)?i:[]}function j(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return s.default(e)}function P(e){const{exp:t}=j(e);return(new Date).getTime()/1e3>t}function R(e,t){return U(e,t,"permissions")}function q(e,t){return U(e,t,"roles")}const $=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function M(e,t){const n=await e,s={code:n.status,ok:n.ok,response:n},a=await n.clone().json();return n.ok?s.data=t?t(a):a:s.error=a,s}const E=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),S=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),A=e=>t=>e.test(t),T=A(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),L=A(/^\+[1-9]{1}[0-9]{3,14}$/),z=E(T,'"{val}" is not a valid email'),J=E(L,'"{val}" is not a valid phone number'),H=E((C=1,e=>e.length>=C),"Minimum length is 1");var C;const D=E((e=>"string"==typeof e),"Input is not a string"),N=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>S(...e).validate(n[t]))),t(...n)),Z=e=>[D(`"${e}" must be a string`),H(`"${e}" must not be empty`)],_=e=>[D(`"${e}" must be a string`),z()],B=e=>[D(`"${e}" must be a string`),J()],K=N(Z("accessKey")),F=e=>({exchange:K((t=>M(e.post(i.exchange,{},{token:t}))))});var G,Q,V,W,X;!function(e){e.sms="sms",e.whatsapp="whatsapp"}(G||(G={})),function(e){e.email="email",e.sms="sms",e.whatsapp="whatsapp"}(Q||(Q={})),function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(V||(V={})),function(e){e.signUp="signup",e.signIn="signin",e.verify="verify"}(W||(W={})),function(e){e.signUp="signup",e.signIn="signin",e.verify="verify",e.updatePhone="updatePhone"}(X||(X={}));const Y=Z("identifier"),ee=N(Y,Z("code")),te=N(Y),ne=N(Y,B("phone")),se=N(Y,_("email")),ae=e=>({verify:Object.keys(Q).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ee(((t,s)=>M(e.post($(o.verify,n),{code:s,externalId:t}))))})),{}),signIn:Object.keys(Q).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:te(((t,s,a)=>M(e.post($(o.signIn,n),{externalId:t,loginOptions:s},{token:a}))))})),{}),signUp:Object.keys(Q).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:te(((t,s)=>M(e.post($(o.signUp,n),{externalId:t,user:s}))))})),{}),signUpOrIn:Object.keys(Q).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:te((t=>M(e.post($(o.signUpOrIn,n),{externalId:t}))))})),{}),update:{email:se(((t,n,s)=>M(e.post(o.update.email,{externalId:t,email:n},{token:s})))),phone:Object.keys(G).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ne(((t,s,a)=>M(e.post($(o.update.phone,n),{externalId:t,phone:s},{token:a}))))})),{})}}),ie=Z("identifier"),oe=Z("uri"),re=N(Z("token")),ue=N(ie,oe),pe=N(ie,B("phone"),oe),de=N(ie,_("email"),oe),ce=e=>({verify:re((t=>M(e.post(r.verify,{token:t})))),signIn:Object.keys(Q).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ue(((t,s,a,i)=>M(e.post($(r.signIn,n),{externalId:t,URI:s,loginOptions:a},{token:i}))))})),{}),signUp:Object.keys(Q).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ue(((t,s,a)=>M(e.post($(r.signUp,n),{externalId:t,URI:s,user:a}))))})),{}),signUpOrIn:Object.keys(Q).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ue(((t,s)=>M(e.post($(r.signUpOrIn,n),{externalId:t,URI:s}))))})),{}),update:{email:de(((t,n,s,a)=>M(e.post(r.update.email,{externalId:t,email:n,URI:s},{token:a})))),phone:Object.keys(G).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:pe(((t,s,a,i)=>M(e.post($(r.update.phone,n),{externalId:t,phone:s,URI:a},{token:i}))))})),{})}}),le=Z("identifier"),ge=Z("uri"),he=N(Z("token")),ve=N(le,ge),fe=N(Z("pendingRef")),me=N(le,_("email"),ge),Ie=e=>({verify:he((t=>M(e.post(u.verify,{token:t})))),signIn:ve(((t,n,s,a)=>M(e.post($(u.signIn,Q.email),{externalId:t,URI:n,loginOptions:s},{token:a})))),signUpOrIn:ve(((t,n)=>M(e.post($(u.signUpOrIn,Q.email),{externalId:t,URI:n})))),signUp:ve(((t,n,s)=>M(e.post($(u.signUp,Q.email),{externalId:t,URI:n,user:s})))),waitForSession:fe(((t,n)=>new Promise((s=>{const{pollingIntervalMs:a,timeoutMs:i}=(({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||6e5,6e5)}))(n);let o;const r=setInterval((async()=>{const n=await e.post(u.session,{pendingRef:t});n.ok&&(clearInterval(r),o&&clearTimeout(o),s(M(Promise.resolve(n))))}),a);o=setTimeout((()=>{s({error:{message:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(r)}),i)})))),update:{email:me(((t,n,s,a)=>M(e.post(u.update.email,{externalId:t,email:n,URI:s},{token:a}))))}});var ye;!function(e){e.facebook="facebook",e.github="github",e.google="google",e.microsoft="microsoft",e.gitlab="gitlab",e.apple="apple"}(ye||(ye={}));const ke=N(Z("code")),be=e=>({start:Object.keys(ye).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:async(t,{redirect:s=!1}={},a,i)=>{const o=await e.post(p.start,a||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:i});if(!s||!o.ok)return M(Promise.resolve(o));const{url:r}=await o.json();window.location.href=r}})),{}),exchange:ke((t=>M(e.post(p.exchange,{code:t}))))}),Oe=N(Z("flowId")),xe=N(Z("executionId"),Z("stepId"),Z("interactionId")),we=e=>({start:Oe(((t,n,s,a)=>M(e.post(m.start,{flowId:t,options:n,interactionId:s,input:a})))),next:xe(((t,n,s,a)=>M(e.post(m.next,{executionId:t,stepId:n,interactionId:s,input:a}))))}),Ue=N(Z("tenant")),je=N(Z("code")),Pe=e=>({start:Ue((async(t,n,{redirect:s=!1}={},a,i)=>{const o=await e.post(d.start,a||{},{queryParams:{tenant:t,redirectURL:n},token:i});if(!s||!o.ok)return M(Promise.resolve(o));const{url:r}=await o.json();window.location.href=r})),exchange:je((t=>M(e.post(d.exchange,{code:t}))))}),Re=Z("identifier"),qe=N(Re,Z("code")),$e=N(Re),Me=N(Re),Ee=e=>({signUp:$e(((t,n)=>M(e.post(c.signUp,{externalId:t,user:n})))),verify:qe(((t,n,s,a)=>M(e.post(c.verify,{externalId:t,code:n,loginOptions:s},{token:a})))),update:Me(((t,n)=>M(e.post(c.update,{externalId:t},{token:n}))))}),Se=Z("identifier"),Ae=Z("origin"),Te=N(Se,Ae,Z("name")),Le=N(Se,Ae),ze=N(Se,Ae,Z("token")),Je=N(Z("transactionId"),Z("response")),He=e=>({signUp:{start:Te(((t,n,s)=>M(e.post(l.signUp.start,{user:{externalId:t,name:s},origin:n})))),finish:Je(((t,n)=>M(e.post(l.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:Le(((t,n,s,a)=>M(e.post(l.signIn.start,{externalId:t,origin:n,loginOptions:s},{token:a})))),finish:Je(((t,n)=>M(e.post(l.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Le(((t,n)=>M(e.post(l.signUpOrIn.start,{externalId:t,origin:n}))))},update:{start:ze(((t,n,s)=>M(e.post(l.update.start,{externalId:t,origin:n},{token:s})))),finish:Je(((t,n)=>M(e.post(l.update.finish,{transactionId:t,response:n}))))}}),Ce=N(Z("token"));var De,Ne;const Ze=N([(De="projectId",Ne=Z("projectId"),E(((e,t)=>n=>S(...t).validate(a.default(n,e)))(De,Ne))())])((({projectId:e,logger:t,baseUrl:n,hooks:s,cookiePolicy:a})=>{return i=w({baseUrl:n||"https://api.descope.com",projectId:e,logger:t,hooks:s,cookiePolicy:a}),{accessKey:F(i),otp:ae(i),magicLink:ce(i),enchantedLink:Ie(i),oauth:be(i),saml:Pe(i),totp:Ee(i),webauthn:He(i),flow:we(i),refresh:e=>M(i.post(g,{},{token:e})),logout:e=>M(i.post(h,{},{token:e})),logoutAll:e=>M(i.post(v,{},{token:e})),me:e=>M(i.get(f,{token:e})),isJwtExpired:Ce(P),getJwtPermissions:Ce(R),getJwtRoles:Ce(q),httpClient:i};var i}));Ze.DeliveryMethods=Q,exports.default=Ze,exports.transformResponse=M; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("jwt-decode"),t=require("lodash.get");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(e),a=n(t),i={exchange:"/v1/auth/accesskey/exchange"},o={verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},r={verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},u={verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},p={start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange"},c={start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},d={verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/user/totp/update"},l={signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},h="/v1/auth/refresh",g="/v1/auth/logout",f="/v1/auth/logoutall",v="/v1/auth/me",m={start:"/v1/flow/start",next:"/v1/flow/next"};const I=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}},k=(e,t)=>{const n=t||fetch;if(!n)throw new Error("fetch is not defined");return e?async(...t)=>{e.log((e=>I().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const s=await n(...t);return e[s.ok?"log":"error"](await(async e=>{const t=await(e.clone?e.clone().text():e.text());return e.text=()=>Promise.resolve(t),e.json=()=>Promise.resolve(JSON.parse(t)),I().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(s)),s}:n};var y;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(y||(y={}));const b=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,s])=>(e[n]=s,e)),e),e}),{})),O=e=>void 0===e?void 0:JSON.stringify(e),x=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},w=({baseUrl:e,projectId:t,baseConfig:n,logger:s,hooks:a,cookiePolicy:i})=>{const o=k(s),r=async s=>{const r=(null==a?void 0:a.beforeRequest)?a.beforeRequest(s):s,{path:u,body:p,headers:c,queryParams:d,method:l,token:h}=r,g=await o((({path:e,baseUrl:t,queryParams:n})=>{const s=new URL(e,t);return n&&(s.search=new URLSearchParams(n).toString()),s})({path:u,baseUrl:e,queryParams:d}),{headers:b(x(t,h),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"0.0.41-alpha.36"},(null==n?void 0:n.baseHeaders)||{},c),method:l,body:O(p),credentials:i||"include"});return(null==a?void 0:a.afterRequest)&&a.afterRequest(s,null==g?void 0:g.clone()),g};return{get:(e,{headers:t,queryParams:n,token:s}={})=>r({path:e,headers:t,queryParams:n,body:void 0,method:y.get,token:s}),post:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:y.post,token:a}),put:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:y.put,token:a}),delete:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:y.delete,token:a}),hooks:a}};function j(e,t,n){var s;let a=U(e);t&&(a=null===(s=a.tenants)||void 0===s?void 0:s[t]);const i=a[n];return Array.isArray(i)?i:[]}function U(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return s.default(e)}function P(e){const{exp:t}=U(e);return(new Date).getTime()/1e3>t}function R(e,t){return j(e,t,"permissions")}function q(e,t){return j(e,t,"roles")}const $=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function E(e,t){const n=await e,s={code:n.status,ok:n.ok,response:n},a=await n.clone().json();return n.ok?s.data=t?t(a):a:s.error=a,s}const M=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),S=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),A=e=>t=>e.test(t),T=A(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),L=A(/^\+[1-9]{1}[0-9]{3,14}$/),z=M(T,'"{val}" is not a valid email'),J=M(L,'"{val}" is not a valid phone number'),H=M((C=1,e=>e.length>=C),"Minimum length is 1");var C;const D=M((e=>"string"==typeof e),"Input is not a string"),N=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>S(...e).validate(n[t]))),t(...n)),Z=e=>[D(`"${e}" must be a string`),H(`"${e}" must not be empty`)],_=e=>[D(`"${e}" must be a string`),z()],B=e=>[D(`"${e}" must be a string`),J()],K=N(Z("accessKey")),F=e=>({exchange:K((t=>E(e.post(i.exchange,{},{token:t}))))});var G,W,Q,V,X;!function(e){e.sms="sms",e.whatsapp="whatsapp"}(G||(G={})),function(e){e.email="email",e.sms="sms",e.whatsapp="whatsapp"}(W||(W={})),function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(Q||(Q={})),function(e){e.signUp="signup",e.signIn="signin",e.verify="verify"}(V||(V={})),function(e){e.signUp="signup",e.signIn="signin",e.verify="verify",e.updatePhone="updatePhone"}(X||(X={}));const Y=Z("identifier"),ee=N(Y,Z("code")),te=N(Y),ne=N(Y,B("phone")),se=N(Y,_("email")),ae=e=>({verify:Object.keys(W).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ee(((t,s)=>E(e.post($(o.verify,n),{code:s,externalId:t}))))})),{}),signIn:Object.keys(W).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:te(((t,s,a)=>E(e.post($(o.signIn,n),{externalId:t,loginOptions:s},{token:a}))))})),{}),signUp:Object.keys(W).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:te(((t,s)=>E(e.post($(o.signUp,n),{externalId:t,user:s}))))})),{}),signUpOrIn:Object.keys(W).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:te((t=>E(e.post($(o.signUpOrIn,n),{externalId:t}))))})),{}),update:{email:se(((t,n,s)=>E(e.post(o.update.email,{externalId:t,email:n},{token:s})))),phone:Object.keys(G).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ne(((t,s,a)=>E(e.post($(o.update.phone,n),{externalId:t,phone:s},{token:a}))))})),{})}}),ie=Z("identifier"),oe=Z("uri"),re=N(Z("token")),ue=N(ie,oe),pe=N(ie,B("phone"),oe),ce=N(ie,_("email"),oe),de=e=>({verify:re((t=>E(e.post(r.verify,{token:t})))),signIn:Object.keys(W).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ue(((t,s,a,i)=>E(e.post($(r.signIn,n),{externalId:t,URI:s,loginOptions:a},{token:i}))))})),{}),signUp:Object.keys(W).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ue(((t,s,a)=>E(e.post($(r.signUp,n),{externalId:t,URI:s,user:a}))))})),{}),signUpOrIn:Object.keys(W).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ue(((t,s)=>E(e.post($(r.signUpOrIn,n),{externalId:t,URI:s}))))})),{}),update:{email:ce(((t,n,s,a)=>E(e.post(r.update.email,{externalId:t,email:n,URI:s},{token:a})))),phone:Object.keys(G).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:pe(((t,s,a,i)=>E(e.post($(r.update.phone,n),{externalId:t,phone:s,URI:a},{token:i}))))})),{})}}),le=Z("identifier"),he=Z("uri"),ge=N(Z("token")),fe=N(le,he),ve=N(Z("pendingRef")),me=N(le,_("email"),he),Ie=e=>({verify:ge((t=>E(e.post(u.verify,{token:t})))),signIn:fe(((t,n,s,a)=>E(e.post($(u.signIn,W.email),{externalId:t,URI:n,loginOptions:s},{token:a})))),signUpOrIn:fe(((t,n)=>E(e.post($(u.signUpOrIn,W.email),{externalId:t,URI:n})))),signUp:fe(((t,n,s)=>E(e.post($(u.signUp,W.email),{externalId:t,URI:n,user:s})))),waitForSession:ve(((t,n)=>new Promise((s=>{const{pollingIntervalMs:a,timeoutMs:i}=(({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||6e5,6e5)}))(n);let o;const r=setInterval((async()=>{const n=await e.post(u.session,{pendingRef:t});n.ok&&(clearInterval(r),o&&clearTimeout(o),s(E(Promise.resolve(n))))}),a);o=setTimeout((()=>{s({error:{message:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(r)}),i)})))),update:{email:me(((t,n,s,a)=>E(e.post(u.update.email,{externalId:t,email:n,URI:s},{token:a}))))}});var ke;!function(e){e.facebook="facebook",e.github="github",e.google="google",e.microsoft="microsoft",e.gitlab="gitlab",e.apple="apple"}(ke||(ke={}));const ye=N(Z("code")),be=e=>({start:Object.keys(ke).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:async(t,{redirect:s=!1}={},a,i)=>{const o=await e.post(p.start,a||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:i});if(!s||!o.ok)return E(Promise.resolve(o));const{url:r}=await o.json();window.location.href=r}})),{}),exchange:ye((t=>E(e.post(p.exchange,{code:t}))))}),Oe=N(Z("flowId")),xe=N(Z("executionId"),Z("stepId"),Z("interactionId")),we=e=>({start:Oe(((t,n,s,a)=>E(e.post(m.start,{flowId:t,options:n,interactionId:s,input:a})))),next:xe(((t,n,s,a)=>E(e.post(m.next,{executionId:t,stepId:n,interactionId:s,input:a}))))}),je=N(Z("tenant")),Ue=N(Z("code")),Pe=e=>({start:je((async(t,n,{redirect:s=!1}={},a,i)=>{const o=await e.post(c.start,a||{},{queryParams:{tenant:t,redirectURL:n},token:i});if(!s||!o.ok)return E(Promise.resolve(o));const{url:r}=await o.json();window.location.href=r})),exchange:Ue((t=>E(e.post(c.exchange,{code:t}))))}),Re=Z("identifier"),qe=N(Re,Z("code")),$e=N(Re),Ee=N(Re),Me=e=>({signUp:$e(((t,n)=>E(e.post(d.signUp,{externalId:t,user:n})))),verify:qe(((t,n,s,a)=>E(e.post(d.verify,{externalId:t,code:n,loginOptions:s},{token:a})))),update:Ee(((t,n)=>E(e.post(d.update,{externalId:t},{token:n}))))}),Se=Z("identifier"),Ae=Z("origin"),Te=N(Se,Ae,Z("name")),Le=N(Se,Ae),ze=N(Se,Ae,Z("token")),Je=N(Z("transactionId"),Z("response")),He=e=>({signUp:{start:Te(((t,n,s)=>E(e.post(l.signUp.start,{user:{externalId:t,name:s},origin:n})))),finish:Je(((t,n)=>E(e.post(l.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:Le(((t,n,s,a)=>E(e.post(l.signIn.start,{externalId:t,origin:n,loginOptions:s},{token:a})))),finish:Je(((t,n)=>E(e.post(l.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Le(((t,n)=>E(e.post(l.signUpOrIn.start,{externalId:t,origin:n}))))},update:{start:ze(((t,n,s)=>E(e.post(l.update.start,{externalId:t,origin:n},{token:s})))),finish:Je(((t,n)=>E(e.post(l.update.finish,{transactionId:t,response:n}))))}}),Ce=N(Z("token"));var De,Ne;let Ze=N([(De="projectId",Ne=Z("projectId"),M(((e,t)=>n=>S(...t).validate(a.default(n,e)))(De,Ne))())])((e=>t=>{var n,s;const a=[].concat((null===(n=t.hooks)||void 0===n?void 0:n.beforeRequest)||[]),i=[].concat((null===(s=t.hooks)||void 0===s?void 0:s.afterRequest)||[]);return e(Object.assign(Object.assign({},t),{hooks:{beforeRequest:e=>null==a?void 0:a.reduce(((e,t)=>t(e)),e),afterRequest:(e,t)=>{null==i||i.forEach((n=>n(e,null==t?void 0:t.clone())))}}}))})((({projectId:e,logger:t,baseUrl:n,hooks:s,cookiePolicy:a})=>{return i=w({baseUrl:n||"https://api.descope.com",projectId:e,logger:t,hooks:s,cookiePolicy:a}),{accessKey:F(i),otp:ae(i),magicLink:de(i),enchantedLink:Ie(i),oauth:be(i),saml:Pe(i),totp:Me(i),webauthn:He(i),flow:we(i),refresh:e=>E(i.post(h,{},{token:e})),logout:e=>E(i.post(g,{},{token:e})),logoutAll:e=>E(i.post(f,{},{token:e})),me:e=>E(i.get(v,{token:e})),isJwtExpired:Ce(P),getJwtPermissions:Ce(R),getJwtRoles:Ce(q),httpClient:i};var i})));var _e=Object.assign(Ze,{DeliveryMethods:W});exports.default=_e,exports.transformResponse=E,exports.wrapWith=(e,t,n)=>(t.forEach((t=>{const s=t.split(".");let a=s.shift(),i=e;for(;s.length>0;){if(i=i[a],!a||!i)throw Error(`Invalid path "${t}", "${a}" is missing or has no value`);a=s.shift()}if("function"!=typeof i[a])throw Error(`"${t}" is not a function`);const o=i[a];i[a]=n(o)})),e); | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
declare type SdkFn = (...args: any[]) => Promise<SdkResponse<ResponseData>>; | ||
declare type SdkFn$1 = (...args: any[]) => Promise<SdkResponse<ResponseData>>; | ||
declare type DeviceInfo = { | ||
@@ -139,3 +139,3 @@ webAuthnSupport?: boolean; | ||
/** Different delivery method */ | ||
declare type Deliveries<T extends SdkFn> = Record<DeliveryMethods, T>; | ||
declare type Deliveries<T extends SdkFn$1> = Record<DeliveryMethods, T>; | ||
/** Logger type that supports the given levels (debug, log, error) */ | ||
@@ -165,2 +165,3 @@ declare type Logger = Pick<Console, 'debug' | 'log' | 'error'>; | ||
delete: (path: string, body?: any, config?: HttpClientReqConfig) => Promise<Response>; | ||
hooks?: Hooks; | ||
}; | ||
@@ -178,10 +179,12 @@ /** For before-request hook allows overriding parts of the request */ | ||
}; | ||
declare type BeforeRequest = (config: RequestConfig) => RequestConfig; | ||
declare type AfterRequest = (req: RequestConfig, res: Response) => void; | ||
/** Hooks before and after the request is made */ | ||
declare type Hooks = { | ||
beforeRequest?: (config: RequestConfig) => RequestConfig; | ||
afterRequest?: (req: RequestConfig, res: Response) => void; | ||
beforeRequest?: BeforeRequest; | ||
afterRequest?: AfterRequest; | ||
}; | ||
declare type SignInFn$1 = (identifier: string, uri: string) => Promise<SdkResponse<EnchantedLinkResponse>>; | ||
declare type SignUpFn$1 = (identifier: string, uri: string, user?: User) => Promise<SdkResponse<EnchantedLinkResponse>>; | ||
declare type EnchantedLinkSignInFn = (identifier: string, uri: string) => Promise<SdkResponse<EnchantedLinkResponse>>; | ||
declare type EnchantedLinkSignUpFn = (identifier: string, uri: string, user?: User) => Promise<SdkResponse<EnchantedLinkResponse>>; | ||
/** Polling configuration for session waiting */ | ||
@@ -212,2 +215,62 @@ declare type WaitForSessionConfig = { | ||
declare type IsObject<T> = T extends Array<any> ? false : T extends Function ? false : T extends object ? true : false; | ||
declare type Tail<T extends ReadonlyArray<string>> = T extends readonly [head: any, ...tail: infer Tail_] ? Tail_ : never; | ||
declare type Head<T extends ReadonlyArray<string>> = T extends readonly [] ? never : T[0]; | ||
declare type SdkResponseType<F extends SdkFn<ResponseData>> = F extends SdkFn<infer U> ? U : never; | ||
declare type SdkFnWrapperInternal<F extends SdkFn<ResponseData>, R extends ResponseData> = (fn: (...args: Parameters<F>) => ReturnType<F>) => (...args: Parameters<F>) => Promise<SdkResponse<R extends Record<string, never> ? SdkResponseType<F> : SdkResponseType<F> & R>>; | ||
declare type PrependDot<T extends string> = [T] extends [never] ? '' : `.${T}`; | ||
declare type SdkFnsPaths<T extends object> = keyof T extends infer K ? K extends string & keyof T ? IsObject<T> extends false ? never : T[K] extends SdkFn<ResponseData> ? K : IsObject<T[K]> extends false ? never : T[K] extends object ? `${K}${PrependDot<SdkFnsPaths<T[K]>>}` : never : never : never; | ||
declare type ReplacePaths<Obj extends object, Paths extends ReadonlyArray<string>, WrapperData extends Record<string, any>> = Head<Paths> extends never ? Obj : Tail<Paths> extends ReadonlyArray<string> ? ReplacePaths<ReplacePath<Obj, Head<Paths>, WrapperData>, Tail<Paths>, WrapperData> : ReplacePath<Obj, Head<Paths>, WrapperData>; | ||
declare type ReplacePath<Obj, Path extends string, WrapperData extends Record<string, any>> = Path extends `${infer Head}.${infer Tail}` ? { | ||
[Key in keyof Obj]: Key extends Head ? ReplacePath<Obj[Key], Tail, WrapperData> : Obj[Key]; | ||
} : { | ||
[Key in keyof Obj]: Key extends Path ? Obj[Key] extends SdkFn<ResponseData> ? ReturnType<SdkFnWrapperInternal<Obj[Key], WrapperData>> : Obj[Key] : Obj[Key]; | ||
}; | ||
declare type SdkFn<T extends ResponseData> = (...args: any) => Promise<SdkResponse<T>>; | ||
declare type SdkFnWrapper<Z extends ResponseData> = <A extends any[], R extends ResponseData>(fn: (...args: A) => Promise<SdkResponse<R>>) => (...args: A) => Promise<SdkResponse<Z extends Record<string, never> ? R : Z & R>>; | ||
/** | ||
* A wrapper function that allows to wrap multiple Sdk function | ||
* @param obj: The Sdk instance you want to wrap | ||
* @param paths: A readonly list of paths of the functions you want to wrap | ||
* @param wrapper: Your wrapper function, it should gets an Sdk function and return a new Sdk function | ||
* @returns a mutated instance of the Sdk with updated type definitions based on your wrapper return type | ||
* | ||
* Usage example: | ||
* | ||
* // Assuming this is our SDK instance | ||
* const sdk = { | ||
* me: (token) => {...} | ||
* flow: { | ||
* start: (...params) => {...} | ||
* next: (...params) => {...} | ||
* } | ||
* ... | ||
* } | ||
* | ||
* // This is our wrapper | ||
* const wrapper = (sdkFn) => async (...args) => { | ||
* const sdkResponse = await sdkFn(...args) | ||
* | ||
* // Modify return value | ||
* return {...sdkResponse, data: {...sdkResponse.data, myCustomAttribute: 'hello'}} | ||
* } | ||
* | ||
* // And those are the paths we want to wrap | ||
* const paths = ['flow.start', 'flow.next'] as const // You MUST add as const! | ||
* | ||
* // We can wrap our SDK functions with the wrapper we created in this way | ||
* const newlyTypedSdk = wrapWith(sdk, paths, wrapper) | ||
* | ||
* Now the 2 wrapped functions will have the updated type based on the wrapper return value | ||
*/ | ||
declare const wrapWith: <Obj extends object, Paths extends readonly SdkFnsPaths<Obj>[], WrapperData extends ResponseData>(obj: Obj, paths: Paths, wrapper: SdkFnWrapper<WrapperData>) => ReplacePaths<Obj, Paths, WrapperData>; | ||
declare type SdkConfig = { | ||
projectId: string; | ||
logger?: Logger; | ||
baseUrl?: string; | ||
hooks?: Hooks; | ||
cookiePolicy?: RequestCredentials; | ||
}; | ||
/** Descope SDK client with delivery methods enum. | ||
@@ -229,8 +292,7 @@ * | ||
*/ | ||
declare const sdkWithAttributes: ((args_0: { | ||
projectId: string; | ||
logger?: Logger; | ||
baseUrl?: string; | ||
hooks?: Hooks; | ||
cookiePolicy?: RequestCredentials; | ||
declare const _default: ((config: Omit<SdkConfig, "hooks"> & { | ||
hooks?: { | ||
beforeRequest?: BeforeRequest | BeforeRequest[]; | ||
afterRequest?: AfterRequest | AfterRequest[]; | ||
}; | ||
}) => { | ||
@@ -262,5 +324,5 @@ accessKey: { | ||
verify: (token: string) => Promise<SdkResponse<never>>; | ||
signIn: SignInFn$1; | ||
signUpOrIn: SignInFn$1; | ||
signUp: SignUpFn$1; | ||
signIn: EnchantedLinkSignInFn; | ||
signUpOrIn: EnchantedLinkSignInFn; | ||
signUp: EnchantedLinkSignUpFn; | ||
waitForSession: (pendingRef: string, config?: WaitForSessionConfig) => Promise<SdkResponse<JWTResponse>>; | ||
@@ -357,2 +419,2 @@ update: { | ||
export { DeliveryMethod, EnchantedLinkResponse, ExchangeAccessKeyResponse, FlowAction, FlowResponse, FlowStatus, HTTPMethods, JWTResponse, OAuthProvider, RequestConfig, ResponseData, SdkResponse, TOTPResponse, URLResponse, UserResponse, sdkWithAttributes as default, transformResponse }; | ||
export { DeliveryMethod, EnchantedLinkResponse, ExchangeAccessKeyResponse, FlowAction, FlowResponse, FlowStatus, HTTPMethods, JWTResponse, OAuthProvider, RequestConfig, ResponseData, SdkFnWrapper, SdkResponse, TOTPResponse, URLResponse, UserResponse, _default as default, transformResponse, wrapWith }; |
@@ -1,2 +0,2 @@ | ||
import e from"jwt-decode";import t from"lodash.get";var n={exchange:"/v1/auth/accesskey/exchange"},s={verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},a={verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},i={verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},o={start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange"},r={start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},u={verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/user/totp/update"},p={signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},d="/v1/auth/refresh",c="/v1/auth/logout",l="/v1/auth/logoutall",g="/v1/auth/me",h={start:"/v1/flow/start",next:"/v1/flow/next"};const m=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}},v=(e,t)=>{const n=t||fetch;if(!n)throw new Error("fetch is not defined");return e?async(...t)=>{e.log((e=>m().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const s=await n(...t);return e[s.ok?"log":"error"](await(async e=>{const t=await(e.clone?e.clone().text():e.text());return e.text=()=>Promise.resolve(t),e.json=()=>Promise.resolve(JSON.parse(t)),m().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(s)),s}:n};var f;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(f||(f={}));const I=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,s])=>(e[n]=s,e)),e),e}),{})),y=e=>void 0===e?void 0:JSON.stringify(e),k=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},b=({baseUrl:e,projectId:t,baseConfig:n,logger:s,hooks:a,cookiePolicy:i})=>{const o=v(s),r=async s=>{const r=(null==a?void 0:a.beforeRequest)?a.beforeRequest(s):s,{path:u,body:p,headers:d,queryParams:c,method:l,token:g}=r,h=await o((({path:e,baseUrl:t,queryParams:n})=>{const s=new URL(e,t);return n&&(s.search=new URLSearchParams(n).toString()),s})({path:u,baseUrl:e,queryParams:c}),{headers:I(k(t,g),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"0.0.41-alpha.35"},(null==n?void 0:n.baseHeaders)||{},d),method:l,body:y(p),credentials:i||"include"});return(null==a?void 0:a.afterRequest)&&a.afterRequest(s,null==h?void 0:h.clone()),h};return{get:(e,{headers:t,queryParams:n,token:s}={})=>r({path:e,headers:t,queryParams:n,body:void 0,method:f.get,token:s}),post:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:f.post,token:a}),put:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:f.put,token:a}),delete:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:f.delete,token:a})}};function O(e,t,n){var s;let a=x(e);t&&(a=null===(s=a.tenants)||void 0===s?void 0:s[t]);const i=a[n];return Array.isArray(i)?i:[]}function x(t){if("string"!=typeof t||!t)throw new Error("Invalid token provided");return e(t)}function w(e){const{exp:t}=x(e);return(new Date).getTime()/1e3>t}function U(e,t){return O(e,t,"permissions")}function j(e,t){return O(e,t,"roles")}const P=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function R(e,t){const n=await e,s={code:n.status,ok:n.ok,response:n},a=await n.clone().json();return n.ok?s.data=t?t(a):a:s.error=a,s}const q=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),$=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),M=e=>t=>e.test(t),E=M(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),S=M(/^\+[1-9]{1}[0-9]{3,14}$/),A=q(E,'"{val}" is not a valid email'),T=q(S,'"{val}" is not a valid phone number'),L=q((z=1,e=>e.length>=z),"Minimum length is 1");var z;const J=q((e=>"string"==typeof e),"Input is not a string"),H=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>$(...e).validate(n[t]))),t(...n)),C=e=>[J(`"${e}" must be a string`),L(`"${e}" must not be empty`)],D=e=>[J(`"${e}" must be a string`),A()],N=e=>[J(`"${e}" must be a string`),T()],Z=H(C("accessKey")),B=e=>({exchange:Z((t=>R(e.post(n.exchange,{},{token:t}))))});var K,F,G,_,Q;!function(e){e.sms="sms",e.whatsapp="whatsapp"}(K||(K={})),function(e){e.email="email",e.sms="sms",e.whatsapp="whatsapp"}(F||(F={})),function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(G||(G={})),function(e){e.signUp="signup",e.signIn="signin",e.verify="verify"}(_||(_={})),function(e){e.signUp="signup",e.signIn="signin",e.verify="verify",e.updatePhone="updatePhone"}(Q||(Q={}));const V=C("identifier"),W=H(V,C("code")),X=H(V),Y=H(V,N("phone")),ee=H(V,D("email")),te=e=>({verify:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:W(((t,a)=>R(e.post(P(s.verify,n),{code:a,externalId:t}))))})),{}),signIn:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:X(((t,a,i)=>R(e.post(P(s.signIn,n),{externalId:t,loginOptions:a},{token:i}))))})),{}),signUp:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:X(((t,a)=>R(e.post(P(s.signUp,n),{externalId:t,user:a}))))})),{}),signUpOrIn:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:X((t=>R(e.post(P(s.signUpOrIn,n),{externalId:t}))))})),{}),update:{email:ee(((t,n,a)=>R(e.post(s.update.email,{externalId:t,email:n},{token:a})))),phone:Object.keys(K).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Y(((t,a,i)=>R(e.post(P(s.update.phone,n),{externalId:t,phone:a},{token:i}))))})),{})}}),ne=C("identifier"),se=C("uri"),ae=H(C("token")),ie=H(ne,se),oe=H(ne,N("phone"),se),re=H(ne,D("email"),se),ue=e=>({verify:ae((t=>R(e.post(a.verify,{token:t})))),signIn:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ie(((t,s,i,o)=>R(e.post(P(a.signIn,n),{externalId:t,URI:s,loginOptions:i},{token:o}))))})),{}),signUp:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ie(((t,s,i)=>R(e.post(P(a.signUp,n),{externalId:t,URI:s,user:i}))))})),{}),signUpOrIn:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ie(((t,s)=>R(e.post(P(a.signUpOrIn,n),{externalId:t,URI:s}))))})),{}),update:{email:re(((t,n,s,i)=>R(e.post(a.update.email,{externalId:t,email:n,URI:s},{token:i})))),phone:Object.keys(K).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:oe(((t,s,i,o)=>R(e.post(P(a.update.phone,n),{externalId:t,phone:s,URI:i},{token:o}))))})),{})}}),pe=C("identifier"),de=C("uri"),ce=H(C("token")),le=H(pe,de),ge=H(C("pendingRef")),he=H(pe,D("email"),de),me=e=>({verify:ce((t=>R(e.post(i.verify,{token:t})))),signIn:le(((t,n,s,a)=>R(e.post(P(i.signIn,F.email),{externalId:t,URI:n,loginOptions:s},{token:a})))),signUpOrIn:le(((t,n)=>R(e.post(P(i.signUpOrIn,F.email),{externalId:t,URI:n})))),signUp:le(((t,n,s)=>R(e.post(P(i.signUp,F.email),{externalId:t,URI:n,user:s})))),waitForSession:ge(((t,n)=>new Promise((s=>{const{pollingIntervalMs:a,timeoutMs:o}=(({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||6e5,6e5)}))(n);let r;const u=setInterval((async()=>{const n=await e.post(i.session,{pendingRef:t});n.ok&&(clearInterval(u),r&&clearTimeout(r),s(R(Promise.resolve(n))))}),a);r=setTimeout((()=>{s({error:{message:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(u)}),o)})))),update:{email:he(((t,n,s,a)=>R(e.post(i.update.email,{externalId:t,email:n,URI:s},{token:a}))))}});var ve;!function(e){e.facebook="facebook",e.github="github",e.google="google",e.microsoft="microsoft",e.gitlab="gitlab",e.apple="apple"}(ve||(ve={}));const fe=H(C("code")),Ie=e=>({start:Object.keys(ve).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:async(t,{redirect:s=!1}={},a,i)=>{const r=await e.post(o.start,a||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:i});if(!s||!r.ok)return R(Promise.resolve(r));const{url:u}=await r.json();window.location.href=u}})),{}),exchange:fe((t=>R(e.post(o.exchange,{code:t}))))}),ye=H(C("flowId")),ke=H(C("executionId"),C("stepId"),C("interactionId")),be=e=>({start:ye(((t,n,s,a)=>R(e.post(h.start,{flowId:t,options:n,interactionId:s,input:a})))),next:ke(((t,n,s,a)=>R(e.post(h.next,{executionId:t,stepId:n,interactionId:s,input:a}))))}),Oe=H(C("tenant")),xe=H(C("code")),we=e=>({start:Oe((async(t,n,{redirect:s=!1}={},a,i)=>{const o=await e.post(r.start,a||{},{queryParams:{tenant:t,redirectURL:n},token:i});if(!s||!o.ok)return R(Promise.resolve(o));const{url:u}=await o.json();window.location.href=u})),exchange:xe((t=>R(e.post(r.exchange,{code:t}))))}),Ue=C("identifier"),je=H(Ue,C("code")),Pe=H(Ue),Re=H(Ue),qe=e=>({signUp:Pe(((t,n)=>R(e.post(u.signUp,{externalId:t,user:n})))),verify:je(((t,n,s,a)=>R(e.post(u.verify,{externalId:t,code:n,loginOptions:s},{token:a})))),update:Re(((t,n)=>R(e.post(u.update,{externalId:t},{token:n}))))}),$e=C("identifier"),Me=C("origin"),Ee=H($e,Me,C("name")),Se=H($e,Me),Ae=H($e,Me,C("token")),Te=H(C("transactionId"),C("response")),Le=e=>({signUp:{start:Ee(((t,n,s)=>R(e.post(p.signUp.start,{user:{externalId:t,name:s},origin:n})))),finish:Te(((t,n)=>R(e.post(p.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:Se(((t,n,s,a)=>R(e.post(p.signIn.start,{externalId:t,origin:n,loginOptions:s},{token:a})))),finish:Te(((t,n)=>R(e.post(p.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Se(((t,n)=>R(e.post(p.signUpOrIn.start,{externalId:t,origin:n}))))},update:{start:Ae(((t,n,s)=>R(e.post(p.update.start,{externalId:t,origin:n},{token:s})))),finish:Te(((t,n)=>R(e.post(p.update.finish,{transactionId:t,response:n}))))}}),ze=H(C("token"));var Je,He;const Ce=H([(Je="projectId",He=C("projectId"),q(((e,n)=>s=>$(...n).validate(t(s,e)))(Je,He))())])((({projectId:e,logger:t,baseUrl:n,hooks:s,cookiePolicy:a})=>{return i=b({baseUrl:n||"https://api.descope.com",projectId:e,logger:t,hooks:s,cookiePolicy:a}),{accessKey:B(i),otp:te(i),magicLink:ue(i),enchantedLink:me(i),oauth:Ie(i),saml:we(i),totp:qe(i),webauthn:Le(i),flow:be(i),refresh:e=>R(i.post(d,{},{token:e})),logout:e=>R(i.post(c,{},{token:e})),logoutAll:e=>R(i.post(l,{},{token:e})),me:e=>R(i.get(g,{token:e})),isJwtExpired:ze(w),getJwtPermissions:ze(U),getJwtRoles:ze(j),httpClient:i};var i}));Ce.DeliveryMethods=F;export{Ce as default,R as transformResponse}; | ||
import e from"jwt-decode";import t from"lodash.get";var n={exchange:"/v1/auth/accesskey/exchange"},s={verify:"/v1/auth/otp/verify",signIn:"/v1/auth/otp/signin",signUp:"/v1/auth/otp/signup",update:{email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},signUpOrIn:"/v1/auth/otp/signup-in"},a={verify:"/v1/auth/magiclink/verify",signIn:"/v1/auth/magiclink/signin",signUp:"/v1/auth/magiclink/signup",update:{email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},signUpOrIn:"/v1/auth/magiclink/signup-in"},i={verify:"/v1/auth/enchantedlink/verify",signIn:"/v1/auth/enchantedlink/signin",signUp:"/v1/auth/enchantedlink/signup",session:"/v1/auth/enchantedlink/pending-session",update:{email:"/v1/auth/enchantedlink/update/email"},signUpOrIn:"/v1/auth/enchantedlink/signup-in"},o={start:"/v1/auth/oauth/authorize",exchange:"/v1/auth/oauth/exchange"},r={start:"/v1/auth/saml/authorize",exchange:"/v1/auth/saml/exchange"},u={verify:"/v1/auth/totp/verify",signUp:"/v1/auth/totp/signup",update:"/v1/user/totp/update"},p={signUp:{start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},signIn:{start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},signUpOrIn:{start:"/v1/auth/webauthn/signup-in/start"},update:{start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"}},c="/v1/auth/refresh",d="/v1/auth/logout",l="/v1/auth/logoutall",h="/v1/auth/me",g={start:"/v1/flow/start",next:"/v1/flow/next"};const v=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}},f=(e,t)=>{const n=t||fetch;if(!n)throw new Error("fetch is not defined");return e?async(...t)=>{e.log((e=>v().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const s=await n(...t);return e[s.ok?"log":"error"](await(async e=>{const t=await(e.clone?e.clone().text():e.text());return e.text=()=>Promise.resolve(t),e.json=()=>Promise.resolve(JSON.parse(t)),v().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(s)),s}:n};var m;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(m||(m={}));const I=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,s])=>(e[n]=s,e)),e),e}),{})),k=e=>void 0===e?void 0:JSON.stringify(e),y=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},b=({baseUrl:e,projectId:t,baseConfig:n,logger:s,hooks:a,cookiePolicy:i})=>{const o=f(s),r=async s=>{const r=(null==a?void 0:a.beforeRequest)?a.beforeRequest(s):s,{path:u,body:p,headers:c,queryParams:d,method:l,token:h}=r,g=await o((({path:e,baseUrl:t,queryParams:n})=>{const s=new URL(e,t);return n&&(s.search=new URLSearchParams(n).toString()),s})({path:u,baseUrl:e,queryParams:d}),{headers:I(y(t,h),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"0.0.41-alpha.36"},(null==n?void 0:n.baseHeaders)||{},c),method:l,body:k(p),credentials:i||"include"});return(null==a?void 0:a.afterRequest)&&a.afterRequest(s,null==g?void 0:g.clone()),g};return{get:(e,{headers:t,queryParams:n,token:s}={})=>r({path:e,headers:t,queryParams:n,body:void 0,method:m.get,token:s}),post:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:m.post,token:a}),put:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:m.put,token:a}),delete:(e,t,{headers:n,queryParams:s,token:a}={})=>r({path:e,headers:n,queryParams:s,body:t,method:m.delete,token:a}),hooks:a}};function O(e,t,n){var s;let a=w(e);t&&(a=null===(s=a.tenants)||void 0===s?void 0:s[t]);const i=a[n];return Array.isArray(i)?i:[]}function w(t){if("string"!=typeof t||!t)throw new Error("Invalid token provided");return e(t)}function x(e){const{exp:t}=w(e);return(new Date).getTime()/1e3>t}function j(e,t){return O(e,t,"permissions")}function U(e,t){return O(e,t,"roles")}const P=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function R(e,t){const n=await e,s={code:n.status,ok:n.ok,response:n},a=await n.clone().json();return n.ok?s.data=t?t(a):a:s.error=a,s}const q=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),$=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),E=e=>t=>e.test(t),M=E(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),S=E(/^\+[1-9]{1}[0-9]{3,14}$/),A=q(M,'"{val}" is not a valid email'),T=q(S,'"{val}" is not a valid phone number'),L=q((z=1,e=>e.length>=z),"Minimum length is 1");var z;const J=q((e=>"string"==typeof e),"Input is not a string"),H=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>$(...e).validate(n[t]))),t(...n)),C=e=>[J(`"${e}" must be a string`),L(`"${e}" must not be empty`)],D=e=>[J(`"${e}" must be a string`),A()],N=e=>[J(`"${e}" must be a string`),T()],Z=H(C("accessKey")),B=e=>({exchange:Z((t=>R(e.post(n.exchange,{},{token:t}))))});var K,F,G,_,Q;!function(e){e.sms="sms",e.whatsapp="whatsapp"}(K||(K={})),function(e){e.email="email",e.sms="sms",e.whatsapp="whatsapp"}(F||(F={})),function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(G||(G={})),function(e){e.signUp="signup",e.signIn="signin",e.verify="verify"}(_||(_={})),function(e){e.signUp="signup",e.signIn="signin",e.verify="verify",e.updatePhone="updatePhone"}(Q||(Q={}));const V=C("identifier"),W=H(V,C("code")),X=H(V),Y=H(V,N("phone")),ee=H(V,D("email")),te=e=>({verify:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:W(((t,a)=>R(e.post(P(s.verify,n),{code:a,externalId:t}))))})),{}),signIn:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:X(((t,a,i)=>R(e.post(P(s.signIn,n),{externalId:t,loginOptions:a},{token:i}))))})),{}),signUp:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:X(((t,a)=>R(e.post(P(s.signUp,n),{externalId:t,user:a}))))})),{}),signUpOrIn:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:X((t=>R(e.post(P(s.signUpOrIn,n),{externalId:t}))))})),{}),update:{email:ee(((t,n,a)=>R(e.post(s.update.email,{externalId:t,email:n},{token:a})))),phone:Object.keys(K).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Y(((t,a,i)=>R(e.post(P(s.update.phone,n),{externalId:t,phone:a},{token:i}))))})),{})}}),ne=C("identifier"),se=C("uri"),ae=H(C("token")),ie=H(ne,se),oe=H(ne,N("phone"),se),re=H(ne,D("email"),se),ue=e=>({verify:ae((t=>R(e.post(a.verify,{token:t})))),signIn:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ie(((t,s,i,o)=>R(e.post(P(a.signIn,n),{externalId:t,URI:s,loginOptions:i},{token:o}))))})),{}),signUp:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ie(((t,s,i)=>R(e.post(P(a.signUp,n),{externalId:t,URI:s,user:i}))))})),{}),signUpOrIn:Object.keys(F).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ie(((t,s)=>R(e.post(P(a.signUpOrIn,n),{externalId:t,URI:s}))))})),{}),update:{email:re(((t,n,s,i)=>R(e.post(a.update.email,{externalId:t,email:n,URI:s},{token:i})))),phone:Object.keys(K).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:oe(((t,s,i,o)=>R(e.post(P(a.update.phone,n),{externalId:t,phone:s,URI:i},{token:o}))))})),{})}}),pe=C("identifier"),ce=C("uri"),de=H(C("token")),le=H(pe,ce),he=H(C("pendingRef")),ge=H(pe,D("email"),ce),ve=e=>({verify:de((t=>R(e.post(i.verify,{token:t})))),signIn:le(((t,n,s,a)=>R(e.post(P(i.signIn,F.email),{externalId:t,URI:n,loginOptions:s},{token:a})))),signUpOrIn:le(((t,n)=>R(e.post(P(i.signUpOrIn,F.email),{externalId:t,URI:n})))),signUp:le(((t,n,s)=>R(e.post(P(i.signUp,F.email),{externalId:t,URI:n,user:s})))),waitForSession:he(((t,n)=>new Promise((s=>{const{pollingIntervalMs:a,timeoutMs:o}=(({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||6e5,6e5)}))(n);let r;const u=setInterval((async()=>{const n=await e.post(i.session,{pendingRef:t});n.ok&&(clearInterval(u),r&&clearTimeout(r),s(R(Promise.resolve(n))))}),a);r=setTimeout((()=>{s({error:{message:`Session polling timeout exceeded: ${o}ms`,errorCode:"0"},ok:!1}),clearInterval(u)}),o)})))),update:{email:ge(((t,n,s,a)=>R(e.post(i.update.email,{externalId:t,email:n,URI:s},{token:a}))))}});var fe;!function(e){e.facebook="facebook",e.github="github",e.google="google",e.microsoft="microsoft",e.gitlab="gitlab",e.apple="apple"}(fe||(fe={}));const me=H(C("code")),Ie=e=>({start:Object.keys(fe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:async(t,{redirect:s=!1}={},a,i)=>{const r=await e.post(o.start,a||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:i});if(!s||!r.ok)return R(Promise.resolve(r));const{url:u}=await r.json();window.location.href=u}})),{}),exchange:me((t=>R(e.post(o.exchange,{code:t}))))}),ke=H(C("flowId")),ye=H(C("executionId"),C("stepId"),C("interactionId")),be=e=>({start:ke(((t,n,s,a)=>R(e.post(g.start,{flowId:t,options:n,interactionId:s,input:a})))),next:ye(((t,n,s,a)=>R(e.post(g.next,{executionId:t,stepId:n,interactionId:s,input:a}))))}),Oe=H(C("tenant")),we=H(C("code")),xe=e=>({start:Oe((async(t,n,{redirect:s=!1}={},a,i)=>{const o=await e.post(r.start,a||{},{queryParams:{tenant:t,redirectURL:n},token:i});if(!s||!o.ok)return R(Promise.resolve(o));const{url:u}=await o.json();window.location.href=u})),exchange:we((t=>R(e.post(r.exchange,{code:t}))))}),je=C("identifier"),Ue=H(je,C("code")),Pe=H(je),Re=H(je),qe=e=>({signUp:Pe(((t,n)=>R(e.post(u.signUp,{externalId:t,user:n})))),verify:Ue(((t,n,s,a)=>R(e.post(u.verify,{externalId:t,code:n,loginOptions:s},{token:a})))),update:Re(((t,n)=>R(e.post(u.update,{externalId:t},{token:n}))))}),$e=C("identifier"),Ee=C("origin"),Me=H($e,Ee,C("name")),Se=H($e,Ee),Ae=H($e,Ee,C("token")),Te=H(C("transactionId"),C("response")),Le=e=>({signUp:{start:Me(((t,n,s)=>R(e.post(p.signUp.start,{user:{externalId:t,name:s},origin:n})))),finish:Te(((t,n)=>R(e.post(p.signUp.finish,{transactionId:t,response:n}))))},signIn:{start:Se(((t,n,s,a)=>R(e.post(p.signIn.start,{externalId:t,origin:n,loginOptions:s},{token:a})))),finish:Te(((t,n)=>R(e.post(p.signIn.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Se(((t,n)=>R(e.post(p.signUpOrIn.start,{externalId:t,origin:n}))))},update:{start:Ae(((t,n,s)=>R(e.post(p.update.start,{externalId:t,origin:n},{token:s})))),finish:Te(((t,n)=>R(e.post(p.update.finish,{transactionId:t,response:n}))))}}),ze=H(C("token"));const Je=(e,t,n)=>(t.forEach((t=>{const s=t.split(".");let a=s.shift(),i=e;for(;s.length>0;){if(i=i[a],!a||!i)throw Error(`Invalid path "${t}", "${a}" is missing or has no value`);a=s.shift()}if("function"!=typeof i[a])throw Error(`"${t}" is not a function`);const o=i[a];i[a]=n(o)})),e);var He,Ce;let De=H([(He="projectId",Ce=C("projectId"),q(((e,n)=>s=>$(...n).validate(t(s,e)))(He,Ce))())])((e=>t=>{var n,s;const a=[].concat((null===(n=t.hooks)||void 0===n?void 0:n.beforeRequest)||[]),i=[].concat((null===(s=t.hooks)||void 0===s?void 0:s.afterRequest)||[]);return e(Object.assign(Object.assign({},t),{hooks:{beforeRequest:e=>null==a?void 0:a.reduce(((e,t)=>t(e)),e),afterRequest:(e,t)=>{null==i||i.forEach((n=>n(e,null==t?void 0:t.clone())))}}}))})((({projectId:e,logger:t,baseUrl:n,hooks:s,cookiePolicy:a})=>{return i=b({baseUrl:n||"https://api.descope.com",projectId:e,logger:t,hooks:s,cookiePolicy:a}),{accessKey:B(i),otp:te(i),magicLink:ue(i),enchantedLink:ve(i),oauth:Ie(i),saml:xe(i),totp:qe(i),webauthn:Le(i),flow:be(i),refresh:e=>R(i.post(c,{},{token:e})),logout:e=>R(i.post(d,{},{token:e})),logoutAll:e=>R(i.post(l,{},{token:e})),me:e=>R(i.get(h,{token:e})),isJwtExpired:ze(x),getJwtPermissions:ze(j),getJwtRoles:ze(U),httpClient:i};var i})));var Ne=Object.assign(De,{DeliveryMethods:F});export{Ne as default,R as transformResponse,Je as wrapWith}; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "@descope/core-js-sdk", | ||
"version": "0.0.41-alpha.35", | ||
"version": "0.0.41-alpha.36", | ||
"main": "dist/cjs/index.cjs.js", | ||
@@ -51,3 +51,3 @@ "module": "dist/index.esm.js", | ||
"@typescript-eslint/parser": "^5.33.1", | ||
"esbuild": "^0.15.0", | ||
"esbuild": "^0.16.0", | ||
"eslint": "8.26.0", | ||
@@ -59,6 +59,6 @@ "eslint-config-airbnb-typescript": "17.0.0", | ||
"eslint-plugin-import": "2.26.0", | ||
"eslint-plugin-jest": "27.1.6", | ||
"eslint-plugin-jest": "27.1.7", | ||
"eslint-plugin-jest-dom": "4.0.3", | ||
"eslint-plugin-jest-formatting": "3.1.0", | ||
"eslint-plugin-n": "15.5.1", | ||
"eslint-plugin-n": "15.6.0", | ||
"eslint-plugin-no-only-tests": "3.1.0", | ||
@@ -65,0 +65,0 @@ "eslint-plugin-prefer-arrow": "1.2.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
187543
502