@vercel/connect 0.0.4-alpha.4 → 0.0.4-alpha.7

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.
@@ -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") {
@@ -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,9 +26,9 @@
26
26
  import { customFetch } from "@auth/core";
27
27
  import { getVercelOidcToken } from "@vercel/oidc";
28
28
  import { tryGetVercelTeamId, withTeamId } from "../internal/team-id.js";
29
- const CONNECT_AUTHORIZATION_URL = "https://vercel.com/api/connex/oauth/authorize";
30
- const CONNECT_TOKEN_URL = "https://vercel.com/api/connex/oauth/token";
31
- const CONNECT_USERINFO_URL = "https://vercel.com/api/connex/oauth/userinfo";
29
+ const CONNECT_AUTHORIZATION_URL = "https://connect.vercel.com/oauth/authorize";
30
+ const CONNECT_TOKEN_URL = "https://connect.vercel.com/oauth/token";
31
+ const CONNECT_USERINFO_URL = "https://connect.vercel.com/oauth/userinfo";
32
32
  /**
33
33
  * Builds an Auth.js `OAuth2Config` for Vercel Connect. Push the
34
34
  * result into `AuthConfig.providers`.
@@ -10,7 +10,7 @@ export async function startAuthorization(connector, params, options) {
10
10
  validateWebhookUrl(options.webhook);
11
11
  }
12
12
  const vercelToken = options?.vercelToken ?? (await getVercelOidcToken());
13
- const endpoint = `https://api.vercel.com/v1/connex/authorize/${encodeURIComponent(connector)}`;
13
+ const endpoint = `https://api.vercel.com/v1/connect/authorize/${encodeURIComponent(connector)}`;
14
14
  const body = {
15
15
  ...params,
16
16
  ...(options?.callbackUrl !== undefined && {
@@ -30,9 +30,9 @@
30
30
  import { getVercelOidcToken } from "@vercel/oidc";
31
31
  import { getOAuth2Tokens } from "better-auth/oauth2";
32
32
  import { tryGetVercelTeamId, withTeamId } from "../internal/team-id.js";
33
- const CONNECT_AUTHORIZATION_URL = "https://vercel.com/api/connex/oauth/authorize";
34
- const CONNECT_TOKEN_URL = "https://vercel.com/api/connex/oauth/token";
35
- const CONNECT_USERINFO_URL = "https://vercel.com/api/connex/oauth/userinfo";
33
+ const CONNECT_AUTHORIZATION_URL = "https://connect.vercel.com/oauth/authorize";
34
+ const CONNECT_TOKEN_URL = "https://connect.vercel.com/oauth/token";
35
+ const CONNECT_USERINFO_URL = "https://connect.vercel.com/oauth/userinfo";
36
36
  /**
37
37
  * Builds a `GenericOAuthConfig` entry for Vercel Connect. Pass the
38
38
  * result into `genericOAuth({ config: [...] })`.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Best-effort Vercel team-id extraction for the OAuth adapters.
3
3
  *
4
- * Vercel Connect's `/api/connex/oauth/authorize` endpoint accepts an
4
+ * Vercel Connect's `/oauth/authorize` endpoint accepts an
5
5
  * optional `?teamId=...` query parameter that scopes the consent UI
6
6
  * to a specific team. The team id lives inside the Vercel OIDC
7
7
  * token's `owner_id` claim, so we decode the JWT payload (no
package/dist/token.js CHANGED
@@ -34,7 +34,7 @@ export async function getTokenResponse(connector, params, options) {
34
34
  cache.delete(cacheKey);
35
35
  }
36
36
  const vercelToken = options?.vercelToken ?? (await getVercelOidcToken());
37
- const endpoint = `https://api.vercel.com/v1/connex/token/${encodeURIComponent(connector)}`;
37
+ const endpoint = `https://api.vercel.com/v1/connect/token/${encodeURIComponent(connector)}`;
38
38
  const response = await fetch(endpoint, {
39
39
  method: "POST",
40
40
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/connect",
3
- "version": "0.0.4-alpha.4",
3
+ "version": "0.0.4-alpha.7",
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.3.0-alpha.29"
32
+ "experimental-ash": ">=0.8.2"
33
33
  },
34
34
  "peerDependenciesMeta": {
35
35
  "@auth/core": {