veryfront 0.0.54 → 0.0.56
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/ai/index.js +1 -1
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/workflow.js +1 -1
- package/dist/ai/workflow.js.map +1 -1
- package/dist/cli.js +32 -27
- package/dist/components.js +1 -1
- package/dist/components.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/data.js +1 -1
- package/dist/data.js.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +2 -2
- package/dist/integrations/_base/files/app/components/ServiceConnections.tsx +14 -4
- package/dist/integrations/gmail/files/app/api/auth/gmail/callback/route.ts +22 -4
- package/package.json +1 -1
- package/dist/integrations/_base/files/app/api/auth/status/route.ts +0 -30
|
@@ -25,10 +25,15 @@ export function ServiceConnections({ services, className = "" }: ServiceConnecti
|
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
async function checkStatus() {
|
|
27
27
|
try {
|
|
28
|
-
const res = await fetch("/api/
|
|
28
|
+
const res = await fetch("/api/integrations/status");
|
|
29
29
|
if (res.ok) {
|
|
30
30
|
const data = await res.json();
|
|
31
|
-
|
|
31
|
+
// Convert array to Record<id, boolean> for status lookup
|
|
32
|
+
const statusMap: Record<string, boolean> = {};
|
|
33
|
+
for (const integration of data.integrations || []) {
|
|
34
|
+
statusMap[integration.id] = integration.connected;
|
|
35
|
+
}
|
|
36
|
+
setStatus(statusMap);
|
|
32
37
|
}
|
|
33
38
|
} catch (err) {
|
|
34
39
|
console.error("Failed to check service status:", err);
|
|
@@ -103,10 +108,15 @@ export function ServiceConnectionsCard({ services, className = "" }: ServiceConn
|
|
|
103
108
|
useEffect(() => {
|
|
104
109
|
async function checkStatus() {
|
|
105
110
|
try {
|
|
106
|
-
const res = await fetch("/api/
|
|
111
|
+
const res = await fetch("/api/integrations/status");
|
|
107
112
|
if (res.ok) {
|
|
108
113
|
const data = await res.json();
|
|
109
|
-
|
|
114
|
+
// Convert array to Record<id, boolean> for status lookup
|
|
115
|
+
const statusMap: Record<string, boolean> = {};
|
|
116
|
+
for (const integration of data.integrations || []) {
|
|
117
|
+
statusMap[integration.id] = integration.connected;
|
|
118
|
+
}
|
|
119
|
+
setStatus(statusMap);
|
|
110
120
|
}
|
|
111
121
|
} catch (err) {
|
|
112
122
|
console.error("Failed to check service status:", err);
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Gmail OAuth Callback
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Handles the OAuth callback from Google and stores the tokens.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { createOAuthCallbackHandler, gmailConfig, memoryTokenStore } from "veryfront/oauth";
|
|
8
|
+
import { tokenStore } from "../../../../../lib/token-store";
|
|
9
|
+
|
|
10
|
+
// Hybrid adapter: uses framework's memoryTokenStore for state (PKCE),
|
|
11
|
+
// but user's tokenStore for actual token storage
|
|
12
|
+
const hybridTokenStore = {
|
|
13
|
+
// Token methods - delegate to user's tokenStore
|
|
14
|
+
async getTokens(serviceId: string) {
|
|
15
|
+
return tokenStore.getToken("current-user", serviceId);
|
|
16
|
+
},
|
|
17
|
+
async setTokens(serviceId: string, tokens: { accessToken: string; refreshToken?: string; expiresAt?: number }) {
|
|
18
|
+
await tokenStore.setToken("current-user", serviceId, tokens);
|
|
19
|
+
},
|
|
20
|
+
async clearTokens(serviceId: string) {
|
|
21
|
+
await tokenStore.revokeToken("current-user", serviceId);
|
|
22
|
+
},
|
|
23
|
+
// State methods - delegate to framework's memoryTokenStore (shared with init route)
|
|
24
|
+
getState: (state: string) => memoryTokenStore.getState(state),
|
|
25
|
+
setState: (state: { state: string; codeVerifier?: string; createdAt: number }) => memoryTokenStore.setState(state),
|
|
26
|
+
clearState: (state: string) => memoryTokenStore.clearState(state),
|
|
27
|
+
};
|
|
8
28
|
|
|
9
29
|
export const GET = createOAuthCallbackHandler(gmailConfig, {
|
|
10
|
-
tokenStore:
|
|
11
|
-
onSuccess: () => "/",
|
|
12
|
-
onError: () => "/",
|
|
30
|
+
tokenStore: hybridTokenStore,
|
|
13
31
|
});
|
package/package.json
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { tokenStore } from "../../../../lib/token-store.ts";
|
|
2
|
-
|
|
3
|
-
// Services to check - add/remove based on your integrations
|
|
4
|
-
// Gmail and Calendar share OAuth credentials, so we check both separately
|
|
5
|
-
const SERVICES = [
|
|
6
|
-
{ id: "gmail", name: "Gmail" },
|
|
7
|
-
{ id: "calendar", name: "Calendar" },
|
|
8
|
-
// { id: 'slack', name: 'Slack' },
|
|
9
|
-
// { id: 'github', name: 'GitHub' },
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
export async function GET() {
|
|
13
|
-
// In production, get userId from session/cookie
|
|
14
|
-
// For development, we use a default user
|
|
15
|
-
const userId = "current-user";
|
|
16
|
-
|
|
17
|
-
const services: Record<string, boolean> = {};
|
|
18
|
-
|
|
19
|
-
for (const service of SERVICES) {
|
|
20
|
-
try {
|
|
21
|
-
services[service.id] = await tokenStore.isConnected(userId, service.id);
|
|
22
|
-
} catch {
|
|
23
|
-
services[service.id] = false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return new Response(JSON.stringify({ services }), {
|
|
28
|
-
headers: { "Content-Type": "application/json" },
|
|
29
|
-
});
|
|
30
|
-
}
|