workflowresolve

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: 10 Imported by: 0

Documentation

Overview

Package workflowresolve contains helpers for matching platform workflow rows to registries in the tenant context and rendering them as a table. It is shared by the workflow list and get commands.

The list API returns workflowSource as either the raw registry id (e.g. "private"), a "contract:<chainSelector>:<0x…>" tuple for on-chain rows, or a "grpc:<…>" string for off-chain rows — so direct equality with the context registry id only works in the first case.

Index

Constants

View Source
const OutputFormatJSON = "json"

Variables

This section is empty.

Functions

func AvailableRegistryIDs

func AvailableRegistryIDs(registries []*tenantctx.Registry) string

AvailableRegistryIDs returns a comma-separated list of registry IDs for use in error messages.

func FindRegistry

func FindRegistry(registries []*tenantctx.Registry, id string) *tenantctx.Registry

FindRegistry returns the registry entry with the matching ID, or nil.

func LooksLikeOnChainExecutionID

func LooksLikeOnChainExecutionID(s string) bool

LooksLikeOnChainExecutionID returns true for 64-char hex execution ids shown in Explorer.

func LooksLikeUUID

func LooksLikeUUID(s string) bool

LooksLikeUUID returns true for the standard UUID shape (8-4-4-4-12).

func LooksLikeWorkflowID

func LooksLikeWorkflowID(s string) bool

LooksLikeWorkflowID returns true for 64-char hex strings (on-chain WorkflowId).

func ParseContractWorkflowSource

func ParseContractWorkflowSource(workflowSource string) (selector, addr string, ok bool)

ParseContractWorkflowSource splits a "contract:<chainSelector>:<addr>" workflow source. ok is false when the prefix is not present.

func PrintEventsJSON

func PrintEventsJSON(events []workflowdataclient.ExecutionEvent) error

PrintEventsJSON marshals events as an indented JSON array to stdout.

func PrintEventsTable

func PrintEventsTable(events []workflowdataclient.ExecutionEvent)

PrintEventsTable renders events as a bulleted list to stdout.

func PrintExecutionDetailJSON

func PrintExecutionDetailJSON(e workflowdataclient.Execution, failedEvents []workflowdataclient.ExecutionEvent) error

PrintExecutionDetailJSON marshals a single execution with its errors and failed events to stdout.

func PrintExecutionDetailTable

func PrintExecutionDetailTable(e workflowdataclient.Execution, failedEvents []workflowdataclient.ExecutionEvent)

PrintExecutionDetailTable renders a single execution with failed capability events inline.

func PrintExecutionsJSON

func PrintExecutionsJSON(rows []workflowdataclient.Execution) error

PrintExecutionsJSON marshals a slice of executions as an indented JSON array to stdout.

func PrintExecutionsTable

func PrintExecutionsTable(rows []workflowdataclient.Execution)

PrintExecutionsTable renders executions as a bulleted list to stdout.

func PrintLogsJSON

func PrintLogsJSON(logs []workflowdataclient.ExecutionLog, nodeFilter string) error

PrintLogsJSON marshals logs as an indented JSON array to stdout. nodeFilter, if non-empty, restricts output to lines whose NodeID matches (case-insensitive).

func PrintLogsTable

func PrintLogsTable(logs []workflowdataclient.ExecutionLog, nodeFilter string)

PrintLogsTable renders log lines to stdout. nodeFilter, if non-empty, restricts output to lines whose NodeID matches (case-insensitive).

func PrintWorkflowStatusJSON

func PrintWorkflowStatusJSON(v WorkflowStatusView) error

PrintWorkflowStatusJSON marshals the status view as indented JSON to stdout.

func PrintWorkflowStatusTable

func PrintWorkflowStatusTable(v WorkflowStatusView)

PrintWorkflowStatusTable renders a rich workflow status view to stdout.

func PrintWorkflowTable

func PrintWorkflowTable(rows []Workflow, registries []*tenantctx.Registry, opts TableOptions)

PrintWorkflowTable renders the workflow rows as a bulleted table using the shared UI helpers.

func PrintWorkflowsJSON

func PrintWorkflowsJSON(rows []Workflow, registries []*tenantctx.Registry) error

PrintWorkflowsJSON marshals workflows as an indented JSON array and writes it to stdout.

func RegistryEligibleForContractRows

func RegistryEligibleForContractRows(reg *tenantctx.Registry) bool

RegistryEligibleForContractRows reports whether a registry can legitimately own on-chain ("contract:…") workflow sources.

func RegistryIDOrSource

func RegistryIDOrSource(workflowSource string, matched *tenantctx.Registry) string

RegistryIDOrSource returns the matched registry's ID, falling back to the raw workflowSource when no registry resolves cleanly.

func ResolveExecutionUUID

func ResolveExecutionUUID(ctx context.Context, wdc ExecutionLookup, arg string) (string, error)

ResolveExecutionUUID accepts a platform UUID or on-chain execution id and returns the platform UUID.

func ResolveOutputFormat

func ResolveOutputFormat(outputFormat string, jsonFlag bool) (string, error)

ResolveOutputFormat normalises --json / --output flags into a validated output format.

func ResolveWorkflowOwnerAddress

func ResolveWorkflowOwnerAddress(
	s *settings.Settings,
	resolvedRegistry settings.ResolvedRegistry,
	derivedOwner string,
) (string, error)

ResolveWorkflowOwnerAddress returns the effective workflow owner for platform lookups. For private/off-chain registry deploys the derived workflow owner from the runtime context is used. For on-chain deploys the configured workflow-owner-address from the selected target is used.

func ResolveWorkflowRegistry

func ResolveWorkflowRegistry(workflowSource string, registries []*tenantctx.Registry) *tenantctx.Registry

ResolveWorkflowRegistry returns the registry in the tenant context that best matches the given workflowSource, or nil if none match.

func ResolveWorkflowUUID

func ResolveWorkflowUUID(ctx context.Context, wdc WorkflowLookup, arg string, opts ResolveOptions) (string, error)

ResolveWorkflowUUID returns the platform UUID for a workflow name or on-chain WorkflowId.

Types

type ExecutionLookup

type ExecutionLookup interface {
	FindExecutionByOnChainID(ctx context.Context, onChainID string) (*workflowdataclient.Execution, error)
}

ExecutionLookup resolves executions by on-chain id.

type ResolveOptions

type ResolveOptions struct {
	// WorkflowOwnerAddress optionally scopes name resolution to workflows owned
	// by this address (from the selected target's workflow-owner settings).
	WorkflowOwnerAddress string
	// NonInteractive suppresses warnings when falling back to a non-ACTIVE workflow.
	NonInteractive bool
}

ResolveOptions controls resolution behaviour for ambiguous workflow names.

type TableOptions

type TableOptions struct {
	// CountBeforeDeletedFilter is the number of rows after any registry/search
	// filtering but before DELETED rows were removed. When it is > 0 and
	// IncludeDeleted is false, the empty-state message hints at --include-deleted.
	CountBeforeDeletedFilter int
	// IncludeDeleted indicates whether the caller is already showing DELETED rows.
	IncludeDeleted bool
}

TableOptions controls the empty-state hint printed by PrintWorkflowTable.

type Workflow

type Workflow = workflowdataclient.Workflow

Workflow is a type alias so callers can refer to the row type without importing the data client directly.

func FilterRowsByRegistry

func FilterRowsByRegistry(rows []Workflow, reg *tenantctx.Registry, all []*tenantctx.Registry) []Workflow

FilterRowsByRegistry returns only the rows that resolve to the given registry in the provided tenant context. A nil registry is treated as "no filter" and rows is returned unchanged.

func OmitDeleted

func OmitDeleted(rows []Workflow) []Workflow

OmitDeleted returns rows whose status is not "DELETED" (case-insensitive).

type WorkflowLookup

type WorkflowLookup interface {
	ListAll(ctx context.Context, pageSize int) ([]workflowdataclient.Workflow, error)
	SearchByName(ctx context.Context, name string, pageSize int, ownerAddress string) ([]workflowdataclient.Workflow, error)
}

WorkflowLookup lists workflows for name and WorkflowId resolution.

type WorkflowStatusView

type WorkflowStatusView struct {
	Summary       *workflowdataclient.WorkflowSummary
	Deployment    *workflowdataclient.WorkflowDeploymentRecord
	DeploymentErr error
	LastExecution *workflowdataclient.Execution
	Registries    []*tenantctx.Registry
}

WorkflowStatusView bundles all data for the status command output.

Jump to

Keyboard shortcuts

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