open-index/open-npm huggingface dataset:
npm package: @schedule-runner-js/core
Description: Reusable scheduler engine extracted from this repository.
Latest version: 0.1.0

# @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
- `SchedulerStorePort` boundary for plugging in your own store

Minimal usage:

```ts
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`.