@nwire/cron
v0.7.1
Published
Nwire — cron interface factory. Dispatch actions on a schedule (croner-backed).
Readme
@nwire/cron
Scheduled-trigger interface — fires actions on a cron expression.
What it does
A small wire that ticks named cron expressions and dispatches Nwire actions against the right app. Each tick seeds a fresh envelope; correlation/causation propagate through any chained dispatches. Built on croner. For multi-process deployments run cron in ONE process (typically the worker wire) — replicating it fires each job N times.
Install
pnpm add @nwire/cronQuick start
import { createCronWire } from "@nwire/cron";
import { apps } from "@amit/learnflow";
createCronWire({
apps,
schedule: {
"0 2 * * *": "submissions.reprocess-stale",
"*/15 * * * *": { action: "mastery.recompute" },
"0 9 * * 1": { action: "reports.weekly", input: { audience: "admins" } },
},
}).start();API surface
createCronWire({ apps, schedule, logger? })— boot the cron wire.CronScheduleEntry—stringshortcut (action name) or{ action, input? }.
When to use
Whenever you need time-based triggers — nightly aggregations, weekly reports, periodic syncs.
Within nwire-app
For developers using this package as part of the Nwire stack — register it via app.use(...) or it auto-wires when you compose createApp({ modules }).
import { createApp } from "@nwire/forge";
const app = createApp({
/* ...config... */
});
// Adapter/plugin wiring happens here when applicable.