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:

ts
// 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.due from 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 your nameOf gave, and as says 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 reads Internal error, incident <id> on the entry and reports its cause as a ServerDefect (during: 'publish due <entry>') through the Diagnostics.Reporter due runs 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 transitions or allow would not let schedule. Otherwise someone who may not publish would publish through someone who may.
  • One failure leaves the remaining entries running. due answers with each entry and its error (or null) 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.