@nhost/nhost-js 4.2.1-beta0 → 4.2.1-beta1
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/dist/nhost-js/auth.cjs.js +1 -1
- package/dist/nhost-js/auth.cjs.js.map +1 -1
- package/dist/nhost-js/auth.es.js +14 -6
- package/dist/nhost-js/auth.es.js.map +1 -1
- package/dist/nhost-js/storage.cjs.js +1 -1
- package/dist/nhost-js/storage.cjs.js.map +1 -1
- package/dist/nhost-js/storage.es.js +6 -6
- package/dist/nhost-js/storage.es.js.map +1 -1
- package/dist/nhost-js.umd.js +1 -1
- package/dist/nhost-js.umd.js.map +1 -1
- package/dist/src/auth/client.d.ts +21 -0
- package/dist/src/auth/client.d.ts.map +1 -1
- package/dist/src/auth/client.js +19 -8
- package/dist/src/auth/client.js.map +1 -1
- package/dist/src/storage/client.d.ts.map +1 -1
- package/dist/src/storage/client.js +10 -8
- package/dist/src/storage/client.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../fetch-DWXwEnoe.js");exports.createAPIClient=(s,e=[])=>{let a=t.createEnhancedFetch(e);return{baseURL:s,pushChainFunction:s=>{e.push(s),a=t.createEnhancedFetch(e)},getJWKs:async e=>{const n=`${s}/.well-known/jwks.json`,r=await a(n,{...e,method:"GET",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},elevateWebauthn:async e=>{const n=`${s}/elevate/webauthn`,r=await a(n,{...e,method:"POST",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},verifyElevateWebauthn:async(e,n)=>{const r=`${s}/elevate/webauthn/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},healthCheckGet:async e=>{const n=`${s}/healthz`,r=await a(n,{...e,method:"GET",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},healthCheckHead:async e=>{const n=`${s}/healthz`,r=await a(n,{...e,method:"HEAD",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}return{body:void 0,status:r.status,headers:r.headers}},linkIdToken:async(e,n)=>{const r=`${s}/link/idtoken`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},changeUserMfa:async e=>{const n=`${s}/mfa/totp/generate`,r=await a(n,{...e,method:"GET",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},createPAT:async(e,n)=>{const r=`${s}/pat`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInAnonymous:async(e,n)=>{const r=`${s}/signin/anonymous`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInEmailPassword:async(e,n)=>{const r=`${s}/signin/email-password`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInIdToken:async(e,n)=>{const r=`${s}/signin/idtoken`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifySignInMfaTotp:async(e,n)=>{const r=`${s}/signin/mfa/totp`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInOTPEmail:async(e,n)=>{const r=`${s}/signin/otp/email`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifySignInOTPEmail:async(e,n)=>{const r=`${s}/signin/otp/email/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInPasswordlessEmail:async(e,n)=>{const r=`${s}/signin/passwordless/email`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInPasswordlessSms:async(e,n)=>{const r=`${s}/signin/passwordless/sms`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifySignInPasswordlessSms:async(e,n)=>{const r=`${s}/signin/passwordless/sms/otp`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInPAT:async(e,n)=>{const r=`${s}/signin/pat`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInProviderURL:(t,e)=>{const a=e&&Object.entries(e).map((([t,s])=>{const e=Array.isArray(s)?s.join(","):"object"==typeof s?JSON.stringify(s):s;return`${t}=${encodeURIComponent(e)}`})).join("&");return a?`${s}/signin/provider/${t}?${a}`:`${s}/signin/provider/${t}`},getProviderTokens:async(e,n)=>{const r=`${s}/signin/provider/${e}/callback/tokens`,i=await a(r,{...n,method:"GET",headers:{...n?.headers}});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInWebauthn:async(e,n)=>{const r=`${s}/signin/webauthn`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifySignInWebauthn:async(e,n)=>{const r=`${s}/signin/webauthn/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signOut:async(e,n)=>{const r=`${s}/signout`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signUpEmailPassword:async(e,n)=>{const r=`${s}/signup/email-password`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signUpWebauthn:async(e,n)=>{const r=`${s}/signup/webauthn`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifySignUpWebauthn:async(e,n)=>{const r=`${s}/signup/webauthn/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},refreshToken:async(e,n)=>{const r=`${s}/token`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},refreshProviderToken:async(e,n,r)=>{const i=`${s}/token/provider/${e}`,o=await a(i,{...r,method:"POST",headers:{"Content-Type":"application/json",...r?.headers},body:JSON.stringify(n)});if(o.status>=300){const s=[412].includes(o.status)?null:await o.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,o.status,o.headers)}const u=[204,205,304].includes(o.status)?null:await o.text();return{body:u?JSON.parse(u):{},status:o.status,headers:o.headers}},verifyToken:async(e,n)=>{const r=`${s}/token/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},getUser:async e=>{const n=`${s}/user`,r=await a(n,{...e,method:"GET",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},deanonymizeUser:async(e,n)=>{const r=`${s}/user/deanonymize`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},changeUserEmail:async(e,n)=>{const r=`${s}/user/email/change`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},sendVerificationEmail:async(e,n)=>{const r=`${s}/user/email/send-verification-email`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifyChangeUserMfa:async(e,n)=>{const r=`${s}/user/mfa`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},changeUserPassword:async(e,n)=>{const r=`${s}/user/password`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},sendPasswordResetEmail:async(e,n)=>{const r=`${s}/user/password/reset`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},addSecurityKey:async e=>{const n=`${s}/user/webauthn/add`,r=await a(n,{...e,method:"POST",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},verifyAddSecurityKey:async(e,n)=>{const r=`${s}/user/webauthn/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifyTicketURL:t=>{const e=t&&Object.entries(t).map((([t,s])=>{const e=Array.isArray(s)?s.join(","):"object"==typeof s?JSON.stringify(s):s;return`${t}=${encodeURIComponent(e)}`})).join("&");return e?`${s}/verify?${e}`:`${s}/verify`},getVersion:async e=>{const n=`${s}/version`,r=await a(n,{...e,method:"GET",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}}}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../fetch-DWXwEnoe.js");exports.createAPIClient=(s,e=[])=>{let a=t.createEnhancedFetch(e);return{baseURL:s,pushChainFunction:s=>{e.push(s),a=t.createEnhancedFetch(e)},getJWKs:async e=>{const n=`${s}/.well-known/jwks.json`,r=await a(n,{...e,method:"GET",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},elevateWebauthn:async e=>{const n=`${s}/elevate/webauthn`,r=await a(n,{...e,method:"POST",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},verifyElevateWebauthn:async(e,n)=>{const r=`${s}/elevate/webauthn/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},healthCheckGet:async e=>{const n=`${s}/healthz`,r=await a(n,{...e,method:"GET",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},healthCheckHead:async e=>{const n=`${s}/healthz`,r=await a(n,{...e,method:"HEAD",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}return{body:void 0,status:r.status,headers:r.headers}},linkIdToken:async(e,n)=>{const r=`${s}/link/idtoken`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},changeUserMfa:async e=>{const n=`${s}/mfa/totp/generate`,r=await a(n,{...e,method:"GET",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},createPAT:async(e,n)=>{const r=`${s}/pat`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInAnonymous:async(e,n)=>{const r=`${s}/signin/anonymous`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInEmailPassword:async(e,n)=>{const r=`${s}/signin/email-password`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInIdToken:async(e,n)=>{const r=`${s}/signin/idtoken`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifySignInMfaTotp:async(e,n)=>{const r=`${s}/signin/mfa/totp`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInOTPEmail:async(e,n)=>{const r=`${s}/signin/otp/email`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifySignInOTPEmail:async(e,n)=>{const r=`${s}/signin/otp/email/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInPasswordlessEmail:async(e,n)=>{const r=`${s}/signin/passwordless/email`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInPasswordlessSms:async(e,n)=>{const r=`${s}/signin/passwordless/sms`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifySignInPasswordlessSms:async(e,n)=>{const r=`${s}/signin/passwordless/sms/otp`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInPAT:async(e,n)=>{const r=`${s}/signin/pat`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInProviderURL:(t,e)=>{const a=e&&Object.entries(e).flatMap((([t,s])=>{if("providerSpecificParams"===t)return"object"!=typeof s||null===s||Array.isArray(s)?[`${t}=${encodeURIComponent(String(s))}`]:Object.entries(s).map((([t,s])=>`${t}=${encodeURIComponent(String(s))}`));const e=Array.isArray(s)?s.join(","):"object"==typeof s&&null!==s?JSON.stringify(s):String(s);return[`${t}=${encodeURIComponent(e)}`]})).join("&");return a?`${s}/signin/provider/${t}?${a}`:`${s}/signin/provider/${t}`},getProviderTokens:async(e,n)=>{const r=`${s}/signin/provider/${e}/callback/tokens`,i=await a(r,{...n,method:"GET",headers:{...n?.headers}});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signInWebauthn:async(e,n)=>{const r=`${s}/signin/webauthn`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifySignInWebauthn:async(e,n)=>{const r=`${s}/signin/webauthn/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signOut:async(e,n)=>{const r=`${s}/signout`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signUpEmailPassword:async(e,n)=>{const r=`${s}/signup/email-password`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},signUpWebauthn:async(e,n)=>{const r=`${s}/signup/webauthn`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifySignUpWebauthn:async(e,n)=>{const r=`${s}/signup/webauthn/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},refreshToken:async(e,n)=>{const r=`${s}/token`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},refreshProviderToken:async(e,n,r)=>{const i=`${s}/token/provider/${e}`,o=await a(i,{...r,method:"POST",headers:{"Content-Type":"application/json",...r?.headers},body:JSON.stringify(n)});if(o.status>=300){const s=[412].includes(o.status)?null:await o.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,o.status,o.headers)}const u=[204,205,304].includes(o.status)?null:await o.text();return{body:u?JSON.parse(u):{},status:o.status,headers:o.headers}},verifyToken:async(e,n)=>{const r=`${s}/token/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},getUser:async e=>{const n=`${s}/user`,r=await a(n,{...e,method:"GET",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},deanonymizeUser:async(e,n)=>{const r=`${s}/user/deanonymize`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},changeUserEmail:async(e,n)=>{const r=`${s}/user/email/change`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},sendVerificationEmail:async(e,n)=>{const r=`${s}/user/email/send-verification-email`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifyChangeUserMfa:async(e,n)=>{const r=`${s}/user/mfa`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},changeUserPassword:async(e,n)=>{const r=`${s}/user/password`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},sendPasswordResetEmail:async(e,n)=>{const r=`${s}/user/password/reset`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},addSecurityKey:async e=>{const n=`${s}/user/webauthn/add`,r=await a(n,{...e,method:"POST",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}},verifyAddSecurityKey:async(e,n)=>{const r=`${s}/user/webauthn/verify`,i=await a(r,{...n,method:"POST",headers:{"Content-Type":"application/json",...n?.headers},body:JSON.stringify(e)});if(i.status>=300){const s=[412].includes(i.status)?null:await i.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,i.status,i.headers)}const o=[204,205,304].includes(i.status)?null:await i.text();return{body:o?JSON.parse(o):{},status:i.status,headers:i.headers}},verifyTicketURL:t=>{const e=t&&Object.entries(t).flatMap((([t,s])=>{const e=Array.isArray(s)?s.join(","):"object"==typeof s&&null!==s?JSON.stringify(s):String(s);return[`${t}=${encodeURIComponent(e)}`]})).join("&");return e?`${s}/verify?${e}`:`${s}/verify`},getVersion:async e=>{const n=`${s}/version`,r=await a(n,{...e,method:"GET",headers:{...e?.headers}});if(r.status>=300){const s=[412].includes(r.status)?null:await r.text(),e=s?JSON.parse(s):{};throw new t.FetchError(e,r.status,r.headers)}const i=[204,205,304].includes(r.status)?null:await r.text();return{body:i?JSON.parse(i):{},status:r.status,headers:r.headers}}}};
|
|
2
2
|
//# sourceMappingURL=auth.cjs.js.map
|