@ontemper/cron
v0.1.0
Published
Declarative cron schedule SDK for Temper workflows. defineCrons() returns a validated, serializable cron declaration consumed by the platform scheduler.
Readme
@ontemper/cron
Declarative cron schedule SDK for Temper workflows.
defineCrons() is a pure, Zod-validated passthrough — it does not start a
ticker in your workflow process. It exports a normalized declaration that the
Temper platform reads at deploy time and drives via its external scheduler.
Usage
import { defineCrons } from '@ontemper/cron';
export const crons = defineCrons([
{
name: 'poll-sftp',
schedule: '*/10 * * * *',
timeZone: 'UTC',
request: {
method: 'POST',
path: '/jobs/poll-sftp',
body: { reason: 'scheduled' },
},
},
]);Then expose the handler on your workflow server:
server.post('/jobs/poll-sftp', async () => {
await pollSftp();
return { status: 200, body: {} };
});Validation
- 5-field cron expression, minimum interval ≥ 60 seconds
timeZoneis an IANA tz string, defaults toUTCpathmust start with/, no.., no scheme/host, max 512 charsbodymust be JSON-serializable and ≤ 16 KiBnamematches/^[a-z0-9-]{1,64}$/and is unique within the array- Maximum of 20 crons per workflow
Invalid input throws synchronously at defineCrons() call time.
