@aura-stack/auth 0.1.0-rc.9 → 0.2.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 (140) hide show
  1. package/dist/@types/index.cjs +15 -15
  2. package/dist/@types/index.d.ts +6 -31
  3. package/dist/@types/index.js +1 -1
  4. package/dist/@types/router.d.cjs +1 -1
  5. package/dist/@types/router.d.d.ts +6 -7
  6. package/dist/@types/utility.cjs +15 -15
  7. package/dist/@types/utility.d.ts +4 -8
  8. package/dist/@types/utility.js +1 -1
  9. package/dist/actions/callback/access-token.cjs +159 -149
  10. package/dist/actions/callback/access-token.d.ts +14 -20
  11. package/dist/actions/callback/access-token.js +9 -4
  12. package/dist/actions/callback/callback.cjs +371 -484
  13. package/dist/actions/callback/callback.d.ts +9 -12
  14. package/dist/actions/callback/callback.js +15 -12
  15. package/dist/actions/callback/userinfo.cjs +149 -139
  16. package/dist/actions/callback/userinfo.d.ts +8 -9
  17. package/dist/actions/callback/userinfo.js +11 -6
  18. package/dist/actions/csrfToken/csrfToken.cjs +112 -190
  19. package/dist/actions/csrfToken/csrfToken.d.ts +3 -3
  20. package/dist/actions/csrfToken/csrfToken.js +12 -8
  21. package/dist/actions/index.cjs +623 -807
  22. package/dist/actions/index.d.ts +12 -13
  23. package/dist/actions/index.js +33 -18
  24. package/dist/actions/session/session.cjs +86 -176
  25. package/dist/actions/session/session.d.ts +3 -3
  26. package/dist/actions/session/session.js +10 -7
  27. package/dist/actions/signIn/authorization.cjs +248 -257
  28. package/dist/actions/signIn/authorization.d.ts +11 -18
  29. package/dist/actions/signIn/authorization.js +16 -6
  30. package/dist/actions/signIn/signIn.cjs +302 -451
  31. package/dist/actions/signIn/signIn.d.ts +9 -10
  32. package/dist/actions/signIn/signIn.js +12 -10
  33. package/dist/actions/signOut/signOut.cjs +299 -468
  34. package/dist/actions/signOut/signOut.d.ts +3 -3
  35. package/dist/actions/signOut/signOut.js +14 -11
  36. package/dist/assert.cjs +40 -36
  37. package/dist/assert.d.ts +12 -4
  38. package/dist/assert.js +12 -2
  39. package/dist/chunk-2RXNXMCZ.js +55 -0
  40. package/dist/chunk-42XB3YCW.js +19 -17
  41. package/dist/chunk-4V4JNXVF.js +55 -0
  42. package/dist/chunk-6R2YZ4AC.js +22 -0
  43. package/dist/chunk-7H3OR6UU.js +81 -0
  44. package/dist/chunk-CXLATHS5.js +143 -0
  45. package/dist/chunk-E3OXBRYF.js +19 -17
  46. package/dist/chunk-EIL2FPSS.js +22 -0
  47. package/dist/chunk-FIPU4MLT.js +18 -16
  48. package/dist/chunk-FKRDCWBF.js +19 -17
  49. package/dist/chunk-IKHPGFCW.js +11 -9
  50. package/dist/chunk-IMICRJ5U.js +197 -0
  51. package/dist/chunk-IUYZQTJV.js +30 -0
  52. package/dist/chunk-KRNOMBXQ.js +19 -17
  53. package/dist/chunk-N2APGLXA.js +71 -0
  54. package/dist/chunk-NEVKX6K2.js +70 -0
  55. package/dist/chunk-PTJUYB33.js +33 -0
  56. package/dist/chunk-QDO2KSRJ.js +35 -0
  57. package/dist/chunk-QEZL7EYN.js +96 -0
  58. package/dist/chunk-RRLIF4PQ.js +55 -0
  59. package/dist/chunk-STHEPPUZ.js +8 -6
  60. package/dist/chunk-TLE4PXY3.js +39 -0
  61. package/dist/chunk-UEH3LVON.js +97 -0
  62. package/dist/chunk-WD7AUHQ5.js +79 -0
  63. package/dist/chunk-ZLR3LI6X.js +55 -0
  64. package/dist/cookie.cjs +222 -187
  65. package/dist/cookie.d.ts +38 -76
  66. package/dist/cookie.js +27 -34
  67. package/dist/errors.cjs +85 -0
  68. package/dist/errors.d.ts +48 -0
  69. package/dist/errors.js +18 -0
  70. package/dist/headers.cjs +28 -28
  71. package/dist/headers.d.ts +2 -2
  72. package/dist/headers.js +6 -2
  73. package/dist/{index-DpfbvTZ_.d.ts → index-EqsoyjrF.d.ts} +351 -318
  74. package/dist/index.cjs +1006 -1001
  75. package/dist/index.d.ts +9 -31
  76. package/dist/index.js +82 -51
  77. package/dist/jose.cjs +74 -66
  78. package/dist/jose.d.ts +11 -8
  79. package/dist/jose.js +10 -5
  80. package/dist/oauth/bitbucket.cjs +38 -38
  81. package/dist/oauth/bitbucket.d.ts +6 -7
  82. package/dist/oauth/bitbucket.js +6 -2
  83. package/dist/oauth/discord.cjs +47 -48
  84. package/dist/oauth/discord.d.ts +6 -7
  85. package/dist/oauth/discord.js +6 -2
  86. package/dist/oauth/figma.cjs +39 -39
  87. package/dist/oauth/figma.d.ts +6 -7
  88. package/dist/oauth/figma.js +6 -2
  89. package/dist/oauth/github.cjs +31 -31
  90. package/dist/oauth/github.d.ts +6 -7
  91. package/dist/oauth/github.js +6 -2
  92. package/dist/oauth/gitlab.cjs +39 -39
  93. package/dist/oauth/gitlab.d.ts +6 -7
  94. package/dist/oauth/gitlab.js +6 -2
  95. package/dist/oauth/index.cjs +306 -180
  96. package/dist/oauth/index.d.ts +6 -26
  97. package/dist/oauth/index.js +43 -9
  98. package/dist/oauth/spotify.cjs +39 -39
  99. package/dist/oauth/spotify.d.ts +6 -7
  100. package/dist/oauth/spotify.js +6 -2
  101. package/dist/oauth/strava.cjs +46 -0
  102. package/dist/oauth/strava.d.ts +6 -0
  103. package/dist/oauth/strava.js +6 -0
  104. package/dist/oauth/x.cjs +39 -39
  105. package/dist/oauth/x.d.ts +6 -7
  106. package/dist/oauth/x.js +6 -2
  107. package/dist/schemas.cjs +97 -91
  108. package/dist/schemas.d.ts +96 -126
  109. package/dist/schemas.js +20 -18
  110. package/dist/secure.cjs +106 -101
  111. package/dist/secure.d.ts +16 -17
  112. package/dist/secure.js +19 -4
  113. package/dist/utils.cjs +197 -135
  114. package/dist/utils.d.ts +20 -26
  115. package/dist/utils.js +25 -21
  116. package/package.json +5 -6
  117. package/dist/chunk-256KIVJL.js +0 -110
  118. package/dist/chunk-6SM22VVJ.js +0 -15
  119. package/dist/chunk-CAKJT3KS.js +0 -77
  120. package/dist/chunk-EBPE35JT.js +0 -29
  121. package/dist/chunk-FJUDBLCP.js +0 -52
  122. package/dist/chunk-GZU3RBTB.js +0 -51
  123. package/dist/chunk-HGJ4TXY4.js +0 -105
  124. package/dist/chunk-HMRKN75I.js +0 -74
  125. package/dist/chunk-JAPMIE6S.js +0 -8
  126. package/dist/chunk-LLR722CL.js +0 -75
  127. package/dist/chunk-RLT4RFKV.js +0 -36
  128. package/dist/chunk-SJPDVKUS.js +0 -93
  129. package/dist/chunk-SMQO5WD7.js +0 -20
  130. package/dist/chunk-UJJ7R56J.js +0 -42
  131. package/dist/chunk-UTDLUEEG.js +0 -25
  132. package/dist/chunk-VFTYH33W.js +0 -44
  133. package/dist/chunk-XXJKNKGQ.js +0 -27
  134. package/dist/chunk-ZV4BH47P.js +0 -156
  135. package/dist/error.cjs +0 -88
  136. package/dist/error.d.ts +0 -62
  137. package/dist/error.js +0 -9
  138. package/dist/response.cjs +0 -34
  139. package/dist/response.d.ts +0 -10
  140. package/dist/response.js +0 -2
@@ -1,213 +1,339 @@
1
- "use strict"
2
- var __defProp = Object.defineProperty
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor
4
- var __getOwnPropNames = Object.getOwnPropertyNames
5
- var __hasOwnProp = Object.prototype.hasOwnProperty
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __export = (target, all) => {
7
- for (var name in all) __defProp(target, name, { get: all[name], enumerable: true })
8
- }
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
9
10
  var __copyProps = (to, from, except, desc) => {
10
- if ((from && typeof from === "object") || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable })
14
- }
15
- return to
16
- }
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod)
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
19
 
19
20
  // src/oauth/index.ts
20
- var oauth_exports = {}
21
+ var oauth_exports = {};
21
22
  __export(oauth_exports, {
22
- bitbucket: () => bitbucket,
23
- builtInOAuthProviders: () => builtInOAuthProviders,
24
- createBuiltInOAuthProviders: () => createBuiltInOAuthProviders,
25
- discord: () => discord,
26
- figma: () => figma,
27
- github: () => github,
28
- gitlab: () => gitlab,
29
- spotify: () => spotify,
30
- x: () => x,
31
- })
32
- module.exports = __toCommonJS(oauth_exports)
23
+ bitbucket: () => bitbucket,
24
+ builtInOAuthProviders: () => builtInOAuthProviders,
25
+ createBuiltInOAuthProviders: () => createBuiltInOAuthProviders,
26
+ discord: () => discord,
27
+ figma: () => figma,
28
+ github: () => github,
29
+ gitlab: () => gitlab,
30
+ spotify: () => spotify,
31
+ strava: () => strava,
32
+ x: () => x
33
+ });
34
+ module.exports = __toCommonJS(oauth_exports);
33
35
 
34
36
  // src/oauth/github.ts
35
37
  var github = {
36
- id: "github",
37
- name: "GitHub",
38
- authorizeURL: "https://github.com/login/oauth/authorize",
39
- accessToken: "https://github.com/login/oauth/access_token",
40
- userInfo: "https://api.github.com/user",
41
- scope: "read:user user:email",
42
- responseType: "code",
43
- }
38
+ id: "github",
39
+ name: "GitHub",
40
+ authorizeURL: "https://github.com/login/oauth/authorize",
41
+ accessToken: "https://github.com/login/oauth/access_token",
42
+ userInfo: "https://api.github.com/user",
43
+ scope: "read:user user:email",
44
+ responseType: "code"
45
+ };
44
46
 
45
47
  // src/oauth/bitbucket.ts
46
48
  var bitbucket = {
47
- id: "bitbucket",
48
- name: "Bitbucket",
49
- authorizeURL: "https://bitbucket.org/site/oauth2/authorize",
50
- accessToken: "https://bitbucket.org/site/oauth2/access_token",
51
- userInfo: "https://api.bitbucket.org/2.0/user",
52
- scope: "account email",
53
- responseType: "code",
54
- profile(profile) {
55
- return {
56
- sub: profile.uuid ?? profile.account_id,
57
- name: profile.display_name ?? profile.nickname,
58
- image: profile.links.avatar.href,
59
- }
60
- },
61
- }
49
+ id: "bitbucket",
50
+ name: "Bitbucket",
51
+ authorizeURL: "https://bitbucket.org/site/oauth2/authorize",
52
+ accessToken: "https://bitbucket.org/site/oauth2/access_token",
53
+ userInfo: "https://api.bitbucket.org/2.0/user",
54
+ scope: "account email",
55
+ responseType: "code",
56
+ profile(profile) {
57
+ return {
58
+ sub: profile.uuid ?? profile.account_id,
59
+ name: profile.display_name ?? profile.nickname,
60
+ image: profile.links.avatar.href
61
+ };
62
+ }
63
+ };
62
64
 
63
65
  // src/oauth/figma.ts
64
66
  var figma = {
65
- id: "figma",
66
- name: "Figma",
67
- authorizeURL: "https://www.figma.com/oauth",
68
- accessToken: "https://api.figma.com/v1/oauth/token",
69
- userInfo: "https://api.figma.com/v1/me",
70
- scope: "current_user:read",
71
- responseType: "code",
72
- profile(profile) {
73
- return {
74
- sub: profile.id,
75
- name: profile.handle,
76
- email: profile.email,
77
- image: profile.img_url,
78
- }
79
- },
80
- }
67
+ id: "figma",
68
+ name: "Figma",
69
+ authorizeURL: "https://www.figma.com/oauth",
70
+ accessToken: "https://api.figma.com/v1/oauth/token",
71
+ userInfo: "https://api.figma.com/v1/me",
72
+ scope: "current_user:read",
73
+ responseType: "code",
74
+ profile(profile) {
75
+ return {
76
+ sub: profile.id,
77
+ name: profile.handle,
78
+ email: profile.email,
79
+ image: profile.img_url
80
+ };
81
+ }
82
+ };
81
83
 
82
84
  // src/oauth/discord.ts
83
85
  var discord = {
84
- id: "discord",
85
- name: "Discord",
86
- authorizeURL: "https://discord.com/oauth2/authorize",
87
- accessToken: "https://discord.com/api/oauth2/token",
88
- userInfo: "https://discord.com/api/users/@me",
89
- scope: "identify email",
90
- responseType: "code",
91
- profile(profile) {
92
- let image = ""
93
- if (profile.avatar === null) {
94
- const index = profile.discriminator === "0" ? (BigInt(profile.id) >> 22n) % 6n : Number(profile.discriminator) % 5
95
- image = `https://cdn.discordapp.com/embed/avatars/${index}.png`
96
- } else {
97
- const format = profile.avatar.startsWith("a_") ? "gif" : "png"
98
- image = `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.${format}`
99
- }
100
- return {
101
- sub: profile.id,
102
- // https://discord.com/developers/docs/change-log#display-names
103
- name: profile.global_name ?? profile.username,
104
- email: profile.email ?? "",
105
- image,
106
- }
107
- },
108
- }
86
+ id: "discord",
87
+ name: "Discord",
88
+ authorizeURL: "https://discord.com/oauth2/authorize",
89
+ accessToken: "https://discord.com/api/oauth2/token",
90
+ userInfo: "https://discord.com/api/users/@me",
91
+ scope: "identify email",
92
+ responseType: "code",
93
+ profile(profile) {
94
+ let image = "";
95
+ if (profile.avatar === null) {
96
+ const index = profile.discriminator === "0" ? (BigInt(profile.id) >> 22n) % 6n : Number(profile.discriminator) % 5;
97
+ image = `https://cdn.discordapp.com/embed/avatars/${index}.png`;
98
+ } else {
99
+ const format = profile.avatar.startsWith("a_") ? "gif" : "png";
100
+ image = `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.${format}`;
101
+ }
102
+ return {
103
+ sub: profile.id,
104
+ name: profile.global_name ?? profile.username,
105
+ email: profile.email ?? "",
106
+ image
107
+ };
108
+ }
109
+ };
109
110
 
110
111
  // src/oauth/gitlab.ts
111
112
  var gitlab = {
112
- id: "gitlab",
113
- name: "GitLab",
114
- authorizeURL: "https://gitlab.com/oauth/authorize",
115
- accessToken: "https://gitlab.com/oauth/token",
116
- userInfo: "https://gitlab.com/api/v4/user",
117
- scope: "read_user",
118
- responseType: "code",
119
- profile(profile) {
120
- return {
121
- sub: profile.id.toString(),
122
- name: profile.name ?? profile.username,
123
- email: profile.email,
124
- avatar: profile.avatar_url,
125
- }
126
- },
127
- }
113
+ id: "gitlab",
114
+ name: "GitLab",
115
+ authorizeURL: "https://gitlab.com/oauth/authorize",
116
+ accessToken: "https://gitlab.com/oauth/token",
117
+ userInfo: "https://gitlab.com/api/v4/user",
118
+ scope: "read_user",
119
+ responseType: "code",
120
+ profile(profile) {
121
+ return {
122
+ sub: profile.id.toString(),
123
+ name: profile.name ?? profile.username,
124
+ email: profile.email,
125
+ avatar: profile.avatar_url
126
+ };
127
+ }
128
+ };
128
129
 
129
130
  // src/oauth/spotify.ts
130
131
  var spotify = {
131
- id: "spotify",
132
- name: "Spotify",
133
- authorizeURL: "https://accounts.spotify.com/authorize",
134
- accessToken: "https://accounts.spotify.com/api/token",
135
- userInfo: "https://api.spotify.com/v1/me",
136
- scope: "user-read-email user-read-private",
137
- responseType: "token",
138
- profile(profile) {
139
- return {
140
- sub: profile.id,
141
- name: profile.display_name,
142
- email: profile.email,
143
- image: profile.images?.[0]?.url,
144
- }
145
- },
146
- }
132
+ id: "spotify",
133
+ name: "Spotify",
134
+ authorizeURL: "https://accounts.spotify.com/authorize",
135
+ accessToken: "https://accounts.spotify.com/api/token",
136
+ userInfo: "https://api.spotify.com/v1/me",
137
+ scope: "user-read-email user-read-private",
138
+ responseType: "token",
139
+ profile(profile) {
140
+ return {
141
+ sub: profile.id,
142
+ name: profile.display_name,
143
+ email: profile.email,
144
+ image: profile.images?.[0]?.url
145
+ };
146
+ }
147
+ };
147
148
 
148
149
  // src/oauth/x.ts
149
150
  var x = {
150
- id: "x",
151
- name: "X",
152
- authorizeURL: "https://x.com/i/oauth2/authorize",
153
- accessToken: "https://api.x.com/2/oauth2/token",
154
- userInfo: "https://api.x.com/2/users/me?user.fields=profile_image_url",
155
- scope: "users.read users.email tweet.read offline.access",
156
- responseType: "code",
157
- profile({ data }) {
158
- return {
159
- sub: data.id,
160
- name: data.name,
161
- image: data.profile_image_url,
162
- email: "",
163
- }
164
- },
165
- }
151
+ id: "x",
152
+ name: "X",
153
+ authorizeURL: "https://x.com/i/oauth2/authorize",
154
+ accessToken: "https://api.x.com/2/oauth2/token",
155
+ userInfo: "https://api.x.com/2/users/me?user.fields=profile_image_url",
156
+ scope: "users.read users.email tweet.read offline.access",
157
+ responseType: "code",
158
+ profile({ data }) {
159
+ return {
160
+ sub: data.id,
161
+ name: data.name,
162
+ image: data.profile_image_url,
163
+ email: ""
164
+ };
165
+ }
166
+ };
167
+
168
+ // src/oauth/strava.ts
169
+ var strava = {
170
+ id: "strava",
171
+ name: "Strava",
172
+ authorizeURL: "https://www.strava.com/oauth/authorize",
173
+ accessToken: "https://www.strava.com/oauth/token",
174
+ userInfo: "https://www.strava.com/api/v3/athlete",
175
+ scope: "read",
176
+ responseType: "code",
177
+ profile(profile) {
178
+ return {
179
+ sub: profile.id.toString(),
180
+ name: `${profile.firstname} ${profile.lastname}`,
181
+ image: profile.profile,
182
+ email: ""
183
+ };
184
+ }
185
+ };
186
+
187
+ // src/schemas.ts
188
+ var import_v4 = require("zod/v4");
189
+ var OAuthProviderConfigSchema = (0, import_v4.object)({
190
+ authorizeURL: (0, import_v4.httpUrl)(),
191
+ accessToken: (0, import_v4.httpUrl)(),
192
+ scope: (0, import_v4.string)().optional(),
193
+ userInfo: (0, import_v4.httpUrl)(),
194
+ responseType: (0, import_v4.enum)(["code", "token", "id_token"]),
195
+ clientId: (0, import_v4.string)(),
196
+ clientSecret: (0, import_v4.string)()
197
+ });
198
+ var OAuthAuthorization = OAuthProviderConfigSchema.extend({
199
+ redirectURI: (0, import_v4.string)(),
200
+ state: (0, import_v4.string)(),
201
+ codeChallenge: (0, import_v4.string)(),
202
+ codeChallengeMethod: (0, import_v4.enum)(["plain", "S256"])
203
+ });
204
+ var OAuthAuthorizationResponse = (0, import_v4.object)({
205
+ state: (0, import_v4.string)("Missing state parameter in the OAuth authorization response."),
206
+ code: (0, import_v4.string)("Missing code parameter in the OAuth authorization response.")
207
+ });
208
+ var OAuthAuthorizationErrorResponse = (0, import_v4.object)({
209
+ error: (0, import_v4.enum)([
210
+ "invalid_request",
211
+ "unauthorized_client",
212
+ "access_denied",
213
+ "unsupported_response_type",
214
+ "invalid_scope",
215
+ "server_error",
216
+ "temporarily_unavailable"
217
+ ]),
218
+ error_description: (0, import_v4.string)().optional(),
219
+ error_uri: (0, import_v4.string)().optional(),
220
+ state: (0, import_v4.string)()
221
+ });
222
+ var OAuthAccessToken = OAuthProviderConfigSchema.extend({
223
+ redirectURI: (0, import_v4.string)(),
224
+ code: (0, import_v4.string)(),
225
+ codeVerifier: (0, import_v4.string)().min(43).max(128)
226
+ });
227
+ var OAuthAccessTokenResponse = (0, import_v4.object)({
228
+ access_token: (0, import_v4.string)(),
229
+ token_type: (0, import_v4.string)(),
230
+ expires_in: (0, import_v4.number)().optional(),
231
+ refresh_token: (0, import_v4.string)().optional(),
232
+ scope: (0, import_v4.string)().optional()
233
+ });
234
+ var OAuthAccessTokenErrorResponse = (0, import_v4.object)({
235
+ error: (0, import_v4.enum)([
236
+ "invalid_request",
237
+ "invalid_client",
238
+ "invalid_grant",
239
+ "unauthorized_client",
240
+ "unsupported_grant_type",
241
+ "invalid_scope"
242
+ ]),
243
+ error_description: (0, import_v4.string)().optional(),
244
+ error_uri: (0, import_v4.string)().optional()
245
+ });
246
+ var OAuthErrorResponse = (0, import_v4.object)({
247
+ error: (0, import_v4.string)(),
248
+ error_description: (0, import_v4.string)().optional()
249
+ });
250
+ var OAuthEnvSchema = (0, import_v4.object)({
251
+ clientId: import_v4.z.string().min(1, "OAuth Client ID is required in the environment variables."),
252
+ clientSecret: import_v4.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
253
+ });
254
+
255
+ // src/errors.ts
256
+ var AuthInternalError = class extends Error {
257
+ type = "AUTH_INTERNAL_ERROR";
258
+ code;
259
+ constructor(code, message, options2) {
260
+ super(message, options2);
261
+ this.code = code;
262
+ this.name = new.target.name;
263
+ Error.captureStackTrace(this, new.target);
264
+ }
265
+ };
266
+
267
+ // src/utils.ts
268
+ var import_router = require("@aura-stack/router");
269
+ var formatZodError = (error) => {
270
+ if (!error.issues || error.issues.length === 0) {
271
+ return {};
272
+ }
273
+ return error.issues.reduce((previous, issue) => {
274
+ const key = issue.path.join(".");
275
+ return {
276
+ ...previous,
277
+ [key]: {
278
+ code: issue.code,
279
+ message: issue.message
280
+ }
281
+ };
282
+ }, {});
283
+ };
166
284
 
167
285
  // src/oauth/index.ts
168
286
  var builtInOAuthProviders = {
169
- github,
170
- bitbucket,
171
- figma,
172
- discord,
173
- gitlab,
174
- spotify,
175
- x,
176
- }
287
+ github,
288
+ bitbucket,
289
+ figma,
290
+ discord,
291
+ gitlab,
292
+ spotify,
293
+ x,
294
+ strava
295
+ };
177
296
  var defineOAuthEnvironment = (oauth) => {
178
- const env = process.env
179
- return {
180
- clientId: env[`AURA_AUTH_${oauth.toUpperCase()}_CLIENT_ID`],
181
- clientSecret: env[`AURA_AUTH_${oauth.toUpperCase()}_CLIENT_SECRET`],
182
- }
183
- }
297
+ const env = process.env;
298
+ const clientIdSuffix = `${oauth.toUpperCase()}_CLIENT_ID`;
299
+ const clientSecretSuffix = `${oauth.toUpperCase()}_CLIENT_SECRET`;
300
+ const loadEnvs = OAuthEnvSchema.safeParse({
301
+ clientId: env[`AURA_AUTH_${clientIdSuffix}`] ?? env[`AUTH_${clientIdSuffix}`] ?? env[`${clientIdSuffix}`],
302
+ clientSecret: env[`AURA_AUTH_${clientSecretSuffix}`] ?? env[`AUTH_${clientSecretSuffix}`] ?? env[`${clientSecretSuffix}`]
303
+ });
304
+ if (!loadEnvs.success) {
305
+ const msg = JSON.stringify(formatZodError(loadEnvs.error), null, 2);
306
+ throw new AuthInternalError("INVALID_ENVIRONMENT_CONFIGURATION", msg);
307
+ }
308
+ return loadEnvs.data;
309
+ };
184
310
  var defineOAuthProviderConfig = (config) => {
185
- if (typeof config === "string") {
186
- const definition = defineOAuthEnvironment(config)
187
- const oauthConfig = builtInOAuthProviders[config]
188
- return {
189
- ...oauthConfig,
190
- ...definition,
191
- }
192
- }
193
- return config
194
- }
311
+ if (typeof config === "string") {
312
+ const definition = defineOAuthEnvironment(config);
313
+ const oauthConfig = builtInOAuthProviders[config];
314
+ return {
315
+ ...oauthConfig,
316
+ ...definition
317
+ };
318
+ }
319
+ return config;
320
+ };
195
321
  var createBuiltInOAuthProviders = (oauth = []) => {
196
- return oauth.reduce((previous, config) => {
197
- const oauthConfig = defineOAuthProviderConfig(config)
198
- return { ...previous, [oauthConfig.id]: oauthConfig }
199
- }, {})
200
- }
322
+ return oauth.reduce((previous, config) => {
323
+ const oauthConfig = defineOAuthProviderConfig(config);
324
+ return { ...previous, [oauthConfig.id]: oauthConfig };
325
+ }, {});
326
+ };
201
327
  // Annotate the CommonJS export names for ESM import in node:
202
- 0 &&
203
- (module.exports = {
204
- bitbucket,
205
- builtInOAuthProviders,
206
- createBuiltInOAuthProviders,
207
- discord,
208
- figma,
209
- github,
210
- gitlab,
211
- spotify,
212
- x,
213
- })
328
+ 0 && (module.exports = {
329
+ bitbucket,
330
+ builtInOAuthProviders,
331
+ createBuiltInOAuthProviders,
332
+ discord,
333
+ figma,
334
+ github,
335
+ gitlab,
336
+ spotify,
337
+ strava,
338
+ x
339
+ });
@@ -1,26 +1,6 @@
1
- export {
2
- B as BitbucketProfile,
3
- p as BuiltInOAuthProvider,
4
- D as DiscordProfile,
5
- F as FigmaProfile,
6
- l as GitHubProfile,
7
- G as GitLabProfile,
8
- N as Nameplate,
9
- g as SpotifyProfile,
10
- X as XProfile,
11
- k as bitbucket,
12
- n as builtInOAuthProviders,
13
- o as createBuiltInOAuthProviders,
14
- i as discord,
15
- j as figma,
16
- m as github,
17
- h as gitlab,
18
- s as spotify,
19
- x,
20
- } from "../index-DpfbvTZ_.js"
21
- import "../@types/utility.js"
22
- import "zod/v4"
23
- import "@aura-stack/jose/jose"
24
- import "../schemas.js"
25
- import "zod/v4/core"
26
- import "cookie"
1
+ export { B as BitbucketProfile, y as BuiltInOAuthProvider, D as DiscordProfile, F as FigmaProfile, t as GitHubProfile, G as GitLabProfile, I as Image, N as Nameplate, m as SpotifyProfile, l as StravaProfile, j as SummaryClub, k as SummaryGear, X as XProfile, r as bitbucket, v as builtInOAuthProviders, w as createBuiltInOAuthProviders, p as discord, q as figma, u as github, o as gitlab, n as spotify, s as strava, x } from '../index-EqsoyjrF.js';
2
+ import '../@types/utility.js';
3
+ import 'zod/v4';
4
+ import '../schemas.js';
5
+ import '@aura-stack/router/cookie';
6
+ import '@aura-stack/jose/jose';
@@ -1,9 +1,43 @@
1
- import { builtInOAuthProviders, createBuiltInOAuthProviders } from "../chunk-VFTYH33W.js"
2
- import { figma } from "../chunk-FKRDCWBF.js"
3
- import { github } from "../chunk-IKHPGFCW.js"
4
- import { gitlab } from "../chunk-KRNOMBXQ.js"
5
- import { spotify } from "../chunk-E3OXBRYF.js"
6
- import { x } from "../chunk-42XB3YCW.js"
7
- import { bitbucket } from "../chunk-FIPU4MLT.js"
8
- import { discord } from "../chunk-EBPE35JT.js"
9
- export { bitbucket, builtInOAuthProviders, createBuiltInOAuthProviders, discord, figma, github, gitlab, spotify, x }
1
+ import {
2
+ builtInOAuthProviders,
3
+ createBuiltInOAuthProviders
4
+ } from "../chunk-7H3OR6UU.js";
5
+ import {
6
+ github
7
+ } from "../chunk-IKHPGFCW.js";
8
+ import {
9
+ gitlab
10
+ } from "../chunk-KRNOMBXQ.js";
11
+ import {
12
+ spotify
13
+ } from "../chunk-E3OXBRYF.js";
14
+ import {
15
+ strava
16
+ } from "../chunk-6R2YZ4AC.js";
17
+ import {
18
+ x
19
+ } from "../chunk-42XB3YCW.js";
20
+ import {
21
+ bitbucket
22
+ } from "../chunk-FIPU4MLT.js";
23
+ import {
24
+ discord
25
+ } from "../chunk-IUYZQTJV.js";
26
+ import {
27
+ figma
28
+ } from "../chunk-FKRDCWBF.js";
29
+ import "../chunk-WD7AUHQ5.js";
30
+ import "../chunk-CXLATHS5.js";
31
+ import "../chunk-RRLIF4PQ.js";
32
+ export {
33
+ bitbucket,
34
+ builtInOAuthProviders,
35
+ createBuiltInOAuthProviders,
36
+ discord,
37
+ figma,
38
+ github,
39
+ gitlab,
40
+ spotify,
41
+ strava,
42
+ x
43
+ };