Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateWorkspace(workspace *Workspace) error
- func WorkflowDefinitionJSONSchema() map[string]any
- type BranchMode
- type BranchPolicy
- type Edge
- type EdgeKind
- type ExecutorSpec
- type GormRepository
- func (r *GormRepository) CreateVersion(ctx context.Context, workflowID string, definition *WorkflowDefinition) (*WorkflowVersion, error)
- func (r *GormRepository) GetActiveVersion(ctx context.Context, workflowID string) (*WorkflowVersion, error)
- func (r *GormRepository) GetVersion(ctx context.Context, versionID string) (*WorkflowVersion, error)
- func (r *GormRepository) GetWorkflow(ctx context.Context, workflowID string) (*Workflow, error)
- func (r *GormRepository) ListVersions(ctx context.Context, workflowID string) ([]*WorkflowVersion, error)
- func (r *GormRepository) ListWorkflows(ctx context.Context) ([]*Workflow, error)
- func (r *GormRepository) PublishVersion(ctx context.Context, versionID string) (*WorkflowVersion, error)
- func (r *GormRepository) SaveVersion(ctx context.Context, version *WorkflowVersion) error
- func (r *GormRepository) SaveWorkflow(ctx context.Context, workflow *Workflow) error
- type GormWorkspaceRepository
- type InputBinding
- type InputMode
- type InputSource
- type InputSpec
- type LoopGroup
- type LoopPolicy
- type MemoryRepository
- func (r *MemoryRepository) CreateVersion(_ context.Context, workflowID string, definition *WorkflowDefinition) (*WorkflowVersion, error)
- func (r *MemoryRepository) GetActiveVersion(_ context.Context, workflowID string) (*WorkflowVersion, error)
- func (r *MemoryRepository) GetVersion(_ context.Context, versionID string) (*WorkflowVersion, error)
- func (r *MemoryRepository) GetWorkflow(_ context.Context, workflowID string) (*Workflow, error)
- func (r *MemoryRepository) ListVersions(_ context.Context, workflowID string) ([]*WorkflowVersion, error)
- func (r *MemoryRepository) ListWorkflows(_ context.Context) ([]*Workflow, error)
- func (r *MemoryRepository) PublishVersion(_ context.Context, versionID string) (*WorkflowVersion, error)
- func (r *MemoryRepository) SaveVersion(_ context.Context, version *WorkflowVersion) error
- func (r *MemoryRepository) SaveWorkflow(_ context.Context, workflow *Workflow) error
- type MemoryWorkspaceRepository
- type Node
- type ParamTemplate
- type ParamTemplateSegment
- type PublishConfig
- type Repository
- type RetryPolicy
- type Trigger
- type TriggerType
- type VersionStatus
- type Workflow
- type WorkflowDefinition
- type WorkflowVersion
- type Workspace
- type WorkspaceDocument
- type WorkspaceEntry
- type WorkspaceFolder
- type WorkspaceRepository
Constants ¶
const ( ExecutorTypeHTTP = "http" ExecutorTypeLocalGo = "local_go" ExecutorTypePython = "python" ExecutorTypeNode = "node" ExecutorTypeQueue = "queue" ExecutorTypeRemote = "remote" ExecutorTypeContainer = "container" ExecutorTypeUnit = "unit" )
const ( NodeTypeTask = "task" NodeTypeParallelGateway = "parallel_gateway" )
const WorkflowContractVersion = 1
const WorkspaceSchemaVersion = 1
Variables ¶
var ( ErrWorkspaceNotFound = errors.New("workspace not found") ErrWorkspaceConflict = errors.New("workspace revision conflict") )
Functions ¶
func ValidateWorkspace ¶
func WorkflowDefinitionJSONSchema ¶
WorkflowDefinitionJSONSchema is generated from the server domain types. It is descriptive of the wire structure; semantic execution rules remain owned by the compiler and are applied by /v1/validate, version creation, and run APIs.
Types ¶
type BranchMode ¶
type BranchMode string
const ( BranchAll BranchMode = "all" BranchFirst BranchMode = "first" )
type BranchPolicy ¶
type BranchPolicy struct {
Mode BranchMode `json:"mode,omitempty"`
}
type Edge ¶
type Edge struct {
ID string `json:"id,omitempty"`
From string `json:"from"`
To string `json:"to"`
Kind EdgeKind `json:"kind,omitempty"`
Condition string `json:"condition,omitempty"`
Priority int `json:"priority,omitempty"`
Label string `json:"label,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
type ExecutorSpec ¶
type ExecutorSpec struct {
Type string `json:"type"`
Ref string `json:"ref,omitempty"`
Version string `json:"version,omitempty"`
Config map[string]any `json:"config,omitempty"`
}
func (ExecutorSpec) IsZero ¶ added in v1.2.9
func (e ExecutorSpec) IsZero() bool
type GormRepository ¶
type GormRepository struct {
// contains filtered or unexported fields
}
func NewGormRepository
deprecated
func NewGormRepository(db *gorm.DB) (*GormRepository, error)
NewGormRepository constructs the legacy standalone definition adapter.
Deprecated: new applications should compose the complete adapter through persist/gormstore.New. This constructor remains available for compatibility.
func (*GormRepository) CreateVersion ¶
func (r *GormRepository) CreateVersion(ctx context.Context, workflowID string, definition *WorkflowDefinition) (*WorkflowVersion, error)
func (*GormRepository) GetActiveVersion ¶
func (r *GormRepository) GetActiveVersion(ctx context.Context, workflowID string) (*WorkflowVersion, error)
func (*GormRepository) GetVersion ¶
func (r *GormRepository) GetVersion(ctx context.Context, versionID string) (*WorkflowVersion, error)
func (*GormRepository) GetWorkflow ¶
func (*GormRepository) ListVersions ¶
func (r *GormRepository) ListVersions(ctx context.Context, workflowID string) ([]*WorkflowVersion, error)
func (*GormRepository) ListWorkflows ¶
func (r *GormRepository) ListWorkflows(ctx context.Context) ([]*Workflow, error)
func (*GormRepository) PublishVersion ¶
func (r *GormRepository) PublishVersion(ctx context.Context, versionID string) (*WorkflowVersion, error)
func (*GormRepository) SaveVersion ¶
func (r *GormRepository) SaveVersion(ctx context.Context, version *WorkflowVersion) error
func (*GormRepository) SaveWorkflow ¶
func (r *GormRepository) SaveWorkflow(ctx context.Context, workflow *Workflow) error
type GormWorkspaceRepository ¶
type GormWorkspaceRepository struct {
// contains filtered or unexported fields
}
func NewGormWorkspaceRepository
deprecated
func NewGormWorkspaceRepository(db *gorm.DB) (*GormWorkspaceRepository, error)
NewGormWorkspaceRepository constructs the legacy standalone workspace adapter.
Deprecated: new applications should compose the complete adapter through persist/gormstore.New. This constructor remains available for compatibility.
func (*GormWorkspaceRepository) GetWorkspace ¶
func (r *GormWorkspaceRepository) GetWorkspace(ctx context.Context) (*Workspace, error)
func (*GormWorkspaceRepository) SaveWorkspace ¶
type InputBinding ¶
type InputBinding struct {
Source InputSource `json:"source,omitempty"`
From string `json:"from,omitempty"`
Path string `json:"path,omitempty"`
Label string `json:"label,omitempty"`
As string `json:"as,omitempty"`
Required bool `json:"required,omitempty"`
Default any `json:"default,omitempty"`
Transform string `json:"transform,omitempty"`
}
type InputSource ¶
type InputSource string
const ( InputSourceNode InputSource = "node" InputSourceVar InputSource = "var" InputSourceRequest InputSource = "request" InputSourceRun InputSource = "run" )
type InputSpec ¶
type InputSpec struct {
Mode InputMode `json:"mode,omitempty"`
Bindings []InputBinding `json:"bindings,omitempty"`
}
type LoopGroup ¶
type LoopGroup struct {
ID string `json:"id"`
Start string `json:"start"`
End string `json:"end"`
Mode string `json:"mode,omitempty"`
MaxIterations int `json:"max_iterations"`
CountBinding *InputBinding `json:"count_binding,omitempty"`
}
LoopGroup repeats a structured single-entry, single-exit subgraph. The start node receives either the original input or the current list item, and the end node publishes the collected outputs after the final iteration.
type LoopPolicy ¶
type LoopPolicy struct {
MaxIterations int `json:"max_iterations,omitempty"`
Condition string `json:"condition,omitempty"`
Mode string `json:"mode,omitempty"`
CountBinding *InputBinding `json:"count_binding,omitempty"`
}
type MemoryRepository ¶
type MemoryRepository struct {
// contains filtered or unexported fields
}
func NewMemoryRepository ¶
func NewMemoryRepository() *MemoryRepository
func (*MemoryRepository) CreateVersion ¶
func (r *MemoryRepository) CreateVersion(_ context.Context, workflowID string, definition *WorkflowDefinition) (*WorkflowVersion, error)
func (*MemoryRepository) GetActiveVersion ¶
func (r *MemoryRepository) GetActiveVersion(_ context.Context, workflowID string) (*WorkflowVersion, error)
func (*MemoryRepository) GetVersion ¶
func (r *MemoryRepository) GetVersion(_ context.Context, versionID string) (*WorkflowVersion, error)
func (*MemoryRepository) GetWorkflow ¶
func (*MemoryRepository) ListVersions ¶
func (r *MemoryRepository) ListVersions(_ context.Context, workflowID string) ([]*WorkflowVersion, error)
func (*MemoryRepository) ListWorkflows ¶
func (r *MemoryRepository) ListWorkflows(_ context.Context) ([]*Workflow, error)
func (*MemoryRepository) PublishVersion ¶
func (r *MemoryRepository) PublishVersion(_ context.Context, versionID string) (*WorkflowVersion, error)
func (*MemoryRepository) SaveVersion ¶
func (r *MemoryRepository) SaveVersion(_ context.Context, version *WorkflowVersion) error
func (*MemoryRepository) SaveWorkflow ¶
func (r *MemoryRepository) SaveWorkflow(_ context.Context, workflow *Workflow) error
type MemoryWorkspaceRepository ¶
type MemoryWorkspaceRepository struct {
// contains filtered or unexported fields
}
func NewMemoryWorkspaceRepository ¶
func NewMemoryWorkspaceRepository() *MemoryWorkspaceRepository
func (*MemoryWorkspaceRepository) GetWorkspace ¶
func (r *MemoryWorkspaceRepository) GetWorkspace(context.Context) (*Workspace, error)
func (*MemoryWorkspaceRepository) SaveWorkspace ¶
type Node ¶
type Node struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type string `json:"type,omitempty"`
Executor ExecutorSpec `json:"executor,omitzero"`
Input any `json:"input,omitempty"`
InputSpec *InputSpec `json:"input_spec,omitempty"`
Params map[string]any `json:"params,omitempty"`
ParamBindings map[string]InputBinding `json:"param_bindings,omitempty"`
ParamTemplates map[string]ParamTemplate `json:"param_templates,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
Retry *RetryPolicy `json:"retry,omitempty"`
Loop *LoopPolicy `json:"loop,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
Branch *BranchPolicy `json:"branch,omitempty"`
Disabled bool `json:"disabled,omitempty"`
UI map[string]any `json:"ui,omitempty"` // editor-only data, removed by compiler
}
func (Node) IsParallelGateway ¶ added in v1.2.9
type ParamTemplate ¶
type ParamTemplate struct {
Segments []ParamTemplateSegment `json:"segments"`
}
type ParamTemplateSegment ¶
type ParamTemplateSegment struct {
Type string `json:"type"`
Value string `json:"value,omitempty"`
Binding *InputBinding `json:"binding,omitempty"`
}
type PublishConfig ¶
type PublishConfig struct {
Enabled bool `json:"enabled"`
Route string `json:"route,omitempty"`
Method string `json:"method,omitempty"`
InputMode string `json:"input_mode,omitempty"`
ResponseMode string `json:"response_mode,omitempty"`
AuthRequired bool `json:"auth_required,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
TimeoutMS int64 `json:"timeout,omitempty"`
}
type Repository ¶
type Repository interface {
SaveWorkflow(ctx context.Context, workflow *Workflow) error
GetWorkflow(ctx context.Context, workflowID string) (*Workflow, error)
ListWorkflows(ctx context.Context) ([]*Workflow, error)
CreateVersion(ctx context.Context, workflowID string, definition *WorkflowDefinition) (*WorkflowVersion, error)
SaveVersion(ctx context.Context, version *WorkflowVersion) error
GetVersion(ctx context.Context, versionID string) (*WorkflowVersion, error)
ListVersions(ctx context.Context, workflowID string) ([]*WorkflowVersion, error)
GetActiveVersion(ctx context.Context, workflowID string) (*WorkflowVersion, error)
PublishVersion(ctx context.Context, versionID string) (*WorkflowVersion, error)
}
type RetryPolicy ¶
type Trigger ¶
type Trigger struct {
ID string `json:"id"`
Type TriggerType `json:"type"`
Enabled bool `json:"enabled"`
Config map[string]any `json:"config,omitempty"`
}
type TriggerType ¶
type TriggerType string
const ( TriggerManual TriggerType = "manual" TriggerHTTP TriggerType = "http" TriggerCron TriggerType = "cron" )
type VersionStatus ¶
type VersionStatus string
const ( VersionDraft VersionStatus = "draft" VersionPublished VersionStatus = "published" VersionArchived VersionStatus = "archived" )
type Workflow ¶
type Workflow struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
ActiveVersion string `json:"active_version,omitempty"`
Tags []string `json:"tags,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Workflow is the immutable business entity that owns multiple versions.
type WorkflowDefinition ¶
type WorkflowDefinition struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
MaxConcurrency int `json:"max_concurrency,omitempty"`
FailFast bool `json:"fail_fast,omitempty"`
EntryNodes []string `json:"entry_nodes,omitempty"`
Nodes []Node `json:"nodes"`
Edges []Edge `json:"edges,omitempty"`
LoopGroups []LoopGroup `json:"loop_groups,omitempty"`
Triggers []Trigger `json:"triggers,omitempty"`
PublishConfig *PublishConfig `json:"publish_config,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
WorkflowDefinition only contains static and executable-agnostic fields.
type WorkflowVersion ¶
type WorkflowVersion struct {
ID string `json:"id"`
WorkflowID string `json:"workflow_id"`
Version int `json:"version"`
Status VersionStatus `json:"status"`
Definition *WorkflowDefinition `json:"definition"`
CreatedAt time.Time `json:"created_at"`
}
WorkflowVersion captures a frozen definition snapshot.
type Workspace ¶
type Workspace struct {
SchemaVersion int `json:"schema_version"`
Revision uint64 `json:"revision"`
ActiveID string `json:"activeId"`
Folders []WorkspaceFolder `json:"folders"`
Entries []WorkspaceEntry `json:"entries"`
ServiceActions []map[string]any `json:"serviceActions"`
UpdatedAt time.Time `json:"updated_at"`
}
Workspace is the server-owned editable state. Executable data is strongly typed as WorkflowDefinition; editor-only layout and service presentation data remain isolated JSON extensions and never enter the compiler directly.
type WorkspaceDocument ¶
type WorkspaceDocument struct {
Definition *WorkflowDefinition `json:"definition"`
Layout map[string]any `json:"layout,omitempty"`
}
type WorkspaceEntry ¶
type WorkspaceEntry struct {
ID string `json:"id"`
SavedAt time.Time `json:"savedAt"`
FolderID string `json:"folderId,omitempty"`
Document WorkspaceDocument `json:"document"`
}