Expand description
§Zeyn Framework
A Rust web framework for data heavy applications. AI agents write the application code; people read it, review it and change it. The language is kept small, typed and has one way to do each thing.
use zeyn::prelude::*;
#[entity(table = "products")]
pub struct Product {
#[key]
pub id: ProductId,
#[rule(required, max_len = 20)]
pub code: String,
}
#[action(permission = "stock.product.read")]
pub async fn search_products(_q: DataQuery) -> Result<Page<Product>> {
Ok(Page::default())
}
#[screen(route = "/products", permission = "stock.product.read")]
pub fn product_list() -> Screen {
Screen::new("Products").body(DataGrid::of(search_products).column(Product::code).filter())
}§Mistakes that do not compile
The compiler refuses these, with an error message that says what to change. Each one has a
compile_fail test in src/compile_fail.rs:
- an action without access
- a shared cache on a screen that is not public, and one longer than a day
- a text rule on a field that is not text
- a form whose submit action does not take
Valid<M> - a route segment that names no field of the screen’s params
- a route with segments on a screen that takes no params
- a total on a text column
- an average on a text column, and a minimum on a yes/no column
- a badge on a column that is not a
#[choice]enum - a row action whose input is not built from the row the way the action takes it
- a bulk action whose input does not hold keys of the given key field
- an inline edit save action that does not take
Valid<M> - a menu item for a screen without a route
- a key on a model that is not an entity
- a
scalerule on a field that is not aDecimal - a
Vecof something that is neither a line model nor a#[choice]enum - a
maskrule on a field that is not text - a mask on a field that is not text
- an unknown action option (the AI options are
ai = "...",ai = falseandconfirm) - empty guidance for models
§Extension points
Component: any type that renders HTML and describes itself in the schema can go on a screen.FieldType: new field types; useFieldKind::Customto name a client side editor.- Models, actions and screens from other crates are used like local ones.
Re-exports§
pub use audit::ExportRecord;pub use audit::FieldChange;pub use audit::FieldRef;pub use audit::RecordRef;pub use audit::Trail;pub use auth::RequireMfa;pub use render::Render;pub use screen::Component;pub use screen::Effect;pub use screen::Export;pub use screen::FormSource;pub use screen::GridSource;pub use screen::Icon;pub use screen::LoadedPage;pub use screen::MAX_SCREEN_CACHE;pub use screen::MAX_SEGMENT;pub use screen::MAX_TOASTS;pub use screen::Node;pub use screen::Params;pub use screen::PathValue;pub use screen::RowCall;pub use screen::Screen;pub use screen::ScreenDef;pub use screen::ScreenMeta;pub use screen::Toast;pub use screen::ToolButton;pub use screen::Toolbar;pub use screen::UiCtx;pub use screen::Window;pub use screen::route_has_segments;pub use screen::screen_url;pub use server::ApiDocs;pub use server::App;pub use server::AuditEntry;pub use server::AuditLog;pub use server::AuditSink;pub use server::Authenticator;pub use server::BasicCredentials;pub use server::Call;pub use server::CallKind;pub use server::CallOutcome;pub use server::DevAuth;pub use server::ForwardAuth;pub use server::HeaderTenant;pub use server::Interceptor;pub use server::Mcp;pub use server::MemoryAudit;pub use server::Plugin;pub use server::Prefetch;pub use server::READY_CACHE;pub use server::StaticCredentials;pub use server::StderrAudit;pub use server::SubdomainTenant;pub use server::TenantResolver;pub use server::Theme;pub use server::TimePolicy;pub use server::probe;
Modules§
- audit
- Field level data audit: which record a call saved, which fields changed and how.
- auth
- Sign in beyond a proxy in front of the app: bearer JWTs for APIs and MCP ([
JwtAuth], Cargo featureoidc), OpenID Connect sign in for browsers ([OidcAuth], featureoidc), a second factor guard (RequireMfa) and a built in TOTP second factor ([Totp], featuretotp). Seedocs/auth.md. - prelude
- Everything application code needs:
use zeyn::prelude::*; - render
- seo
- Head tags for search engines and the sitemap. Head tags for search engines and link previews, and the sitemap.
- server
- HTTP server: page shell, screen, grid, form, language and agent endpoints.
- text
- Text in the form search compares.
foldis what free text search (crate::DataQuery::q) uses on both sides, in memory and in SQL; use it for search key columns too, so a key written by the app matches what users type. - ui
- Component library: layout containers, field editors and display components.
Macros§
- t
- Catalog text checked at compile time:
t!("products.title")ort!("orders.count", n = count).
Structs§
- Action
Meta - Action definition generated by
#[action]. - Aggregate
Request - One column total asked for by a grid query.
- Ai
- AI policy of an action or a screen, set with
#[action(ai = "...")],ai = falseandconfirm. It applies to every way a model reaches the app: the MCP endpoint, WebMCP tools in the browser and the built in assistant. - ApiEntry
- An action published as an API endpoint.
- Bottom
NavItem - One link of the site shell’s bottom bar (
SiteShell::bottom_nav): a label, a screen with a route and an optional icon above the label. - Checked
- Result of reading and validating a CSV file.
- Choice
- The kind of a choice key: a short text the user picked, such as a tab.
- Choice
Option - One option of a
#[choice]enum. - Claimed
Job - A run a worker holds a lease on.
- Client
Pref - A declared client preference key of kind
K(ConsentorChoice). Build it as a constant; an unusable name (1 to 40 ASCII letters, digits,-and_) or a lifetime under one second or overMAX_PREF_LIFETIMEdoes not compile. - Client
Prefs - The client preference keys of an app and its consent hook, built with
crate::App::client_prefs. - Column
View - One shown column of a view: field, width set by the user and pin.
- Command
- A command the user can run from the palette, a menu bar or its keyboard shortcut.
- Config
- Merged configuration. Later sources override earlier ones.
- Consent
- The kind of a consent key: the user confirmed something, such as a notice.
- Context
Menu - A context menu. Items run an effect in the browser or an action on the server; action items carry the action’s permission and are left out for users who may not run it.
- Csp
- Extra hosts for the page’s content security policy. Built with
crate::App::csp: - Ctx
- Request context: identity, language and services. Cheap to clone. Actions and screens may take it as an injected argument.
- Cursor
- Opaque position in a list, used by infinite scroll. Built by the data layer from the last row’s sort values and key. It only says where to continue; filters and permissions are applied again.
- Data
Grid - Data grid. Its data source is an action that takes a
DataQueryand returnsPage<E>. - Data
Grid Column - Configures the last added column. DataGrid methods can be called from here too.
- Data
Grid View - How a user arranged a grid: shown columns in order with widths and pins, sort and filters. Comes from the client, so the grid cleans it with its own columns before any use.
- Data
Query - Query a grid sends to the server.
- Date
- A calendar day with no time zone: birth dates, invoice dates, holidays.
- Date
Time - An exact moment, always stored in UTC with millisecond precision.
- Date
Words - Words people type instead of a date or time, in one language:
bugün,yarın,+3gin Turkish,today,tomorrow,+3din English. Read from thezeyn.date.words.*catalog keys, each a comma separated list. English words are always understood as well. - Decimal
- An exact decimal number:
mantissa / 10^scale. Equal values compare equal whatever their scale (1.5 == 1.50); the scale is kept so1.50is shown as typed. - Dep
- A dependency of an action or screen, checked when the app starts.
- Disk
Store - Files on the local disk under one folder:
{id}.binholds the bytes and{id}.jsonthe metadata. Uploads are written to{id}.partand renamed when complete, so a stopped upload never shows up. Writing happens on the blocking pool, one chunk at a time. - EnvSource
- Environment variables with a prefix:
APP_DB__URLbecomesdb.urlfor prefixAPP. - Export
Column - One column of a typed export: the label in the user’s language and the width in pixels.
- Feature
- A feature: route prefix, guards, screens and menu.
- Field
- Typed field reference such as
Product::code. A wrong field name does not compile. - Field
Error - One validation error.
fieldis empty for errors that belong to the whole model. - Field
Meta - Field definition produced at compile time.
- File
- A file kept by a
FileStore, as a form field holds it. The id is generated by the server; the name, size and type are for display. Downloads always use what the store recorded, so a client that edits these values changes nothing but its own view. - File
Chunks - The body of an upload, in chunks of at most
super::UPLOAD_CHUNKbytes. AnErrmeans the upload stopped (the client left or a limit was passed): the store must throw away what it wrote and return an error. - File
Entry - A store registered on a feature.
- File
Meta - What a store records about a file. The server fills it; the store keeps it with the bytes
and gives it back with
FileStore::getandFileStore::meta. - File
Rules - What an upload field accepts: the store it goes to, the largest file, how many files a field
may hold and which types. Build it as a
constand use the same value on the feature and the form, so the browser shows the limits the server checks. - Filter
- Column filter. Every condition that is set must hold; unset conditions are ignored.
- Fixed
License - A fixed license, for development and tests.
- Footer
Column - One column of footer links.
- Form
- Form that edits a model. Add fields, then call
submitlast. - FormRow
- Fields placed side by side.
- I18n
- Message catalogs. Built in
zeyn.*messages exist in English and Turkish, and in the languages turned on with thelang-*Cargo features; apps add their own. - Identity
- Who is making the request.
- Import
- CSV import of
Mrows through an action that takesVec<Valid<M>>. - IpRange
- An address range such as
10.0.0.0/8,192.168.1.10or2001:db8::/32. - JobStatus
- Status of one job. Errors are shown by code only; details go to the server log.
- Jobs
- The app’s background jobs. Inject it into actions to trigger jobs or read their status.
- Json
File Source - A JSON file of nested objects; nested keys are joined with dots. A missing file is an error.
- License
- A license: who holds it, until when, and which modules it opens.
- Licensed
- Guard: the request must have a valid license, optionally for a module.
- Loaded
Page - One loaded page of grid rows, type erased.
- Local
Date Time - A date and wall clock time at a place, with no time zone: a clinic appointment at 10:00 stays at 10:00 for everyone.
- Masking
- Masking of one field, generated from
#[mask(...)]. - Media
- An opened media file: its reader, length, content type and optional entity tag.
- Media
Entry - A media source registered on a feature.
- Memory
JobStore - Job runs in memory: the default store. Runs are lost when the process stops. At most
capacityruns are held; when it is full the oldest failed run is dropped, and with none to dropenqueuefails. - Memory
Rate Store - In memory token buckets with a cap on the number of keys, so a flood of addresses cannot exhaust memory.
- Memory
Store - Files in memory, for tests and demos. Capped by total bytes; an upload that would pass
the cap is refused. Unlike
DiskStoreit holds every file whole. - Memory
View Store - Saved views in memory, lost on restart. For development, tests and samples.
- Menu
- Menu builder.
- Menu
Group - Menu group.
- Menu
Item - Menu item.
- Money
- Amount of money, stored as an integer count of the smallest unit to avoid floating point errors.
- NewJob
- A run to put in the queue.
- Node
- Type erased component: a node of the screen tree.
- Number
Format - Separators used to show and read numbers in a language.
- Page
- One page of a list.
- PerTenant
- A service that is built once per tenant and reused, such as a database pool made from the tenant’s own connection string.
- Pref
Info - One row of
crate::App::client_prefs_table: a key as the privacy page lists it. - Rate
Limit - At most
requestsperwindowfor each key. Bursts up torequestsare allowed, then the allowance refills evenly over the window (token bucket). - Revealed
- A revealed value and the record it belongs to.
- Route
- A route of a feature.
- RowCall
- An action call built on the server for one row or menu item, ready to run.
- RowError
- One problem in one row.
rowcounts data rows from 1; the header is not counted. - Schedule
- When a job runs and how often a failed run is tried again.
- Screen
- Content of a screen. Screen functions return this.
- Screen
Entry - A registered screen with type erased params.
- Screen
Meta - Screen definition generated by
#[screen]. - Search
- A server search the command palette runs as the user types, registered with
crate::Feature::search. The action takes the query and returns hits. - Search
Hit - One result of a palette search: what it shows and the app path it opens, such as
/guides/theming#density. The path is relative to the app’s base path. - Secret
- A value that must never appear in logs:
DebugandDisplayprint[redacted]. - Services
- Registered services, looked up by type.
- Shell
- Chooses the page frame of a feature’s screens. The app shell is the default; call
Shell::sitefor public pages. - Signed
In - Built in guard: the user must be signed in.
- Site
Footer - Footer of the site shell.
- Site
Header - The site shell’s top bar, in slots that take any component, modeled on an app bar with
logical names:
startcomes before the brand,centersits between the menu and the end,endcloses the bar andbottomis a full width row under it, such as tabs or chips. Start and end follow the writing direction, so they swap sides in right to left languages. Each slot holds several nodes in order. Nothing is shown unless asked for. - Site
Shell - Settings of the site shell. Built with
Shell::site. - Slug
- A readable URL part: lowercase ASCII letters and digits, words joined by
-, at mostSlug::MAX_LENbytes. Turkish letters are mapped (ı,İtoi,ştos,ğtog,çtoc,ötoo,ütou), other accented Latin letters lose their accent, spaces and punctuation become-, and everything else is dropped. - Sort
- Static
Source - Fixed values, for defaults and tests.
- Stored
File - A stored file opened for reading.
- Submit
Form - Form with a submit action attached.
- Tenant
- The tenant a request belongs to in a multi tenant app.
- Tenant
Required - Built in guard: the request must belong to a tenant.
- Time
- A wall clock time with second precision.
- Time
Zone - A time zone: an IANA zone such as
Europe/Istanbulwith its whole history of offset and daylight saving changes, or a fixed offset such asUTC+03:00. - Toast
- A toast with a tone and an optional action button, for
UiCtx::notify. - Tool
Button - Toolbar button being configured.
- Toolbar
- Screen toolbar.
- Total
- One computed column total.
- Transition
- A move from one state to another, and the permission it needs.
- Transition
Record - A transition as written to the audit log: who is in the audit entry, this says from, to and why.
- Transition
Request - What a transition button sends to its action. The record key comes from the screen on the server, never from the client.
- Transitions
- Buttons for the moves the user may make on one record, with an optional comment. Submitting
calls the action with a
TransitionRequest. - UiCtx
- Context given to event handlers. Collects the effects they ask for.
- Valid
- A value that passed validation. Only
Valid::newand deserialization create one. - Validation
Errors - All validation errors of a model.
- Window
- Window helpers.
- Workflow
- The states of a record and the allowed moves between them. Every move is checked on the
server: the record must be in the move’s
fromstate and the user must have its permission.
Enums§
- Access
- Who may call an action or open a screen.
- Aggregate
- Kind of column total.
- Browser
Shortcut - How a shortcut collides with the browser.
- Byte
Range - What a
Rangeheader asks for, for a body of a known length. - Center
OnPhone - Where the center slot of the site header goes on phones (800 px wide and less).
- CsvError
- Why a CSV text could not be read at all.
- Currency
- Currency.
- Data
Mode - Where sorting and filtering happen.
- Effect
- What the client does after a user interaction.
- Error
- Zeyn errors.
- Export
- Export format.
- Field
Kind - How a field is shown on screen and described in the schema.
- File
Type - A file type an upload may have. Each type is recognized by its content, and the name’s
extension must belong to the same type: a PDF renamed to
.pngis refused. HTML, SVG, XML and scripts are never accepted. - Guard
Result - Result of a guard.
- Icon
- Icons.
- Import
File - A file to import: CSV text, or XLSX bytes with the
xlsxfeature. - JobState
- What a job is doing.
- Local
Time Error - Why a wall clock time could not become a moment.
- Mask
Style - How a masked value is shown.
- NextRun
- What happens to a run after a try.
- Page
Request - Which part of the list the client wants.
- Paging
- How a grid loads rows beyond the first batch.
- Pin
- Side a column is pinned to.
Startis the left in left to right languages. - Pref
Kind - What a preference holds, for the privacy table.
- Purpose
- Why a preference is kept, for the privacy page and for consent.
- RateKey
- What a rate limit counts by.
- RowStyle
- Row highlight.
- Rule
- Field validation rule.
- Scan
Verdict - Whether a scanned file may be kept.
- Text
- Text shown to users: either a literal or a catalog key resolved in the user’s language.
- Tone
- Color of a badge. Tones follow the theme, so they work in light and dark mode.
- Value
- Type independent form of a field value. Rendering, schema and grid use this.
Constants§
- BROWSER_
DEFAULTS - Shortcuts a page can take over, but that people expect to do their browser’s or the text
field’s job: print, save, find, address bar, history, downloads, reload, zoom, developer
tools, copy and paste. Zeyn never binds them unless a command or button opts in with
override_browser(). - BROWSER_
RESERVED - Shortcuts browsers keep for themselves and never pass to a page: new window, new tab, close tab, switch tab, quit. A command or button with one of them would never run.
- COLUMN_
WIDTH - Narrowest and widest column a user may set, in pixels.
- DEFAULT_
EXPORT_ LIMIT - Most rows an export holds unless the grid sets another limit.
- DEFAULT_
MAX_ ROWS - Rows an import takes unless set with
max_rows. - DEFAULT_
PAGE_ SIZE - Page size used when the client sends none.
- DEFAULT_
PRECISION - Digits of a
Decimalfield without aprecisionrule. - DEFAULT_
SCALE - Decimals of a
Decimalfield without ascalerule. - HARD_
MAX_ ROWS - Largest row limit an import may set.
- JOB_
LEASE - How long a worker holds a claimed run without a heartbeat. It renews the lease every third of this while the run works; a run whose worker stopped is claimed again once it has passed.
- JOB_
POLL - How often a worker looks for due runs in the store when nothing wakes it earlier.
- MAX_
BACKOFF_ MS - Longest wait between two tries of a failed run.
- MAX_
BULK - Most rows one bulk action may cover; larger selections are refused.
- MAX_
COMMENT - Longest comment a transition takes, in characters.
- MAX_
CSV_ BYTES - Largest CSV text accepted, in bytes.
- MAX_
EMBED_ URL - Longest URL that
embed_urlkeeps. - MAX_
FIELD_ FILES - Most files one field may hold, whatever the rules say.
- MAX_
FILE_ NAME - Longest file name kept, in characters. Longer names are cut.
- MAX_
FILTERS - Most filters one query may carry; the rest are dropped.
- MAX_
FILTER_ CHOICES - Most choices one
any_ofcondition may list; the rest are dropped. - MAX_
FILTER_ TEXT - Longest filter text in characters; longer conditions are ignored.
- MAX_
JOB_ PAYLOAD - Longest payload of a queued run, in bytes. Payloads carry ids and small JSON, not documents.
- MAX_
MEDIA_ ID - Longest media id, in bytes.
- MAX_
PAGE_ SIZE - Largest number of rows one request may return, whatever the client asks for.
- MAX_
PINNED - Most columns pinned to one side.
- MAX_
POSITION_ SECONDS - Longest saved play position, in seconds (about 115 days). Longer values are refused.
- MAX_
PRECISION - Most significant digits a
Decimalholds, the precision ofNUMERIC(38, s)and OracleNUMBER. - MAX_
PREF_ LIFETIME - Longest lifetime of a client preference: 400 days, the longest browsers keep a cookie.
- MAX_
PUBLIC_ MEDIA_ CACHE - Longest cache time of a public media source, in seconds (one year).
- MAX_
SCALE - Most decimals a
Decimalholds. - MAX_
SCREEN_ CACHE - Longest
cache = Na screen may ask for: one day. - MAX_
SEARCH_ HITS - Most results one palette search shows, over all features.
- MAX_
SEARCH_ QUERY - Longest palette search query, in characters. Longer queries are cut.
- MAX_
SEGMENT - Longest path segment value read or written, in bytes.
- MAX_
SORT - Most sort keys one query may carry.
- MAX_
TOASTS - Most toasts the runtime shows at once; older ones make room for new ones.
- MAX_
UPLOAD_ BYTES - Largest file any upload may have, whatever the rules say: 1 GiB.
- MEDIA_
CHUNK - Bytes read from a media reader at a time.
- MEMORY_
JOB_ CAPACITY - Runs a
MemoryJobStoreholds unless built withMemoryJobStore::with_capacity. - PALETTE_
SHORTCUT - The default shortcut of the command palette. It is free in every common browser; apps can
choose another with
App::palette_shortcut. - SNIFF_
BYTES - Bytes read from the start of an upload to learn its type.
- TRACKING_
PARAMS - Query parameters that only track the visitor.
embed_urlremoves them, and every parameter whose name starts withutm_. - UPLOAD_
CHUNK - Bytes passed to a store at a time.
- VIRTUAL_
LIVE_ ROWS - Rows of a virtual grid’s first block rendered live in the page (enough for a tall screen
plus the overscan); the rest of the block waits in a
<template>until it scrolls into view. - VIRTUAL_
WIDE_ COLUMNS - Fewest columns (with the selection, detail and row action columns) for which a virtual grid
sends its whole first block in the
<template>, so the browser styles and lays out only the columns the runtime keeps in view. MatchesCOLV_MINof the browser runtime (assets/zeyn/grid-cells.js), where column windowing starts.
Traits§
- Action
- A server side action. Generated by
#[action], never written by hand. - ApiInput
- Types an API action can take as input.
- ApiOutput
- Types an API action can return inside
Result. - ApiResult
- What an API action returns:
zeyn::Result<T>with an API friendlyT. - Bulk
Action - Actions that take the keys of selected rows: their input is
Vec<K>, whereKis the type of the key field given tobulk_action. - Cell
Renderer - Draws the content of a grid cell from the column’s typed value. The extension point for
app specific cells; closures
Fn(&T, &Render) -> Stringare renderers too. - Choice
Type - Enums made with
#[choice]. DataGrid badges work only on them. - Component
- Anything that can be placed on a screen. This is the extension point for third party components.
- Config
Source - Where configuration comes from: environment, a file, a database, a vault, a license server.
- Data
Grid View Store - Where saved grid views live, one per user and grid. Register one with
App::datagrid_views. - Entity
- A model stored in a database table. Generated by
#[entity]. - Field
Type - Types that can be model fields.
- File
Scanner - Checks an uploaded file before it is accepted, such as a virus scanner. Registered with
Feature::scan_files. A refused file, or a scanner that fails, is deleted and the upload answers422. - File
Store - Where uploaded files are kept. Registered with
Feature::files. - Form
Action - Actions that can submit a form of
M: their input must beValid<M>. - Form
Source - A component that saves data through an action. Implemented by forms with
submit. - Grid
Source - A component that loads rows through an action. Implemented by
DataGrid. - Guard
- A check that runs on the server before any screen of a feature is opened and before any of its
grids or forms is called. Plain functions
fn(&Ctx) -> GuardResultare guards. - Import
Source - An import component on a screen, as the server sees it.
- Inject
- Types that can be injected into actions and screens:
Ctxand registered services. - Into
Screen - What a screen function may return.
- IsBool
- Yes/no column types, for
check_icon(). - IsMoment
- Moment column types, for
relative_time(). - JobStore
- Where job runs are stored. A run is claimed with a lease: until the lease ends no other worker
gets it, and a worker that stops without finishing leaves a run that is claimed again once the
lease has passed.
MemoryJobStoreis the default;SqlJobStore(featurespostgres,oracle) keeps runs across restarts and shares them between servers. - License
Source - Where licenses come from: a file, a license server, a vault, a database. Called with the request’s tenant in multi tenant apps.
- Media
Reader - What a media response is read from. Any
Read + Seekworks, such asstd::fs::File. - Media
Source - Where an app keeps its media: films, songs, recordings, captions. Registered with
Feature::mediaunder a permission. - Model
- Validated data with typed fields. Generated by
#[model]or#[entity], never written by hand. - Outcome
- Action outputs that can report failure to a form or grid.
- Params
- Screen params. Implemented by
#[params]; screens without params use(). - Path
Value - A params field type that can be a path segment of a route, such as
idin/orders/{id}. A segment only parses in the one form the framework writes it in (7, not+7or007), so each record has one address. - Rate
Store - Counters behind a rate limit. The built in one keeps them in memory, which is right for a single
server; several servers behind a load balancer need a shared store such as
RedisStore(Cargo featureredis). - Screen
Def - A screen. Implemented by
#[screen], never written by hand. - Service
- Marks a type as an injectable service. Register it with
App::service. - Supports
MinMax - Types that accept the
minandmaxrules. - Supports
MinMax Total - Column types that accept
min()andmax()totals in a grid. - Supports
Required - Types that accept the
requiredrule. - Supports
Scale - Types that accept the
scaleandprecisionrules. - Supports
Sum - Column types that accept
sum()in a grid. - Supports
Text - Types that accept the text rules
min_len,max_lenandemail. - Upload
Value - Field types an upload control can fill.
- VecItem
- Item types a
Vec<T>field can hold: line models (#[model],#[entity]), edited as a lines table, and#[choice]enums, edited with a multi select.Vec<i64>holds ids forForm::lookup_many. - Workflow
State - States are
#[choice]enums.
Functions§
- browser_
shortcut - Whether a normalized shortcut (see
normalize_shortcut) belongs to the browser. - can_
unmask - Whether the identity behind
ctxmay see the raw value of a masked field. Never for calls made by AI agents (MCP, WebMCP, the assistant): masked values do not go to models, whatever the user may see. - check_
csv - Reads a CSV file and validates every row as a form of
Mwould, in the user’s language and time zone. Columns are matched by field name or label, in any case. - check_
file - Reads a CSV or XLSX file and validates every row as
check_csvdoes. XLSX cells keep their types: numbers, dates and booleans are read as such, whatever the user’s locale. - clean_
file_ name - A file name safe to keep and show: the part after the last
/or\, without control characters, cut toMAX_FILE_NAMEcharacters, never empty, never starting with a dot. - client_
ip - The client’s address: the connection’s peer, or, when the peer is a trusted proxy, the last
address in
X-Forwarded-Forthat is not a trusted proxy. - embed_
url - The canonical form of an address to embed, or
Nonewhen it cannot be embedded. - error_
report - Error report as CSV (
row;field;message), safe to open in a spreadsheet. - masked_
text - The text a masked field is shown with. Unmasked fields come back unchanged.
- media_
type - Content type for a file name, by its extension;
application/octet-streamwhen unknown. - model_
schema - JSON Schema of an object with the model’s fields.
- normalize_
shortcut - Reads a shortcut such as
"ctrl+shift+p"into the formaria-keyshortcutsuses:Control+Shift+P. Modifiers come in the order Control, Alt, Shift, Meta.Nonewhen it cannot be read. - parse_
csv - Reads CSV text: a UTF-8 byte order mark is dropped, the separator (
,,;or tab) is taken from the header line, values may be quoted with"(doubled inside), quoted values may hold separators and line breaks, and both\r\nand\nend a row. Empty lines are skipped. - parse_
ranges - Parses a list of ranges; invalid entries are reported so a typo never opens a door silently.
- position_
cursor - Cursor for a row position in an in memory list.
- range_
presets - Ranges offered next to a date range picker, worked out from today in the user’s time zone:
(key, from, to)with keystoday,yesterday,last_7_days,this_month,last_month,this_year. Labels are thezeyn.ui.date.presets.{key}catalog texts. - reveal_
in - The raw value of a masked field of
model, for an audited reveal. - route_
has_ segments - Whether a route has path segments. Usable in constant checks.
- screen_
url - URL of a screen at
path(its route with the feature prefix) with these params: path segments filled from the params fields of the same name, the other fields in the JSONparamsquery. Fields that arenull(an emptyOption) are left out of the query, so the address stays canonical.Nonewhen a segment’s field is missing or not a number or a usable string. - total
- Computes one total over a column’s values. Nulls are skipped.
Nonewhen the op does not fit the values (a sum of text, or money in different currencies). Money averages round half away from zero to the smallest unit. - valid_
file_ id - Whether a file id has the shape the server generates: 32 lower case hex digits.
- valid_
media_ id - Whether a media id or source name has a safe shape: 1 to 128 ASCII letters, digits,
-,_and., not starting with a dot and without... Ids that fail are answered with404before any source sees them.
Type Aliases§
- BoxFuture
- Boxed future returned by generated
callandbuildfunctions. - Result
- Result type of Zeyn actions.
Attribute Macros§
- action
- Defines a server side action. Access must be declared.
- choice
- Defines a field type with a fixed set of options (a select list). Variants may take
#[label("...")]. - entity
- Defines a model stored in a database table. Needs
table = "..."and exactly one#[key]field. - model
- Defines validated data that is not tied to a table: form input, filters, wizard steps, report rows.
- params
- Marks a struct or enum as screen params.
- screen
- Defines a screen. The first argument is its params; a screen without params takes none or
_: ().