Skip to content

FieldModel

FieldModel = object

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

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:70

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:33

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


column: string

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

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


optional decimal?: object

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

A rollup’s or formula’s decimal, for the column protobase migration adds.

precision: number

Its number of digits.

scale: number

Its number of digits after the point.


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

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

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 encrypted?: true

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

Stored encrypted, and sensitive too (.encrypted()).


optional enumValues?: string[]

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

An enum’s values, in order.


optional file?: FileFieldModel

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

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:29

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


optional formula?: string

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

The database computes it from the record’s other fields (.formula()).


optional lookup?: Lookup

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

A lookup field: the linked record’s field it shows, which has no column of this table (.lookup()).


name: string

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

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


nullable: boolean

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

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


readOnly: boolean

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

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


optional relation?: object

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

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 rollup?: Rollup

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

The database keeps it from the records of another resource (.rollup()).


optional sensitive?: true

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

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


sortable: boolean

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

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


optional strongSignIn?: object

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

Its reveal needs a strong sign-in this recent, and it is sensitive too (.strongSignIn()).

minutes: number

The most minutes since the sign-in, or its confirmation, proved a passkey or a second step.


type: FieldType

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

Its storage type.


optional writeOnly?: true

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

In /meta only: the caller may write the field but not read it, as its own .access() write rule allows. It comes sensitive, with no value to reveal, and the form edits it only where the view’s layout names it.