ScheduleClient
The scheduled client is a client for managing scheduled workflows within Hatchet
Methods
bulkDelete()
Bulk deletes scheduled runs (by explicit IDs and/or a filter).
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | { filter?: ScheduledWorkflowsBulkDeleteFilter; scheduledRuns?: (… | …)[]; } | Either scheduledRuns (ids/objects) and/or a server-side filter. |
opts.filter? | ScheduledWorkflowsBulkDeleteFilter | - |
opts.scheduledRuns? | (… | …)[] | - |
Returns
Promise<ScheduledWorkflowsBulkDeleteResponse>
A promise that resolves to deleted ids + per-id errors.
bulkUpdate()
Bulk updates (reschedules) scheduled runs.
Parameters
| Parameter | Type | Description |
|---|---|---|
updates | object[] | List of id/object + new triggerAt. |
Returns
Promise<ScheduledWorkflowsBulkUpdateResponse>
A promise that resolves to updated ids + per-id errors.
create()
Creates a new Scheduled Run.
Parameters
| Parameter | Type | Description |
|---|---|---|
workflow | string | Workflow | The workflow name or Workflow object. |
cron | { additionalMetadata?: Record<string, string>; input?: Record<string, any>; priority?: number; triggerAt: Date; } | - |
cron.additionalMetadata? | Record<string, string> | - |
cron.input? | Record<string, any> | - |
cron.priority? | number | - |
cron.triggerAt | Date | - |
Returns
Promise<ScheduledWorkflows>
A promise that resolves to the created ScheduledWorkflows object.
Throws
Will throw an error if the input is invalid or the API call fails.
delete()
Deletes an existing Scheduled Run.
Parameters
| Parameter | Type | Description |
|---|---|---|
scheduledRun | string | ScheduledWorkflows | The Scheduled Run ID as a string or ScheduledWorkflows object. |
Returns
Promise<void>
A promise that resolves when the Scheduled Run is deleted.
get()
Retrieves a specific Scheduled Run by its ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
scheduledRun | string | ScheduledWorkflows | The Scheduled Run ID as a string or ScheduledWorkflows object. |
Returns
Promise<ScheduledWorkflows>
A promise that resolves to the ScheduledWorkflows object.
list()
Lists all Cron Triggers based on the provided query parameters.
Parameters
| Parameter | Type | Description |
|---|---|---|
query | object & object | Query parameters for listing Scheduled Runs. |
Returns
Promise<ScheduledWorkflowsList>
A promise that resolves to a ScheduledWorkflowsList object.
update()
Updates (reschedules) an existing Scheduled Run.
Parameters
| Parameter | Type | Description |
|---|---|---|
scheduledRun | string | ScheduledWorkflows | The Scheduled Run ID as a string or ScheduledWorkflows object. |
update | { triggerAt: Date; } | The update payload (currently only triggerAt). |
update.triggerAt | Date | - |
Returns
Promise<ScheduledWorkflows>
A promise that resolves to the updated ScheduledWorkflows object.