@schedule-runner-js/core
v0.1.0
Published
Reusable scheduler engine extracted from this repository.
Downloads
5
Readme
@schedule-runner-js/core
Reusable scheduler engine extracted from this repository.
What it provides:
ScheduleRunner- action registration via
onAction()/registerAction() - typed event shape and hydrator hooks
SchedulerStorePortboundary for plugging in your own store
Minimal usage:
import { ScheduleRunner, type SchedulerEventShape } from "@schedule-runner-js/core";
type MyAction = { kind: "notify"; channel: string };
type MyEvent = SchedulerEventShape<MyAction>;
const runner = new ScheduleRunner<MyAction, MyEvent>({
connectionString,
store,
getActionType: (action) => action.kind
});
runner.onAction("notify", async ({ event, phase, action }) => {
console.log(phase, event.id, action.channel);
});
await runner.start();This package expects a PostgreSQL connection string for LISTEN/NOTIFY.
The actual event persistence and due-event fetching live behind SchedulerStorePort.
