@vercel/connect 2.1.0 → 2.2.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.
- package/README.md +15 -1
- package/dist/chat/index.d.ts +2 -1
- package/dist/chat/index.js +1 -0
- package/dist/chat/teams-adapter.d.ts +31 -0
- package/dist/chat/teams-adapter.js +43 -0
- package/dist/chat/types.d.ts +11 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ SDK for obtaining scoped tokens for third-party services on behalf of apps or us
|
|
|
5
5
|
Seven entrypoints, all ESM:
|
|
6
6
|
|
|
7
7
|
- `@vercel/connect` — core token / authorization SDK
|
|
8
|
-
- `@vercel/connect/chat` — adapter helpers for the [Chat SDK](https://chat-sdk.dev) (`chat`): `connectSlackAdapter`, `connectDiscordAdapter`, `connectGitHubAdapter`, `connectLinearAdapter`, `connectNotionAdapter`, `connectTelegramAdapter`, `connectSendblueAdapter` (no Chat SDK dependency — returns structural config)
|
|
8
|
+
- `@vercel/connect/chat` — adapter helpers for the [Chat SDK](https://chat-sdk.dev) (`chat`): `connectSlackAdapter`, `connectDiscordAdapter`, `connectGitHubAdapter`, `connectLinearAdapter`, `connectNotionAdapter`, `connectTelegramAdapter`, `connectSendblueAdapter`, `connectTeamsAdapter` (no Chat SDK dependency — returns structural config)
|
|
9
9
|
- `@vercel/connect/ai-sdk` — [Vercel AI SDK](https://ai-sdk.dev) glue: re-exports `connectAuthProvider` for MCP transports (optional peers: `ai`, `@ai-sdk/mcp`)
|
|
10
10
|
- `@vercel/connect/mcp` — canonical MCP-spec `OAuthClientProvider` for any MCP client (optional peer: `@ai-sdk/mcp`)
|
|
11
11
|
- `@vercel/connect/eve` — adapter helpers for [Eve](https://github.com/vercel/eve) connections (optional peer: `eve`)
|
|
@@ -62,6 +62,20 @@ createSlackAdapter({
|
|
|
62
62
|
`connectGitHubAdapter` (`installationToken`), and `connectLinearAdapter`
|
|
63
63
|
(`accessToken`) follow the same shape. `connectSendblueAdapter` supplies a
|
|
64
64
|
lazy Sendblue `accessToken` and Connect OIDC webhook verifier.
|
|
65
|
+
`connectTeamsAdapter` supplies a lazy Microsoft Teams `appId`, a scope-aware
|
|
66
|
+
`token` callback for Bot Framework and Microsoft Graph, and Connect OIDC webhook
|
|
67
|
+
verification. Use it with a Teams adapter release that supports lazy `appId`
|
|
68
|
+
and `webhookVerifier`:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { createTeamsAdapter } from '@chat-adapter/teams';
|
|
72
|
+
import { connectTeamsAdapter } from '@vercel/connect/chat';
|
|
73
|
+
|
|
74
|
+
createTeamsAdapter({
|
|
75
|
+
...connectTeamsAdapter('microsoft-teams/my-bot'),
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
65
79
|
`connectNotionAdapter` supplies only the outbound `token`; native Notion
|
|
66
80
|
webhooks still require `NOTION_VERIFICATION_TOKEN`. `connectTelegramAdapter`
|
|
67
81
|
supplies only `botToken`; Telegram retains native webhook verification or
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export { createConnectWebhookVerifier, type ConnectWebhookVerifier, type ConnectWebhookVerifierOptions, } from './webhook-verifier.js';
|
|
24
|
-
export type { ConnectDiscordAdapterConfig, ConnectGitHubAdapterConfig, ConnectLinearAdapterConfig, ConnectLinqAdapterConfig, ConnectLinqCredentials, ConnectNotionAdapterConfig, ConnectSendblueAdapterConfig, ConnectTelegramAdapterConfig, ConnectTokenResolver, } from './types.js';
|
|
24
|
+
export type { ConnectDiscordAdapterConfig, ConnectGitHubAdapterConfig, ConnectLinearAdapterConfig, ConnectLinqAdapterConfig, ConnectLinqCredentials, ConnectNotionAdapterConfig, ConnectSendblueAdapterConfig, ConnectTeamsAdapterConfig, ConnectTelegramAdapterConfig, ConnectTokenResolver, } from './types.js';
|
|
25
25
|
export { connectDiscordAdapter, type ConnectDiscordAdapterParams, } from './discord-adapter.js';
|
|
26
26
|
export { connectSlackAdapter, type ConnectSlackAdapterConfig, type ConnectSlackAdapterParams, } from './slack-adapter.js';
|
|
27
27
|
export { connectGitHubAdapter, type ConnectGitHubAdapterParams, } from './github-adapter.js';
|
|
@@ -30,3 +30,4 @@ export { connectLinqAdapter, type ConnectLinqAdapterParams, } from './linq-adapt
|
|
|
30
30
|
export { connectNotionAdapter, type ConnectNotionAdapterParams, } from './notion-adapter.js';
|
|
31
31
|
export { connectTelegramAdapter, type ConnectTelegramAdapterParams, } from './telegram-adapter.js';
|
|
32
32
|
export { connectSendblueAdapter, type ConnectSendblueAdapterParams, } from './sendblue-adapter.js';
|
|
33
|
+
export { connectTeamsAdapter, type ConnectTeamsAdapterParams, } from './teams-adapter.js';
|
package/dist/chat/index.js
CHANGED
|
@@ -29,3 +29,4 @@ export { connectLinqAdapter, } from './linq-adapter.js';
|
|
|
29
29
|
export { connectNotionAdapter, } from './notion-adapter.js';
|
|
30
30
|
export { connectTelegramAdapter, } from './telegram-adapter.js';
|
|
31
31
|
export { connectSendblueAdapter, } from './sendblue-adapter.js';
|
|
32
|
+
export { connectTeamsAdapter, } from './teams-adapter.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ConnectOptions, type ConnectTokenParams } from '../index.js';
|
|
2
|
+
import type { ConnectTeamsAdapterConfig } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Teams bot tokens are app-scoped. The adapter selects the resource scopes
|
|
5
|
+
* for each call, so neither `subject` nor `scopes` can be overridden here.
|
|
6
|
+
*/
|
|
7
|
+
export type ConnectTeamsAdapterParams = Omit<ConnectTokenParams, 'subject' | 'scopes'>;
|
|
8
|
+
/**
|
|
9
|
+
* Build a Microsoft Teams adapter config backed by a managed Connect bot.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { createTeamsAdapter } from '@chat-adapter/teams';
|
|
13
|
+
* import { connectTeamsAdapter } from '@vercel/connect/chat';
|
|
14
|
+
*
|
|
15
|
+
* createTeamsAdapter({
|
|
16
|
+
* ...connectTeamsAdapter('microsoft-teams/my-bot'),
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* The app id is resolved lazily from public connector metadata. The token
|
|
21
|
+
* callback requests separate Bot Framework and Microsoft Graph tokens using
|
|
22
|
+
* the adapter's scopes, with caching and refresh handled by Connect. Graph
|
|
23
|
+
* access requires the bot's resource-specific permissions to be granted when
|
|
24
|
+
* it is installed in a team.
|
|
25
|
+
*
|
|
26
|
+
* Connect selects the managed bot's home tenant, so the token callback's
|
|
27
|
+
* tenant argument does not change token selection. The webhook verifier
|
|
28
|
+
* validates Connect-forwarded activities with Vercel OIDC after Connect has
|
|
29
|
+
* verified Microsoft's native JWT.
|
|
30
|
+
*/
|
|
31
|
+
export declare function connectTeamsAdapter(connector: string, params?: ConnectTeamsAdapterParams, options?: ConnectOptions): ConnectTeamsAdapterConfig;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getConnectorMetadata, getToken, } from '../index.js';
|
|
2
|
+
import { createConnectWebhookVerifier } from './webhook-verifier.js';
|
|
3
|
+
/**
|
|
4
|
+
* Build a Microsoft Teams adapter config backed by a managed Connect bot.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { createTeamsAdapter } from '@chat-adapter/teams';
|
|
8
|
+
* import { connectTeamsAdapter } from '@vercel/connect/chat';
|
|
9
|
+
*
|
|
10
|
+
* createTeamsAdapter({
|
|
11
|
+
* ...connectTeamsAdapter('microsoft-teams/my-bot'),
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* The app id is resolved lazily from public connector metadata. The token
|
|
16
|
+
* callback requests separate Bot Framework and Microsoft Graph tokens using
|
|
17
|
+
* the adapter's scopes, with caching and refresh handled by Connect. Graph
|
|
18
|
+
* access requires the bot's resource-specific permissions to be granted when
|
|
19
|
+
* it is installed in a team.
|
|
20
|
+
*
|
|
21
|
+
* Connect selects the managed bot's home tenant, so the token callback's
|
|
22
|
+
* tenant argument does not change token selection. The webhook verifier
|
|
23
|
+
* validates Connect-forwarded activities with Vercel OIDC after Connect has
|
|
24
|
+
* verified Microsoft's native JWT.
|
|
25
|
+
*/
|
|
26
|
+
export function connectTeamsAdapter(connector, params = {}, options) {
|
|
27
|
+
return {
|
|
28
|
+
appId: async () => {
|
|
29
|
+
const metadata = await getConnectorMetadata(connector, options);
|
|
30
|
+
const appId = metadata.vendor.appId;
|
|
31
|
+
if (typeof appId !== 'string' || appId.length === 0) {
|
|
32
|
+
throw new Error(`Vercel Connect connector ${connector} did not return a Microsoft Teams app id.`);
|
|
33
|
+
}
|
|
34
|
+
return appId;
|
|
35
|
+
},
|
|
36
|
+
token: scope => getToken(connector, {
|
|
37
|
+
...params,
|
|
38
|
+
subject: { type: 'app' },
|
|
39
|
+
scopes: Array.isArray(scope) ? scope : [scope],
|
|
40
|
+
}, options),
|
|
41
|
+
webhookVerifier: createConnectWebhookVerifier(),
|
|
42
|
+
};
|
|
43
|
+
}
|
package/dist/chat/types.d.ts
CHANGED
|
@@ -76,6 +76,17 @@ export interface ConnectNotionAdapterConfig {
|
|
|
76
76
|
export interface ConnectTelegramAdapterConfig {
|
|
77
77
|
botToken: ConnectTokenResolver;
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Partial Microsoft Teams adapter config backed by Vercel Connect.
|
|
81
|
+
*
|
|
82
|
+
* Structurally matches the lazy `appId`, scope-aware `token`, and
|
|
83
|
+
* `webhookVerifier` options of `createTeamsAdapter` from `@chat-adapter/teams`.
|
|
84
|
+
*/
|
|
85
|
+
export interface ConnectTeamsAdapterConfig {
|
|
86
|
+
appId: ConnectTokenResolver;
|
|
87
|
+
token: (scope: string | string[], tenantId?: string) => Promise<string>;
|
|
88
|
+
webhookVerifier: ConnectWebhookVerifier;
|
|
89
|
+
}
|
|
79
90
|
/**
|
|
80
91
|
* Partial Sendblue adapter config backed by Vercel Connect.
|
|
81
92
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/connect",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dist"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vercel/oidc": "3.8.
|
|
45
|
+
"@vercel/oidc": "3.8.8"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@ai-sdk/mcp": "^1 || ^2",
|