every
uses #tcm/host (checkSchedule)
A recurring job: export const nightly = every("0 3 * * *", cleanup) (five cron fields, UTC) or an interval
like every("15m", sync). tcm start / tcm dev run the jobs in the app's namespace, once per slot.
import type { RecurringJob } from "#codebase/tcmts/server"; import { checkSchedule } from "#tcm/host"; export function every(spec: string, fn: () => unknown): RecurringJob { checkSchedule(spec); if (typeof fn !== "function") throw new TypeError("every() needs a function"); return { [Symbol.for("tcm.job")]: true, spec, fn } as RecurringJob; }