@vercel/connect 2.8.0 → 2.9.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 +4 -2
- package/dist/chat/index.d.ts +2 -1
- package/dist/chat/index.js +1 -0
- package/dist/chat/resend-adapter.d.ts +41 -0
- package/dist/chat/resend-adapter.js +38 -0
- package/dist/chat/types.d.ts +10 -0
- package/dist/chat/webhook-verifier.d.ts +1 -1
- package/dist/chat/webhook-verifier.js +1 -1
- package/dist/eve/index.d.ts +1 -0
- package/dist/eve/index.js +1 -0
- package/dist/eve/resend-credentials.d.ts +36 -0
- package/dist/eve/resend-credentials.js +26 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -113,8 +113,10 @@ createSlackAdapter({
|
|
|
113
113
|
|
|
114
114
|
`connectDiscordAdapter` (`botToken` and `applicationId`),
|
|
115
115
|
`connectGitHubAdapter` (`installationToken`), and `connectLinearAdapter`
|
|
116
|
-
(`accessToken`) follow the same shape. `
|
|
117
|
-
|
|
116
|
+
(`accessToken`) follow the same shape. `connectResendAdapter` supplies a lazy
|
|
117
|
+
Resend `apiKey` and Connect OIDC webhook verifier; pass `fromAddress` yourself.
|
|
118
|
+
`connectSendblueAdapter` supplies a lazy Sendblue `accessToken` and Connect OIDC
|
|
119
|
+
webhook verifier.
|
|
118
120
|
`connectTeamsAdapter` supplies a lazy Microsoft Teams `appId`, a scope-aware
|
|
119
121
|
`token` callback for Bot Framework and Microsoft Graph, and Connect OIDC webhook
|
|
120
122
|
verification. Use it with a Teams adapter release that supports lazy `appId`
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -21,13 +21,14 @@
|
|
|
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, ConnectTeamsAdapterConfig, ConnectTelegramAdapterConfig, ConnectTokenResolver, } from './types.js';
|
|
24
|
+
export type { ConnectDiscordAdapterConfig, ConnectGitHubAdapterConfig, ConnectLinearAdapterConfig, ConnectLinqAdapterConfig, ConnectLinqCredentials, ConnectNotionAdapterConfig, ConnectResendAdapterConfig, 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';
|
|
28
28
|
export { connectLinearAdapter, type ConnectLinearAdapterParams, } from './linear-adapter.js';
|
|
29
29
|
export { connectLinqAdapter, type ConnectLinqAdapterParams, } from './linq-adapter.js';
|
|
30
30
|
export { connectNotionAdapter, type ConnectNotionAdapterParams, } from './notion-adapter.js';
|
|
31
|
+
export { connectResendAdapter, type ConnectResendAdapterParams, } from './resend-adapter.js';
|
|
31
32
|
export { connectTelegramAdapter, type ConnectTelegramAdapterParams, } from './telegram-adapter.js';
|
|
32
33
|
export { connectSendblueAdapter, type ConnectSendblueAdapterParams, } from './sendblue-adapter.js';
|
|
33
34
|
export { connectTeamsAdapter, type ConnectTeamsAdapterParams, } from './teams-adapter.js';
|
package/dist/chat/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export { connectGitHubAdapter, } from './github-adapter.js';
|
|
|
27
27
|
export { connectLinearAdapter, } from './linear-adapter.js';
|
|
28
28
|
export { connectLinqAdapter, } from './linq-adapter.js';
|
|
29
29
|
export { connectNotionAdapter, } from './notion-adapter.js';
|
|
30
|
+
export { connectResendAdapter, } from './resend-adapter.js';
|
|
30
31
|
export { connectTelegramAdapter, } from './telegram-adapter.js';
|
|
31
32
|
export { connectSendblueAdapter, } from './sendblue-adapter.js';
|
|
32
33
|
export { connectTeamsAdapter, } from './teams-adapter.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ConnectOptions, type ConnectTokenParams } from '../index.js';
|
|
2
|
+
import type { ConnectResendAdapterConfig } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Token parameters accepted by {@link connectResendAdapter}.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors {@link ConnectTokenParams} from `@vercel/connect`, minus
|
|
7
|
+
* `subject` — Resend API keys are app-scoped, so this helper pins the
|
|
8
|
+
* subject to `{ type: "app" }`.
|
|
9
|
+
*/
|
|
10
|
+
export type ConnectResendAdapterParams = Omit<ConnectTokenParams, 'subject'>;
|
|
11
|
+
/**
|
|
12
|
+
* Build a Resend adapter config fragment backed by a Vercel Connect
|
|
13
|
+
* connector.
|
|
14
|
+
*
|
|
15
|
+
* Spread the result into `createResendAdapter` from
|
|
16
|
+
* `@resend/chat-sdk-adapter`, alongside the adapter's own `fromAddress`:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { createResendAdapter } from '@resend/chat-sdk-adapter';
|
|
20
|
+
* import { connectResendAdapter } from '@vercel/connect/chat';
|
|
21
|
+
*
|
|
22
|
+
* createResendAdapter({
|
|
23
|
+
* ...connectResendAdapter('resend/acme-resend'),
|
|
24
|
+
* fromAddress: 'bot@acme.com',
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* The lazy `apiKey` resolver fetches the app-scoped Connect token each time
|
|
29
|
+
* the adapter needs to call the Resend API, so Connect token rotation takes
|
|
30
|
+
* effect without rebuilding the adapter.
|
|
31
|
+
*
|
|
32
|
+
* Connect retains Resend's webhook signing secret and verifies the Svix
|
|
33
|
+
* signature on trigger-forwarded webhooks before attaching a Vercel OIDC
|
|
34
|
+
* token. `webhookVerifier` validates that OIDC token, replacing the adapter's
|
|
35
|
+
* native `webhookSecret` / `RESEND_WEBHOOK_SECRET` verification.
|
|
36
|
+
*
|
|
37
|
+
* The optional `params` and `options` arguments mirror the signature of
|
|
38
|
+
* {@link getToken}, allowing callers to pass through fields like
|
|
39
|
+
* `installationId`, `scopes`, or `validityBufferMs`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function connectResendAdapter(connector: string, params?: ConnectResendAdapterParams, options?: ConnectOptions): ConnectResendAdapterConfig;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getToken, } from '../index.js';
|
|
2
|
+
import { createConnectWebhookVerifier } from './webhook-verifier.js';
|
|
3
|
+
/**
|
|
4
|
+
* Build a Resend adapter config fragment backed by a Vercel Connect
|
|
5
|
+
* connector.
|
|
6
|
+
*
|
|
7
|
+
* Spread the result into `createResendAdapter` from
|
|
8
|
+
* `@resend/chat-sdk-adapter`, alongside the adapter's own `fromAddress`:
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { createResendAdapter } from '@resend/chat-sdk-adapter';
|
|
12
|
+
* import { connectResendAdapter } from '@vercel/connect/chat';
|
|
13
|
+
*
|
|
14
|
+
* createResendAdapter({
|
|
15
|
+
* ...connectResendAdapter('resend/acme-resend'),
|
|
16
|
+
* fromAddress: 'bot@acme.com',
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* The lazy `apiKey` resolver fetches the app-scoped Connect token each time
|
|
21
|
+
* the adapter needs to call the Resend API, so Connect token rotation takes
|
|
22
|
+
* effect without rebuilding the adapter.
|
|
23
|
+
*
|
|
24
|
+
* Connect retains Resend's webhook signing secret and verifies the Svix
|
|
25
|
+
* signature on trigger-forwarded webhooks before attaching a Vercel OIDC
|
|
26
|
+
* token. `webhookVerifier` validates that OIDC token, replacing the adapter's
|
|
27
|
+
* native `webhookSecret` / `RESEND_WEBHOOK_SECRET` verification.
|
|
28
|
+
*
|
|
29
|
+
* The optional `params` and `options` arguments mirror the signature of
|
|
30
|
+
* {@link getToken}, allowing callers to pass through fields like
|
|
31
|
+
* `installationId`, `scopes`, or `validityBufferMs`.
|
|
32
|
+
*/
|
|
33
|
+
export function connectResendAdapter(connector, params = {}, options) {
|
|
34
|
+
return {
|
|
35
|
+
apiKey: () => getToken(connector, { ...params, subject: { type: 'app' } }, options),
|
|
36
|
+
webhookVerifier: createConnectWebhookVerifier(),
|
|
37
|
+
};
|
|
38
|
+
}
|
package/dist/chat/types.d.ts
CHANGED
|
@@ -66,6 +66,16 @@ export interface ConnectLinqAdapterConfig {
|
|
|
66
66
|
export interface ConnectNotionAdapterConfig {
|
|
67
67
|
token: ConnectTokenResolver;
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Partial Resend adapter config backed by Vercel Connect.
|
|
71
|
+
*
|
|
72
|
+
* Structurally matches the `apiKey` and `webhookVerifier` options of
|
|
73
|
+
* `createResendAdapter` from `@resend/chat-sdk-adapter`.
|
|
74
|
+
*/
|
|
75
|
+
export interface ConnectResendAdapterConfig {
|
|
76
|
+
apiKey: ConnectTokenResolver;
|
|
77
|
+
webhookVerifier: ConnectWebhookVerifier;
|
|
78
|
+
}
|
|
69
79
|
/**
|
|
70
80
|
* Partial Telegram adapter config backed by Vercel Connect.
|
|
71
81
|
*
|
|
@@ -26,7 +26,7 @@ export type ConnectWebhookVerifierOptions = Parameters<typeof verifyVercelOidcTo
|
|
|
26
26
|
* validates it against Vercel's JWKS via
|
|
27
27
|
* {@link verifyVercelOidcToken}, replacing the provider's native
|
|
28
28
|
* signature check (Slack signing secret, Discord public key, GitHub webhook
|
|
29
|
-
* secret, Linear webhook secret).
|
|
29
|
+
* secret, Linear webhook secret, Resend Svix signing secret).
|
|
30
30
|
*
|
|
31
31
|
* Trust boundary: by default the token must be issued by
|
|
32
32
|
* `https://oidc.vercel.com` (issuer is hard-pinned) and match the
|
|
@@ -10,7 +10,7 @@ const BEARER_TOKEN_PATTERN = /^Bearer\s+(.+)$/i;
|
|
|
10
10
|
* validates it against Vercel's JWKS via
|
|
11
11
|
* {@link verifyVercelOidcToken}, replacing the provider's native
|
|
12
12
|
* signature check (Slack signing secret, Discord public key, GitHub webhook
|
|
13
|
-
* secret, Linear webhook secret).
|
|
13
|
+
* secret, Linear webhook secret, Resend Svix signing secret).
|
|
14
14
|
*
|
|
15
15
|
* Trust boundary: by default the token must be issued by
|
|
16
16
|
* `https://oidc.vercel.com` (issuer is hard-pinned) and match the
|
package/dist/eve/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { connectLinearCredentials, type ConnectLinearCredentialsParams, } from '
|
|
|
15
15
|
export { connectLinqCredentials, type ConnectLinqCredentials, type ConnectLinqCredentialsParams, } from './linq-credentials.js';
|
|
16
16
|
export { connectTeamsCredentials, type ConnectTeamsCredentialsParams, } from './microsoft-teams-credentials.js';
|
|
17
17
|
export { connectPhotonCredentials, type ConnectPhotonCredentialProvider, type PhotonCredentials, type ConnectPhotonCredentialsParams, } from './photon-credentials.js';
|
|
18
|
+
export { connectResendCredentials, type ConnectResendCredentials, type ConnectResendCredentialsParams, } from './resend-credentials.js';
|
|
18
19
|
export { connectSlackCredentials, type ConnectSlackCredentialsParams, } from './slack-credentials.js';
|
|
19
20
|
export { connectSendblueCredentials, type ConnectSendblueCredentials, type ConnectSendblueCredentialsParams, } from './sendblue-credentials.js';
|
|
20
21
|
export { connectTelegramCredentials, type ConnectTelegramCredentialsParams, } from './telegram-credentials.js';
|
package/dist/eve/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { connectLinearCredentials, } from './linear-credentials.js';
|
|
|
15
15
|
export { connectLinqCredentials, } from './linq-credentials.js';
|
|
16
16
|
export { connectTeamsCredentials, } from './microsoft-teams-credentials.js';
|
|
17
17
|
export { connectPhotonCredentials, } from './photon-credentials.js';
|
|
18
|
+
export { connectResendCredentials, } from './resend-credentials.js';
|
|
18
19
|
export { connectSlackCredentials, } from './slack-credentials.js';
|
|
19
20
|
export { connectSendblueCredentials, } from './sendblue-credentials.js';
|
|
20
21
|
export { connectTelegramCredentials, } from './telegram-credentials.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ConnectWebhookVerifier } from '../chat/webhook-verifier.js';
|
|
2
|
+
import { type ConnectOptions, type ConnectTokenParams } from '../index.js';
|
|
3
|
+
/** Resend channel credentials returned by {@link connectResendCredentials}. */
|
|
4
|
+
export interface ConnectResendCredentials {
|
|
5
|
+
/** App-scoped API key for outbound Resend API calls. */
|
|
6
|
+
apiKey: () => Promise<string>;
|
|
7
|
+
/** Verifies webhooks forwarded by Vercel Connect. */
|
|
8
|
+
webhookVerifier: ConnectWebhookVerifier;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Token parameters accepted by {@link connectResendCredentials}.
|
|
12
|
+
*
|
|
13
|
+
* Mirrors {@link ConnectTokenParams} from `@vercel/connect`, minus `subject`.
|
|
14
|
+
* Resend API keys are app-scoped, so this helper always uses
|
|
15
|
+
* `{ type: 'app' }`.
|
|
16
|
+
*/
|
|
17
|
+
export type ConnectResendCredentialsParams = Omit<ConnectTokenParams, 'subject'>;
|
|
18
|
+
/**
|
|
19
|
+
* Build Resend channel credentials backed by a Vercel Connect connector.
|
|
20
|
+
*
|
|
21
|
+
* The API-key resolver keeps token rotation delegated to Connect.
|
|
22
|
+
* `webhookVerifier` validates the Vercel OIDC token Connect attaches after it
|
|
23
|
+
* has verified the Resend (Svix) signature and forwarded the webhook, so the
|
|
24
|
+
* signing secret stays in Connect.
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { connectResendCredentials } from '@vercel/connect/eve';
|
|
28
|
+
* import { resendChannel } from 'eve/channels/resend';
|
|
29
|
+
*
|
|
30
|
+
* export default resendChannel({
|
|
31
|
+
* credentials: connectResendCredentials('resend/my-agent'),
|
|
32
|
+
* fromAddress: 'agent@example.com',
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function connectResendCredentials(connector: string, params?: ConnectResendCredentialsParams, options?: ConnectOptions): ConnectResendCredentials;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createConnectWebhookVerifier, } from '../chat/webhook-verifier.js';
|
|
2
|
+
import { getToken, } from '../index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Build Resend channel credentials backed by a Vercel Connect connector.
|
|
5
|
+
*
|
|
6
|
+
* The API-key resolver keeps token rotation delegated to Connect.
|
|
7
|
+
* `webhookVerifier` validates the Vercel OIDC token Connect attaches after it
|
|
8
|
+
* has verified the Resend (Svix) signature and forwarded the webhook, so the
|
|
9
|
+
* signing secret stays in Connect.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { connectResendCredentials } from '@vercel/connect/eve';
|
|
13
|
+
* import { resendChannel } from 'eve/channels/resend';
|
|
14
|
+
*
|
|
15
|
+
* export default resendChannel({
|
|
16
|
+
* credentials: connectResendCredentials('resend/my-agent'),
|
|
17
|
+
* fromAddress: 'agent@example.com',
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export function connectResendCredentials(connector, params = {}, options) {
|
|
22
|
+
return {
|
|
23
|
+
apiKey: () => getToken(connector, { ...params, subject: { type: 'app' } }, options),
|
|
24
|
+
webhookVerifier: createConnectWebhookVerifier(),
|
|
25
|
+
};
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/connect",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"dist"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@vercel/oidc": "4.0.
|
|
57
|
+
"@vercel/oidc": "4.0.7"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@ai-sdk/mcp": "^1 || ^2",
|