parser

package
v1.1.2209 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const UnknownTaskParamType = "unknown"

UnknownTaskParamType is the default type for unknown task parameters that need replacement.

Variables

This section is empty.

Functions

func CreateContactSheet added in v1.1.2120

func CreateContactSheet(ctx context.Context, tasks []*model.TaskSpec) (string, error)

CreateContactSheet creates a contact sheet for a set of tasks.

func DefaultTaskDescription added in v1.1.2120

func DefaultTaskDescription(taskName string, typ string) string

DefaultTaskDescription returns a default description for a task.

func DefaultTaskParamDescription added in v1.1.2120

func DefaultTaskParamDescription(paramName string) string

DefaultTaskParamDescription returns a default description for a task parameter.

func Parse

func Parse(ctx context.Context, defaultEngine expression.Engine, name string, rdr io.Reader) (*model.Workflow, error)

Parse parses BPMN, and turns it into a SHAR state machine

func ParseExtensions added in v1.1.2139

func ParseExtensions(doc *xmlquery.Node, dialects []Dialect, modelElement interface{}, i *xmlquery.Node) error

ParseExtensions parses the extensions of a workflow element in the given dialects.

func ParseTasks added in v1.1.2120

func ParseTasks(ctx context.Context, defaultEngine expression.Engine, name string, rdr io.Reader) (serviceTasks map[string]*model.TaskSpec, userTasks map[string]*model.TaskSpec, err error)

ParseTasks parses a workflow and returns the service and user tasks.

func RandomAlphaNum8 added in v1.1.2139

func RandomAlphaNum8() (string, error)

RandomAlphaNum8 generates a random string of length 8 using the given alphabet.

func ValidateProcessExpressions added in v1.1.2165

func ValidateProcessExpressions(ctx context.Context, workflows []*model.Workflow, taskSpecs []*model.TaskSpec, eng expression.Engine) error

ValidateProcessExpressions validates that input and output expressions in process elements reference appropriate variables based on the available task specs.

Validates:

  • Service tasks: input/output expressions against task specs
  • User tasks: input/output expressions against task specs
  • End events: output expressions (used to return values from the process)
  • Start events: input/output expressions
  • Outbound conditions: condition expressions on transitions/sequence flows

For input expressions:

  • Variables used must be outputs from previous process elements
  • Variables must be assigned to fields available in the task spec inputs

For output expressions:

  • Variables used must be from task spec outputs or previously created process variables

For condition expressions:

  • Variables used must be available at the point of the transition
  • Expressions must compile successfully
  • All variables used must be strongly typed, and errors must be returned if they are not typed.

func WalkElementVariables added in v1.1.2165

func WalkElementVariables(ctx context.Context, nav *Navigable, el *model.Element, varMap map[string][][]TypedVar, pv []TypedVar, visited []string)

WalkElementVariables walks the graph of elements from a start point and determines the variables available to each element. varMap is a map of element id to a list of variable names. pv is a list of variables that have already been determined to be available to the element. visited is a list of element ids that have already been visited. This function is recursive and will walk the graph of elements.

Types

type Dialect added in v1.1.2139

type Dialect interface {
	Name() string
	Present(node *xmlquery.Node) (bool, error)
	ParseExtensions(doc *xmlquery.Node, modelElement interface{}, i *xmlquery.Node) error
}

Dialect represents a workflow dialect.

type Duration added in v0.1.74

type Duration struct {
	Y int
	M int
	W int
	D int
	// Time Component
	TH int
	TM int
	TS int
}

Duration represents an ISO8601 Duration https://en.wikipedia.org/wiki/ISO_8601#Durations

func ParseISO8601 added in v0.1.74

func ParseISO8601(from string) (Duration, error)

ParseISO8601 parses an ISO8601 Duration string.

func (Duration) IsZero added in v0.1.74

func (d Duration) IsZero() bool

IsZero reports whether d represents the zero Duration, P0D.

func (Duration) Shift added in v0.1.74

func (d Duration) Shift(t time.Time) time.Time

Shift returns a time.Time, shifted by the Duration from the given start.

NB: Shift uses time.AddDate for years, months, weeks, and days, and so shares its limitations. In particular, shifting by months is not recommended unless the start date is before the 28th of the month. Otherwise, dates will roll over, e.g. Aug 31 + P1M = Oct 1.

Week and Day values will be combined as W*7 + D.

type Navigable struct {
	Incoming map[string][]*model.Element
	Outgoing map[string][]*model.Element
	Start    []*model.Element
}

Navigable is a helper object for static analysis.

func NewNavigable added in v1.1.1913

func NewNavigable(ctx context.Context, eles *model.Workflow) (*Navigable, error)

NewNavigable creates a Navigable object from a workflow to assist in static analysis.

type SharDialect added in v1.1.2139

type SharDialect struct {
}

SharDialect represents the SHAR dialect as generated by the SHAR editor.

func (*SharDialect) Name added in v1.1.2139

func (z *SharDialect) Name() string

Name returns the dialect name.

func (*SharDialect) ParseExtensions added in v1.1.2139

func (z *SharDialect) ParseExtensions(doc *xmlquery.Node, modelElement interface{}, i *xmlquery.Node) error

ParseExtensions parses the extension elements of a BPMN element.

func (*SharDialect) Present added in v1.1.2139

func (z *SharDialect) Present(doc *xmlquery.Node) (bool, error)

Present returns true if the document is a SHAR diagram.

type TypedVar added in v1.1.2165

type TypedVar struct {
	// Typ is the type of the variable.
	Typ string
	// Name is the name of the variable.
	Name string
	// Collection indicates if the variable is a collection.
	Collection bool
}

TypedVar is a variable with a type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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