workflowdataclient

package
v1.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPageSize = 100

Variables

ValidExecutionStatuses is the full set of values accepted by the platform.

Functions

This section is empty.

Types

type CapabilityExecutionError added in v1.24.0

type CapabilityExecutionError struct {
	Error string
	Count int
}

CapabilityExecutionError is an error attached to a capability event.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client fetches workflow data from the CRE platform GraphQL API.

func New

func New(gql *graphqlclient.Client, log *zerolog.Logger) *Client

New creates a WorkflowDataClient backed by the provided GraphQL client.

func (*Client) CountExecutions added in v1.24.0

func (c *Client) CountExecutions(parent context.Context, workflowUUID string, statuses []ExecutionStatus) (int, error)

CountExecutions returns the total number of executions matching the given filters. It fetches only a single-item page — only the count field is used.

func (*Client) CreateServiceContextWithTimeout added in v1.17.0

func (c *Client) CreateServiceContextWithTimeout(parent context.Context) (context.Context, context.CancelFunc)

func (*Client) FindExecutionByOnChainID added in v1.24.0

func (c *Client) FindExecutionByOnChainID(parent context.Context, onChainID string) (*Execution, error)

FindExecutionByOnChainID resolves the platform UUID for an execution given its on-chain hex ID (the identifier shown in the Explorer UI). It uses the platform workflowExecutions search filter, then verifies an exact id match on the result.

func (*Client) GetExecution added in v1.24.0

func (c *Client) GetExecution(parent context.Context, uuid string) (*Execution, error)

GetExecution fetches a single execution by its UUID.

func (*Client) GetLatestDeployment added in v1.24.0

func (c *Client) GetLatestDeployment(parent context.Context, workflowUUID string, from, to time.Time) (*WorkflowDeploymentRecord, error)

GetLatestDeployment fetches the most recent deployment record for a workflow. from/to mirror what the Explorer UI passes — the backend requires them even though the schema marks them optional.

func (*Client) GetWorkflowSummary added in v1.24.0

func (c *Client) GetWorkflowSummary(parent context.Context, uuid string, from time.Time) (*WorkflowSummary, error)

GetWorkflowSummary fetches extended workflow details including execution health.

func (*Client) ListAll

func (c *Client) ListAll(parent context.Context, pageSize int) ([]Workflow, error)

ListAll pages through the ListWorkflows query and returns all workflows.

func (*Client) ListExecutionEvents added in v1.24.0

func (c *Client) ListExecutionEvents(parent context.Context, in ListEventsInput) ([]ExecutionEvent, error)

ListExecutionEvents fetches all node/capability events for an execution.

func (*Client) ListExecutionLogs added in v1.24.0

func (c *Client) ListExecutionLogs(parent context.Context, executionUUID string) ([]ExecutionLog, error)

ListExecutionLogs fetches all log lines for an execution.

func (*Client) ListExecutions added in v1.24.0

func (c *Client) ListExecutions(parent context.Context, in ListExecutionsInput) ([]Execution, error)

ListExecutions fetches workflow executions matching the given filters. At most one page of results is returned; Limit controls page size (max 100).

func (*Client) ListWithFilter added in v1.24.0

func (c *Client) ListWithFilter(parent context.Context, pageSize int, filter ListFilter) ([]Workflow, error)

ListWithFilter pages through the ListWorkflows query with optional search and workflow-owner filters.

func (*Client) SearchByName added in v1.13.0

func (c *Client) SearchByName(parent context.Context, name string, pageSize int, ownerAddress string) ([]Workflow, error)

SearchByName pages through the ListWorkflows query with the given search filter (server-side contains match on workflow name). When ownerAddress is non-empty, results are scoped to that workflow owner.

func (*Client) SetServiceTimeout added in v1.17.0

func (c *Client) SetServiceTimeout(timeout time.Duration)

type Execution added in v1.24.0

type Execution struct {
	UUID         string
	ID           string // on-chain execution ID shown in the Explorer UI
	WorkflowUUID string
	WorkflowID   string // on-chain workflow hash (workflowId scalar)
	WorkflowName string
	Status       ExecutionStatus
	StartedAt    time.Time
	FinishedAt   *time.Time
	CreditUsed   *string // CreditAmount scalar serialised as a string
	Errors       []ExecutionError
}

Execution is a single workflow execution record.

type ExecutionError added in v1.24.0

type ExecutionError struct {
	Error string
	Count int
}

ExecutionError is a top-level error on a workflow execution.

type ExecutionEvent added in v1.24.0

type ExecutionEvent struct {
	CapabilityID string
	Status       string
	StartedAt    time.Time
	FinishedAt   *time.Time
	Errors       []CapabilityExecutionError
	Method       *string
}

ExecutionEvent is one node/capability event within an execution.

type ExecutionLog added in v1.24.0

type ExecutionLog struct {
	NodeID    string
	Message   string
	Timestamp time.Time
}

ExecutionLog is a single log line emitted during an execution.

type ExecutionStatus added in v1.24.0

type ExecutionStatus string

ExecutionStatus mirrors the WorkflowExecutionStatus enum from the platform schema.

const (
	ExecutionStatusUnknown     ExecutionStatus = "UNKNOWN"
	ExecutionStatusUnspecified ExecutionStatus = "UNSPECIFIED"
	ExecutionStatusTriggered   ExecutionStatus = "TRIGGERED"
	ExecutionStatusInProgress  ExecutionStatus = "IN_PROGRESS"
	ExecutionStatusSuccess     ExecutionStatus = "SUCCESS"
	ExecutionStatusFailure     ExecutionStatus = "FAILURE"
)

type ListEventsInput added in v1.24.0

type ListEventsInput struct {
	ExecutionUUID string
	CapabilityID  *string
	Status        *string
}

ListEventsInput maps to WorkflowExecutionEventsInput on the platform.

type ListExecutionsInput added in v1.24.0

type ListExecutionsInput struct {
	WorkflowUUID *string
	Statuses     []ExecutionStatus
	From         *time.Time
	To           *time.Time
	// Search is passed to the platform search filter (e.g. on-chain execution id hex).
	Search *string
	// Limit is the maximum number of results to return (capped at 100 by the API).
	Limit int
}

ListExecutionsInput maps to WorkflowExecutionsInput on the platform.

type ListFilter added in v1.24.0

type ListFilter struct {
	Search               string
	WorkflowOwnerAddress string
}

ListFilter controls optional server-side filters for ListWorkflows.

type Workflow

type Workflow struct {
	UUID           string
	Name           string
	WorkflowID     string
	OwnerAddress   string
	Status         string
	WorkflowSource string
}

Workflow is a workflow row returned by the platform list API.

type WorkflowDeploymentRecord added in v1.24.0

type WorkflowDeploymentRecord struct {
	UUID         string
	WorkflowID   string
	Status       string
	DeployedAt   time.Time
	TxHash       *string
	BinaryURL    *string
	ConfigURL    *string
	ErrorMessage *string
}

WorkflowDeploymentRecord is a single deployment entry.

type WorkflowSummary added in v1.24.0

type WorkflowSummary struct {
	UUID           string
	Name           string
	WorkflowID     string
	OwnerAddress   string
	Status         string
	WorkflowSource string
	RegisteredAt   time.Time
	ExecutedAt     *time.Time
	ExecutionCount int
	SuccessCount   int
	FailureCount   int
}

WorkflowSummary is an extended workflow record including execution health fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL