We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking "Accept", you agree to our use of cookies.
Learn more.

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

ParameterTypeDescription
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

ParameterTypeDescription
updatesobject[]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

ParameterTypeDescription
workflowstring | WorkflowThe 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.triggerAtDate-

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

ParameterTypeDescription
scheduledRunstring | ScheduledWorkflowsThe 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

ParameterTypeDescription
scheduledRunstring | ScheduledWorkflowsThe 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

ParameterTypeDescription
queryobject & objectQuery parameters for listing Scheduled Runs.

Returns

Promise<ScheduledWorkflowsList>

A promise that resolves to a ScheduledWorkflowsList object.

update()

Updates (reschedules) an existing Scheduled Run.

Parameters

ParameterTypeDescription
scheduledRunstring | ScheduledWorkflowsThe Scheduled Run ID as a string or ScheduledWorkflows object.
update{ triggerAt: Date; }The update payload (currently only triggerAt).
update.triggerAtDate-

Returns

Promise<ScheduledWorkflows>

A promise that resolves to the updated ScheduledWorkflows object.