@vercel/connect 0.0.4-alpha.9 → 0.0.6-alpha.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.
- package/README.md +29 -5
- package/dist/token.d.ts +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ function getTokenResponse(
|
|
|
55
55
|
): Promise<ConnectTokenResponse>;
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
Returns the full token response including `expiresAt`, `installationId`, `tenantId`, and `externalSubject`. Use this when you need the expiration or any of the metadata fields.
|
|
58
|
+
Returns the full token response including `expiresAt`, connector identity (`connector`), `installationId`, `tenantId`, and `externalSubject`. Use this when you need the expiration or any of the metadata fields.
|
|
59
59
|
|
|
60
60
|
Both functions share an in-process LRU cache (max 100 entries) keyed by `connector` plus the full `params` payload. Cached entries are reused until they fall inside the `validityBufferMs` window before expiration, after which they're refetched.
|
|
61
61
|
|
|
@@ -103,6 +103,14 @@ interface ConnectTokenResponse {
|
|
|
103
103
|
token: string;
|
|
104
104
|
/** Expiration timestamp in ms since epoch. */
|
|
105
105
|
expiresAt: number;
|
|
106
|
+
connector: {
|
|
107
|
+
/** Opaque Vercel Connect connector id. */
|
|
108
|
+
id: string;
|
|
109
|
+
/** Human-readable Vercel Connect connector UID. */
|
|
110
|
+
uid: string;
|
|
111
|
+
/** Vercel Connect connector type identifier. */
|
|
112
|
+
type: string;
|
|
113
|
+
};
|
|
106
114
|
name?: string;
|
|
107
115
|
installationId?: string;
|
|
108
116
|
tenantId?: string;
|
|
@@ -167,7 +175,7 @@ try {
|
|
|
167
175
|
|
|
168
176
|
## `@vercel/connect/ash`
|
|
169
177
|
|
|
170
|
-
Adapter helpers for the [Ash](https://github.com/vercel/ash) connection runtime. Importing this subpath requires `experimental-ash >= 0.
|
|
178
|
+
Adapter helpers for the [Ash](https://github.com/vercel/ash) connection runtime. Importing this subpath requires `experimental-ash >= 0.8.2` to be installed in the consumer project.
|
|
171
179
|
|
|
172
180
|
### `connect(input)`
|
|
173
181
|
|
|
@@ -176,13 +184,17 @@ Builds an Ash `AuthorizationDefinition` backed by Vercel Connect, collapsing the
|
|
|
176
184
|
```ts
|
|
177
185
|
function connect(
|
|
178
186
|
connector: string,
|
|
179
|
-
):
|
|
187
|
+
): AshConnectAuthorizationDefinition<
|
|
188
|
+
InteractiveAuthorizationDefinition<ConnectAuthorizationState>
|
|
189
|
+
>;
|
|
180
190
|
function connect(
|
|
181
191
|
options: AshAuthorizationOptions & { principalType?: "user" },
|
|
182
|
-
):
|
|
192
|
+
): AshConnectAuthorizationDefinition<
|
|
193
|
+
InteractiveAuthorizationDefinition<ConnectAuthorizationState>
|
|
194
|
+
>;
|
|
183
195
|
function connect(
|
|
184
196
|
options: AshAuthorizationOptions & { principalType: "app" },
|
|
185
|
-
): NonInteractiveAuthorizationDefinition
|
|
197
|
+
): AshConnectAuthorizationDefinition<NonInteractiveAuthorizationDefinition>;
|
|
186
198
|
```
|
|
187
199
|
|
|
188
200
|
The shorthand form `connect("linear")` is equivalent to `connect({ connector: "linear" })` — `principalType` defaults to `"user"`, so the helper returns an interactive definition unless you opt into `"app"` explicitly.
|
|
@@ -219,6 +231,18 @@ export default defineMcpClientConnection({
|
|
|
219
231
|
```ts
|
|
220
232
|
type AshAuthorizationInput = string | AshAuthorizationOptions;
|
|
221
233
|
|
|
234
|
+
interface VercelConnectMetadata {
|
|
235
|
+
readonly connector: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
type AshConnectAuthorizationDefinition<
|
|
239
|
+
TAuthorization extends
|
|
240
|
+
| InteractiveAuthorizationDefinition<ConnectAuthorizationState>
|
|
241
|
+
| NonInteractiveAuthorizationDefinition,
|
|
242
|
+
> = TAuthorization & {
|
|
243
|
+
readonly vercelConnect: VercelConnectMetadata;
|
|
244
|
+
};
|
|
245
|
+
|
|
222
246
|
type ConnectAuthorizationPhase =
|
|
223
247
|
| "getToken"
|
|
224
248
|
| "startAuthorization"
|
package/dist/token.d.ts
CHANGED
|
@@ -24,6 +24,14 @@ export interface ConnectTokenResponse {
|
|
|
24
24
|
token: string;
|
|
25
25
|
/** Token expiration timestamp in milliseconds since epoch. */
|
|
26
26
|
expiresAt: number;
|
|
27
|
+
connector: {
|
|
28
|
+
/** Opaque Vercel Connect connector id. */
|
|
29
|
+
id: string;
|
|
30
|
+
/** Human-readable Vercel Connect connector UID. */
|
|
31
|
+
uid: string;
|
|
32
|
+
/** Vercel Connect connector type identifier. */
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
27
35
|
name?: string;
|
|
28
36
|
installationId?: string;
|
|
29
37
|
tenantId?: string;
|