Expand description
Flow templates - versionable, named flow graphs persisted to disk, grouped into collections by SQLite metadata.
Filesystem layout is intentionally flat: one JSON file per template at
<dir>/<slug>.flow.json (plus an optional sibling <slug>.flow text
projection). Collections do not affect filesystem layout - they’re held in
the template_collections / template_membership tables on
flow_storage::Store. A template with no template_membership row is in
the system-managed Default collection.
Structs§
- Template
Record - Template
Source - Source provenance for a template installed from the Template Hub. Plain struct rather than an enum: there is exactly one source today; widen later if another lands.
Enums§
Constants§
- DEFAULT_
COLLECTION_ NAME - Display name of the Default collection, used by
ensure_default. - DEFAULT_
COLLECTION_ SLUG - Slug of the system-managed Default collection. Every template whose
template_membershiprow is absent is reported as belonging here.
Functions§
- delete
- File-first deletion: removes the canonical JSON, then the sibling DSL, then the membership row. Membership cleanup is best-effort and logs on failure - the file is the source of truth.
- ensure_
default - Idempotently insert the Default collection row at boot. Called by
FlowApp::new. Safe to call repeatedly: the upsert never downgradesis_systemonce set. - list
- List every template on disk, annotated with its collection + source from
the membership index. Files without a membership row report
DEFAULT_COLLECTION_SLUGandsource: None. - list_in
- List templates in one collection only. Files in other collections are skipped. Files with no membership row count as Default.
- load
- save
- Save a template into
collection_slug. Membership is written only when the placement is non-default OR a hubsourceis supplied - keeps the SQLite skinny: in-default user-authored templates have no row. - save_
with_ slug - Lower-level save that takes an explicit slug instead of deriving one.
Used by the Hub install path, where the catalog slug must stay stable
across versions even when the display name changes.
slugis validated against the same[a-z0-9-]+rule as the renderer-facing routes.