transform

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package transform implements the extraction-ready, pure expression transform step kind.

Transform config is a non-empty object whose normalized keys name outputs and whose values are raw workflow expressions. Expressions are evaluated without environment access or adapter-defined functions. The default executor exposes invocation inputs through the standard inputs root. Hosts that have already constructed a visibility-scoped invocation context may inject a ContextProvider to expose steps, item, index, and immutable runtime roots.

The package owns no storage, transport, provider, or Hadron application integration. Runtime owns declared output-schema validation and persistence.

Index

Constants

View Source
const (
	// Name is the canonical registered transform kind name.
	Name = "transform"
	// Version is the immutable initial transform contract version.
	Version = "v1"

	// CodeContextUnavailable identifies an invalid or unavailable invocation
	// expression context. Its process-local cause is never copied into Message.
	CodeContextUnavailable = "transform_context_unavailable"
	// CodeExpressionFailed identifies failure of one named output expression.
	CodeExpressionFailed = "transform_expression_failed"
	// CodeOutputInvalid identifies an evaluated result that cannot become a
	// persistable typed workflow value.
	CodeOutputInvalid = "transform_output_invalid"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextProvider

type ContextProvider interface {
	ExpressionContext(context.Context, stepkind.Invocation) (values.ExpressionContext, error)
}

ContextProvider derives a fresh, deterministic, invocation-scoped expression context. Implementations must be concurrency-safe, must not mutate invocation, and must not consult ambient process state. In particular, environment values are always removed by Executor. Runtime/compiler visibility policy must scope Steps before returning the context.

type ContextProviderFunc

type ContextProviderFunc func(context.Context, stepkind.Invocation) (values.ExpressionContext, error)

ContextProviderFunc adapts a function to ContextProvider.

func (ContextProviderFunc) ExpressionContext

func (f ContextProviderFunc) ExpressionContext(ctx context.Context, invocation stepkind.Invocation) (values.ExpressionContext, error)

ExpressionContext implements ContextProvider.

type Executor

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

Executor is the pure transform StepKind. The zero value uses an Inputs-only expression context; New is preferred when registering the kind.

func New

func New() *Executor

New returns a transform executor whose expression context contains only the invocation's typed Inputs.

func NewWithContextProvider

func NewWithContextProvider(provider ContextProvider) (*Executor, error)

NewWithContextProvider returns a transform executor that augments invocation Inputs with a pre-scoped expression context. The provider cannot enable env.

func (*Executor) Execute

Execute evaluates every named expression against one immutable context and returns typed, persistable outputs. Outputs are evaluated in normalized name order; sibling outputs are not expression roots and cannot observe each other.

func (*Executor) Spec

func (e *Executor) Spec() stepkind.StepKindSpec

Spec returns immutable metadata for transform@v1. Runtime validates the actual named output set against the graph node's declared output schemas.

func (*Executor) ValidateConfig

func (e *Executor) ValidateConfig(_ context.Context, config graph.Config) []diagnostic.Diagnostic

ValidateConfig validates normalized named outputs and raw expression syntax. Config paths identify the expression so compiler-owned source maps can attach the corresponding SourceRef without the adapter inventing source locations.

Jump to

Keyboard shortcuts

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