@vercel/connect 0.4.0 → 0.4.2
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/authorization.js +11 -6
- package/package.json +3 -3
package/dist/authorization.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { getVercelOidcToken } from '@vercel/oidc';
|
|
2
|
+
const DETACHED_INTERACTIVE_AUTH_MODE = 'detached';
|
|
3
|
+
const INTERACTIVE_AUTH_MODE_ENV = 'VERCEL_CONNECT_INTERACTIVE_AUTH_MODE';
|
|
2
4
|
export async function startAuthorization(connector, params, options) {
|
|
3
5
|
if (!connector) {
|
|
4
6
|
throw new Error('connector is required');
|
|
5
7
|
}
|
|
6
|
-
|
|
8
|
+
const detachedInteractiveAuth = process.env[INTERACTIVE_AUTH_MODE_ENV] === DETACHED_INTERACTIVE_AUTH_MODE;
|
|
9
|
+
if (!detachedInteractiveAuth && options?.callbackUrl !== undefined) {
|
|
7
10
|
validateCallbackUrl(options.callbackUrl);
|
|
8
11
|
}
|
|
9
12
|
if (options?.webhook !== undefined) {
|
|
@@ -11,14 +14,16 @@ export async function startAuthorization(connector, params, options) {
|
|
|
11
14
|
}
|
|
12
15
|
const vercelToken = options?.vercelToken ?? (await getVercelOidcToken());
|
|
13
16
|
const endpoint = `https://api.vercel.com/v1/connect/authorize/${encodeURIComponent(connector)}`;
|
|
17
|
+
const deviceCode = options?.deviceCode ?? (detachedInteractiveAuth ? true : undefined);
|
|
18
|
+
const returnUrl = !detachedInteractiveAuth && options?.callbackUrl !== undefined
|
|
19
|
+
? { returnUrl: options.callbackUrl }
|
|
20
|
+
: {};
|
|
14
21
|
const body = {
|
|
15
22
|
...params,
|
|
16
|
-
...
|
|
17
|
-
returnUrl: options.callbackUrl,
|
|
18
|
-
}),
|
|
23
|
+
...returnUrl,
|
|
19
24
|
...(options?.webhook !== undefined && { webhook: options.webhook }),
|
|
20
|
-
...(
|
|
21
|
-
deviceCode
|
|
25
|
+
...(deviceCode !== undefined && {
|
|
26
|
+
deviceCode,
|
|
22
27
|
}),
|
|
23
28
|
...(options?.expiresInMs !== undefined && {
|
|
24
29
|
expiresInMs: options.expiresInMs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/connect",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
"@ai-sdk/mcp": "2.0.0-beta.37",
|
|
77
77
|
"@auth/core": "0.37.4",
|
|
78
78
|
"@chat-adapter/slack": "4.31.0",
|
|
79
|
-
"ai": "7.0.
|
|
79
|
+
"ai": "7.0.26",
|
|
80
80
|
"better-auth": "1.5.5",
|
|
81
|
-
"eve": "0.
|
|
81
|
+
"eve": "0.24.3",
|
|
82
82
|
"typescript": "^5"
|
|
83
83
|
},
|
|
84
84
|
"private": false,
|