Add defineUninstallLogicFunction hook for applications (#23227)

This commit is contained in:
martmull
2026-07-24 10:41:22 +02:00
committed by GitHub
parent cada1ef6d7
commit fb52635d2a
31 changed files with 370 additions and 18 deletions
@@ -101,3 +101,11 @@ yarn twenty dev:function:exec
```
Run again after rebuilding to verify idempotency.
## Uninstall Hook
Use `defineUninstallLogicFunction` for best-effort cleanup of external resources when the app is uninstalled (deprovision API resources, delete remaining bots, revoke webhooks). Failures are logged and never block the uninstall.
Uninstall hook files live alongside other logic functions (typically `src/logic-functions/uninstall.ts`). Kebab-case filename, one export per file.
The hook runs before the app's metadata, data, and code are removed, so handlers can still query the app's objects and records. Handlers receive `UninstallPayload` (`{ version?: string }`).