Skip to content

FieldModel

FieldModel = object

Defined in: packages/schema/src/model.ts:12

A field of a resource as the server and the app see it, built from its f.* builder and options; see Field options.

optional ai?: object

Defined in: packages/schema/src/model.ts:53

A job fills it from the prompt after a create or an update of a field the prompt names (.ai()).

prompt: string

The prompt, with {field} placeholders.


aliases: string[]

Defined in: packages/schema/src/model.ts:28

Other names filters may use for the field (.alias()).


column: string

Defined in: packages/schema/src/model.ts:16

The table column it reads and writes: the snake_case of the name unless .column() says otherwise.


optional default?: { value: unknown; } | { db: true; }

Defined in: packages/schema/src/model.ts:41

A value the form prefills, or db when the database supplies it (identity, now(), …).

{ value: unknown; }

value: unknown

The value a create uses when none is given (.default()).


{ db: true; }

db: true

The database supplies the value (.dbDefault()).


optional enumValues?: string[]

Defined in: packages/schema/src/model.ts:30

An enum’s values, in order.


optional file?: FileFieldModel

Defined in: packages/schema/src/model.ts:51

A file field’s allowed types (empty: any), largest upload in bytes, provider, and what each upload writes.


filterable: boolean

Defined in: packages/schema/src/model.ts:24

May appear in filters and filter widgets (.filterable()).


name: string

Defined in: packages/schema/src/model.ts:14

The field’s name: in URLs, the API, filters and sorts.


nullable: boolean

Defined in: packages/schema/src/model.ts:20

Whether the value may be null (.optional()).


readOnly: boolean

Defined in: packages/schema/src/model.ts:22

Never written through the API (.readOnly()).


optional relation?: object

Defined in: packages/schema/src/model.ts:32

A relation’s target.

columns: string[]

The columns of this table holding the other record’s key, in the order of that key.

resource: string

The resource it points at.


optional sensitive?: true

Defined in: packages/schema/src/model.ts:39

Never sent with the record; revealed one value at a time (.sensitive()).


sortable: boolean

Defined in: packages/schema/src/model.ts:26

May appear in order_by and sorts (.sortable()).


type: FieldType

Defined in: packages/schema/src/model.ts:18

Its storage type.