docs(sdk): document DatabaseEventPayload and simplify its type (#20754)

closes
https://discord.com/channels/1130383047699738754/1505967920163983502

Update logic-function docs to match the real `DatabaseEventPayload`
shape.

The docs now show database event payloads as record-level events with
`recordId` and `properties.before/after/diff/updatedFields`, including
compact examples for created, updated, and destroyed events. Route
payload type imports now use the preferred `twenty-sdk/logic-function`
surface.

Also clean up the shared payload type wrapper so it models event
metadata without over-promising actor fields; `userId`,
`userWorkspaceId`, and `workspaceMemberId` remain optional through the
underlying event type.
This commit is contained in:
nitin
2026-05-20 14:52:58 +05:30
committed by GitHub
parent 8d81496625
commit a26fe3bb65
2 changed files with 116 additions and 15 deletions
@@ -37,19 +37,11 @@ type SimplifiedFlatObjectMetadata = {
viewUniversalIdentifiers: string[];
};
type WorkspaceEventBatch<WorkspaceEvent> = {
type DatabaseEventMetadata = {
name: string;
workspaceId: string;
objectMetadata: SimplifiedFlatObjectMetadata;
userId: string;
userWorkspaceId: string;
workspaceMemberId: string;
recordId: string;
events: WorkspaceEvent[];
};
export type DatabaseEventPayload<T = ObjectRecordEvent> = Omit<
WorkspaceEventBatch<T>,
'events'
> &
T;
export type DatabaseEventPayload<T = ObjectRecordEvent> =
DatabaseEventMetadata & T;