Skip to content

EventContext

EventContext<R> = object

Defined in: packages/schema/src/events/event-helpers.ts:16

One record’s change in one transaction, as an event’s match sees it. Records use field names and leave out sensitive fields, whose names changed still lists.

R = Record<string, unknown>

actor: EventActor | null

Defined in: packages/schema/src/events/event-helpers.ts:26

null for a write made outside the API (psql, another service, a database trigger).


optional after?: Partial<R>

Defined in: packages/schema/src/events/event-helpers.ts:22

The record after the change, as it is at commit; none for a delete.


optional before?: Partial<R>

Defined in: packages/schema/src/events/event-helpers.ts:20

The record before the change, as it was at the start of the transaction; none for a create.


changed: string[]

Defined in: packages/schema/src/events/event-helpers.ts:24

The names of the fields that changed, sensitive ones included.


operation: EventOperation

Defined in: packages/schema/src/events/event-helpers.ts:18

What happened to the record.


source: "api" | "database"

Defined in: packages/schema/src/events/event-helpers.ts:28

api for a write through the API, database for any other.


optional tenant?: string | number

Defined in: packages/schema/src/events/event-helpers.ts:30

The record’s tenant, when the resource has one.


transaction: string

Defined in: packages/schema/src/events/event-helpers.ts:32

The writing transaction’s id.