@adonisjs/ally 6.0.0-next.0 → 6.1.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 (38) hide show
  1. package/README.md +2 -2
  2. package/build/{chunk-WM3V3APX.js → chunk-46TOMXWK.js} +92 -15
  3. package/build/chunk-6BP2DK5A.js +43 -0
  4. package/build/{chunk-KSJ4CFTC.js → chunk-NK6X76EQ.js} +16 -25
  5. package/build/{chunk-KWRXS6EG.js → chunk-SBQAXPUK.js} +33 -3
  6. package/build/chunk-TFPW7D75.js +125 -0
  7. package/build/index.js +67 -6
  8. package/build/providers/ally_provider.d.ts +10 -0
  9. package/build/providers/ally_provider.js +13 -2
  10. package/build/src/abstract_drivers/oauth1.d.ts +26 -0
  11. package/build/src/abstract_drivers/oauth2.d.ts +50 -2
  12. package/build/src/ally_manager.d.ts +67 -3
  13. package/build/src/debug.d.ts +1 -1
  14. package/build/src/define_config.d.ts +16 -1
  15. package/build/src/drivers/discord.d.ts +9 -0
  16. package/build/src/drivers/discord.js +13 -3
  17. package/build/src/drivers/facebook.d.ts +9 -0
  18. package/build/src/drivers/facebook.js +13 -3
  19. package/build/src/drivers/github.d.ts +12 -0
  20. package/build/src/drivers/github.js +17 -4
  21. package/build/src/drivers/google.d.ts +9 -0
  22. package/build/src/drivers/google.js +13 -3
  23. package/build/src/drivers/linked_in.d.ts +12 -0
  24. package/build/src/drivers/linked_in.js +16 -3
  25. package/build/src/drivers/linked_in_openid_connect.d.ts +14 -5
  26. package/build/src/drivers/linked_in_openid_connect.js +14 -5
  27. package/build/src/drivers/spotify.d.ts +11 -0
  28. package/build/src/drivers/spotify.js +15 -3
  29. package/build/src/drivers/twitter.d.ts +17 -0
  30. package/build/src/drivers/twitter.js +22 -3
  31. package/build/src/drivers/twitter_x.d.ts +137 -0
  32. package/build/src/drivers/twitter_x.js +169 -0
  33. package/build/src/errors.d.ts +29 -0
  34. package/build/src/redirect_request.d.ts +7 -0
  35. package/build/src/types.d.ts +150 -0
  36. package/package.json +27 -21
  37. package/build/chunk-MLKGABMK.js +0 -9
  38. package/build/chunk-SZ4YJCVU.js +0 -46
@@ -0,0 +1,169 @@
1
+ import {
2
+ Oauth2Driver
3
+ } from "../../chunk-46TOMXWK.js";
4
+ import "../../chunk-NK6X76EQ.js";
5
+ import "../../chunk-6BP2DK5A.js";
6
+
7
+ // src/drivers/twitter_x.ts
8
+ var TwitterXDriver = class extends Oauth2Driver {
9
+ /**
10
+ * Create a new X driver instance.
11
+ *
12
+ * @param ctx - The current HTTP context.
13
+ * @param config - X driver configuration.
14
+ */
15
+ constructor(ctx, config) {
16
+ super(ctx, config);
17
+ this.config = config;
18
+ this.loadState();
19
+ }
20
+ config;
21
+ /**
22
+ * X token endpoint URL.
23
+ */
24
+ accessTokenUrl = "https://api.x.com/2/oauth2/token";
25
+ /**
26
+ * X authorization endpoint URL.
27
+ */
28
+ authorizeUrl = "https://x.com/i/oauth2/authorize";
29
+ /**
30
+ * X user profile endpoint URL.
31
+ */
32
+ userInfoUrl = "https://api.x.com/2/users/me";
33
+ /**
34
+ * The param name for the authorization code
35
+ */
36
+ codeParamName = "code";
37
+ /**
38
+ * The param name for the error
39
+ */
40
+ errorParamName = "error";
41
+ /**
42
+ * Cookie name for storing the "twitter_x_oauth_state"
43
+ */
44
+ stateCookieName = "twitter_x_oauth_state";
45
+ /**
46
+ * Cookie name for storing the PKCE code verifier
47
+ */
48
+ codeVerifierCookieName = "twitter_x_oauth_code_verifier";
49
+ /**
50
+ * Parameter name to be used for sending and receiving the state from X
51
+ */
52
+ stateParamName = "state";
53
+ /**
54
+ * Parameter name for defining the scopes
55
+ */
56
+ scopeParamName = "scope";
57
+ /**
58
+ * Scopes separator
59
+ */
60
+ scopesSeparator = " ";
61
+ /**
62
+ * Configures the redirect request with X-specific requirements.
63
+ *
64
+ * @param request - The redirect request to configure.
65
+ */
66
+ configureRedirectRequest(request) {
67
+ request.scopes(this.config.scopes || ["tweet.read", "users.read", "users.email"]);
68
+ request.param("response_type", "code");
69
+ }
70
+ /**
71
+ * Configures the token request with the PKCE verifier and the Basic auth
72
+ * header required for confidential X clients.
73
+ *
74
+ * @param request - The token request to configure.
75
+ */
76
+ configureAccessTokenRequest(request) {
77
+ const credentials = Buffer.from(`${this.config.clientId}:${this.config.clientSecret}`).toString(
78
+ "base64"
79
+ );
80
+ request.header("Authorization", `Basic ${credentials}`);
81
+ request.clearField("client_id");
82
+ request.clearField("client_secret");
83
+ }
84
+ /**
85
+ * Creates an authenticated request for X API calls.
86
+ *
87
+ * @param url - The API endpoint URL.
88
+ * @param token - The access token to send.
89
+ * @returns A configured HTTP client instance.
90
+ */
91
+ getAuthenticatedRequest(url, token) {
92
+ const request = this.httpClient(url);
93
+ request.header("Authorization", `Bearer ${token}`);
94
+ request.header("Accept", "application/json");
95
+ request.parseAs("json");
96
+ return request;
97
+ }
98
+ /**
99
+ * Fetches the authenticated user's profile from /2/users/me.
100
+ *
101
+ * @param token - The access token to use.
102
+ * @param includeConfirmedEmail - Whether to request the confirmed email field.
103
+ * @param callback - Optional callback to customize the API request.
104
+ */
105
+ async getUserInfo(token, includeConfirmedEmail, callback) {
106
+ const request = this.getAuthenticatedRequest(this.config.userInfoUrl || this.userInfoUrl, token);
107
+ request.param(
108
+ "user.fields",
109
+ includeConfirmedEmail ? "profile_image_url,confirmed_email" : "profile_image_url"
110
+ );
111
+ if (typeof callback === "function") {
112
+ callback(request);
113
+ }
114
+ const body = await request.get();
115
+ const user = body.data;
116
+ return {
117
+ id: user.id,
118
+ nickName: user.username,
119
+ name: user.name ?? user.username,
120
+ email: user.confirmed_email ?? null,
121
+ emailVerificationState: "unsupported",
122
+ avatarUrl: user.profile_image_url ?? null,
123
+ original: body
124
+ };
125
+ }
126
+ /**
127
+ * Check if the error from the callback indicates that the user denied
128
+ * authorization.
129
+ *
130
+ * @returns `true` when the provider reported an access-denied error.
131
+ */
132
+ accessDenied() {
133
+ const error = this.getError();
134
+ if (!error) {
135
+ return false;
136
+ }
137
+ return error === "access_denied";
138
+ }
139
+ /**
140
+ * Fetches the authenticated user using the authorization code from the
141
+ * callback request.
142
+ *
143
+ * @param callback - Optional callback to customize the API request.
144
+ */
145
+ async user(callback) {
146
+ const token = await this.accessToken(callback);
147
+ const user = await this.getUserInfo(token.token, token.scope.includes("users.email"), callback);
148
+ return {
149
+ ...user,
150
+ token
151
+ };
152
+ }
153
+ /**
154
+ * Fetches the user profile using an existing access token.
155
+ *
156
+ * @param token - The access token to use.
157
+ * @param callback - Optional callback to customize the API request.
158
+ */
159
+ async userFromToken(token, callback) {
160
+ const user = await this.getUserInfo(token, false, callback);
161
+ return {
162
+ ...user,
163
+ token: { token, type: "bearer" }
164
+ };
165
+ }
166
+ };
167
+ export {
168
+ TwitterXDriver
169
+ };
@@ -1,10 +1,39 @@
1
1
  /**
2
2
  * Error thrown when the OAuth redirect is missing the required
3
3
  * authorization code or token parameter.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * throw new errors.E_OAUTH_MISSING_CODE(['code'])
8
+ * ```
4
9
  */
5
10
  export declare const E_OAUTH_MISSING_CODE: new (args: [string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
6
11
  /**
7
12
  * Error thrown when the OAuth state parameter does not match
8
13
  * the expected value, indicating a potential CSRF attack.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * throw new errors.E_OAUTH_STATE_MISMATCH()
18
+ * ```
9
19
  */
10
20
  export declare const E_OAUTH_STATE_MISMATCH: new (args?: any, options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
21
+ /**
22
+ * Error thrown when attempting to use an unknown Ally provider.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * throw new errors.E_UNKNOWN_ALLY_PROVIDER(['github'])
27
+ * ```
28
+ */
29
+ export declare const E_UNKNOWN_ALLY_PROVIDER: new (args: [string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
30
+ /**
31
+ * Error thrown when a provider is used for signup but local signup
32
+ * is disabled for it.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * throw new errors.E_LOCAL_SIGNUP_DISALLOWED(['github'])
37
+ * ```
38
+ */
39
+ export declare const E_LOCAL_SIGNUP_DISALLOWED: new (args: [string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
@@ -8,6 +8,8 @@ import { type LiteralStringUnion } from './types.ts';
8
8
  export declare class RedirectRequest<Scopes extends string> extends UrlBuilder {
9
9
  #private;
10
10
  /**
11
+ * Create a redirect request builder with scope helpers.
12
+ *
11
13
  * @param baseUrl - The authorization URL for the OAuth provider
12
14
  * @param scopeParamName - The query parameter name for scopes (e.g., 'scope')
13
15
  * @param scopeSeparator - The character used to separate multiple scopes (e.g., ' ' or ',')
@@ -19,6 +21,7 @@ export declare class RedirectRequest<Scopes extends string> extends UrlBuilder {
19
21
  * require scope prefixes or transformations.
20
22
  *
21
23
  * @param callback - Function that transforms the scopes array
24
+ * @returns The current redirect request instance.
22
25
  *
23
26
  * @example
24
27
  * ```ts
@@ -33,6 +36,7 @@ export declare class RedirectRequest<Scopes extends string> extends UrlBuilder {
33
36
  * any previously set scopes.
34
37
  *
35
38
  * @param scopes - Array of scope strings to request
39
+ * @returns The current redirect request instance.
36
40
  *
37
41
  * @example
38
42
  * ```ts
@@ -45,6 +49,7 @@ export declare class RedirectRequest<Scopes extends string> extends UrlBuilder {
45
49
  * for adding scopes without replacing the default ones.
46
50
  *
47
51
  * @param scopes - Array of scope strings to merge
52
+ * @returns The current redirect request instance.
48
53
  *
49
54
  * @example
50
55
  * ```ts
@@ -57,6 +62,8 @@ export declare class RedirectRequest<Scopes extends string> extends UrlBuilder {
57
62
  /**
58
63
  * Clear all existing scopes from the authorization request.
59
64
  *
65
+ * @returns The current redirect request instance.
66
+ *
60
67
  * @example
61
68
  * ```ts
62
69
  * request.clearScopes().scopes(['user'])
@@ -8,9 +8,34 @@ export type { Oauth1RequestToken };
8
8
  export type { ApiRequestContract };
9
9
  export type { Oauth2ClientConfig as Oauth2DriverConfig };
10
10
  export type { Oauth1ClientConfig as Oauth1DriverConfig };
11
+ /**
12
+ * Allowed high-level intents when using a provider through `AllyManager`.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * ally.use('github', { intent: 'signup' })
17
+ * ```
18
+ */
19
+ export type AllyManagerIntent = 'signup' | 'login' | 'link';
20
+ /**
21
+ * Options accepted by `AllyManager.use`.
22
+ */
23
+ export type AllyManagerUseOptions = {
24
+ /**
25
+ * The interaction intent associated with the provider usage.
26
+ */
27
+ intent?: AllyManagerIntent;
28
+ };
11
29
  /**
12
30
  * Issue: https://github.com/Microsoft/TypeScript/issues/29729
13
31
  * Solution: https://github.com/sindresorhus/type-fest/blob/main/source/literal-union.d.ts
32
+ *
33
+ * Allows known literal values while still accepting arbitrary strings.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const scopes: LiteralStringUnion<'email' | 'profile'>[] = ['email']
38
+ * ```
14
39
  */
15
40
  export type LiteralStringUnion<LiteralType> = LiteralType | (string & {
16
41
  _?: never;
@@ -18,92 +43,172 @@ export type LiteralStringUnion<LiteralType> = LiteralType | (string & {
18
43
  /**
19
44
  * Extension of oauth-client redirect request with support
20
45
  * for defining scopes as first class citizen
46
+ *
47
+ * @typeParam Scopes - The known set of supported scopes for the provider.
21
48
  */
22
49
  export interface RedirectRequestContract<Scopes extends string = string> extends ClientRequestContract {
23
50
  /**
24
51
  * Define a callback to transform scopes before they are defined
25
52
  * as a param
53
+ *
54
+ * @param callback - Callback used to transform scope values before serialization.
55
+ * @returns The current redirect request instance.
26
56
  */
27
57
  transformScopes(callback: (scopes: LiteralStringUnion<Scopes>[]) => string[]): this;
28
58
  /**
29
59
  * Define the scopes for authorization
60
+ *
61
+ * @param scopes - The scopes to serialize on the request.
62
+ * @returns The current redirect request instance.
30
63
  */
31
64
  scopes(scopes: LiteralStringUnion<Scopes>[]): this;
32
65
  /**
33
66
  * Merge to existing pre-defined scopes
67
+ *
68
+ * @param scopes - Additional scopes to merge with the existing list.
69
+ * @returns The current redirect request instance.
34
70
  */
35
71
  mergeScopes(scopes: LiteralStringUnion<Scopes>[]): this;
36
72
  /**
37
73
  * Clear existing scopes
74
+ *
75
+ * @returns The current redirect request instance.
38
76
  */
39
77
  clearScopes(): this;
40
78
  }
41
79
  /**
42
80
  * The user fetched from the oauth provider.
81
+ *
82
+ * @typeParam Token - The access token shape returned by the provider.
43
83
  */
44
84
  export interface AllyUserContract<Token extends Oauth2AccessToken | Oauth1AccessToken> {
85
+ /**
86
+ * Unique user identifier returned by the provider.
87
+ */
45
88
  id: string;
89
+ /**
90
+ * Provider-specific nickname or username.
91
+ */
46
92
  nickName: string;
93
+ /**
94
+ * Display name returned by the provider.
95
+ */
47
96
  name: string;
97
+ /**
98
+ * Primary email address returned by the provider, when available.
99
+ */
48
100
  email: string | null;
101
+ /**
102
+ * Email verification state as inferred from the provider payload.
103
+ */
49
104
  emailVerificationState: 'verified' | 'unverified' | 'unsupported';
105
+ /**
106
+ * URL to the user's avatar, when available.
107
+ */
50
108
  avatarUrl: string | null;
109
+ /**
110
+ * Access token information associated with the user payload.
111
+ */
51
112
  token: Token;
113
+ /**
114
+ * Original provider response body.
115
+ */
52
116
  original: any;
53
117
  }
54
118
  /**
55
119
  * Every driver should implement this contract
120
+ *
121
+ * @typeParam Token - The token shape returned by the driver.
122
+ * @typeParam Scopes - The supported authorization scopes for the driver.
56
123
  */
57
124
  export interface AllyDriverContract<Token extends Oauth2AccessToken | Oauth1AccessToken, Scopes extends string> {
125
+ /**
126
+ * OAuth protocol version supported by the driver.
127
+ */
58
128
  version: 'oauth1' | 'oauth2';
129
+ /**
130
+ * Driver configuration. Drivers may expose their config publicly so
131
+ * the manager can inspect runtime capabilities.
132
+ */
133
+ config?: any;
59
134
  /**
60
135
  * Perform stateless authentication. Only applicable for Oauth2 clients
136
+ *
137
+ * @returns The current driver instance.
61
138
  */
62
139
  stateless(): this;
63
140
  /**
64
141
  * Redirect user for authorization
142
+ *
143
+ * @param callback - Optional callback used to customize the redirect request.
144
+ * @returns A promise that resolves after the redirect response is prepared.
65
145
  */
66
146
  redirect(callback?: (request: RedirectRequestContract<Scopes>) => void): Promise<void>;
67
147
  /**
68
148
  * Get redirect url. You must manage the state yourself when redirecting
69
149
  * manually
150
+ *
151
+ * @param callback - Optional callback used to customize the redirect request.
152
+ * @returns A promise resolving to the computed redirect URL.
70
153
  */
71
154
  redirectUrl(callback?: (request: RedirectRequestContract<Scopes>) => void): Promise<string>;
72
155
  /**
73
156
  * Find if the current request has authorization code or oauth token
157
+ *
158
+ * @returns `true` when the current request contains an authorization code or token.
74
159
  */
75
160
  hasCode(): boolean;
76
161
  /**
77
162
  * Get the current request authorization code or oauth token. Returns
78
163
  * null if there no code
164
+ *
165
+ * @returns The current authorization code or token value.
79
166
  */
80
167
  getCode(): string | null;
81
168
  /**
82
169
  * Find if the current error code is for access denied
170
+ *
171
+ * @returns `true` when the provider reported an access-denied response.
83
172
  */
84
173
  accessDenied(): boolean;
85
174
  /**
86
175
  * Find if there is a state mismatch
176
+ *
177
+ * @returns `true` when the request state does not match the stored state.
87
178
  */
88
179
  stateMisMatch(): boolean;
89
180
  /**
90
181
  * Find if there is an error post redirect
182
+ *
183
+ * @returns `true` when the callback request contains a provider error.
91
184
  */
92
185
  hasError(): boolean;
93
186
  /**
94
187
  * Get the post redirect error
188
+ *
189
+ * @returns The provider error code or message, when present.
95
190
  */
96
191
  getError(): string | null;
97
192
  /**
98
193
  * Get access token
194
+ *
195
+ * @param callback - Optional callback used to customize the token request.
196
+ * @returns A promise resolving to the access token payload.
99
197
  */
100
198
  accessToken(callback?: (request: ApiRequestContract) => void): Promise<Token>;
101
199
  /**
102
200
  * Returns details for the authorized user
201
+ *
202
+ * @param callback - Optional callback used to customize downstream API requests.
203
+ * @returns A promise resolving to the authenticated user profile.
103
204
  */
104
205
  user(callback?: (request: ApiRequestContract) => void): Promise<AllyUserContract<Token>>;
105
206
  /**
106
207
  * Finds the user by access token. Applicable with "Oauth2" only
208
+ *
209
+ * @param token - The access token to use.
210
+ * @param callback - Optional callback used to customize downstream API requests.
211
+ * @returns A promise resolving to the authenticated user profile.
107
212
  */
108
213
  userFromToken(token: string, callback?: (request: ApiRequestContract) => void): Promise<AllyUserContract<{
109
214
  token: string;
@@ -111,6 +216,11 @@ export interface AllyDriverContract<Token extends Oauth2AccessToken | Oauth1Acce
111
216
  }>>;
112
217
  /**
113
218
  * Finds the user by access token. Applicable with "Oauth1" only
219
+ *
220
+ * @param token - The OAuth1 token to use.
221
+ * @param secret - The OAuth1 token secret to use.
222
+ * @param callback - Optional callback used to customize downstream API requests.
223
+ * @returns A promise resolving to the authenticated user profile.
114
224
  */
115
225
  userFromTokenAndSecret(token: string, secret: string, callback?: (request: ApiRequestContract) => void): Promise<AllyUserContract<{
116
226
  token: string;
@@ -120,6 +230,9 @@ export interface AllyDriverContract<Token extends Oauth2AccessToken | Oauth1Acce
120
230
  /**
121
231
  * The manager driver factory method is called by the AllyManager to create
122
232
  * an instance of a driver during an HTTP request
233
+ *
234
+ * @param ctx - The current HTTP context.
235
+ * @returns A social authentication driver instance.
123
236
  */
124
237
  export type AllyManagerDriverFactory = (ctx: HttpContext) => AllyDriverContract<any, any>;
125
238
  /**
@@ -147,6 +260,7 @@ export type DiscordToken = {
147
260
  * Extra options available for Discord
148
261
  */
149
262
  export type DiscordDriverConfig = Oauth2ClientConfig & {
263
+ disallowLocalSignup?: boolean;
150
264
  userInfoUrl?: string;
151
265
  scopes?: LiteralStringUnion<DiscordScopes>[];
152
266
  prompt?: 'consent' | 'none';
@@ -176,6 +290,7 @@ export type GithubToken = {
176
290
  * Extra options available for Github
177
291
  */
178
292
  export type GithubDriverConfig = Oauth2ClientConfig & {
293
+ disallowLocalSignup?: boolean;
179
294
  login?: string;
180
295
  scopes?: LiteralStringUnion<GithubScopes>[];
181
296
  allowSignup?: boolean;
@@ -200,8 +315,33 @@ export type TwitterToken = {
200
315
  * Extra options available for twitter
201
316
  */
202
317
  export type TwitterDriverConfig = Oauth1ClientConfig & {
318
+ disallowLocalSignup?: boolean;
203
319
  userInfoUrl?: string;
204
320
  };
321
+ /**
322
+ * ----------------------------------------
323
+ * Twitter X driver
324
+ * ----------------------------------------
325
+ */
326
+ /**
327
+ * Common X OAuth2 scopes.
328
+ * https://docs.x.com/fundamentals/authentication/oauth-2.0/user-access-token
329
+ */
330
+ export type TwitterXScopes = 'tweet.read' | 'tweet.write' | 'tweet.moderate.write' | 'users.email' | 'users.read' | 'follows.read' | 'follows.write' | 'offline.access' | 'space.read' | 'mute.read' | 'mute.write' | 'like.read' | 'like.write' | 'list.read' | 'list.write' | 'block.read' | 'block.write' | 'bookmark.read' | 'bookmark.write' | 'dm.read' | 'dm.write' | 'media.write';
331
+ /**
332
+ * Shape of the X access token
333
+ */
334
+ export type TwitterXToken = Oauth2AccessToken & {
335
+ scope: string;
336
+ };
337
+ /**
338
+ * Extra options available for X
339
+ */
340
+ export type TwitterXDriverConfig = Oauth2ClientConfig & {
341
+ disallowLocalSignup?: boolean;
342
+ userInfoUrl?: string;
343
+ scopes?: LiteralStringUnion<TwitterXScopes>[];
344
+ };
205
345
  /**
206
346
  * ----------------------------------------
207
347
  * Google driver
@@ -230,6 +370,7 @@ export type GoogleToken = Oauth2AccessToken & {
230
370
  * https://developers.google.com/identity/protocols/oauth2/openid-connect#re-consent
231
371
  */
232
372
  export type GoogleDriverConfig = Oauth2ClientConfig & {
373
+ disallowLocalSignup?: boolean;
233
374
  userInfoUrl?: string;
234
375
  /**
235
376
  * Can be configured at runtime
@@ -266,6 +407,7 @@ export type LinkedInToken = {
266
407
  * https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin%2Fcontext&tabs=HTTPS#step-2-request-an-authorization-code
267
408
  */
268
409
  export type LinkedInDriverConfig = Oauth2ClientConfig & {
410
+ disallowLocalSignup?: boolean;
269
411
  userInfoUrl?: string;
270
412
  userEmailUrl?: string;
271
413
  /**
@@ -297,6 +439,7 @@ export type LinkedInOpenidConnectScopes = 'openid' | 'profile' | 'email';
297
439
  * The configuration accepted by the driver implementation.
298
440
  */
299
441
  export type LinkedInOpenidConnectDriverConfig = {
442
+ disallowLocalSignup?: boolean;
300
443
  clientId: string;
301
444
  clientSecret: string;
302
445
  callbackUrl: string;
@@ -338,6 +481,7 @@ export type FacebookToken = {
338
481
  * https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow
339
482
  */
340
483
  export type FacebookDriverConfig = Oauth2ClientConfig & {
484
+ disallowLocalSignup?: boolean;
341
485
  userInfoUrl?: string;
342
486
  /**
343
487
  * Can be configured at runtime
@@ -371,6 +515,7 @@ export type SpotifyToken = {
371
515
  * Extra options available for Spotify
372
516
  */
373
517
  export type SpotifyDriverConfig = Oauth2ClientConfig & {
518
+ disallowLocalSignup?: boolean;
374
519
  scopes?: LiteralStringUnion<SpotifyScopes>[];
375
520
  showDialog?: boolean;
376
521
  };
@@ -383,6 +528,11 @@ export type SpotifyDriverConfig = Oauth2ClientConfig & {
383
528
  */
384
529
  export interface SocialProviders {
385
530
  }
531
+ /**
532
+ * Infer the configured social providers from an Ally config provider.
533
+ *
534
+ * @typeParam T - The Ally config provider to inspect.
535
+ */
386
536
  export type InferSocialProviders<T extends ConfigProvider<Record<string, AllyManagerDriverFactory>>> = Awaited<ReturnType<T['resolver']>>;
387
537
  /**
388
538
  * Ally service is shared with the HTTP context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/ally",
3
- "version": "6.0.0-next.0",
3
+ "version": "6.1.0",
4
4
  "description": "Social authentication provider for AdonisJS",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "scripts": {
23
23
  "pretest": "npm run lint",
24
- "test": "c8 npm run quick:test",
24
+ "test": "npm run quick:test",
25
25
  "lint": "eslint",
26
26
  "format": "prettier --write .",
27
27
  "typecheck": "tsc --noEmit",
@@ -39,33 +39,39 @@
39
39
  "quick:test": "cross-env NODE_DEBUG=\"adonisjs:ally\" node --enable-source-maps --import=@poppinss/ts-exec bin/test.ts"
40
40
  },
41
41
  "devDependencies": {
42
- "@adonisjs/assembler": "^8.0.0-next.14",
43
- "@adonisjs/core": "^7.0.0-next.8",
44
- "@adonisjs/eslint-config": "^3.0.0-next.4",
42
+ "@adonisjs/assembler": "^8.4.0",
43
+ "@adonisjs/core": "^7.3.0",
44
+ "@adonisjs/eslint-config": "^3.0.0",
45
45
  "@adonisjs/prettier-config": "^1.4.5",
46
- "@adonisjs/tsconfig": "^2.0.0-next.3",
47
- "@japa/assert": "^4.1.1",
48
- "@japa/expect-type": "^2.0.3",
49
- "@japa/file-system": "^2.3.2",
50
- "@japa/runner": "^4.4.0",
51
- "@poppinss/ts-exec": "^1.4.1",
52
- "@release-it/conventional-changelog": "^10.0.1",
53
- "@types/node": "^24.10.0",
54
- "c8": "^10.1.3",
46
+ "@adonisjs/tsconfig": "^2.0.0",
47
+ "@japa/assert": "^4.2.0",
48
+ "@japa/expect-type": "^2.0.4",
49
+ "@japa/file-system": "^3.0.0",
50
+ "@japa/runner": "^5.3.0",
51
+ "@poppinss/ts-exec": "^1.4.4",
52
+ "@release-it/conventional-changelog": "^10.0.6",
53
+ "@types/node": "^25.5.2",
54
+ "c8": "^11.0.0",
55
55
  "copyfiles": "^2.4.1",
56
56
  "cross-env": "^10.1.0",
57
57
  "del-cli": "^7.0.0",
58
- "eslint": "^9.39.0",
59
- "prettier": "^3.6.2",
60
- "release-it": "^19.0.5",
61
- "tsup": "^8.5.0",
62
- "typescript": "^5.9.3"
58
+ "eslint": "^10.2.0",
59
+ "prettier": "^3.8.1",
60
+ "release-it": "^19.2.4",
61
+ "tsup": "^8.5.1",
62
+ "typescript": "^6.0.2"
63
63
  },
64
64
  "dependencies": {
65
- "@poppinss/oauth-client": "^7.0.1"
65
+ "@poppinss/oauth-client": "^7.2.0"
66
66
  },
67
67
  "peerDependencies": {
68
- "@adonisjs/core": "^7.0.0-next.8"
68
+ "@adonisjs/core": "^7.0.0-next.8 || ^7.0.0",
69
+ "@adonisjs/assembler": "^8.0.0"
70
+ },
71
+ "peerDependenciesMeta": {
72
+ "@adonisjs/assembler": {
73
+ "optional": true
74
+ }
69
75
  },
70
76
  "homepage": "https://github.com/adonisjs/ally#readme",
71
77
  "repository": {
@@ -1,9 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- export {
8
- __export
9
- };