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
- func AvailableRegistryIDs(registries []*tenantctx.Registry) string
- func FindRegistry(registries []*tenantctx.Registry, id string) *tenantctx.Registry
- func LooksLikeOnChainExecutionID(s string) bool
- func LooksLikeUUID(s string) bool
- func LooksLikeWorkflowID(s string) bool
- func ParseContractWorkflowSource(workflowSource string) (selector, addr string, ok bool)
- func PrintEventsJSON(events []workflowdataclient.ExecutionEvent) error
- func PrintEventsTable(events []workflowdataclient.ExecutionEvent)
- func PrintExecutionDetailJSON(e workflowdataclient.Execution, ...) error
- func PrintExecutionDetailTable(e workflowdataclient.Execution, ...)
- func PrintExecutionsJSON(rows []workflowdataclient.Execution) error
- func PrintExecutionsTable(rows []workflowdataclient.Execution)
- func PrintLogsJSON(logs []workflowdataclient.ExecutionLog, nodeFilter string) error
- func PrintLogsTable(logs []workflowdataclient.ExecutionLog, nodeFilter string)
- func PrintWorkflowStatusJSON(v WorkflowStatusView) error
- func PrintWorkflowStatusTable(v WorkflowStatusView)
- func PrintWorkflowTable(rows []Workflow, registries []*tenantctx.Registry, opts TableOptions)
- func PrintWorkflowsJSON(rows []Workflow, registries []*tenantctx.Registry) error
- func RegistryEligibleForContractRows(reg *tenantctx.Registry) bool
- func RegistryIDOrSource(workflowSource string, matched *tenantctx.Registry) string
- func ResolveExecutionUUID(ctx context.Context, wdc ExecutionLookup, arg string) (string, error)
- func ResolveOutputFormat(outputFormat string, jsonFlag bool) (string, error)
- func ResolveWorkflowOwnerAddress(s *settings.Settings, resolvedRegistry settings.ResolvedRegistry, ...) (string, error)
- func ResolveWorkflowRegistry(workflowSource string, registries []*tenantctx.Registry) *tenantctx.Registry
- func ResolveWorkflowUUID(ctx context.Context, wdc WorkflowLookup, arg string, opts ResolveOptions) (string, error)
- type ExecutionLookup
- type ResolveOptions
- type TableOptions
- type Workflow
- type WorkflowLookup
- type WorkflowStatusView
Constants ¶
const OutputFormatJSON = "json"
Variables ¶
This section is empty.
Functions ¶
func AvailableRegistryIDs ¶
AvailableRegistryIDs returns a comma-separated list of registry IDs for use in error messages.
func FindRegistry ¶
FindRegistry returns the registry entry with the matching ID, or nil.
func LooksLikeOnChainExecutionID ¶
LooksLikeOnChainExecutionID returns true for 64-char hex execution ids shown in Explorer.
func LooksLikeUUID ¶
LooksLikeUUID returns true for the standard UUID shape (8-4-4-4-12).
func LooksLikeWorkflowID ¶
LooksLikeWorkflowID returns true for 64-char hex strings (on-chain WorkflowId).
func ParseContractWorkflowSource ¶
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 ¶
PrintWorkflowsJSON marshals workflows as an indented JSON array and writes it to stdout.
func RegistryEligibleForContractRows ¶
RegistryEligibleForContractRows reports whether a registry can legitimately own on-chain ("contract:…") workflow sources.
func RegistryIDOrSource ¶
RegistryIDOrSource returns the matched registry's ID, falling back to the raw workflowSource when no registry resolves cleanly.
func ResolveExecutionUUID ¶
ResolveExecutionUUID accepts a platform UUID or on-chain execution id and returns the platform UUID.
func ResolveOutputFormat ¶
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 ¶
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.