CMS / foldkit-cms
The lifecycle
State is derived from facts and a clock. Nothing stores a status, so it cannot disagree with what is true.
ts
Cms.state({ archivedAt: null, row: 'visible', draft: { scheduledFor, scheduleError: null } }, now)
// { _tag: 'Changed', schedule: { at, overdue: false, error: null } }| State | Facts |
|---|---|
New | no row yet |
Published | a row a visitor sees, and no draft |
Changed | a row a visitor sees, and unpublished work beside it |
Unpublished | a row hidden by its published role |
Archived | the entry was archived; nothing else applies until it is restored |
A schedule rides beside a state that has a draft. A scheduled publish that
did not happen reads overdue, with the reason, because that is true; it does
not read Published.
Cms.offers(facts, now, content) is the transitions an entry offers now:
save, discard, publish, schedule, unschedule, unpublish, archive,
unarchive, restore. It is what a view enables and what a server checks
before it asks who is asking. unpublish is offered only to a content type with
a published role.