@aura-stack/auth 0.4.0-rc.5 → 0.4.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.
- package/dist/@types/index.d.ts +4 -3
- package/dist/@types/router.d.cjs +0 -17
- package/dist/@types/router.d.d.ts +3 -2
- package/dist/@types/router.d.js +0 -1
- package/dist/actions/callback/access-token.cjs +40 -25
- package/dist/actions/callback/access-token.d.ts +4 -3
- package/dist/actions/callback/access-token.js +3 -4
- package/dist/actions/callback/callback.cjs +287 -77
- package/dist/actions/callback/callback.d.ts +5 -26
- package/dist/actions/callback/callback.js +13 -10
- package/dist/actions/callback/userinfo.cjs +68 -7
- package/dist/actions/callback/userinfo.d.ts +4 -3
- package/dist/actions/callback/userinfo.js +8 -6
- package/dist/actions/csrfToken/csrfToken.cjs +63 -4
- package/dist/actions/csrfToken/csrfToken.d.ts +1 -3
- package/dist/actions/csrfToken/csrfToken.js +8 -6
- package/dist/actions/index.cjs +400 -175
- package/dist/actions/index.d.ts +3 -2
- package/dist/actions/index.js +21 -19
- package/dist/actions/session/session.cjs +40 -11
- package/dist/actions/session/session.d.ts +1 -3
- package/dist/actions/session/session.js +4 -4
- package/dist/actions/signIn/authorization.cjs +171 -132
- package/dist/actions/signIn/authorization.d.ts +21 -11
- package/dist/actions/signIn/authorization.js +8 -6
- package/dist/actions/signIn/signIn.cjs +220 -113
- package/dist/actions/signIn/signIn.d.ts +5 -25
- package/dist/actions/signIn/signIn.js +9 -7
- package/dist/actions/signOut/signOut.cjs +268 -119
- package/dist/actions/signOut/signOut.d.ts +1 -9
- package/dist/actions/signOut/signOut.js +10 -8
- package/dist/assert.cjs +117 -5
- package/dist/assert.d.ts +22 -3
- package/dist/assert.js +17 -3
- package/dist/chunk-4EKY7655.js +123 -0
- package/dist/chunk-4MYWAOLG.js +31 -0
- package/dist/chunk-4YHJ4IEQ.js +25 -0
- package/dist/chunk-54CZPKR4.js +25 -0
- package/dist/chunk-5LZ7TOM3.js +25 -0
- package/dist/{chunk-W6LG7BFW.js → chunk-5W4BRQYG.js} +24 -20
- package/dist/chunk-6MXFPFR3.js +143 -0
- package/dist/{chunk-3EUWD5BB.js → chunk-7QF22LHP.js} +13 -9
- package/dist/chunk-ALG3GIV4.js +95 -0
- package/dist/chunk-E6G5YCI6.js +25 -0
- package/dist/chunk-EBAMFRB7.js +34 -0
- package/dist/chunk-EEE7UM5T.js +25 -0
- package/dist/{chunk-TLE4PXY3.js → chunk-FRJFWTOY.js} +38 -7
- package/dist/chunk-FW4W3REU.js +25 -0
- package/dist/{chunk-HT4YLL7N.js → chunk-ICAZ4OVS.js} +10 -8
- package/dist/chunk-IPKO6UQN.js +25 -0
- package/dist/{chunk-YRCB5FLE.js → chunk-KJBAQZX2.js} +13 -0
- package/dist/chunk-KMMAZFSJ.js +25 -0
- package/dist/chunk-LDU7A2JE.js +25 -0
- package/dist/{chunk-N2APGLXA.js → chunk-NUDITUKX.js} +18 -16
- package/dist/chunk-OVHNRULD.js +33 -0
- package/dist/{chunk-JVFTCTTE.js → chunk-PHFH2MGS.js} +12 -9
- package/dist/chunk-QQVSRXGX.js +149 -0
- package/dist/chunk-TM5IPSNF.js +113 -0
- package/dist/{chunk-GA2SMTJO.js → chunk-TZB6MUXN.js} +33 -13
- package/dist/chunk-VNCNJKS2.js +267 -0
- package/dist/{chunk-IVET23KF.js → chunk-XGLBNXL4.js} +31 -14
- package/dist/chunk-XUP6KKNG.js +106 -0
- package/dist/cookie.cjs +24 -20
- package/dist/cookie.d.ts +4 -3
- package/dist/cookie.js +1 -1
- package/dist/env.cjs +56 -0
- package/dist/env.d.ts +7 -0
- package/dist/env.js +6 -0
- package/dist/errors.d.ts +4 -3
- package/dist/headers.cjs +28 -2
- package/dist/headers.d.ts +25 -1
- package/dist/headers.js +9 -3
- package/dist/{index-B8jeIElf.d.ts → index-CSyIJmCM.d.ts} +373 -45
- package/dist/index.cjs +1128 -483
- package/dist/index.d.ts +7 -67
- package/dist/index.js +83 -42
- package/dist/jose.cjs +62 -25
- package/dist/jose.d.ts +7 -5
- package/dist/jose.js +8 -6
- package/dist/logger.cjs +292 -0
- package/dist/logger.d.ts +8 -0
- package/dist/logger.js +8 -0
- package/dist/oauth/bitbucket.cjs +19 -15
- package/dist/oauth/bitbucket.d.ts +3 -2
- package/dist/oauth/bitbucket.js +1 -1
- package/dist/oauth/discord.cjs +27 -24
- package/dist/oauth/discord.d.ts +3 -2
- package/dist/oauth/discord.js +1 -1
- package/dist/oauth/figma.cjs +19 -16
- package/dist/oauth/figma.d.ts +3 -2
- package/dist/oauth/figma.js +1 -1
- package/dist/oauth/github.cjs +19 -8
- package/dist/oauth/github.d.ts +3 -2
- package/dist/oauth/github.js +1 -1
- package/dist/oauth/gitlab.cjs +19 -16
- package/dist/oauth/gitlab.d.ts +3 -2
- package/dist/oauth/gitlab.js +1 -1
- package/dist/oauth/index.cjs +266 -166
- package/dist/oauth/index.d.ts +3 -2
- package/dist/oauth/index.js +22 -21
- package/dist/oauth/mailchimp.cjs +19 -16
- package/dist/oauth/mailchimp.d.ts +3 -2
- package/dist/oauth/mailchimp.js +1 -1
- package/dist/oauth/pinterest.cjs +19 -16
- package/dist/oauth/pinterest.d.ts +3 -2
- package/dist/oauth/pinterest.js +1 -1
- package/dist/oauth/spotify.cjs +19 -16
- package/dist/oauth/spotify.d.ts +3 -2
- package/dist/oauth/spotify.js +1 -1
- package/dist/oauth/strava.cjs +19 -16
- package/dist/oauth/strava.d.ts +3 -2
- package/dist/oauth/strava.js +1 -1
- package/dist/oauth/x.cjs +19 -16
- package/dist/oauth/x.d.ts +3 -2
- package/dist/oauth/x.js +1 -1
- package/dist/schemas.cjs +16 -2
- package/dist/schemas.d.ts +17 -1
- package/dist/schemas.js +5 -3
- package/dist/secure.cjs +58 -16
- package/dist/secure.d.ts +4 -10
- package/dist/secure.js +5 -5
- package/dist/utils.cjs +94 -87
- package/dist/utils.d.ts +9 -39
- package/dist/utils.js +11 -9
- package/package.json +3 -4
- package/dist/chunk-42XB3YCW.js +0 -22
- package/dist/chunk-6R2YZ4AC.js +0 -22
- package/dist/chunk-A3N4PVAT.js +0 -70
- package/dist/chunk-B737EUJV.js +0 -22
- package/dist/chunk-CXLATHS5.js +0 -143
- package/dist/chunk-DIVDFNAP.js +0 -0
- package/dist/chunk-E3OXBRYF.js +0 -22
- package/dist/chunk-EIL2FPSS.js +0 -22
- package/dist/chunk-EMKJA2GJ.js +0 -89
- package/dist/chunk-FIPU4MLT.js +0 -21
- package/dist/chunk-FKRDCWBF.js +0 -22
- package/dist/chunk-HP34YGGJ.js +0 -22
- package/dist/chunk-IKHPGFCW.js +0 -14
- package/dist/chunk-IUYZQTJV.js +0 -30
- package/dist/chunk-KRNOMBXQ.js +0 -22
- package/dist/chunk-KSWLO5ZU.js +0 -102
- package/dist/chunk-N4SX7TZT.js +0 -96
- package/dist/chunk-STHEPPUZ.js +0 -11
package/dist/oauth/index.cjs
CHANGED
|
@@ -35,197 +35,277 @@ __export(oauth_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(oauth_exports);
|
|
37
37
|
|
|
38
|
+
// src/env.ts
|
|
39
|
+
var import_meta = {};
|
|
40
|
+
var env = new Proxy({}, {
|
|
41
|
+
get(_, prop) {
|
|
42
|
+
if (typeof prop !== "string") return void 0;
|
|
43
|
+
const hasProperty = (process2) => {
|
|
44
|
+
return process2 && Object.prototype.hasOwnProperty.call(process2, prop);
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
if (typeof process !== "undefined" && hasProperty(process.env)) {
|
|
48
|
+
return process.env[prop];
|
|
49
|
+
}
|
|
50
|
+
if (typeof import_meta !== "undefined" && hasProperty(import_meta.env)) {
|
|
51
|
+
return import_meta.env[prop];
|
|
52
|
+
}
|
|
53
|
+
if (typeof Deno !== "undefined" && Deno.env?.get) {
|
|
54
|
+
return Deno.env.get(prop);
|
|
55
|
+
}
|
|
56
|
+
if (typeof Bun !== "undefined" && hasProperty(Bun.env)) {
|
|
57
|
+
return Bun.env[prop];
|
|
58
|
+
}
|
|
59
|
+
const globalValue = globalThis[prop];
|
|
60
|
+
return typeof globalValue === "string" ? globalValue : void 0;
|
|
61
|
+
} catch {
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
38
67
|
// src/oauth/github.ts
|
|
39
|
-
var github = {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
68
|
+
var github = (options2) => {
|
|
69
|
+
return {
|
|
70
|
+
id: "github",
|
|
71
|
+
name: "GitHub",
|
|
72
|
+
authorizeURL: "https://github.com/login/oauth/authorize",
|
|
73
|
+
accessToken: "https://github.com/login/oauth/access_token",
|
|
74
|
+
userInfo: "https://api.github.com/user",
|
|
75
|
+
scope: "read:user user:email",
|
|
76
|
+
responseType: "code",
|
|
77
|
+
profile: (profile) => {
|
|
78
|
+
return {
|
|
79
|
+
sub: profile.id.toString(),
|
|
80
|
+
name: profile.name ?? profile.login,
|
|
81
|
+
email: profile.email ?? void 0,
|
|
82
|
+
image: profile.avatar_url
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
...options2
|
|
86
|
+
};
|
|
47
87
|
};
|
|
48
88
|
|
|
49
89
|
// src/oauth/bitbucket.ts
|
|
50
|
-
var bitbucket = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
90
|
+
var bitbucket = (options2) => {
|
|
91
|
+
return {
|
|
92
|
+
id: "bitbucket",
|
|
93
|
+
name: "Bitbucket",
|
|
94
|
+
authorizeURL: "https://bitbucket.org/site/oauth2/authorize",
|
|
95
|
+
accessToken: "https://bitbucket.org/site/oauth2/access_token",
|
|
96
|
+
userInfo: "https://api.bitbucket.org/2.0/user",
|
|
97
|
+
scope: "account email",
|
|
98
|
+
responseType: "code",
|
|
99
|
+
profile(profile) {
|
|
100
|
+
return {
|
|
101
|
+
sub: profile.uuid ?? profile.account_id,
|
|
102
|
+
name: profile.display_name ?? profile.nickname,
|
|
103
|
+
image: profile.links.avatar?.href,
|
|
104
|
+
email: void 0
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
...options2
|
|
108
|
+
};
|
|
65
109
|
};
|
|
66
110
|
|
|
67
111
|
// src/oauth/figma.ts
|
|
68
|
-
var figma = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
112
|
+
var figma = (options2) => {
|
|
113
|
+
return {
|
|
114
|
+
id: "figma",
|
|
115
|
+
name: "Figma",
|
|
116
|
+
authorizeURL: "https://www.figma.com/oauth",
|
|
117
|
+
accessToken: "https://api.figma.com/v1/oauth/token",
|
|
118
|
+
userInfo: "https://api.figma.com/v1/me",
|
|
119
|
+
scope: "current_user:read",
|
|
120
|
+
responseType: "code",
|
|
121
|
+
profile(profile) {
|
|
122
|
+
return {
|
|
123
|
+
sub: profile.id,
|
|
124
|
+
name: profile.handle,
|
|
125
|
+
email: profile.email,
|
|
126
|
+
image: profile.img_url
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
...options2
|
|
130
|
+
};
|
|
84
131
|
};
|
|
85
132
|
|
|
86
133
|
// src/oauth/discord.ts
|
|
87
|
-
var discord = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
134
|
+
var discord = (options2) => {
|
|
135
|
+
return {
|
|
136
|
+
id: "discord",
|
|
137
|
+
name: "Discord",
|
|
138
|
+
authorizeURL: "https://discord.com/oauth2/authorize",
|
|
139
|
+
accessToken: "https://discord.com/api/oauth2/token",
|
|
140
|
+
userInfo: "https://discord.com/api/users/@me",
|
|
141
|
+
scope: "identify email",
|
|
142
|
+
responseType: "code",
|
|
143
|
+
profile(profile) {
|
|
144
|
+
let image = "";
|
|
145
|
+
if (profile.avatar === null) {
|
|
146
|
+
const index = profile.discriminator === "0" ? (BigInt(profile.id) >> 22n) % 6n : Number(profile.discriminator) % 5;
|
|
147
|
+
image = `https://cdn.discordapp.com/embed/avatars/${index}.png`;
|
|
148
|
+
} else {
|
|
149
|
+
const format = profile.avatar.startsWith("a_") ? "gif" : "png";
|
|
150
|
+
image = `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.${format}`;
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
sub: profile.id,
|
|
154
|
+
name: profile.global_name ?? profile.username,
|
|
155
|
+
email: profile.email ?? "",
|
|
156
|
+
image
|
|
157
|
+
};
|
|
158
|
+
},
|
|
159
|
+
...options2
|
|
160
|
+
};
|
|
111
161
|
};
|
|
112
162
|
|
|
113
163
|
// src/oauth/gitlab.ts
|
|
114
|
-
var gitlab = {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
164
|
+
var gitlab = (options2) => {
|
|
165
|
+
return {
|
|
166
|
+
id: "gitlab",
|
|
167
|
+
name: "GitLab",
|
|
168
|
+
authorizeURL: "https://gitlab.com/oauth/authorize",
|
|
169
|
+
accessToken: "https://gitlab.com/oauth/token",
|
|
170
|
+
userInfo: "https://gitlab.com/api/v4/user",
|
|
171
|
+
scope: "read_user",
|
|
172
|
+
responseType: "code",
|
|
173
|
+
profile(profile) {
|
|
174
|
+
return {
|
|
175
|
+
sub: profile.id.toString(),
|
|
176
|
+
name: profile.name ?? profile.username,
|
|
177
|
+
email: profile.email,
|
|
178
|
+
image: profile.avatar_url
|
|
179
|
+
};
|
|
180
|
+
},
|
|
181
|
+
...options2
|
|
182
|
+
};
|
|
130
183
|
};
|
|
131
184
|
|
|
132
185
|
// src/oauth/spotify.ts
|
|
133
|
-
var spotify = {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
186
|
+
var spotify = (options2) => {
|
|
187
|
+
return {
|
|
188
|
+
id: "spotify",
|
|
189
|
+
name: "Spotify",
|
|
190
|
+
authorizeURL: "https://accounts.spotify.com/authorize",
|
|
191
|
+
accessToken: "https://accounts.spotify.com/api/token",
|
|
192
|
+
userInfo: "https://api.spotify.com/v1/me",
|
|
193
|
+
scope: "user-read-private user-read-email",
|
|
194
|
+
responseType: "code",
|
|
195
|
+
profile(profile) {
|
|
196
|
+
return {
|
|
197
|
+
sub: profile.id,
|
|
198
|
+
name: profile.display_name,
|
|
199
|
+
email: profile.email,
|
|
200
|
+
image: profile.images[0]?.url ?? void 0
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
...options2
|
|
204
|
+
};
|
|
149
205
|
};
|
|
150
206
|
|
|
151
207
|
// src/oauth/x.ts
|
|
152
|
-
var x = {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
208
|
+
var x = (options2) => {
|
|
209
|
+
return {
|
|
210
|
+
id: "x",
|
|
211
|
+
name: "X",
|
|
212
|
+
authorizeURL: "https://twitter.com/i/oauth2/authorize",
|
|
213
|
+
accessToken: "https://api.twitter.com/2/oauth2/token",
|
|
214
|
+
userInfo: "https://api.twitter.com/2/users/me?user.fields=profile_image_url",
|
|
215
|
+
scope: "tweet.read users.read offline.access",
|
|
216
|
+
responseType: "code",
|
|
217
|
+
profile(profile) {
|
|
218
|
+
return {
|
|
219
|
+
sub: profile.data.id,
|
|
220
|
+
name: profile.data.name,
|
|
221
|
+
image: profile.data.profile_image_url,
|
|
222
|
+
email: void 0
|
|
223
|
+
};
|
|
224
|
+
},
|
|
225
|
+
...options2
|
|
226
|
+
};
|
|
168
227
|
};
|
|
169
228
|
|
|
170
229
|
// src/oauth/strava.ts
|
|
171
|
-
var strava = {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
230
|
+
var strava = (options2) => {
|
|
231
|
+
return {
|
|
232
|
+
id: "strava",
|
|
233
|
+
name: "Strava",
|
|
234
|
+
authorizeURL: "https://www.strava.com/oauth/authorize",
|
|
235
|
+
accessToken: "https://www.strava.com/oauth/token",
|
|
236
|
+
userInfo: "https://www.strava.com/api/v3/athlete",
|
|
237
|
+
scope: "read",
|
|
238
|
+
responseType: "code",
|
|
239
|
+
profile(profile) {
|
|
240
|
+
return {
|
|
241
|
+
sub: profile.id.toString(),
|
|
242
|
+
name: `${profile.firstname} ${profile.lastname}`,
|
|
243
|
+
image: profile.profile,
|
|
244
|
+
email: void 0
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
...options2
|
|
248
|
+
};
|
|
187
249
|
};
|
|
188
250
|
|
|
189
251
|
// src/oauth/mailchimp.ts
|
|
190
|
-
var mailchimp = {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
252
|
+
var mailchimp = (options2) => {
|
|
253
|
+
return {
|
|
254
|
+
id: "mailchimp",
|
|
255
|
+
name: "Mailchimp",
|
|
256
|
+
authorizeURL: "https://login.mailchimp.com/oauth2/authorize",
|
|
257
|
+
accessToken: "https://login.mailchimp.com/oauth2/token",
|
|
258
|
+
userInfo: "https://login.mailchimp.com/oauth2/metadata",
|
|
259
|
+
scope: "",
|
|
260
|
+
responseType: "code",
|
|
261
|
+
profile(profile) {
|
|
262
|
+
return {
|
|
263
|
+
sub: profile.user_id,
|
|
264
|
+
name: profile.accountname,
|
|
265
|
+
email: profile.login.email,
|
|
266
|
+
image: profile.login.avatar
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
...options2
|
|
270
|
+
};
|
|
206
271
|
};
|
|
207
272
|
|
|
208
273
|
// src/oauth/pinterest.ts
|
|
209
|
-
var pinterest = {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
274
|
+
var pinterest = (options2) => {
|
|
275
|
+
return {
|
|
276
|
+
id: "pinterest",
|
|
277
|
+
name: "Pinterest",
|
|
278
|
+
authorizeURL: "https://www.pinterest.com/oauth",
|
|
279
|
+
accessToken: "https://api.pinterest.com/v5/oauth/token",
|
|
280
|
+
userInfo: "https://api.pinterest.com/v5/user_account",
|
|
281
|
+
scope: "user_accounts:read",
|
|
282
|
+
responseType: "code",
|
|
283
|
+
profile(profile) {
|
|
284
|
+
return {
|
|
285
|
+
sub: profile.id,
|
|
286
|
+
name: profile.username,
|
|
287
|
+
image: profile.profile_image,
|
|
288
|
+
email: void 0
|
|
289
|
+
};
|
|
290
|
+
},
|
|
291
|
+
...options2
|
|
292
|
+
};
|
|
225
293
|
};
|
|
226
294
|
|
|
227
295
|
// src/schemas.ts
|
|
228
296
|
var import_zod = require("zod");
|
|
297
|
+
var OAuthProviderCredentialsSchema = (0, import_zod.object)({
|
|
298
|
+
id: (0, import_zod.string)(),
|
|
299
|
+
name: (0, import_zod.string)(),
|
|
300
|
+
authorizeURL: (0, import_zod.string)().url(),
|
|
301
|
+
accessToken: (0, import_zod.string)().url(),
|
|
302
|
+
scope: (0, import_zod.string)(),
|
|
303
|
+
userInfo: (0, import_zod.string)().url(),
|
|
304
|
+
responseType: (0, import_zod.enum)(["code", "token", "id_token"]),
|
|
305
|
+
clientId: (0, import_zod.string)(),
|
|
306
|
+
clientSecret: (0, import_zod.string)(),
|
|
307
|
+
profile: import_zod.z.function().optional()
|
|
308
|
+
});
|
|
229
309
|
var OAuthProviderConfigSchema = (0, import_zod.object)({
|
|
230
310
|
authorizeURL: (0, import_zod.string)().url(),
|
|
231
311
|
accessToken: (0, import_zod.string)().url(),
|
|
@@ -336,7 +416,6 @@ var builtInOAuthProviders = {
|
|
|
336
416
|
pinterest
|
|
337
417
|
};
|
|
338
418
|
var defineOAuthEnvironment = (oauth) => {
|
|
339
|
-
const env = process.env;
|
|
340
419
|
const clientIdSuffix = `${oauth.toUpperCase()}_CLIENT_ID`;
|
|
341
420
|
const clientSecretSuffix = `${oauth.toUpperCase()}_CLIENT_SECRET`;
|
|
342
421
|
const loadEnvs = OAuthEnvSchema.safeParse({
|
|
@@ -352,17 +431,38 @@ var defineOAuthEnvironment = (oauth) => {
|
|
|
352
431
|
var defineOAuthProviderConfig = (config) => {
|
|
353
432
|
if (typeof config === "string") {
|
|
354
433
|
const definition = defineOAuthEnvironment(config);
|
|
355
|
-
const oauthConfig = builtInOAuthProviders[config];
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
434
|
+
const oauthConfig = builtInOAuthProviders[config]();
|
|
435
|
+
const parsed2 = OAuthProviderCredentialsSchema.safeParse({ ...oauthConfig, ...definition });
|
|
436
|
+
if (!parsed2.success) {
|
|
437
|
+
const details = JSON.stringify(formatZodError(parsed2.error), null, 2);
|
|
438
|
+
throw new AuthInternalError(
|
|
439
|
+
"INVALID_OAUTH_PROVIDER_CONFIGURATION",
|
|
440
|
+
`Invalid configuration for OAuth provider "${config}": ${details}`
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
return parsed2.data;
|
|
444
|
+
}
|
|
445
|
+
const hasCredentials = config.clientId && config.clientSecret;
|
|
446
|
+
const envConfig = hasCredentials ? {} : defineOAuthEnvironment(config.id);
|
|
447
|
+
const parsed = OAuthProviderCredentialsSchema.safeParse({ ...envConfig, ...config });
|
|
448
|
+
if (!parsed.success) {
|
|
449
|
+
const details = JSON.stringify(formatZodError(parsed.error), null, 2);
|
|
450
|
+
throw new AuthInternalError(
|
|
451
|
+
"INVALID_OAUTH_PROVIDER_CONFIGURATION",
|
|
452
|
+
`Invalid configuration for OAuth provider "${config.id}": ${details}`
|
|
453
|
+
);
|
|
360
454
|
}
|
|
361
|
-
return
|
|
455
|
+
return parsed.data;
|
|
362
456
|
};
|
|
363
457
|
var createBuiltInOAuthProviders = (oauth = []) => {
|
|
364
458
|
return oauth.reduce((previous, config) => {
|
|
365
459
|
const oauthConfig = defineOAuthProviderConfig(config);
|
|
460
|
+
if (oauthConfig.id in previous) {
|
|
461
|
+
throw new AuthInternalError(
|
|
462
|
+
"DUPLICATED_OAUTH_PROVIDER_ID",
|
|
463
|
+
`Duplicate OAuth provider id "${oauthConfig.id}" found. Each provider must have a unique id.`
|
|
464
|
+
);
|
|
465
|
+
}
|
|
366
466
|
return { ...previous, [oauthConfig.id]: oauthConfig };
|
|
367
467
|
}, {});
|
|
368
468
|
};
|
package/dist/oauth/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { H as BitbucketProfile, Z as BuiltInOAuthProvider, D as DiscordProfile, F as FigmaProfile, Q as GitHubProfile, G as GitLabProfile, n as Login, M as MailchimpProfile, N as Nameplate, P as PinterestProfile, u as SpotifyImage, v as SpotifyProfile, s as StravaProfile, q as SummaryClub, r as SummaryGear, X as XProfile, K as bitbucket, W as builtInOAuthProviders, Y as createBuiltInOAuthProviders, z as discord, B as figma, V as github, y as gitlab, o as mailchimp, p as pinterest, w as spotify, t as strava, x } from '../index-CSyIJmCM.js';
|
|
2
2
|
import '../@types/utility.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '../schemas.js';
|
|
5
|
-
import '
|
|
5
|
+
import '../jose.js';
|
|
6
6
|
import '@aura-stack/jose';
|
|
7
7
|
import '@aura-stack/jose/jose';
|
|
8
|
+
import '@aura-stack/router/cookie';
|
package/dist/oauth/index.js
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
import {
|
|
2
2
|
builtInOAuthProviders,
|
|
3
3
|
createBuiltInOAuthProviders
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-TM5IPSNF.js";
|
|
5
|
+
import {
|
|
6
|
+
spotify
|
|
7
|
+
} from "../chunk-IPKO6UQN.js";
|
|
8
|
+
import {
|
|
9
|
+
strava
|
|
10
|
+
} from "../chunk-54CZPKR4.js";
|
|
5
11
|
import {
|
|
6
12
|
x
|
|
7
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-EEE7UM5T.js";
|
|
14
|
+
import {
|
|
15
|
+
bitbucket
|
|
16
|
+
} from "../chunk-4YHJ4IEQ.js";
|
|
17
|
+
import {
|
|
18
|
+
discord
|
|
19
|
+
} from "../chunk-OVHNRULD.js";
|
|
8
20
|
import {
|
|
9
21
|
figma
|
|
10
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-KMMAZFSJ.js";
|
|
11
23
|
import {
|
|
12
24
|
github
|
|
13
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-FW4W3REU.js";
|
|
14
26
|
import {
|
|
15
27
|
gitlab
|
|
16
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-5LZ7TOM3.js";
|
|
17
29
|
import {
|
|
18
30
|
mailchimp
|
|
19
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-LDU7A2JE.js";
|
|
20
32
|
import {
|
|
21
33
|
pinterest
|
|
22
|
-
} from "../chunk-
|
|
23
|
-
import
|
|
24
|
-
|
|
25
|
-
|
|
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";
|
|
34
|
+
} from "../chunk-E6G5YCI6.js";
|
|
35
|
+
import "../chunk-KJBAQZX2.js";
|
|
36
|
+
import "../chunk-QQVSRXGX.js";
|
|
37
|
+
import "../chunk-4MYWAOLG.js";
|
|
36
38
|
import "../chunk-RRLIF4PQ.js";
|
|
37
|
-
import "../chunk-YRCB5FLE.js";
|
|
38
39
|
export {
|
|
39
40
|
bitbucket,
|
|
40
41
|
builtInOAuthProviders,
|
package/dist/oauth/mailchimp.cjs
CHANGED
|
@@ -23,22 +23,25 @@ __export(mailchimp_exports, {
|
|
|
23
23
|
mailchimp: () => mailchimp
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(mailchimp_exports);
|
|
26
|
-
var mailchimp = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
var mailchimp = (options) => {
|
|
27
|
+
return {
|
|
28
|
+
id: "mailchimp",
|
|
29
|
+
name: "Mailchimp",
|
|
30
|
+
authorizeURL: "https://login.mailchimp.com/oauth2/authorize",
|
|
31
|
+
accessToken: "https://login.mailchimp.com/oauth2/token",
|
|
32
|
+
userInfo: "https://login.mailchimp.com/oauth2/metadata",
|
|
33
|
+
scope: "",
|
|
34
|
+
responseType: "code",
|
|
35
|
+
profile(profile) {
|
|
36
|
+
return {
|
|
37
|
+
sub: profile.user_id,
|
|
38
|
+
name: profile.accountname,
|
|
39
|
+
email: profile.login.email,
|
|
40
|
+
image: profile.login.avatar
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
...options
|
|
44
|
+
};
|
|
42
45
|
};
|
|
43
46
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
47
|
0 && (module.exports = {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { n as Login, M as MailchimpProfile, o as mailchimp } from '../index-CSyIJmCM.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../schemas.js';
|
|
4
|
-
import '
|
|
4
|
+
import '../jose.js';
|
|
5
5
|
import '@aura-stack/jose';
|
|
6
6
|
import '@aura-stack/jose/jose';
|
|
7
|
+
import '@aura-stack/router/cookie';
|
|
7
8
|
import '../@types/utility.js';
|