c0cc0689d6
## Add API client generation to SDK dev mode and refactor orchestrator into step-based pipeline ### Why The SDK dev mode lacked typed API client generation, forcing developers to work without auto-generated GraphQL types when building applications. Additionally, the orchestrator was a monolithic class that mixed watcher management, token handling, and sync logic — making it difficult to extend with new steps like client generation. ### How - **Refactored the orchestrator** into a step-based pipeline with dedicated classes: `CheckServer`, `EnsureValidTokens`, `ResolveApplication`, `BuildManifest`, `UploadFiles`, `GenerateApiClient`, `SyncApplication`, and `StartWatchers`. Each step has typed input/output/status, managed by a new `OrchestratorState` class. - **Added `GenerateApiClientOrchestratorStep`** that detects object/field schema changes and regenerates a typed GraphQL client (via `@genql/cli`) into `node_modules/twenty-sdk/generated` for seamless imports. - **Replaced `checkApplicationExist`** with `findOneApplication` on both server resolver and SDK API service, returning the entity data instead of a boolean. - **Added application token pair mutations** (`generateApplicationToken`, `renewApplicationToken`) to the API service, with the server now returning `ApplicationTokenPairDTO` containing both access and refresh tokens. - **Restructured the dev UI** into `dev/ui/components/` with dedicated panel, section, and event log components. - **Simplified `AppDevCommand`** from ~180 lines of watcher management down to ~40 lines that delegate entirely to the orchestrator.
Stripe synchronizer
Synchronizes customers from Stripe to Twenty
Requirements
- an
apiKey- go to Settings > API & Webhooks to generate one - Stripe secret API key - available in Stripe workbench
Setup
- Synchronize app
cd packages/twenty-apps/community/stripe-synchronizer
yarn auth
yarn sync
- Go to Stripe > Workbench > Webhooks and add webhook:
- events: customer.subscription.created and customer.subscription.updated
- webhook endpoint
- destination:
{TWENTY_URL}/s/webhook/stripe, e.g. https://workspace.twenty.com/s/webhook/stripe
- Go to Twenty > Settings > Integrations > Stripe synchronizer > Settings and add values
Flow
- Retrieve Stripe webhook
- Check if it's either subscription created or updated, if not, exit
- Read customer ID, sub status and quantity from webhook
- Read customer data from Stripe API, if business name is empty, exit
- Check if customer company exists in Twenty, if not, create it
- Check if related person exists in Twenty, if not, create it and link to company
Notes
- app synchronizes only new customers, those created before start of app won't be synchronized unless they're updated
- customers will be added to Twenty People object only if their name and email are filled with data, otherwise app will throw an error
Todo
- add validation of signature key from Stripe to ensure that incoming request is valid (possible once request headers are exposed to serverless functions)
- update app so it'll use provided Twenty generated object with native types from workspace once extending objects is possible