Expand description
The declarative resource model.
A resource is one resources/<name>.toml file. It declares fields and a
per-action permission policy; the framework turns it into a Postgres table
and a set of RESTful CRUD endpoints. Users, roles and api-keys are ordinary
resources that ship with built-in defaults (see crate::defaults).
Structs§
- Auth
Spec - Auth configuration carried in a
[auth]section on theuserresource. - Field
- One column in a resource.
- Field
Admin - Per-field dashboard presentation, from
[fields.<name>.admin]. - Hooks
- The
[hooks]section of a resource: a function name per lifecycle event. - Permissions
- Per-action permissions. Strings in TOML are parsed via
Policy::parse. - Policy
- An access level, optionally narrowed to organisations of one class.
- Publishes
- The
[publish]section of a resource: a topic per write that succeeded. - Rate
Limits - The
[rate_limit]section of a resource: a rule for the whole resource and a rule per action, both optional. - Reference
- A resolved
belongs_toedge: the referencing field, its target resource, and the JSON key it expands under (owner_id→owner). - Resource
- A fully-parsed resource definition.
- Resource
Admin - The
[admin]section of a resource: how it is presented — and to whom — in the generated dashboard. - Resource
Meta
Enums§
- Access
- Access policy for a single action on a resource.
- Auth
Event - One point in an auth endpoint’s lifecycle at which a function may run.
- Content
Format - What kind of content a free-text field holds.
- Crud
Action - One CRUD action, named the way
[permissions]and[rate_limit]name it. - Field
Type - Supported column types.
- Hook
Event - One point in a resource’s request lifecycle at which a function may run.
- OnDelete
- Referential action applied by a foreign key when the parent row is deleted.
- Rate
Limit Rule - How many requests one client may make in a window before an endpoint starts
answering
429. - Scope
- Whether a resource is isolated per organisation (the default) or shared across the whole deployment.
- Text
Case - The case a text field is kept in.
- Widget
- The input a field is edited with in the dashboard.
Constants§
- ORG_
CLASS_ FIELD - The
organizationcolumn holding a class. Server-owned: written only by somebody[organization] org_class_editorsnames. - ORG_
CLASS_ SUFFIX - What separates a level from the organisation class it is narrowed to.
Functions§
- is_
auth_ resource - Whether a resource is one of the built-in auth/tenancy resources, which the dashboard manages through dedicated screens instead of generic CRUD.
- pluralize
- A deliberately small English pluraliser — enough for the labels apiplant
generates, and overridable per resource with
[admin] plural. - relation_
name - The relation name a reference field expands under:
owner_id→owner, otherwise the field name unchanged. - titleize
"purchase_order"→"Purchase order". Sentence case, not title case: a dashboard full of Capitalised Nouns reads like a form, not an application.