Teach a word
Some words an entity uses are yours to define: a string format (format: 'slug'), an id generator
(generate: 'ulid'), a verb that reads (total). A frond teaches them in its vocabulary/
directory, which the scan reads first:
// fronds/blog/vocabulary/ulid.ts
import { Generators } from '@fougere/schema';
export const ulid = Generators.term('ulid', () => …);
// fronds/blog/entities/Post.ts
id: primary({ generate: 'ulid' }),
| Registry | A word for | Example |
|---|---|---|
StringFormats | a string's format | StringFormats.term('slug', …) |
Generators | how an id is generated | Generators.term('ulid', …) |
Verbs | whether an operation reads | Verbs.term('total', 'query') |
A word answers every entity of the process, whichever frond teaches it, and the statement lists it
beside the fronds (export const vocabulary = [ulid] in fronds.ts). An entity that names a word
nothing answers refuses the boot (term-missing).