workflowrender

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package workflowrender 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

This section is empty.

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 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 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 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.

Types

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).

Jump to

Keyboard shortcuts

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