workflows

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagActionAdd = TagAction(iota)
	TagActionRemove
	TagActionToggle
)

Variables

This section is empty.

Functions

func AddWorkflowVersionNodeLog

func AddWorkflowVersionNodeLog(db *sqlx.DB,
	reference string,
	workflowVersionNodeId int,
	triggeringWorkflowVersionNodeId int,
	inputs map[commons.WorkflowParameterLabel]string,
	outputs map[commons.WorkflowParameterLabel]string,
	workflowError error)

func ApplyFilters added in v0.18.1

func ApplyFilters(filters interface{}, data []map[string]interface{}) []interface{}

func DeserialiseQuery added in v0.18.1

func DeserialiseQuery(query interface{}) interface{}

func GetFilterFunctions added in v0.18.1

func GetFilterFunctions() map[FilterCategoryType]map[string]FilterFunc

func GetTriggerGroupWorkflowVersionNodeId added in v0.17.1

func GetTriggerGroupWorkflowVersionNodeId(db *sqlx.DB, workflowVersionNodeId int) (int, error)

func GetWorkflowIdsByNodeType added in v0.18.1

func GetWorkflowIdsByNodeType(db *sqlx.DB, nodeType commons.WorkflowNodeType) ([]int, error)

func ProcessQuery added in v0.18.1

func ProcessQuery(filters interface{}, item map[string]interface{}) bool

func ProcessWorkflowNode

func ProcessWorkflowNode(ctx context.Context, db *sqlx.DB,
	workflowNode WorkflowNode,
	triggeringWorkflowVersionNodeId int,
	workflowNodeCache map[int]WorkflowNode,
	workflowNodeStatus map[int]commons.Status,
	workflowNodeStagingParametersCache map[int]map[commons.WorkflowParameterLabel]string,
	reference string,
	inputs map[commons.WorkflowParameterLabel]string,
	iteration int,
	workflowStageExitConfigurationCache map[int]map[commons.WorkflowParameterLabel]string,
	lightningRequestChannel chan interface{},
	rebalanceRequestChannel chan commons.RebalanceRequest) (map[commons.WorkflowParameterLabel]string, commons.Status, error)

ProcessWorkflowNode workflowNodeStagingParametersCache[WorkflowVersionNodeId][parameterLabel] (i.e. parameterLabel = sourceChannels)

func RegisterWorkflowRoutes

func RegisterWorkflowRoutes(r *gin.RouterGroup, db *sqlx.DB)

func StructToMap added in v0.18.1

func StructToMap(structs []channels.ChannelBody) []map[string]interface{}

Types

type AndClause added in v0.18.1

type AndClause struct {
	Prefix       string
	ChildClauses []interface{}
	Result       bool
}

func (*AndClause) AddChildClause added in v0.18.1

func (a *AndClause) AddChildClause(clause Clause)

type ChannelPolicyConfiguration added in v0.18.1

type ChannelPolicyConfiguration struct {
	ChannelIds       []int   `json:"channelIds"`
	TimeLockDelta    *uint32 `json:"timeLockDelta"`
	MinHtlcMsat      *uint64 `json:"minHtlcMsat"`
	MaxHtlcMsat      *uint64 `json:"maxHtlcMsat"`
	FeeBaseMsat      *int64  `json:"feeBaseMsat"`
	FeeRateMilliMsat *int64  `json:"feeRateMilliMsat"`
}

type Clause added in v0.18.1

type Clause struct {
	Prefix       string
	ChildClauses []Clause
	Filter       FilterInterface
	Result       bool
}

type ClauseWithResult added in v0.18.1

type ClauseWithResult struct {
	Prefix       string
	ChildClauses []interface{}
	Result       bool
}

type CreateNodeRequest

type CreateNodeRequest struct {
	WorkflowVersionId  int                            `json:"workflowVersionId" db:"workflow_version_id"`
	Name               string                         `json:"name" db:"name"`
	Type               commons.WorkflowNodeType       `json:"type" db:"type"`
	Stage              int                            `json:"stage" db:"stage"`
	VisibilitySettings WorkflowNodeVisibilitySettings `json:"visibilitySettings" db:"visibility_settings"`
	Parameters         *interface{}                   `json:"parameters" db:"parameters"`
}

type CreateWorkflowVersionNodeLinkRequest

type CreateWorkflowVersionNodeLinkRequest struct {
	WorkflowVersionId           int                            `json:"workflowVersionId" db:"workflow_version_id"`
	ParentOutput                commons.WorkflowParameterLabel `json:"parentOutput" db:"parent_output"`
	ParentWorkflowVersionNodeId int                            `json:"parentWorkflowVersionNodeId" db:"parent_workflow_version_node_id"`
	ChildInput                  commons.WorkflowParameterLabel `json:"childInput" db:"child_input"`
	ChildWorkflowVersionNodeId  int                            `json:"childWorkflowVersionNodeId" db:"child_workflow_version_node_id"`
}

type DeleteStageRequest

type DeleteStageRequest struct {
	WorkflowVersionId int `json:"workflowVersionId"`
	Stage             int `json:"stage"`
}

type Filter added in v0.18.1

type Filter struct {
	FuncName  string      `json:"funcName"`
	Key       string      `json:"key"`
	Parameter interface{} `json:"parameter"`
	Category  string      `json:"category"`
}

type FilterCategoryType added in v0.18.1

type FilterCategoryType string
const (
	FilterCategoryTypeNumber   FilterCategoryType = "number"
	FilterCategoryTypeString   FilterCategoryType = "string"
	FilterCategoryTypeDate     FilterCategoryType = "date"
	FilterCategoryTypeBoolean  FilterCategoryType = "boolean"
	FilterCategoryTypeArray    FilterCategoryType = "array"
	FilterCategoryTypeDuration FilterCategoryType = "duration"
	FilterCategoryTypeEnum     FilterCategoryType = "enum"
	FilterCategoryTypeTag      FilterCategoryType = "tag"
)

type FilterClause added in v0.18.1

type FilterClause struct {
	Prefix string
	Filter FilterInterface
	Result bool
}

func (*FilterClause) ToJSON added in v0.18.1

func (f *FilterClause) ToJSON() map[string]interface{}

type FilterClauses added in v0.18.1

type FilterClauses struct {
	And    []FilterClauses `json:"$and"`
	Or     []FilterClauses `json:"$or"`
	Filter Filter          `json:"$filter"`
}

type FilterFunc added in v0.18.1

type FilterFunc func(input map[string]interface{}, key string, parameter FilterParameterType) bool

type FilterInterface added in v0.18.1

type FilterInterface struct {
	Category      FilterCategoryType
	FuncName      string
	Parameter     FilterParameterType
	Key           string
	SelectOptions []SelectOptionType
	Value         interface{}
	Label         string
}

type FilterParameterType added in v0.18.1

type FilterParameterType interface{}

type LinkVisibilitySettings

type LinkVisibilitySettings struct {
	XPosition int `json:"xPosition"`
	YPosition int `json:"yPosition"`
}

type ModifyTagsParameters

type ModifyTagsParameters struct {
	TagNames  []string  `json:"tagNames"`
	TagAction TagAction `json:"tagAction"`
}

type OrClause added in v0.18.1

type OrClause struct {
	Prefix       string
	ChildClauses []interface{}
	Result       bool
}

type Parameter added in v0.18.1

type Parameter string

type RebalanceConfiguration added in v0.18.1

type RebalanceConfiguration struct {
	IncomingChannelIds   []int   `json:"incomingChannelIds"`
	OutgoingChannelIds   []int   `json:"outgoingChannelIds"`
	AmountMsat           *uint64 `json:"amountMsat"`
	MaximumCostMilliMsat *int64  `json:"maximumCostMilliMsat"`
	MaximumCostMsat      *uint64 `json:"maximumCostMsat"`
}

type SelectOptionType added in v0.18.1

type SelectOptionType struct {
	Value string
	Label string
}

type TagAction

type TagAction int

type TagInfo added in v0.16.9

type TagInfo struct {
	Label string `json:"label"`
	Value int    `json:"value"`
}

type TagParameters added in v0.16.9

type TagParameters struct {
	NodeTag     bool      `json:"nodeTag"`
	AddedTags   []TagInfo `json:"addedTags"`
	RemovedTags []TagInfo `json:"removedTags"`
}

type TimeTriggerParameters

type TimeTriggerParameters struct {
	Seconds  int32 `json:"seconds" db:"seconds"`
	TimeUnit int   `json:"timeUnit" db:"time_unit"` // Time Unit is just used in the frontend
}

type UpdateNodeRequest

type UpdateNodeRequest struct {
	WorkflowVersionNodeId int                             `json:"workflowVersionNodeId" db:"workflow_version_node_id"`
	Name                  *string                         `json:"name" db:"name"`
	Status                *WorkflowStatus                 `json:"status" db:"status"`
	Parameters            *interface{}                    `json:"parameters" db:"parameters"`
	VisibilitySettings    *WorkflowNodeVisibilitySettings `json:"visibilitySettings" db:"visibility_settings"`
}

type UpdateWorkflow

type UpdateWorkflow struct {
	WorkflowId int             `json:"workflowId" db:"workflow_id"`
	Name       *string         `json:"name" db:"name"`
	Status     *WorkflowStatus `json:"status" db:"status"`
}

type Workflow

type Workflow struct {
	WorkflowId int            `json:"workflowId" db:"workflow_id"`
	Name       string         `json:"name" db:"name"`
	Status     WorkflowStatus `json:"status" db:"status"`
	CreatedOn  time.Time      `json:"createdOn" db:"created_on"`
	UpdateOn   time.Time      `json:"updatedOn" db:"updated_on"`
}

func GetWorkflow

func GetWorkflow(db *sqlx.DB, workflowId int) (Workflow, error)

type WorkflowForest

type WorkflowForest struct {
	SortedStageTrees map[int][]*WorkflowNode `json:"sortedStageTrees"`
}

func GetWorkflowForest

func GetWorkflowForest(db *sqlx.DB, workflowVersionId int) (WorkflowForest, error)

type WorkflowNode

type WorkflowNode struct {
	WorkflowVersionNodeId int                             `json:"workflowVersionNodeId"`
	Name                  string                          `json:"name"`
	Status                WorkflowStatus                  `json:"status"`
	Stage                 int                             `json:"stage"`
	Type                  commons.WorkflowNodeType        `json:"type"`
	Parameters            interface{}                     `json:"parameters"`
	VisibilitySettings    WorkflowNodeVisibilitySettings  `json:"visibilitySettings"`
	UpdateOn              time.Time                       `json:"updatedOn"`
	ParentNodes           map[int]*WorkflowNode           `json:"parentNodes"`
	ChildNodes            map[int]*WorkflowNode           `json:"childNodes"`
	LinkDetails           map[int]WorkflowVersionNodeLink `json:"LinkDetails"`
	WorkflowVersionId     int                             `json:"workflowVersionId"`
}

func GetActiveEventTriggerNodes

func GetActiveEventTriggerNodes(db *sqlx.DB, nodeType commons.WorkflowNodeType) ([]WorkflowNode, error)

func GetActiveSortedStageTriggerNodeForWorkflowVersionId

func GetActiveSortedStageTriggerNodeForWorkflowVersionId(db *sqlx.DB, workflowVersionId int) ([]WorkflowNode, error)

func GetWorkflowNode

func GetWorkflowNode(db *sqlx.DB, workflowVersionNodeId int) (WorkflowNode, error)

GetWorkflowNode is not recursive and only returns direct parent/child relations without further nesting.

type WorkflowNodeParameter

type WorkflowNodeParameter struct {
	Type        commons.WorkflowParameterType `json:"type"`
	ValueNumber int                           `json:"valueNumber"`
	ValueString string                        `json:"valueString"`
}

func (*WorkflowNodeParameter) Scan

func (wp *WorkflowNodeParameter) Scan(val interface{}) (err error)

type WorkflowNodeVisibilitySettings

type WorkflowNodeVisibilitySettings struct {
	YPosition *int  `json:"yPosition" db:"yPosition"`
	XPosition *int  `json:"xPosition" db:"xPosition"`
	Collapsed *bool `json:"collapsed" db:"collapsed"`
}

func (*WorkflowNodeVisibilitySettings) Scan

func (nvs *WorkflowNodeVisibilitySettings) Scan(val interface{}) (err error)

type WorkflowPage

type WorkflowPage struct {
	Workflow Workflow                  `json:"workflow"`
	Version  WorkflowVersion           `json:"version"`
	Nodes    []WorkflowVersionNode     `json:"nodes"`
	Links    []WorkflowVersionNodeLink `json:"links"`
}

type WorkflowStatus added in v0.18.1

type WorkflowStatus int

type WorkflowTableRow

type WorkflowTableRow struct {
	WorkflowId              int     `json:"workflowId" db:"workflow_id"`
	WorkflowName            string  `json:"workflowName" db:"workflow_name"`
	WorkflowStatus          int     `json:"workflowStatus" db:"workflow_status"`
	LatestVersionName       *string `json:"latestVersionName" db:"latest_version_name"`
	LatestVersion           *int    `json:"latestVersion" db:"latest_version"`
	LatestWorkflowVersionId *int    `json:"latestWorkflowVersionId" db:"latest_workflow_version_id"`
	LatestVersionStatus     *int    `json:"latestVersionStatus" db:"latest_version_status"`
	ActiveVersionName       *string `json:"activeVersionName" db:"active_version_name"`
	ActiveVersion           *int    `json:"activeVersion" db:"active_version"`
	ActiveWorkflowVersionId *int    `json:"activeWorkflowVersionId" db:"active_workflow_version_id"`
	ActiveVersionStatus     *int    `json:"activeVersionStatus" db:"active_version_status"`
}

func GetWorkflows

func GetWorkflows(db *sqlx.DB) ([]WorkflowTableRow, error)

type WorkflowToTrigger added in v0.18.1

type WorkflowToTrigger struct {
	WorkflowVersionId     int `json:"workflowVersionId"`
	Type                  int `json:"type"`
	WorkflowId            int `json:"workflowId"`
	WorkflowVersionNodeId int `json:"workflowVersionNodeId"`
}

type WorkflowVersion

type WorkflowVersion struct {
	WorkflowVersionId int            `json:"workflowVersionId" db:"workflow_version_id"`
	Name              string         `json:"name" db:"name"`
	Version           int            `json:"version" db:"version"`
	Status            WorkflowStatus `json:"status" db:"status"`
	WorkflowId        int            `json:"workflowId" db:"workflow_id"`
	CreatedOn         time.Time      `json:"createdOn" db:"created_on"`
	UpdateOn          time.Time      `json:"updatedOn" db:"updated_on"`
}

func GetWorkflowVersion

func GetWorkflowVersion(db *sqlx.DB, workflowId int, versionId int) (WorkflowVersion, error)

func GetWorkflowVersionById added in v0.18.1

func GetWorkflowVersionById(db *sqlx.DB, workflowVersionId int) (WorkflowVersion, error)

func GetWorkflowVersions

func GetWorkflowVersions(db *sqlx.DB, workflowId int) ([]WorkflowVersion, error)

type WorkflowVersionNode

type WorkflowVersionNode struct {
	WorkflowId            int                            `json:"workflowId" db:"workflow_id"`
	Version               int                            `json:"version" db:"version"`
	WorkflowVersionId     int                            `json:"workflowVersionId" db:"workflow_version_id"`
	WorkflowVersionNodeId int                            `json:"workflowVersionNodeId" db:"workflow_version_node_id"`
	Name                  string                         `json:"name" db:"name"`
	Stage                 int                            `json:"stage" db:"stage"`
	Status                WorkflowStatus                 `json:"status" db:"status"`
	Type                  commons.WorkflowNodeType       `json:"type" db:"type"`
	Parameters            interface{}                    `json:"parameters" db:"parameters"`
	VisibilitySettings    WorkflowNodeVisibilitySettings `json:"visibilitySettings" db:"visibility_settings"`
	CreatedOn             time.Time                      `json:"createdOn" db:"created_on"`
	UpdateOn              time.Time                      `json:"updatedOn" db:"updated_on"`
}

func GetWorkflowNodes

func GetWorkflowNodes(db *sqlx.DB, workflowVersionId int, workflowId int, version int) ([]WorkflowVersionNode, error)

func GetWorkflowVersionNode

func GetWorkflowVersionNode(db *sqlx.DB, workflowVersionNodeId int) (WorkflowVersionNode, error)

func (WorkflowVersionNode) GetWorkflowNodeStructured

func (wfn WorkflowVersionNode) GetWorkflowNodeStructured() WorkflowNode
type WorkflowVersionNodeLink struct {
	WorkflowVersionNodeLinkId   int                                       `json:"workflowVersionNodeLinkId" db:"workflow_version_node_link_id"`
	Name                        string                                    `json:"name" db:"name"`
	VisibilitySettings          WorkflowVersionNodeLinkVisibilitySettings `json:"visibilitySettings" db:"visibility_settings"`
	ParentOutput                commons.WorkflowParameterLabel            `json:"parentOutput" db:"parent_output"`
	ParentWorkflowVersionNodeId int                                       `json:"parentWorkflowVersionNodeId" db:"parent_workflow_version_node_id"`
	ChildInput                  commons.WorkflowParameterLabel            `json:"childInput" db:"child_input"`
	ChildWorkflowVersionNodeId  int                                       `json:"childWorkflowVersionNodeId" db:"child_workflow_version_node_id"`
	WorkflowVersionId           int                                       `json:"workflowVersionId" db:"workflow_version_id"`
	CreatedOn                   time.Time                                 `json:"createdOn" db:"created_on"`
	UpdateOn                    time.Time                                 `json:"updatedOn" db:"updated_on"`
	Stage                       int                                       `json:"stage" db:"stage"`
}
func GetWorkflowVersionNodeLinks(db *sqlx.DB, workflowVersionId int) ([]WorkflowVersionNodeLink, error)

type WorkflowVersionNodeLinkVisibilitySettings

type WorkflowVersionNodeLinkVisibilitySettings struct {
	Child  LinkVisibilitySettings `json:"child"`
	Parent LinkVisibilitySettings `json:"parent"`
}

func (*WorkflowVersionNodeLinkVisibilitySettings) Scan

func (nvls *WorkflowVersionNodeLinkVisibilitySettings) Scan(val interface{}) (err error)

type WorkflowVersionNodeLog

type WorkflowVersionNodeLog struct {
	TriggerReference                string    `json:"triggerReference" db:"trigger_reference"`
	InputData                       string    `json:"input_data" db:"input_data"`
	OutputData                      string    `json:"output_data" db:"output_data"`
	DebugData                       string    `json:"debug_data" db:"debug_data"`
	ErrorData                       string    `json:"error_data" db:"error_data"`
	WorkflowVersionNodeId           int       `json:"workflowVersionNodeId" db:"workflow_version_node_id"`
	TriggeringWorkflowVersionNodeId *int      `json:"triggeringWorkflowVersionNodeId" db:"triggering_workflow_version_node_id"`
	CreatedOn                       time.Time `json:"createdOn" db:"created_on"`
}

func GetNodeLogs

func GetNodeLogs(db *sqlx.DB, workflowVersionNodeId int, maximumResultCount int) ([]WorkflowVersionNodeLog, error)

func GetWorkflowLogs

func GetWorkflowLogs(db *sqlx.DB, workflowId int, maximumResultCount int) ([]WorkflowVersionNodeLog, error)

type WorkflowVersionNodeResponse

type WorkflowVersionNodeResponse struct {
	WorkflowVersionNode
	Parameters []byte
}

Jump to

Keyboard shortcuts

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