@aura-stack/auth 0.1.0-rc.9 → 0.2.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/@types/index.cjs +15 -15
  2. package/dist/@types/index.d.ts +7 -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 +7 -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 +176 -155
  10. package/dist/actions/callback/access-token.d.ts +15 -20
  11. package/dist/actions/callback/access-token.js +10 -4
  12. package/dist/actions/callback/callback.cjs +394 -490
  13. package/dist/actions/callback/callback.d.ts +10 -12
  14. package/dist/actions/callback/callback.js +16 -12
  15. package/dist/actions/callback/userinfo.cjs +166 -145
  16. package/dist/actions/callback/userinfo.d.ts +9 -9
  17. package/dist/actions/callback/userinfo.js +12 -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 +652 -814
  22. package/dist/actions/index.d.ts +13 -13
  23. package/dist/actions/index.js +34 -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 +254 -263
  28. package/dist/actions/signIn/authorization.d.ts +12 -18
  29. package/dist/actions/signIn/authorization.js +16 -6
  30. package/dist/actions/signIn/signIn.cjs +320 -456
  31. package/dist/actions/signIn/signIn.d.ts +10 -10
  32. package/dist/actions/signIn/signIn.js +13 -10
  33. package/dist/actions/signOut/signOut.cjs +304 -473
  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 +13 -4
  38. package/dist/assert.js +12 -2
  39. package/dist/chunk-3EUWD5BB.js +63 -0
  40. package/dist/chunk-42XB3YCW.js +19 -17
  41. package/dist/chunk-6R2YZ4AC.js +22 -0
  42. package/dist/chunk-A3N4PVAT.js +70 -0
  43. package/dist/chunk-B737EUJV.js +22 -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-EMKJA2GJ.js +89 -0
  48. package/dist/chunk-FIPU4MLT.js +18 -16
  49. package/dist/chunk-FKRDCWBF.js +19 -17
  50. package/dist/chunk-GA2SMTJO.js +58 -0
  51. package/dist/chunk-HP34YGGJ.js +22 -0
  52. package/dist/chunk-HT4YLL7N.js +35 -0
  53. package/dist/chunk-IKHPGFCW.js +11 -9
  54. package/dist/chunk-IUYZQTJV.js +30 -0
  55. package/dist/chunk-IVET23KF.js +58 -0
  56. package/dist/chunk-JVFTCTTE.js +33 -0
  57. package/dist/chunk-KRNOMBXQ.js +19 -17
  58. package/dist/chunk-KSWLO5ZU.js +102 -0
  59. package/dist/chunk-N2APGLXA.js +71 -0
  60. package/dist/chunk-N4SX7TZT.js +96 -0
  61. package/dist/chunk-RRLIF4PQ.js +55 -0
  62. package/dist/chunk-STHEPPUZ.js +8 -6
  63. package/dist/chunk-TLE4PXY3.js +39 -0
  64. package/dist/chunk-W6LG7BFW.js +197 -0
  65. package/dist/chunk-YRCB5FLE.js +79 -0
  66. package/dist/chunk-ZNCZVF6U.js +14 -0
  67. package/dist/cookie.cjs +222 -187
  68. package/dist/cookie.d.ts +39 -76
  69. package/dist/cookie.js +27 -34
  70. package/dist/errors.cjs +85 -0
  71. package/dist/errors.d.ts +49 -0
  72. package/dist/errors.js +18 -0
  73. package/dist/headers.cjs +28 -28
  74. package/dist/headers.d.ts +2 -2
  75. package/dist/headers.js +6 -2
  76. package/dist/index-DkaLJFn8.d.ts +679 -0
  77. package/dist/index.cjs +1074 -1007
  78. package/dist/index.d.ts +10 -31
  79. package/dist/index.js +85 -51
  80. package/dist/jose.cjs +74 -66
  81. package/dist/jose.d.ts +11 -8
  82. package/dist/jose.js +10 -5
  83. package/dist/oauth/bitbucket.cjs +38 -38
  84. package/dist/oauth/bitbucket.d.ts +7 -7
  85. package/dist/oauth/bitbucket.js +6 -2
  86. package/dist/oauth/discord.cjs +47 -48
  87. package/dist/oauth/discord.d.ts +7 -7
  88. package/dist/oauth/discord.js +6 -2
  89. package/dist/oauth/figma.cjs +39 -39
  90. package/dist/oauth/figma.d.ts +7 -7
  91. package/dist/oauth/figma.js +6 -2
  92. package/dist/oauth/github.cjs +31 -31
  93. package/dist/oauth/github.d.ts +7 -7
  94. package/dist/oauth/github.js +6 -2
  95. package/dist/oauth/gitlab.cjs +39 -39
  96. package/dist/oauth/gitlab.d.ts +7 -7
  97. package/dist/oauth/gitlab.js +6 -2
  98. package/dist/oauth/index.cjs +350 -180
  99. package/dist/oauth/index.d.ts +7 -26
  100. package/dist/oauth/index.js +51 -9
  101. package/dist/oauth/mailchimp.cjs +46 -0
  102. package/dist/oauth/mailchimp.d.ts +7 -0
  103. package/dist/oauth/mailchimp.js +6 -0
  104. package/dist/oauth/pinterest.cjs +46 -0
  105. package/dist/oauth/pinterest.d.ts +7 -0
  106. package/dist/oauth/pinterest.js +6 -0
  107. package/dist/oauth/spotify.cjs +39 -39
  108. package/dist/oauth/spotify.d.ts +7 -7
  109. package/dist/oauth/spotify.js +6 -2
  110. package/dist/oauth/strava.cjs +46 -0
  111. package/dist/oauth/strava.d.ts +7 -0
  112. package/dist/oauth/strava.js +6 -0
  113. package/dist/oauth/x.cjs +39 -39
  114. package/dist/oauth/x.d.ts +7 -7
  115. package/dist/oauth/x.js +6 -2
  116. package/dist/request.cjs +38 -0
  117. package/dist/request.d.ts +13 -0
  118. package/dist/request.js +6 -0
  119. package/dist/schemas.cjs +103 -97
  120. package/dist/schemas.d.ts +96 -126
  121. package/dist/schemas.js +20 -18
  122. package/dist/secure.cjs +106 -101
  123. package/dist/secure.d.ts +17 -17
  124. package/dist/secure.js +19 -4
  125. package/dist/utils.cjs +197 -135
  126. package/dist/utils.d.ts +20 -26
  127. package/dist/utils.js +25 -21
  128. package/package.json +8 -7
  129. package/dist/chunk-256KIVJL.js +0 -110
  130. package/dist/chunk-6SM22VVJ.js +0 -15
  131. package/dist/chunk-CAKJT3KS.js +0 -77
  132. package/dist/chunk-EBPE35JT.js +0 -29
  133. package/dist/chunk-FJUDBLCP.js +0 -52
  134. package/dist/chunk-GZU3RBTB.js +0 -51
  135. package/dist/chunk-HGJ4TXY4.js +0 -105
  136. package/dist/chunk-HMRKN75I.js +0 -74
  137. package/dist/chunk-JAPMIE6S.js +0 -8
  138. package/dist/chunk-LLR722CL.js +0 -75
  139. package/dist/chunk-RLT4RFKV.js +0 -36
  140. package/dist/chunk-SJPDVKUS.js +0 -93
  141. package/dist/chunk-SMQO5WD7.js +0 -20
  142. package/dist/chunk-UJJ7R56J.js +0 -42
  143. package/dist/chunk-UTDLUEEG.js +0 -25
  144. package/dist/chunk-VFTYH33W.js +0 -44
  145. package/dist/chunk-XXJKNKGQ.js +0 -27
  146. package/dist/chunk-ZV4BH47P.js +0 -156
  147. package/dist/error.cjs +0 -88
  148. package/dist/error.d.ts +0 -62
  149. package/dist/error.js +0 -9
  150. package/dist/index-DpfbvTZ_.d.ts +0 -597
  151. package/dist/response.cjs +0 -34
  152. package/dist/response.d.ts +0 -10
  153. package/dist/response.js +0 -2
@@ -1,213 +1,383 @@
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
+ mailchimp: () => mailchimp,
31
+ pinterest: () => pinterest,
32
+ spotify: () => spotify,
33
+ strava: () => strava,
34
+ x: () => x
35
+ });
36
+ module.exports = __toCommonJS(oauth_exports);
33
37
 
34
38
  // src/oauth/github.ts
35
39
  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
- }
40
+ id: "github",
41
+ name: "GitHub",
42
+ authorizeURL: "https://github.com/login/oauth/authorize",
43
+ accessToken: "https://github.com/login/oauth/access_token",
44
+ userInfo: "https://api.github.com/user",
45
+ scope: "read:user user:email",
46
+ responseType: "code"
47
+ };
44
48
 
45
49
  // src/oauth/bitbucket.ts
46
50
  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
- }
51
+ id: "bitbucket",
52
+ name: "Bitbucket",
53
+ authorizeURL: "https://bitbucket.org/site/oauth2/authorize",
54
+ accessToken: "https://bitbucket.org/site/oauth2/access_token",
55
+ userInfo: "https://api.bitbucket.org/2.0/user",
56
+ scope: "account email",
57
+ responseType: "code",
58
+ profile(profile) {
59
+ return {
60
+ sub: profile.uuid ?? profile.account_id,
61
+ name: profile.display_name ?? profile.nickname,
62
+ image: profile.links.avatar.href
63
+ };
64
+ }
65
+ };
62
66
 
63
67
  // src/oauth/figma.ts
64
68
  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
- }
69
+ id: "figma",
70
+ name: "Figma",
71
+ authorizeURL: "https://www.figma.com/oauth",
72
+ accessToken: "https://api.figma.com/v1/oauth/token",
73
+ userInfo: "https://api.figma.com/v1/me",
74
+ scope: "current_user:read",
75
+ responseType: "code",
76
+ profile(profile) {
77
+ return {
78
+ sub: profile.id,
79
+ name: profile.handle,
80
+ email: profile.email,
81
+ image: profile.img_url
82
+ };
83
+ }
84
+ };
81
85
 
82
86
  // src/oauth/discord.ts
83
87
  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
- }
88
+ id: "discord",
89
+ name: "Discord",
90
+ authorizeURL: "https://discord.com/oauth2/authorize",
91
+ accessToken: "https://discord.com/api/oauth2/token",
92
+ userInfo: "https://discord.com/api/users/@me",
93
+ scope: "identify email",
94
+ responseType: "code",
95
+ profile(profile) {
96
+ let image = "";
97
+ if (profile.avatar === null) {
98
+ const index = profile.discriminator === "0" ? (BigInt(profile.id) >> 22n) % 6n : Number(profile.discriminator) % 5;
99
+ image = `https://cdn.discordapp.com/embed/avatars/${index}.png`;
100
+ } else {
101
+ const format = profile.avatar.startsWith("a_") ? "gif" : "png";
102
+ image = `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.${format}`;
103
+ }
104
+ return {
105
+ sub: profile.id,
106
+ name: profile.global_name ?? profile.username,
107
+ email: profile.email ?? "",
108
+ image
109
+ };
110
+ }
111
+ };
109
112
 
110
113
  // src/oauth/gitlab.ts
111
114
  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
- }
115
+ id: "gitlab",
116
+ name: "GitLab",
117
+ authorizeURL: "https://gitlab.com/oauth/authorize",
118
+ accessToken: "https://gitlab.com/oauth/token",
119
+ userInfo: "https://gitlab.com/api/v4/user",
120
+ scope: "read_user",
121
+ responseType: "code",
122
+ profile(profile) {
123
+ return {
124
+ sub: profile.id.toString(),
125
+ name: profile.name ?? profile.username,
126
+ email: profile.email,
127
+ avatar: profile.avatar_url
128
+ };
129
+ }
130
+ };
128
131
 
129
132
  // src/oauth/spotify.ts
130
133
  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
- }
134
+ id: "spotify",
135
+ name: "Spotify",
136
+ authorizeURL: "https://accounts.spotify.com/authorize",
137
+ accessToken: "https://accounts.spotify.com/api/token",
138
+ userInfo: "https://api.spotify.com/v1/me",
139
+ scope: "user-read-email user-read-private",
140
+ responseType: "token",
141
+ profile(profile) {
142
+ return {
143
+ sub: profile.id,
144
+ name: profile.display_name,
145
+ email: profile.email,
146
+ image: profile.images?.[0]?.url
147
+ };
148
+ }
149
+ };
147
150
 
148
151
  // src/oauth/x.ts
149
152
  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
- }
153
+ id: "x",
154
+ name: "X",
155
+ authorizeURL: "https://x.com/i/oauth2/authorize",
156
+ accessToken: "https://api.x.com/2/oauth2/token",
157
+ userInfo: "https://api.x.com/2/users/me?user.fields=profile_image_url",
158
+ scope: "users.read users.email tweet.read offline.access",
159
+ responseType: "code",
160
+ profile({ data }) {
161
+ return {
162
+ sub: data.id,
163
+ name: data.name,
164
+ image: data.profile_image_url,
165
+ email: ""
166
+ };
167
+ }
168
+ };
169
+
170
+ // src/oauth/strava.ts
171
+ var strava = {
172
+ id: "strava",
173
+ name: "Strava",
174
+ authorizeURL: "https://www.strava.com/oauth/authorize",
175
+ accessToken: "https://www.strava.com/oauth/token",
176
+ userInfo: "https://www.strava.com/api/v3/athlete",
177
+ scope: "read",
178
+ responseType: "code",
179
+ profile(profile) {
180
+ return {
181
+ sub: profile.id.toString(),
182
+ name: `${profile.firstname} ${profile.lastname}`,
183
+ image: profile.profile,
184
+ email: ""
185
+ };
186
+ }
187
+ };
188
+
189
+ // src/oauth/mailchimp.ts
190
+ var mailchimp = {
191
+ id: "mailchimp",
192
+ name: "Mailchimp",
193
+ authorizeURL: "https://login.mailchimp.com/oauth2/authorize",
194
+ accessToken: "https://login.mailchimp.com/oauth2/token",
195
+ userInfo: "https://login.mailchimp.com/oauth2/metadata",
196
+ scope: "",
197
+ responseType: "code",
198
+ profile(profile) {
199
+ return {
200
+ sub: profile.user_id,
201
+ name: profile.accountname,
202
+ email: profile.login.login_email,
203
+ image: null
204
+ };
205
+ }
206
+ };
207
+
208
+ // src/oauth/pinterest.ts
209
+ var pinterest = {
210
+ id: "pinterest",
211
+ name: "Pinterest",
212
+ authorizeURL: "https://api.pinterest.com/oauth/",
213
+ accessToken: "https://api.pinterest.com/v5/oauth/token",
214
+ userInfo: "https://api.pinterest.com/v5/user_account",
215
+ scope: "user_accounts:read",
216
+ responseType: "code",
217
+ profile(profile) {
218
+ return {
219
+ sub: profile.id,
220
+ name: profile.username,
221
+ email: null,
222
+ image: profile.profile_image
223
+ };
224
+ }
225
+ };
226
+
227
+ // src/schemas.ts
228
+ var import_zod = require("zod");
229
+ var OAuthProviderConfigSchema = (0, import_zod.object)({
230
+ authorizeURL: (0, import_zod.string)().url(),
231
+ accessToken: (0, import_zod.string)().url(),
232
+ scope: (0, import_zod.string)().optional(),
233
+ userInfo: (0, import_zod.string)().url(),
234
+ responseType: (0, import_zod.enum)(["code", "token", "id_token"]),
235
+ clientId: (0, import_zod.string)(),
236
+ clientSecret: (0, import_zod.string)()
237
+ });
238
+ var OAuthAuthorization = OAuthProviderConfigSchema.extend({
239
+ redirectURI: (0, import_zod.string)(),
240
+ state: (0, import_zod.string)(),
241
+ codeChallenge: (0, import_zod.string)(),
242
+ codeChallengeMethod: (0, import_zod.enum)(["plain", "S256"])
243
+ });
244
+ var OAuthAuthorizationResponse = (0, import_zod.object)({
245
+ state: (0, import_zod.string)({ message: "Missing state parameter in the OAuth authorization response." }),
246
+ code: (0, import_zod.string)({ message: "Missing code parameter in the OAuth authorization response." })
247
+ });
248
+ var OAuthAuthorizationErrorResponse = (0, import_zod.object)({
249
+ error: (0, import_zod.enum)([
250
+ "invalid_request",
251
+ "unauthorized_client",
252
+ "access_denied",
253
+ "unsupported_response_type",
254
+ "invalid_scope",
255
+ "server_error",
256
+ "temporarily_unavailable"
257
+ ]),
258
+ error_description: (0, import_zod.string)().optional(),
259
+ error_uri: (0, import_zod.string)().optional(),
260
+ state: (0, import_zod.string)()
261
+ });
262
+ var OAuthAccessToken = OAuthProviderConfigSchema.extend({
263
+ redirectURI: (0, import_zod.string)(),
264
+ code: (0, import_zod.string)(),
265
+ codeVerifier: (0, import_zod.string)().min(43).max(128)
266
+ });
267
+ var OAuthAccessTokenResponse = (0, import_zod.object)({
268
+ access_token: (0, import_zod.string)(),
269
+ token_type: (0, import_zod.string)().optional(),
270
+ expires_in: (0, import_zod.number)().optional(),
271
+ refresh_token: (0, import_zod.string)().optional(),
272
+ scope: (0, import_zod.string)().optional().or((0, import_zod.null)())
273
+ });
274
+ var OAuthAccessTokenErrorResponse = (0, import_zod.object)({
275
+ error: (0, import_zod.enum)([
276
+ "invalid_request",
277
+ "invalid_client",
278
+ "invalid_grant",
279
+ "unauthorized_client",
280
+ "unsupported_grant_type",
281
+ "invalid_scope"
282
+ ]),
283
+ error_description: (0, import_zod.string)().optional(),
284
+ error_uri: (0, import_zod.string)().optional()
285
+ });
286
+ var OAuthErrorResponse = (0, import_zod.object)({
287
+ error: (0, import_zod.string)(),
288
+ error_description: (0, import_zod.string)().optional()
289
+ });
290
+ var OAuthEnvSchema = (0, import_zod.object)({
291
+ clientId: import_zod.z.string().min(1, "OAuth Client ID is required in the environment variables."),
292
+ clientSecret: import_zod.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
293
+ });
294
+
295
+ // src/errors.ts
296
+ var AuthInternalError = class extends Error {
297
+ type = "AUTH_INTERNAL_ERROR";
298
+ code;
299
+ constructor(code, message, options2) {
300
+ super(message, options2);
301
+ this.code = code;
302
+ this.name = new.target.name;
303
+ Error.captureStackTrace(this, new.target);
304
+ }
305
+ };
306
+
307
+ // src/utils.ts
308
+ var import_router = require("@aura-stack/router");
309
+ var formatZodError = (error) => {
310
+ if (!error.issues || error.issues.length === 0) {
311
+ return {};
312
+ }
313
+ return error.issues.reduce((previous, issue) => {
314
+ const key = issue.path.join(".");
315
+ return {
316
+ ...previous,
317
+ [key]: {
318
+ code: issue.code,
319
+ message: issue.message
320
+ }
321
+ };
322
+ }, {});
323
+ };
166
324
 
167
325
  // src/oauth/index.ts
168
326
  var builtInOAuthProviders = {
169
- github,
170
- bitbucket,
171
- figma,
172
- discord,
173
- gitlab,
174
- spotify,
175
- x,
176
- }
327
+ github,
328
+ bitbucket,
329
+ figma,
330
+ discord,
331
+ gitlab,
332
+ spotify,
333
+ x,
334
+ strava,
335
+ mailchimp,
336
+ pinterest
337
+ };
177
338
  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
- }
339
+ const env = process.env;
340
+ const clientIdSuffix = `${oauth.toUpperCase()}_CLIENT_ID`;
341
+ const clientSecretSuffix = `${oauth.toUpperCase()}_CLIENT_SECRET`;
342
+ const loadEnvs = OAuthEnvSchema.safeParse({
343
+ clientId: env[`AURA_AUTH_${clientIdSuffix}`] ?? env[`AUTH_${clientIdSuffix}`] ?? env[`${clientIdSuffix}`],
344
+ clientSecret: env[`AURA_AUTH_${clientSecretSuffix}`] ?? env[`AUTH_${clientSecretSuffix}`] ?? env[`${clientSecretSuffix}`]
345
+ });
346
+ if (!loadEnvs.success) {
347
+ const msg = JSON.stringify(formatZodError(loadEnvs.error), null, 2);
348
+ throw new AuthInternalError("INVALID_ENVIRONMENT_CONFIGURATION", msg);
349
+ }
350
+ return loadEnvs.data;
351
+ };
184
352
  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
- }
353
+ if (typeof config === "string") {
354
+ const definition = defineOAuthEnvironment(config);
355
+ const oauthConfig = builtInOAuthProviders[config];
356
+ return {
357
+ ...oauthConfig,
358
+ ...definition
359
+ };
360
+ }
361
+ return config;
362
+ };
195
363
  var createBuiltInOAuthProviders = (oauth = []) => {
196
- return oauth.reduce((previous, config) => {
197
- const oauthConfig = defineOAuthProviderConfig(config)
198
- return { ...previous, [oauthConfig.id]: oauthConfig }
199
- }, {})
200
- }
364
+ return oauth.reduce((previous, config) => {
365
+ const oauthConfig = defineOAuthProviderConfig(config);
366
+ return { ...previous, [oauthConfig.id]: oauthConfig };
367
+ }, {});
368
+ };
201
369
  // 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
- })
370
+ 0 && (module.exports = {
371
+ bitbucket,
372
+ builtInOAuthProviders,
373
+ createBuiltInOAuthProviders,
374
+ discord,
375
+ figma,
376
+ github,
377
+ gitlab,
378
+ mailchimp,
379
+ pinterest,
380
+ spotify,
381
+ strava,
382
+ x
383
+ });
@@ -1,26 +1,7 @@
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, K as BuiltInOAuthProvider, D as DiscordProfile, F as FigmaProfile, w as GitHubProfile, G as GitLabProfile, I as Image, L as Login, M as MailchimpProfile, N as Nameplate, P as PinterestProfile, o as SpotifyProfile, n as StravaProfile, k as SummaryClub, l as SummaryGear, X as XProfile, v as bitbucket, z as builtInOAuthProviders, H as createBuiltInOAuthProviders, t as discord, u as figma, y as github, r as gitlab, m as mailchimp, p as pinterest, q as spotify, s as strava, x } from '../index-DkaLJFn8.js';
2
+ import '../@types/utility.js';
3
+ import 'zod';
4
+ import '../schemas.js';
5
+ import '@aura-stack/router/cookie';
6
+ import '@aura-stack/jose';
7
+ import '@aura-stack/jose/jose';
@@ -1,9 +1,51 @@
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-EMKJA2GJ.js";
5
+ import {
6
+ x
7
+ } from "../chunk-42XB3YCW.js";
8
+ import {
9
+ figma
10
+ } from "../chunk-FKRDCWBF.js";
11
+ import {
12
+ github
13
+ } from "../chunk-IKHPGFCW.js";
14
+ import {
15
+ gitlab
16
+ } from "../chunk-KRNOMBXQ.js";
17
+ import {
18
+ mailchimp
19
+ } from "../chunk-B737EUJV.js";
20
+ import {
21
+ pinterest
22
+ } from "../chunk-HP34YGGJ.js";
23
+ import {
24
+ spotify
25
+ } from "../chunk-E3OXBRYF.js";
26
+ import {
27
+ strava
28
+ } from "../chunk-6R2YZ4AC.js";
29
+ import {
30
+ bitbucket
31
+ } from "../chunk-FIPU4MLT.js";
32
+ import {
33
+ discord
34
+ } from "../chunk-IUYZQTJV.js";
35
+ import "../chunk-CXLATHS5.js";
36
+ import "../chunk-RRLIF4PQ.js";
37
+ import "../chunk-YRCB5FLE.js";
38
+ export {
39
+ bitbucket,
40
+ builtInOAuthProviders,
41
+ createBuiltInOAuthProviders,
42
+ discord,
43
+ figma,
44
+ github,
45
+ gitlab,
46
+ mailchimp,
47
+ pinterest,
48
+ spotify,
49
+ strava,
50
+ x
51
+ };