CMS / foldkit-cms-drizzle
Scheduling
CmsSchedule promises a draft for later: it sets the draft's scheduledFor,
after checking the publish mutation would take the draft now. What could not be
published now is not promised for later. CmsUnschedule takes the promise back.
Nothing else happens until you call due:
// A Cloudflare cron trigger, a setInterval, a queue consumer: the host's choice.
export default {
scheduled: () =>
run(cms.due(new Date(), { as: name => authors.byName(name) })),
}- Triggered by your host. Call
cms.duefrom a Cloudflare cron trigger, queue consumer, or interval so clustered hosts never fire duplicate jobs. due(now, { as })publishes every draft whose time has come, each in its own transaction, as whoever scheduled it: a draft keeps the name yournameOfgave, andassays who that is now. Someone who has since lost the right publishes nothing.- A publish that fails stays scheduled, with the reason. The entry reads
overdue with that error, and stays paused until the draft changes so a fault
is not hammered every minute. The entry keeps a reader-facing reason as it is
(a denial, a declared refusal,
RemoteServer.tell); any driver or handler failure readsInternal error, incident <id>on the entry and reports its cause as aServerDefect(during: 'publish due <entry>') through theDiagnostics.Reporterdueruns with. - What was promised is changed only by someone who could have promised it.
Since a scheduled draft is published as whoever scheduled it, saving over it,
restoring over it or discarding it is refused to an author your
transitionsorallowwould not letschedule. Otherwise someone who may not publish would publish through someone who may. - One failure leaves the remaining entries running.
dueanswers with each entry and its error (ornull) in the failure's own words for host logging. - An archived entry keeps its promise waiting until restored.
Restoring
CmsRestore copies a past revision's value into a working draft to review,
edit, and publish as the next revision. It replaces any current draft, clears
any pending schedule, and keeps the form values key by key so older revisions
still open cleanly.
Archiving
CmsArchive puts an entry away: off the worklist, and, for a type with a
published role, off show. CmsUnarchive brings it back as unpublished work;
publishing shows it again.
The worklist, and an entry's state
cms.queries includes Cms.Entries: the entries of one content type, searched
by label (literal characters: % and _ are matched directly, not as
wildcards), filtered by archived status. It lists entries rather than published
rows, so unpublished drafts appear in the worklist.
An entry's state is derived on the server with Cms.state from whether the
entry has a draft, whether a visitor can see its row, and your now clock. An
overdue scheduled publish reads overdue with its reason.