@vercel/connect 0.0.4-alpha.6 → 0.0.4-alpha.8
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/README.md +2 -2
- package/dist/ash/connection-authorization.d.ts +39 -4
- package/dist/ash/connection-authorization.js +3 -2
- package/dist/ash/index.d.ts +1 -1
- package/dist/authjs/connect-provider.d.ts +1 -1
- package/dist/authjs/connect-provider.js +1 -1
- package/dist/betterauth/connect-provider.d.ts +1 -1
- package/dist/betterauth/connect-provider.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -313,7 +313,7 @@ export const auth = betterAuth({
|
|
|
313
313
|
| -------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
314
314
|
| `id` | `string` | Provider id used by Better Auth's generic OAuth plugin. Surfaces in the sign-in URL and account rows. |
|
|
315
315
|
| `connector` | `string` | Vercel Connect connector identifier — accepts `scl_...` or the human-readable UID. |
|
|
316
|
-
| `scopes` | `readonly string[]` | Scopes to request. `offline_access` is added automatically. Defaults to `["
|
|
316
|
+
| `scopes` | `readonly string[]` | Scopes to request. `offline_access` is added automatically. Defaults to `["openid"]`. |
|
|
317
317
|
| `getVercelOidcToken` | `() => Promise<string>` | Override the OIDC token fetcher. Defaults to `getVercelOidcToken` from `@vercel/oidc`. |
|
|
318
318
|
|
|
319
319
|
When the OIDC token is readable, the helper scopes the Vercel Connect consent UI to the deployment's Vercel team (`?teamId=...` on the authorization URL); outside Vercel it falls back to the unqualified URL.
|
|
@@ -354,7 +354,7 @@ export const authConfig: AuthConfig = {
|
|
|
354
354
|
| `id` | `string` | Provider id surfaced by Auth.js. Becomes the path segment in callback URLs and the `provider` field on accounts. |
|
|
355
355
|
| `name` | `string` | Human-readable display name used by Auth.js sign-in UIs. |
|
|
356
356
|
| `connector` | `string` | Vercel Connect connector identifier — accepts `scl_...` or the human-readable UID. |
|
|
357
|
-
| `scopes` | `readonly string[]` | Scopes to request. `offline_access` is added automatically. Defaults to `["
|
|
357
|
+
| `scopes` | `readonly string[]` | Scopes to request. `offline_access` is added automatically. Defaults to `["openid"]`. |
|
|
358
358
|
| `getVercelOidcToken` | `() => Promise<string>` | Override the OIDC token fetcher. Defaults to `getVercelOidcToken` from `@vercel/oidc`. |
|
|
359
359
|
|
|
360
360
|
#### `ConnectProfile`
|
|
@@ -109,6 +109,36 @@ export interface AshAuthorizationOptions {
|
|
|
109
109
|
}
|
|
110
110
|
/** Input accepted by {@link connect}. */
|
|
111
111
|
export type AshAuthorizationInput = string | AshAuthorizationOptions;
|
|
112
|
+
/**
|
|
113
|
+
* Structurally-readable marker exposed on every {@link connect} return
|
|
114
|
+
* value so downstream tooling can detect Vercel Connect-backed
|
|
115
|
+
* connections at compile time and surface deep links to the matching
|
|
116
|
+
* connector settings page.
|
|
117
|
+
*
|
|
118
|
+
* The `connector` field carries the raw value the author passed to
|
|
119
|
+
* {@link connect} — either the human-readable UID
|
|
120
|
+
* (`"oauth/mcp-linear-app"`) or the opaque service-connector key
|
|
121
|
+
* (`"scl_..."`). Consumers that need the canonical `scl_...` form
|
|
122
|
+
* (eg. the Vercel dashboard, when building a `/connect/<clientId>`
|
|
123
|
+
* URL) can resolve UID → `scl_...` against the Vercel Connect API;
|
|
124
|
+
* both forms address the same connector.
|
|
125
|
+
*
|
|
126
|
+
* The marker is purely metadata — it does not influence the runtime
|
|
127
|
+
* token-fetching behaviour, which continues to be driven by the
|
|
128
|
+
* `getToken` / `startAuthorization` / `completeAuthorization`
|
|
129
|
+
* callbacks.
|
|
130
|
+
*/
|
|
131
|
+
export interface VercelConnectMetadata {
|
|
132
|
+
readonly connector: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Augments the standard Ash authorization shape with the
|
|
136
|
+
* {@link VercelConnectMetadata} marker, narrowed to whichever flavour
|
|
137
|
+
* `connect()` produces.
|
|
138
|
+
*/
|
|
139
|
+
export type AshConnectAuthorizationDefinition<TAuthorization extends InteractiveAuthorizationDefinition<ConnectAuthorizationState> | NonInteractiveAuthorizationDefinition> = TAuthorization & {
|
|
140
|
+
readonly vercelConnect: VercelConnectMetadata;
|
|
141
|
+
};
|
|
112
142
|
/**
|
|
113
143
|
* Builds an Ash {@link AuthorizationDefinition} backed by Vercel
|
|
114
144
|
* Connect. The return type narrows based on
|
|
@@ -120,12 +150,17 @@ export type AshAuthorizationInput = string | AshAuthorizationOptions;
|
|
|
120
150
|
* - `principalType: "app"` returns a
|
|
121
151
|
* {@link NonInteractiveAuthorizationDefinition}; Ash never runs a
|
|
122
152
|
* consent flow for app-scoped connectors.
|
|
153
|
+
*
|
|
154
|
+
* Every returned definition also carries a {@link VercelConnectMetadata}
|
|
155
|
+
* marker on its `vercelConnect` field so downstream tooling (Ash
|
|
156
|
+
* compiler, dashboards) can detect Vercel Connect-backed connections
|
|
157
|
+
* without inspecting closure state.
|
|
123
158
|
*/
|
|
124
|
-
export declare function connect(connector: string): InteractiveAuthorizationDefinition<ConnectAuthorizationState
|
|
159
|
+
export declare function connect(connector: string): AshConnectAuthorizationDefinition<InteractiveAuthorizationDefinition<ConnectAuthorizationState>>;
|
|
125
160
|
export declare function connect(options: AshAuthorizationOptions & {
|
|
126
161
|
readonly principalType?: "user";
|
|
127
|
-
}): InteractiveAuthorizationDefinition<ConnectAuthorizationState
|
|
162
|
+
}): AshConnectAuthorizationDefinition<InteractiveAuthorizationDefinition<ConnectAuthorizationState>>;
|
|
128
163
|
export declare function connect(options: AshAuthorizationOptions & {
|
|
129
164
|
readonly principalType: "app";
|
|
130
|
-
}): NonInteractiveAuthorizationDefinition
|
|
131
|
-
export declare function connect(options: AshAuthorizationInput): InteractiveAuthorizationDefinition<ConnectAuthorizationState> | NonInteractiveAuthorizationDefinition
|
|
165
|
+
}): AshConnectAuthorizationDefinition<NonInteractiveAuthorizationDefinition>;
|
|
166
|
+
export declare function connect(options: AshAuthorizationInput): AshConnectAuthorizationDefinition<InteractiveAuthorizationDefinition<ConnectAuthorizationState> | NonInteractiveAuthorizationDefinition>;
|
|
@@ -33,10 +33,11 @@ import { startAuthorization } from "../authorization.js";
|
|
|
33
33
|
import { ConnectorInstallationRequiredError, getTokenResponse, NoValidTokenError, UserAuthorizationRequiredError, } from "../token.js";
|
|
34
34
|
export function connect(input) {
|
|
35
35
|
const options = normalizeAuthorizationOptions(input);
|
|
36
|
+
const vercelConnect = { connector: options.connector };
|
|
36
37
|
if (options.principalType === "app") {
|
|
37
|
-
return buildNonInteractiveDefinition(options);
|
|
38
|
+
return { ...buildNonInteractiveDefinition(options), vercelConnect };
|
|
38
39
|
}
|
|
39
|
-
return buildInteractiveDefinition(options);
|
|
40
|
+
return { ...buildInteractiveDefinition(options), vercelConnect };
|
|
40
41
|
}
|
|
41
42
|
function normalizeAuthorizationOptions(input) {
|
|
42
43
|
if (typeof input === "string") {
|
package/dist/ash/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* this barrel re-exports the public API so consumers import
|
|
7
7
|
* everything from `@vercel/connect/ash`.
|
|
8
8
|
*/
|
|
9
|
-
export { connect, type AshAuthorizationInput, type AshAuthorizationOptions, type ConnectAuthorizationPhase, type ConnectAuthorizationState, } from "./connection-authorization.js";
|
|
9
|
+
export { connect, type AshAuthorizationInput, type AshAuthorizationOptions, type AshConnectAuthorizationDefinition, type ConnectAuthorizationPhase, type ConnectAuthorizationState, type VercelConnectMetadata, } from "./connection-authorization.js";
|
|
10
10
|
export { CONNECT_OAUTH_ISSUER, connectOAuth, type ConnectOAuthAudienceEnvironment, type ConnectOAuthEnvironment, type ConnectOAuthOptions, } from "./connect-oauth.js";
|
|
11
11
|
export { connectSlackCredentials } from "./slack-credentials.js";
|
|
@@ -26,7 +26,7 @@ export interface AuthJsConnectOptions {
|
|
|
26
26
|
/**
|
|
27
27
|
* Scopes to request. `offline_access` is added automatically so
|
|
28
28
|
* the Vercel Connect side can mint refresh tokens. Defaults to
|
|
29
|
-
* `["
|
|
29
|
+
* `["openid"]`.
|
|
30
30
|
*/
|
|
31
31
|
readonly scopes?: readonly string[];
|
|
32
32
|
/**
|
|
@@ -35,7 +35,7 @@ const CONNECT_USERINFO_URL = "https://connect.vercel.com/oauth/userinfo";
|
|
|
35
35
|
*/
|
|
36
36
|
export function connect(options) {
|
|
37
37
|
const fetchVercelToken = options.getVercelOidcToken ?? getVercelOidcToken;
|
|
38
|
-
const scope = Array.from(new Set([...(options.scopes ?? ["
|
|
38
|
+
const scope = Array.from(new Set([...(options.scopes ?? ["openid"]), "offline_access"])).join(" ");
|
|
39
39
|
return {
|
|
40
40
|
id: options.id,
|
|
41
41
|
name: options.name,
|
|
@@ -15,7 +15,7 @@ export interface BetterAuthConnectOptions {
|
|
|
15
15
|
readonly connector: string;
|
|
16
16
|
/**
|
|
17
17
|
* Scopes to request. `offline_access` is added automatically so the
|
|
18
|
-
* Vercel Connect side can mint refresh tokens. Defaults to `["
|
|
18
|
+
* Vercel Connect side can mint refresh tokens. Defaults to `["openid"]`.
|
|
19
19
|
*/
|
|
20
20
|
readonly scopes?: readonly string[];
|
|
21
21
|
/**
|
|
@@ -39,7 +39,7 @@ const CONNECT_USERINFO_URL = "https://connect.vercel.com/oauth/userinfo";
|
|
|
39
39
|
*/
|
|
40
40
|
export function connect(options) {
|
|
41
41
|
const fetchVercelToken = options.getVercelOidcToken ?? getVercelOidcToken;
|
|
42
|
-
const scopes = Array.from(new Set([...(options.scopes ?? ["
|
|
42
|
+
const scopes = Array.from(new Set([...(options.scopes ?? ["openid"]), "offline_access"]));
|
|
43
43
|
return {
|
|
44
44
|
providerId: options.providerId,
|
|
45
45
|
clientId: options.connector,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/connect",
|
|
3
|
-
"version": "0.0.4-alpha.
|
|
3
|
+
"version": "0.0.4-alpha.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@auth/core": ">=0.37.0",
|
|
31
31
|
"better-auth": ">=1.5.0",
|
|
32
|
-
"experimental-ash": ">=0.
|
|
32
|
+
"experimental-ash": ">=0.8.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependenciesMeta": {
|
|
35
35
|
"@auth/core": {
|