Parameters
The id of the schedule to register. The identifier you use will be available in the
context.source.id
when the Job runs.
The schedule to register. It is either a cron
or interval
schedule.
The cron expression to use.
Any additional data you wish to store with the schedule. This will be available in the
context.source.metadata
when the Job runs.
An optional account ID to use when running the job. This will be available in the Job
context and can be used in auth
resolvers
The number of seconds between each trigger.
Any additional data you wish to store with the schedule. This will be available in the
context.source.metadata
when the Job runs.
An optional account ID to use when running the job. This will be available in the Job
context and can be used in auth
resolvers
Returns
The id of the schedule that was registered.
The schedule that was registered, one of “cron” or “interval”.
The type of schedule. This will always be “cron”.
An object containing options about the CRON schedule.
The registered CRON expression.
Any additional metadata about the interval.
The type of schedule. This will always be “interval”.
An object containing options about the interval.
The number of seconds for the interval. Min = 60, Max = 2_592_000 (30 days)
Any additional metadata about the interval.
Metadata about the schedule.
Whether the schedule is active or not.
await dynamicSchedule.register(userId, {
type: "cron",
options: {
cron: "0 0 * * *",
},
});