619ea13649
## Twenty for Twenty: Resend module Introduces `packages/twenty-apps/internal/twenty-for-twenty`, the official internal Twenty app, with a first module integrating [Resend](https://resend.com). ### Breakdown **Resend module** (`src/modules/resend/`) - Two app variables: `RESEND_API_KEY` and `RESEND_WEBHOOK_SECRET`. - **Objects**: `resendContact`, `resendSegment`, `resendTemplate`, `resendBroadcast`, `resendEmail`, with relations between them and to standard `person`. - **Inbound sync (Resend → Twenty)**: - Cron-driven logic function `sync-resend-data` (every 5 min) pulling all entities through paginated, rate-limit-aware utilities (`sync-contacts`, `sync-segments`, `sync-templates`, `sync-broadcasts`, `sync-emails`). - Webhook endpoint (`resend-webhook`) verifying signatures and handling `contact.*` and `email.*` events in real time. - `find-or-create-person` auto-links Resend contacts to Twenty people by email. - **Outbound sync (Twenty → Resend)**: DB-event logic functions for `contact.created/updated/deleted` and `segment.created/deleted`, with a `lastSyncedFromResend` field for loop prevention. - **UI**: views, page layouts, navigation menu items, and front components (`HtmlPreview`, `RecordHtmlViewer`) to preview email/template HTML in record pages; `sync-resend-data` command exposed as a front component. ### Setup See the new README for install steps, webhook configuration, and local testing with the Resend CLI.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
const TWENTY_API_URL = process.env.TWENTY_API_URL ?? 'http://localhost:2020';
|
|
const TWENTY_API_KEY =
|
|
process.env.TWENTY_API_KEY ??
|
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyMDIwMjAyMC0xYzI1LTRkMDItYmYyNS02YWVjY2Y3ZWE0MTkiLCJ0eXBlIjoiQVBJX0tFWSIsIndvcmtzcGFjZUlkIjoiMjAyMDIwMjAtMWMyNS00ZDAyLWJmMjUtNmFlY2NmN2VhNDE5IiwiaWF0IjoxNzM1Njg5NjAwLCJleHAiOjQ4OTE0NDk2MDAsImp0aSI6IjIwMjAyMDIwLWY0MDEtNGQ4YS1hNzMxLTY0ZDAwN2MyN2JhZCJ9.bfQjfyN0NEtTCLE_xPyNcwonDzlSXFoP8kdCQTdnuDc';
|
|
|
|
// Make env vars available to globalSetup (test.env only applies to workers)
|
|
process.env.TWENTY_API_URL = TWENTY_API_URL;
|
|
process.env.TWENTY_API_KEY = TWENTY_API_KEY;
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
tsconfigPaths({
|
|
projects: ['tsconfig.spec.json'],
|
|
ignoreConfigErrors: true,
|
|
}),
|
|
],
|
|
test: {
|
|
testTimeout: 120_000,
|
|
hookTimeout: 120_000,
|
|
fileParallelism: false,
|
|
include: ['src/**/*.integration-test.ts'],
|
|
globalSetup: ['src/__tests__/global-setup.ts'],
|
|
env: {
|
|
TWENTY_API_URL,
|
|
TWENTY_API_KEY,
|
|
},
|
|
},
|
|
});
|