import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.workflowExecution.retrieve("wrk_123")
.then(({ workflow_execution }) => {
console.log(workflow_execution)
}){
"workflow_execution": {
"id": "<string>",
"workflow_id": "<string>",
"transaction_id": "<string>",
"execution": {
"steps": {}
},
"context": {
"compensate": {},
"errors": [
{
"error": {},
"action": "<string>",
"handlerType": "<string>"
}
],
"data": {
"invoke": {},
"payload": "<unknown>"
}
},
"state": "not_started",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}Retrieve a workflows execution by its ID. You can expand the workflows execution’s relations or select the fields that should be returned.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.workflowExecution.retrieve("wrk_123")
.then(({ workflow_execution }) => {
console.log(workflow_execution)
}){
"workflow_execution": {
"id": "<string>",
"workflow_id": "<string>",
"transaction_id": "<string>",
"execution": {
"steps": {}
},
"context": {
"compensate": {},
"errors": [
{
"error": {},
"action": "<string>",
"handlerType": "<string>"
}
],
"data": {
"invoke": {},
"payload": "<unknown>"
}
},
"state": "not_started",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The workflows execution's ID.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
OK
The workflow execution's details.
The workflows execution's details.
Show child attributes
The workflow execution's ID.
The ID of the workflow.
The workflow execution's transaction ID.
The workflow execution's steps details.
Show child attributes
The execution's steps. Each object key is a step ID, and the value is the object whose properties are shown below.
Show child attributes
Show child attributes
The step's ID.
The state of the step's invokation function.
Show child attributes
The invokation step's state.
failed, not_started, invoking, compensating, done, reverted, dormant, skipped, skipped_failure, timeout The invokation step's state.
idle, ok, waiting_response, temp_failure, permanent_failure The step's definition details.
Show child attributes
Whether the step is async.
Whether the compensation function of the step is async.
Whether the step doesn't have a compensation function.
Whether the workflow should continue executing even if its status is changed to failed.
The ID of the step to skip to in case of a permanent failure.
The maximum number of times to retry the step.
Whether the workflow shouldn't wait for the step to finish before moving to the next step.
The interval in seconds between retry attempts when the step fails.
The interval in seconds to retry a step even if its status is waiting_response.
Whether the step's response is stored.
The maximum time in seconds to wait for this step to complete. If the step exceeds this time, the step's state is changed to timeout, but the step continues executing.
Whether the step should be automatically retried if it fails.
The maximum number of times to retry the step while it's in the waiting_response state.
The state of the step's compensation function.
Show child attributes
The compensation function's state.
failed, not_started, invoking, compensating, done, reverted, dormant, skipped, skipped_failure, timeout The compensation function's status.
idle, ok, waiting_response, temp_failure, permanent_failure The step's depth in the workflow's execution.
The timestamp the step started executing.
The workflow execution's context.
Show child attributes
The context's compensate.
The context's data.
Show child attributes
The step's invokation details.
Show child attributes
Show child attributes
the payload of the transaction.
The workflow execution's state.
not_started, invoking, waiting_to_compensate, compensating, done, reverted, failed The date the workflow execution was created.
The date the workflow execution was updated.
The date the workflow execution was deleted.