7ec56433c7
## Summary
- add packages/twenty-apps/rollup-engine: a parameterised rollup engine
that ships a default Opportunity → Company
aggregation.
- declare runtime config in package.json (TWENTY_API_KEY, optional
TWENTY_API_BASE_URL, and ROLLUP_ENGINE_CONFIG) so
app configuration lives entirely in Settings → Apps → [App] →
Configuration.
- document the workflow in README.md: deploy via twenty app sync,
populate env vars in the UI, use the Test panel with
a ready JSON payload, and reference troubleshooting tips.
- adjust the function entry point to a named async export and add
fallback logic for blank base URLs, matching the
UI’s env behaviour.
- prune legacy templates and examples so
config/templates/opportunity-to-company.json is the single copy/paste
starting point.
## UI / UX impact
After syncing the app:
- the Configuration screen shows the three env keys with helpful
descriptions (API key, optional base URL, JSON
override),
- the built-in Test your function panel works immediately
- and the default JSON config is available from
config/templates/opportunity-to-company.json for users who need to
customise rollups.
## Testing
- Out-of-the-box deploy to the hosted workspace (Opportunity update) ✓
- “Test your function” with the default config ✓
- Override example: point debugOpportunityCount at a scratch field via
ROLLUP_ENGINE_CONFIG ✓
- Optional: local smoke test (yarn install && yarn smoke) still passes
25 lines
727 B
JSON
25 lines
727 B
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/twentyhq/twenty/main/packages/twenty-cli/schemas/serverlessFunction.schema.json",
|
|
"universalIdentifier": "c3ec36c8-5b1d-421f-9172-a9e035ab9c18",
|
|
"name": "calculaterollups",
|
|
"triggers": [
|
|
{
|
|
"universalIdentifier": "eec8aaf2-b0cc-47fd-b522-8d4aa5fe4bd3",
|
|
"type": "databaseEvent",
|
|
"eventName": "opportunity.*"
|
|
},
|
|
{
|
|
"universalIdentifier": "a3fea230-1121-44a6-b395-5811c3031f8e",
|
|
"type": "cron",
|
|
"schedule": " 0 2 * * *"
|
|
},
|
|
{
|
|
"universalIdentifier": "d33b0fe4-4b2b-45c0-aa2f-e617fdbba484",
|
|
"type": "route",
|
|
"path": "/recalculate-all",
|
|
"httpMethod": "POST",
|
|
"isAuthRequired": true
|
|
}
|
|
]
|
|
}
|