Task Entities
These entities are used by the Task adapter and encapsulate data objects used by the Epicenter Task API.
Enums
RETRY_POLICY
Specifies what should happen if a task fails to execute.
Possible values:
RETRY_POLICY.DO_NOTHING = 'DO_NOTHING'- If the task fails, do nothing. This is the default.RETRY_POLICY.FIRE_ON_FAIL_SAFE = 'FIRE_ON_FAIL_SAFE'- Retry the task within its fail-safe execution window.
Interfaces
TaskScopeReadOutView
Represents the scope associated with a task. Extends GenericScope.
Properties
userKey?: string- (Optional) Key of the user associated with the task, for user-specific scope.
StatusReadOutView
Represents the current group status as returned by the API.
Properties
code?: string- (Optional) Status code.message?: string- (Optional) Status message.
StatusCreateInView
Represents a group status to set when a groupStatus task fires.
Properties
code: string- Status code.message: string- Status message.
CronTaskTriggerCreateInView
Used to schedule a repeating task.
Properties
objectType: 'cron'- Identifies the trigger as a cron trigger.value: string- A cron expression (e.g.'0 7 * * * ?') describing when the task should fire.
DateTaskTriggerCreateInView
Represents a trigger that fires once, at a specific date and time.
Properties
objectType: 'date'- Identifies the trigger as a date trigger.value: string- An ISO-8601 date-time string describing when the task should fire.
OffsetTaskTriggerCreateInView
Represents a trigger that fires once, after an offset relative to the time the task is created.
Properties
objectType: 'offset'- Identifies the trigger as an offset trigger.minutes?: number- (Optional) Number of minutes until the task fires.hours?: number- (Optional) Number of hours until the task fires.days?: number- (Optional) Number of days until the task fires.
HttpTaskPayloadCreateInView
Represents an HTTP request to be executed when a task fires.
Generics
B extends object = TaskPayloadBody- (Optional) Shape of the requestbody. Defaults toTaskPayloadBody.H extends object = TaskPayloadHeaders- (Optional) Shape of the requestheaders. Defaults toTaskPayloadHeaders.
Properties
objectType: 'http'- Identifies the payload as an HTTP request.method: TaskHttpMethod- HTTP method to use. SeeTaskHttpMethod.url: string- Relative URL the request is sent to. Gets appended to the application URL as{host}{targetPath}/{account}/{project}{url}.target?: 'APPLICATION' | 'PROXY'- (Optional) Where the task fires: the project app ('APPLICATION', the default) or the project's proxy server ('PROXY').body: B- JSON body of the HTTP request.headers?: H- (Optional) Headers to send with the request. Must be non-empty when provided. If headers are not required, omit this property rather than pass an empty object.timeoutSeconds?: number- (Optional) The HTML timeout in seconds. Must be between 1 and 30.
GroupStatusTaskPayloadCreateInView
Represents a group status change to be applied when a task fires.
Properties
objectType: 'groupStatus'- Identifies the payload as a group-status change.groupKey: string- Key of the group whose status will be changed.status: StatusCreateInView- The status to set.
HttpTaskPayloadReadOutView
Represents an HTTP task payload as returned by the API.
Generics
B extends object = TaskPayloadBody- (Optional) Shape of the requestbody. Defaults toTaskPayloadBody.H extends object = TaskPayloadHeaders- (Optional) Shape of the requestheaders. Defaults toTaskPayloadHeaders.
Properties
objectType: 'http'- Identifies the payload as an HTTP request.method?: TaskHttpMethod- (Optional) HTTP method used. SeeTaskHttpMethod.url?: string- (Optional) Relative URL the request is sent to.target?: 'application' | 'proxy'- (Optional) Where the task fires.body?: B- (Optional) JSON body of the HTTP request.headers?: H- (Optional) Headers sent with the request.timeoutSeconds?: number- (Optional) Request timeout in seconds.
GroupStatusTaskPayloadReadOutView
Represents a group-status task payload as returned by the API.
Properties
objectType: 'groupStatus'- Identifies the payload as a group-status change.groupKey?: string- (Optional) Key of the group whose status will be changed.status?: StatusReadOutView- (Optional) The status to set.
TaskReadOutView
TaskReadOutView is used by the Task adapter functions and contains the properties of a task. It is a generic type that allows you to strongly type the task's payload body and headers.
Type parameters
B extends object = TaskPayloadBody- (Optional) Shape of the payload's requestbody. Defaults toTaskPayloadBody.H extends object = TaskPayloadHeaders- (Optional) Shape of the payload's requestheaders. Defaults toTaskPayloadHeaders.
Properties
taskKey?: string- (Optional) Unique key identifying the task.name?: string- (Optional) Name of the task.status?: TaskStatusReadOutView- (Optional) Current status of the task.cron?: string- (Optional) Cron expression driving the task, if the task was created with a cron trigger.mutationKey?: string- (Optional) Mutation key for the task.failures?: number- (Optional) Number of times the task has failed.successes?: number- (Optional) Number of times the task has succeeded.address?: TaskAddressReadOutView- (Optional) Address associated with the task.payload?: TaskPayloadReadOutView<B, H>- (Optional) The payload executed when the task fires.scope?: TaskScopeReadOutView- (Optional) The scope of the task.retryPolicy?: TaskRetryPolicyReadOutView- (Optional) The retry policy applied to the task.failSafeTermination?: string- (Optional) The date when Epicenter will stop running the Task (if it's scheduled as a repeated event).ttlSeconds?: number- (Optional) The amount of time Epicenter waits for the task's operation to complete before marking it as failed.
TaskHistoryReadOutView
Represents a single record of a task's history.
Properties
result?: string- (Optional) Result of the task's operation.execution?: number- (Optional) Timestamp of when the task ran.response?: number- (Optional) Timestamp of when the response was received.success?: boolean- (Optional) Whether the operation succeeded.taskId?: number- (Optional) Numeric identifier for this execution of the task.
TaskPageOptions
Pagination options used when retrieving a task's history.
Properties
first?: number- (Optional) Zero-based index of the first record. Defaults to0.max?: number- (Optional) Maximum number of records to return. Defaults to100and cannot exceed100.
TaskScopePageOptions
Pagination and sorting options used when retrieving tasks by scope. Extends TaskPageOptions.
Properties
sort?: string[]- (Optional) Task fields to sort by.
Type aliases
TaskPayloadBody
Record<string, unknown>
Represents the default shape of an HTTP task payload's request body.
TaskPayloadHeaders
Record<string, string>
Represents the default shape of an HTTP task payload's request headers.
TaskHttpMethod
A union type defining the supported HTTP methods for an HttpTaskPayloadCreateInView:
'GET''POST''PUT''DELETE'
TaskRetryPolicyReadOutView
A union type describing the possible values of a task's retryPolicy as returned by the API:
'do_nothing''fire_on_fail_safe'
TaskStatusReadOutView
A union type describing the possible values of a task's status:
'initialized''triggered''succeeded''failed''cancelled''terminated'
TaskAddressReadOutView
Partial<Address>
Represents the address associated with a task. All fields are optional.
TaskTriggerCreateInView
This union type implements:
TaskPayloadCreateInView
This union type implements:
HttpTaskPayloadCreateInput
Represents the input shape accepted by taskAdapter.create() for an HTTP payload. Equivalent to HttpTaskPayloadCreateInView, except that objectType is optional (it is set to 'http' automatically if omitted).
Generics
B extends object = TaskPayloadBody- (Optional) Shape of the requestbody. Defaults toTaskPayloadBody.H extends object = TaskPayloadHeaders- (Optional) Shape of the requestheaders. Defaults toTaskPayloadHeaders.
TaskPayloadCreateInput
Describes the payload for a newly created task.
Used as the payload argument type of taskAdapter.create().
TaskPayloadReadOutView
This union type implements: