Skip to content

PrepareContext

PrepareContext<R> = object

Defined in: packages/schema/src/prepare.ts:15

What .prepare() gets besides the values: the write it prepares, its caller and its transaction.

R

optional before?: R

Defined in: packages/schema/src/prepare.ts:27

On update, the record as it is stored now.


operation: "create" | "update"

Defined in: packages/schema/src/prepare.ts:17

The write being prepared.


session: PrepareSession

Defined in: packages/schema/src/prepare.ts:21

The caller’s session as the server resolved it.


optional tenant?: string | number

Defined in: packages/schema/src/prepare.ts:23

The tenant the write works in, for a resource with .tenant().


trx: Kysely<any>

Defined in: packages/schema/src/prepare.ts:25

The write’s transaction: what the hook reads or writes here commits with the record, or not at all.


user: AccessUser

Defined in: packages/schema/src/prepare.ts:19

The user who writes, with the roles they act with.