common

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsClassifierConfig

func AsClassifierConfig(cfg interface{}) (*models.ClassifierConfig, bool)

AsClassifierConfig returns a pointer to ClassifierConfig regardless of value or pointer storage.

func AsCodeConfig

func AsCodeConfig(cfg interface{}) (*models.CodeConfig, bool)

AsCodeConfig returns a pointer to CodeConfig regardless of value or pointer storage.

func AsConditionConfig

func AsConditionConfig(cfg interface{}) (*models.ConditionConfig, bool)

AsConditionConfig returns a pointer to ConditionConfig regardless of value or pointer storage.

func AsEndConfig

func AsEndConfig(cfg interface{}) (*models.EndConfig, bool)

AsEndConfig returns a pointer to EndConfig regardless of value or pointer storage.

func AsIterationConfig

func AsIterationConfig(cfg interface{}) (*models.IterationConfig, bool)

AsIterationConfig returns a pointer to IterationConfig regardless of value or pointer storage.

func AsLLMConfig

func AsLLMConfig(cfg interface{}) (*models.LLMConfig, bool)

AsLLMConfig returns a pointer to LLMConfig regardless of value or pointer storage.

func AsStartConfig

func AsStartConfig(cfg interface{}) (*models.StartConfig, bool)

AsStartConfig returns a pointer to StartConfig regardless of value or pointer storage.

func CollectAllEdgesAndNodes

func CollectAllEdgesAndNodes(unifiedDSL *models.UnifiedDSL, iterationInternalNodeIDs map[string]bool) ([]models.Edge, []models.Node)

CollectAllEdgesAndNodes collects all edges and nodes from main workflow and iterations

func CollectIterationInternalNodeIDs

func CollectIterationInternalNodeIDs(nodes []models.Node) map[string]bool

CollectIterationInternalNodeIDs collects all iteration internal node IDs for filtering

func CreateVariableReference

func CreateVariableReference(originalRef *models.VariableReference, nodeID, outputName string) *models.VariableReference

CreateVariableReference creates a variable reference with given parameters

func GenerateSimpleNodeID

func GenerateSimpleNodeID(node models.Node, index int) string

GenerateSimpleNodeID generates a simple random 16-digit numeric ID

func NewNodeIDMapper

func NewNodeIDMapper() interfaces.IDMapper

NewNodeIDMapper creates a timestamp-based ID mapper.

func NewSecureNodeIDMapper

func NewSecureNodeIDMapper() interfaces.IDMapper

NewSecureNodeIDMapper creates a cryptographically secure ID mapper.

func NewUnifiedIDMapper

func NewUnifiedIDMapper(strategy IDGenerationStrategy) interfaces.IDMapper

NewUnifiedIDMapper creates a unified ID mapper with configurable strategies.

func ReplaceTemplateNodeReferences

func ReplaceTemplateNodeReferences(text string, nodeIDMapping map[string]string) string

ReplaceTemplateNodeReferences replaces node ID references in template strings

func ReverseIDMapping

func ReverseIDMapping(idMapping map[string]string, targetID string) string

ReverseIDMapping performs reverse lookup in ID mapping to find original ID

func TryRemapNodeID

func TryRemapNodeID(idMapping map[string]string, nodeID string) (string, bool)

TryRemapNodeID attempts to remap a node ID using the provided mapping

func UpdateVariableSelector

func UpdateVariableSelector(selector []string, nodeIDMapping map[string]string) []string

UpdateVariableSelector updates a variable selector array with mapped node ID

Types

type BaseGenerator

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

BaseGenerator provides base implementation for generators

func NewBaseGenerator

func NewBaseGenerator(platformType models.PlatformType) *BaseGenerator

func (*BaseGenerator) GetPlatformType

func (g *BaseGenerator) GetPlatformType() models.PlatformType

GetPlatformType returns the platform type

type BaseParser

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

BaseParser provides base implementation for parsers

func NewBaseParser

func NewBaseParser(platformType models.PlatformType) *BaseParser

func (*BaseParser) GetPlatformType

func (p *BaseParser) GetPlatformType() models.PlatformType

GetPlatformType returns the platform type

type GraphGenerationContext

type GraphGenerationContext struct {
	UnifiedDSL    *models.UnifiedDSL
	NodeIDMapping map[string]string
	Graph         interface{} // Generic graph type (could be DifyGraph, IflytekGraph, etc.)
}

GraphGenerationContext holds context information for graph generation

type IDGenerationStrategy

type IDGenerationStrategy int

IDGenerationStrategy defines ID generation strategies.

const (
	StrategyTimestampBased IDGenerationStrategy = iota // Timestamp-based ID generation for general use
	StrategyCryptoSecure                               // Cryptographically secure ID generation
	StrategySimpleNumeric                              // Simple numeric ID generation for platforms requiring simple IDs
)

type NodeGenerationContext

type NodeGenerationContext struct {
	Phase         NodeGenerationPhase
	IDMapping     map[string]string
	TitleMapping  map[string]string
	BranchMapping map[string]string
	SkipSubNodes  bool
}

NodeGenerationContext holds context for node generation process

type NodeGenerationPhase

type NodeGenerationPhase int

NodeGenerationPhase represents the phase of node generation

const (
	PhaseInitialGeneration NodeGenerationPhase = iota
	PhaseRegeneration
)

type UnifiedDSLValidator

type UnifiedDSLValidator struct{}

UnifiedDSLValidator validates unified DSL structures

func NewUnifiedDSLValidator

func NewUnifiedDSLValidator() *UnifiedDSLValidator

func (*UnifiedDSLValidator) ValidateEdge

func (v *UnifiedDSLValidator) ValidateEdge(edge *models.Edge, nodes []models.Node) error

ValidateEdge validates edges

func (*UnifiedDSLValidator) ValidateMetadata

func (v *UnifiedDSLValidator) ValidateMetadata(metadata *models.Metadata) error

ValidateMetadata validates metadata

func (*UnifiedDSLValidator) ValidateNode

func (v *UnifiedDSLValidator) ValidateNode(node *models.Node) error

ValidateNode validates a single node

func (*UnifiedDSLValidator) ValidateWorkflow

func (v *UnifiedDSLValidator) ValidateWorkflow(workflow *models.Workflow) error

ValidateWorkflow validates basic workflow structure

type UnifiedIDMapper

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

UnifiedIDMapper provides unified node ID mapping with configurable strategies.

func (*UnifiedIDMapper) Clear

func (m *UnifiedIDMapper) Clear()

Clear clears all mappings.

func (*UnifiedIDMapper) GetMapping

func (m *UnifiedIDMapper) GetMapping() map[string]string

GetMapping returns the complete mapping table.

func (*UnifiedIDMapper) GetStrategy

func (m *UnifiedIDMapper) GetStrategy() IDGenerationStrategy

GetStrategy returns the current ID generation strategy.

func (*UnifiedIDMapper) HasMapping

func (m *UnifiedIDMapper) HasMapping(originalID string) bool

HasMapping checks if a mapping exists.

func (*UnifiedIDMapper) MapNodeID

func (m *UnifiedIDMapper) MapNodeID(originalID string, nodeType models.NodeType) string

MapNodeID maps original node ID to generated ID.

func (*UnifiedIDMapper) SetMapping

func (m *UnifiedIDMapper) SetMapping(mapping map[string]string)

SetMapping sets the mapping table.

func (*UnifiedIDMapper) SetStrategy

func (m *UnifiedIDMapper) SetStrategy(strategy IDGenerationStrategy)

SetStrategy sets the ID generation strategy.

func (*UnifiedIDMapper) Statistics

func (m *UnifiedIDMapper) Statistics() map[string]interface{}

Statistics returns mapper statistics.

Jump to

Keyboard shortcuts

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