Expand description
The document formats this build ships, read once out of the frontend bundle.
§Why a global tier exists
doc_formats says which app owns a content type, where its documents live and
how to index them. Written at runtime by the shell — an app starts, says “I
handle cloudillo/notillo”, the shell PUTs its bundled copy of that app’s
manifest — that copies the same constant into one row per tenant per node, and
only for a tenant whose user actually opened the app. A tenant nobody logged
into, a guest arriving on a share link, a manifest changed by an upgrade
nobody has opened yet — all end up with documents stored but not indexed.
The data is a property of the bundle, so it is loaded from the bundle: the
frontend build serialises each bundled app’s manifest into dist, and this
registry reads them at startup. Conceptually the tn_id = 0 tier, but held in
memory and never written to doc_formats — nothing is duplicated into the
database, and there is nothing to migrate when the bundle changes.
§Precedence
A tenant row always wins, whatever its formatVersion. A row means the tenant
deliberately installed something — usually a packaged app whose code lives in a
blob — and a backend upgrade must never silently repoint it at a bundled app.
DELETE /api/doc-formats/{content_type} drops the row and reverts to the
bundled entry. There is no way to suppress a bundled format, only to override
it; see cloudillo_core::doc_format for the resolution itself.
§Failure is not fatal
DIST_DIR is externally supplied data that a deployment can point anywhere,
and dev checkouts frequently have no dist at all. A missing directory, an
unreadable file, malformed JSON or an invalid search block therefore degrade
— to an empty registry, or to one format fewer — rather than failing startup.
An empty registry leaves resolution entirely to the tenant’s own rows.
Structs§
- Bundled
AppRegistry - The doc formats the bundle declares, keyed by content type.
Functions§
- encode_
format_ version "1.0.0"→1_000_000. The inverse of the frontend’sdecodeFormatVersionand the exact encodingencodeFormatVersionproduces: three decimal digits per component,major * 1_000_000 + minor * 1_000 + patch, each component0..=999.