@aura-stack/auth 0.6.0 → 0.7.0

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.
Files changed (70) hide show
  1. package/dist/@types/index.d.ts +2 -2
  2. package/dist/assert-_fBNnaOk.js +3 -0
  3. package/dist/assert-hDwQ_SPO.cjs +3 -0
  4. package/dist/client/index.cjs +1 -1
  5. package/dist/client/index.d.ts +1 -1
  6. package/dist/client/index.js +1 -1
  7. package/dist/crypto-D6_SoGMH.cjs +1 -0
  8. package/dist/crypto-DyrRzBSQ.js +1 -0
  9. package/dist/env-7as-tgzO.cjs +1 -0
  10. package/dist/env-CJtSi1eX.js +1 -0
  11. package/dist/errors-Czt_w1t_.js +1 -0
  12. package/dist/errors-DcK2ELlk.cjs +1 -0
  13. package/dist/identity-b8FCr0Oa.cjs +1 -0
  14. package/dist/{index-BkpwQ0l4.d.cts → index-C9U6ICDT.d.ts} +792 -275
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/{logger-C59_CDMk.js → logger-DjXkgSn5.js} +1 -1
  19. package/dist/{logger-UnUhYL2V.cjs → logger-G5PinyEc.cjs} +1 -1
  20. package/dist/oauth/atlassian.d.ts +1 -1
  21. package/dist/oauth/bitbucket.d.ts +1 -1
  22. package/dist/oauth/click-up.cjs +1 -0
  23. package/dist/oauth/click-up.d.ts +2 -0
  24. package/dist/oauth/click-up.js +1 -0
  25. package/dist/oauth/discord.d.ts +1 -1
  26. package/dist/oauth/dribbble.cjs +1 -0
  27. package/dist/oauth/dribbble.d.ts +2 -0
  28. package/dist/oauth/dribbble.js +1 -0
  29. package/dist/oauth/dropbox.d.ts +1 -1
  30. package/dist/oauth/figma.d.ts +1 -1
  31. package/dist/oauth/github.d.ts +1 -1
  32. package/dist/oauth/gitlab.d.ts +1 -1
  33. package/dist/oauth/index.cjs +1 -1
  34. package/dist/oauth/index.d.ts +2 -2
  35. package/dist/oauth/index.js +1 -1
  36. package/dist/oauth/mailchimp.d.ts +1 -1
  37. package/dist/oauth/notion.cjs +1 -1
  38. package/dist/oauth/notion.d.ts +1 -1
  39. package/dist/oauth/notion.js +1 -1
  40. package/dist/oauth/pinterest.d.ts +1 -1
  41. package/dist/oauth/spotify.d.ts +1 -1
  42. package/dist/oauth/strava.d.ts +1 -1
  43. package/dist/oauth/twitch.cjs +1 -1
  44. package/dist/oauth/twitch.d.ts +1 -1
  45. package/dist/oauth/twitch.js +1 -1
  46. package/dist/oauth/x.d.ts +1 -1
  47. package/dist/oauth-D3_mnBOx.js +1 -0
  48. package/dist/oauth-gPiWxjBd.cjs +1 -0
  49. package/dist/shared/crypto.cjs +1 -1
  50. package/dist/shared/crypto.d.ts +26 -2
  51. package/dist/shared/crypto.js +1 -1
  52. package/dist/shared/identity.cjs +1 -1
  53. package/dist/shared/identity.d.ts +2 -2
  54. package/dist/shared/identity.js +1 -1
  55. package/dist/shared/index.cjs +1 -1
  56. package/dist/shared/index.d.ts +1 -1
  57. package/dist/shared/index.js +1 -1
  58. package/package.json +9 -6
  59. package/dist/assert-B3iQSYlK.js +0 -3
  60. package/dist/assert-NJGroSJd.cjs +0 -3
  61. package/dist/crypto-Bz8nIciY.js +0 -1
  62. package/dist/crypto-CoXA5w_4.cjs +0 -1
  63. package/dist/env-bq387KyP.cjs +0 -1
  64. package/dist/env-nvh8QBNz.js +0 -1
  65. package/dist/errors-CCYPHuBO.cjs +0 -1
  66. package/dist/errors-DFWHOho6.js +0 -1
  67. package/dist/index-nqLV2t91.d.ts +0 -2279
  68. package/dist/index.d.cts +0 -2
  69. package/dist/oauth-BntNm6aE.cjs +0 -1
  70. package/dist/oauth-DmHy9VrB.js +0 -1
package/dist/index.d.cts DELETED
@@ -1,2 +0,0 @@
1
- import { R as createAuth, _t as User, bt as AuthInstance, pt as Session, yt as AuthConfig } from "./index-BkpwQ0l4.cjs";
2
- export { type AuthConfig, type AuthInstance, type Session, type User, createAuth };
@@ -1 +0,0 @@
1
- const e=require(`./errors-CCYPHuBO.cjs`),t=require(`./env-bq387KyP.cjs`),n=require(`./assert-NJGroSJd.cjs`),r=require(`./oauth/github.cjs`),i=require(`./oauth/bitbucket.cjs`),a=require(`./oauth/figma.cjs`),o=require(`./oauth/discord.cjs`),s=require(`./oauth/gitlab.cjs`),c=require(`./oauth/spotify.cjs`),l=require(`./oauth/x.cjs`),u=require(`./oauth/strava.cjs`),d=require(`./oauth/mailchimp.cjs`),f=require(`./oauth/pinterest.cjs`),p=require(`./oauth/twitch.cjs`),m=require(`./oauth/notion.cjs`),h=require(`./oauth/dropbox.cjs`),g=require(`./oauth/atlassian.cjs`);let _=require(`zod/v4`);const v=_.z.union([(0,_.string)().url(),(0,_.object)({url:(0,_.string)().url(),params:(0,_.object)({owner:(0,_.string)().optional(),responseType:(0,_.enum)([`code`,`token`,`id_token`,`refresh_token`]).optional(),scope:(0,_.string)().optional()})})]),y=_.z.union([(0,_.string)().url(),(0,_.object)({url:(0,_.string)().url(),headers:_.z.record((0,_.string)(),(0,_.string)()).optional()})]),b=_.z.union([(0,_.string)().url(),(0,_.object)({url:(0,_.string)().url(),headers:_.z.record((0,_.string)(),(0,_.string)()).optional(),method:(0,_.string)().optional()})]),x=(0,_.object)({id:(0,_.string)(),name:(0,_.string)(),authorize:v.optional(),authorizeURL:(0,_.string)().url().optional(),accessToken:y,scope:(0,_.string)().optional(),userInfo:b,responseType:(0,_.enum)([`code`,`token`,`id_token`,`refresh_token`]).optional(),clientId:(0,_.string)(),clientSecret:(0,_.string)(),profile:_.z.function().optional()}),S=(0,_.object)({authorize:v.optional(),authorizeURL:(0,_.string)().url().optional(),accessToken:y,scope:(0,_.string)().optional(),userInfo:b,responseType:(0,_.enum)([`code`,`token`,`id_token`,`refresh_token`]).optional(),clientId:(0,_.string)(),clientSecret:(0,_.string)()}),C=S.extend({redirectURI:(0,_.string)(),state:(0,_.string)(),codeChallenge:(0,_.string)(),codeChallengeMethod:(0,_.enum)([`plain`,`S256`])});(0,_.object)({state:(0,_.string)({message:`Missing state parameter in the OAuth authorization response.`}),code:(0,_.string)({message:`Missing code parameter in the OAuth authorization response.`})});const w=(0,_.object)({error:(0,_.enum)([`invalid_request`,`unauthorized_client`,`access_denied`,`unsupported_response_type`,`invalid_scope`,`server_error`,`temporarily_unavailable`]),error_description:(0,_.string)().optional(),error_uri:(0,_.string)().optional(),state:(0,_.string)()});S.extend({redirectURI:(0,_.string)(),code:(0,_.string)(),codeVerifier:(0,_.string)().min(43).max(128)});const T=(0,_.object)({access_token:(0,_.string)(),token_type:(0,_.string)().optional(),expires_in:(0,_.number)().optional(),refresh_token:(0,_.string)().optional(),scope:(0,_.union)([(0,_.string)().optional().or((0,_.null)()),(0,_.array)((0,_.string)()).optional()])}),E=(0,_.object)({error:(0,_.enum)([`invalid_request`,`invalid_client`,`invalid_grant`,`unauthorized_client`,`unsupported_grant_type`,`invalid_scope`]),error_description:(0,_.string)().optional(),error_uri:(0,_.string)().optional()}),D=(0,_.object)({error:(0,_.string)(),error_description:(0,_.string)().optional()}),O=(0,_.object)({clientId:_.z.string().min(1,`OAuth Client ID is required in the environment variables.`),clientSecret:_.z.string().min(1,`OAuth Client Secret is required in the environment variables.`)}),k={github:r.github,bitbucket:i.bitbucket,figma:a.figma,discord:o.discord,gitlab:s.gitlab,spotify:c.spotify,x:l.x,strava:u.strava,mailchimp:d.mailchimp,pinterest:f.pinterest,twitch:p.twitch,notion:m.notion,dropbox:h.dropbox,atlassian:g.atlassian},A=r=>{let i=O.safeParse({clientId:t.n(`${r.toUpperCase()}_CLIENT_ID`),clientSecret:t.n(`${r.toUpperCase()}_CLIENT_SECRET`)});if(!i.success)throw new e.n(`INVALID_ENVIRONMENT_CONFIGURATION`,JSON.stringify({[r]:n.p(i.error)},null,2));return i.data},j=t=>{if(typeof t==`string`){let r=A(t),i=k[t](),a=x.safeParse({...i,...r});if(!a.success)throw new e.n(`INVALID_OAUTH_PROVIDER_CONFIGURATION`,`Invalid configuration for OAuth provider "${t}": ${JSON.stringify({[t]:n.p(a.error)},null,2)}`);return a.data}let r=t.clientId&&t.clientSecret?{}:A(t.id),i=x.safeParse({...r,...t});if(!i.success){let r=JSON.stringify({[t.id]:n.p(i.error)},null,2);throw new e.n(`INVALID_OAUTH_PROVIDER_CONFIGURATION`,`Invalid configuration for OAuth provider "${t.id}": ${r}`)}return i.data},M=(t=[])=>t.reduce((t,n)=>{let r=j(n);if(r.id in t)throw new e.n(`DUPLICATED_OAUTH_PROVIDER_ID`,`Duplicate OAuth provider id "${r.id}" found. Each provider must have a unique id.`);return{...t,[r.id]:r}},{});Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return k}});
@@ -1 +0,0 @@
1
- import{n as e}from"./errors-DFWHOho6.js";import{n as t}from"./env-nvh8QBNz.js";import{p as n}from"./assert-B3iQSYlK.js";import{github as r}from"./oauth/github.js";import{bitbucket as i}from"./oauth/bitbucket.js";import{figma as a}from"./oauth/figma.js";import{discord as o}from"./oauth/discord.js";import{gitlab as s}from"./oauth/gitlab.js";import{spotify as c}from"./oauth/spotify.js";import{x as l}from"./oauth/x.js";import{strava as u}from"./oauth/strava.js";import{mailchimp as d}from"./oauth/mailchimp.js";import{pinterest as f}from"./oauth/pinterest.js";import{twitch as p}from"./oauth/twitch.js";import{notion as m}from"./oauth/notion.js";import{dropbox as h}from"./oauth/dropbox.js";import{atlassian as g}from"./oauth/atlassian.js";import{array as _,enum as v,null as y,number as b,object as x,string as S,union as C,z as w}from"zod/v4";const T=w.union([S().url(),x({url:S().url(),params:x({owner:S().optional(),responseType:v([`code`,`token`,`id_token`,`refresh_token`]).optional(),scope:S().optional()})})]),E=w.union([S().url(),x({url:S().url(),headers:w.record(S(),S()).optional()})]),D=w.union([S().url(),x({url:S().url(),headers:w.record(S(),S()).optional(),method:S().optional()})]),O=x({id:S(),name:S(),authorize:T.optional(),authorizeURL:S().url().optional(),accessToken:E,scope:S().optional(),userInfo:D,responseType:v([`code`,`token`,`id_token`,`refresh_token`]).optional(),clientId:S(),clientSecret:S(),profile:w.function().optional()}),k=x({authorize:T.optional(),authorizeURL:S().url().optional(),accessToken:E,scope:S().optional(),userInfo:D,responseType:v([`code`,`token`,`id_token`,`refresh_token`]).optional(),clientId:S(),clientSecret:S()}),A=k.extend({redirectURI:S(),state:S(),codeChallenge:S(),codeChallengeMethod:v([`plain`,`S256`])});x({state:S({message:`Missing state parameter in the OAuth authorization response.`}),code:S({message:`Missing code parameter in the OAuth authorization response.`})});const j=x({error:v([`invalid_request`,`unauthorized_client`,`access_denied`,`unsupported_response_type`,`invalid_scope`,`server_error`,`temporarily_unavailable`]),error_description:S().optional(),error_uri:S().optional(),state:S()});k.extend({redirectURI:S(),code:S(),codeVerifier:S().min(43).max(128)});const M=x({access_token:S(),token_type:S().optional(),expires_in:b().optional(),refresh_token:S().optional(),scope:C([S().optional().or(y()),_(S()).optional()])}),N=x({error:v([`invalid_request`,`invalid_client`,`invalid_grant`,`unauthorized_client`,`unsupported_grant_type`,`invalid_scope`]),error_description:S().optional(),error_uri:S().optional()}),P=x({error:S(),error_description:S().optional()}),F=x({clientId:w.string().min(1,`OAuth Client ID is required in the environment variables.`),clientSecret:w.string().min(1,`OAuth Client Secret is required in the environment variables.`)}),I={github:r,bitbucket:i,figma:a,discord:o,gitlab:s,spotify:c,x:l,strava:u,mailchimp:d,pinterest:f,twitch:p,notion:m,dropbox:h,atlassian:g},L=r=>{let i=F.safeParse({clientId:t(`${r.toUpperCase()}_CLIENT_ID`),clientSecret:t(`${r.toUpperCase()}_CLIENT_SECRET`)});if(!i.success)throw new e(`INVALID_ENVIRONMENT_CONFIGURATION`,JSON.stringify({[r]:n(i.error)},null,2));return i.data},R=t=>{if(typeof t==`string`){let r=L(t),i=I[t](),a=O.safeParse({...i,...r});if(!a.success)throw new e(`INVALID_OAUTH_PROVIDER_CONFIGURATION`,`Invalid configuration for OAuth provider "${t}": ${JSON.stringify({[t]:n(a.error)},null,2)}`);return a.data}let r=t.clientId&&t.clientSecret?{}:L(t.id),i=O.safeParse({...r,...t});if(!i.success){let r=JSON.stringify({[t.id]:n(i.error)},null,2);throw new e(`INVALID_OAUTH_PROVIDER_CONFIGURATION`,`Invalid configuration for OAuth provider "${t.id}": ${r}`)}return i.data},z=(t=[])=>t.reduce((t,n)=>{let r=R(n);if(r.id in t)throw new e(`DUPLICATED_OAUTH_PROVIDER_ID`,`Duplicate OAuth provider id "${r.id}" found. Each provider must have a unique id.`);return{...t,[r.id]:r}},{});export{A as a,M as i,z as n,j as o,N as r,P as s,I as t};