Job
Job protocol schemas
Cron Schedule Schema
Schedule jobs using cron expressions
Source: packages/spec/src/system/job.zod.ts
TypeScript Usage
import { IntervalSchedule, JobExecution, JobExecutionStatus, OnceSchedule, RetryPolicy } from '@objectstack/spec/system';
import type { IntervalSchedule, JobExecution, JobExecutionStatus, OnceSchedule, RetryPolicy } from '@objectstack/spec/system';
// Validate data
const result = IntervalSchedule.parse(data);IntervalSchedule
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| type | string | ✅ | |
| intervalMs | integer | ✅ | Interval in milliseconds |
JobExecution
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| jobId | string | ✅ | Job identifier |
| startedAt | string | ✅ | ISO 8601 datetime when execution started |
| completedAt | string | optional | ISO 8601 datetime when execution completed |
| status | Enum<'running' | 'success' | 'failed' | 'timeout'> | ✅ | Execution status |
| error | string | optional | Error message if failed |
| duration | integer | optional | Execution duration in milliseconds |
JobExecutionStatus
Allowed Values
runningsuccessfailedtimeout
OnceSchedule
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| type | string | ✅ | |
| at | string | ✅ | ISO 8601 datetime when to execute |
RetryPolicy
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| maxRetries | integer | ✅ | Maximum number of retry attempts |
| backoffMs | integer | ✅ | Initial backoff delay in milliseconds |
| backoffMultiplier | number | ✅ | Multiplier for exponential backoff |