Documentation
¶
Index ¶
- Constants
- func ApplyWorkflowCredentials(w WorkflowInterface, creds map[string]map[string]string)
- func CredentialKeys(nodeType string) []string
- func ExportNodeRED(w WorkflowInterface) ([]byte, error)
- func ExtractWorkflowCredentials(w WorkflowInterface, existing map[string]map[string]string) map[string]map[string]string
- func ImportChildFlow(w WorkflowInterface, raw []byte) ([]string, error)
- func IsComponentInstance(nodeType string) bool
- func IsCredentialKey(nodeType, key string) bool
- func IsCredentialSentinel(v any) bool
- func RegisterCredentialKeys(typeID string, keys []string)
- type ChildFlowExport
- type CredentialCipher
- type CredentialInterface
- type CredentialQueryInterface
- type DeployRecordInterface
- type DeployRecordQueryInterface
- type EdgeInterface
- type EdgeQueryInterface
- type MessageInterface
- type MessageQueryInterface
- type NewStoreOptions
- type NodeGroupInterface
- type NodeGroupQueryInterface
- type NodeInterface
- type NodeQueryInterface
- type Store
- func (st *Store) ConfigGet(ctx context.Context, key string) (string, error)
- func (st *Store) ConfigSet(ctx context.Context, key string, value string) error
- func (st *Store) CredentialCount(ctx context.Context, query CredentialQueryInterface) (int64, error)
- func (st *Store) CredentialCreate(ctx context.Context, credential CredentialInterface) error
- func (st *Store) CredentialDeleteByID(ctx context.Context, id string) error
- func (st *Store) CredentialDeleteByWorkflowID(ctx context.Context, workflowID string) error
- func (st *Store) CredentialFindByID(ctx context.Context, id string) (CredentialInterface, error)
- func (st *Store) CredentialFindByNode(ctx context.Context, workflowID, nodeID string) (CredentialInterface, error)
- func (st *Store) CredentialList(ctx context.Context, query CredentialQueryInterface) ([]CredentialInterface, error)
- func (st *Store) CredentialMapForWorkflow(ctx context.Context, workflowID string) (map[string]map[string]string, error)
- func (st *Store) CredentialReplaceForWorkflow(ctx context.Context, workflowID string, creds map[string]map[string]string) error
- func (st *Store) CredentialUpdate(ctx context.Context, credential CredentialInterface) error
- func (st *Store) DeployRecordCount(ctx context.Context, query DeployRecordQueryInterface) (int64, error)
- func (st *Store) DeployRecordCreate(ctx context.Context, record DeployRecordInterface) error
- func (st *Store) DeployRecordDeleteByID(ctx context.Context, id string) error
- func (st *Store) DeployRecordDeleteByWorkflowID(ctx context.Context, workflowID string) error
- func (st *Store) DeployRecordFindByID(ctx context.Context, id string) (DeployRecordInterface, error)
- func (st *Store) DeployRecordList(ctx context.Context, query DeployRecordQueryInterface) ([]DeployRecordInterface, error)
- func (st *Store) EdgeCount(ctx context.Context, query EdgeQueryInterface) (int64, error)
- func (st *Store) EdgeCreate(ctx context.Context, edge EdgeInterface) error
- func (st *Store) EdgeDeleteByID(ctx context.Context, id string) error
- func (st *Store) EdgeFindByID(ctx context.Context, id string) (EdgeInterface, error)
- func (st *Store) EdgeList(ctx context.Context, query EdgeQueryInterface) ([]EdgeInterface, error)
- func (st *Store) EdgeUpdate(ctx context.Context, edge EdgeInterface) error
- func (st *Store) EnableDebug(debugEnabled bool) StoreInterface
- func (st *Store) GetDB() *sql.DB
- func (st *Store) GetEntityStore() entitystore.StoreInterface
- func (st *Store) MessageCount(ctx context.Context, query MessageQueryInterface) (int64, error)
- func (st *Store) MessageCreate(ctx context.Context, message MessageInterface) error
- func (st *Store) MessageDeleteByID(ctx context.Context, id string) error
- func (st *Store) MessageFindByID(ctx context.Context, id string) (MessageInterface, error)
- func (st *Store) MessageList(ctx context.Context, query MessageQueryInterface) ([]MessageInterface, error)
- func (st *Store) MessageUpdate(ctx context.Context, message MessageInterface) error
- func (st *Store) MigrateViewGroups(ctx context.Context) (int, error)
- func (st *Store) MigrateWorkflowBlobAttributes(ctx context.Context) (int, error)
- func (st *Store) MigrateWorkflowGroupsConfig(ctx context.Context, configKey string) (int, error)
- func (st *Store) NodeCount(ctx context.Context, query NodeQueryInterface) (int64, error)
- func (st *Store) NodeCreate(ctx context.Context, node NodeInterface) error
- func (st *Store) NodeDeleteByID(ctx context.Context, id string) error
- func (st *Store) NodeFindByID(ctx context.Context, id string) (NodeInterface, error)
- func (st *Store) NodeGroupCount(ctx context.Context, query NodeGroupQueryInterface) (int64, error)
- func (st *Store) NodeGroupCreate(ctx context.Context, group NodeGroupInterface) error
- func (st *Store) NodeGroupDeleteByID(ctx context.Context, id string) error
- func (st *Store) NodeGroupFindByID(ctx context.Context, id string) (NodeGroupInterface, error)
- func (st *Store) NodeGroupList(ctx context.Context, query NodeGroupQueryInterface) ([]NodeGroupInterface, error)
- func (st *Store) NodeGroupUpdate(ctx context.Context, group NodeGroupInterface) error
- func (st *Store) NodeList(ctx context.Context, query NodeQueryInterface) ([]NodeInterface, error)
- func (st *Store) NodeUpdate(ctx context.Context, node NodeInterface) error
- func (st *Store) WorkflowCount(ctx context.Context, query WorkflowQueryInterface) (int64, error)
- func (st *Store) WorkflowCreate(ctx context.Context, workflow WorkflowInterface) error
- func (st *Store) WorkflowDeleteByID(ctx context.Context, id string) error
- func (st *Store) WorkflowFindByID(ctx context.Context, id string) (WorkflowInterface, error)
- func (st *Store) WorkflowFindByName(ctx context.Context, name string) (WorkflowInterface, error)
- func (st *Store) WorkflowGroupCount(ctx context.Context, query WorkflowGroupQueryInterface) (int64, error)
- func (st *Store) WorkflowGroupCreate(ctx context.Context, group WorkflowGroupInterface) error
- func (st *Store) WorkflowGroupDeleteByID(ctx context.Context, id string) error
- func (st *Store) WorkflowGroupFindByID(ctx context.Context, id string) (WorkflowGroupInterface, error)
- func (st *Store) WorkflowGroupList(ctx context.Context, query WorkflowGroupQueryInterface) ([]WorkflowGroupInterface, error)
- func (st *Store) WorkflowGroupUpdate(ctx context.Context, group WorkflowGroupInterface) error
- func (st *Store) WorkflowList(ctx context.Context, query WorkflowQueryInterface) ([]WorkflowInterface, error)
- func (st *Store) WorkflowTrashByID(ctx context.Context, id string) error
- func (st *Store) WorkflowUpdate(ctx context.Context, workflow WorkflowInterface) error
- type StoreInterface
- type WorkflowGroupInterface
- type WorkflowGroupQueryInterface
- type WorkflowInterface
- type WorkflowQueryInterface
Constants ¶
const ASC = "asc"
const ATTRIBUTE_ACTOR = "actor"
Attribute keys (persisted in the entity store attributes table)
const ATTRIBUTE_DATA = "data"
const ATTRIBUTE_DEPLOYED = "deployed"
const ATTRIBUTE_DESCRIPTION = "description"
const ATTRIBUTE_EDGES = "edges" // legacy: JSON blob on workflow entities
Legacy attribute keys — never written anymore, only read as a fallback when loading pre-migration records and cleaned up by entityAttributesReplace (they are in each type's managed key set).
const ATTRIBUTE_ERROR = "error"
const ATTRIBUTE_FLOW = "flow"
const ATTRIBUTE_GROUP_ID = "group_id"
const ATTRIBUTE_METADATA = "metadata"
const ATTRIBUTE_NAME = "name"
const ATTRIBUTE_NODES = "nodes" // legacy: JSON blob on workflow entities
const ATTRIBUTE_NODE_ID = "node_id"
const ATTRIBUTE_PARENT_ID = "parent_id"
const ATTRIBUTE_PAYLOAD = "payload"
const ATTRIBUTE_POSITION = "position"
const ATTRIBUTE_SOURCE = "source"
const ATTRIBUTE_SOURCE_KEY = "source_key"
const ATTRIBUTE_TARGET = "target"
const ATTRIBUTE_TARGET_KEY = "target_key"
const ATTRIBUTE_TIMESTAMP = "timestamp" // legacy: duplicated entity created_at on messages
const ATTRIBUTE_TYPE = "type"
const ATTRIBUTE_VALUE = "value"
const ATTRIBUTE_VIEW = "view"
const ATTRIBUTE_WORKFLOWS = "workflows"
const ATTRIBUTE_WORKFLOW_ID = "workflow_id"
const AttributeConfigValue = "value"
AttributeConfigValue holds a config entry's raw string payload
const CredentialSentinel = "__PWRD__"
CredentialSentinel is the marker stored in node.Data in place of a real credential value (the same convention Node-RED's editor uses, "__PWRD__"). Stored workflows and editor payloads carry the sentinel where a secret exists; the actual value lives in server-side credential storage and is merged back into node.Data at deploy time. Exports must strip sentinel values and credential keys entirely.
const DESC = "desc"
const DeployRecordRetention = 20
DeployRecordRetention caps the deploy history kept per workflow — the last N records survive, older ones are pruned on append (same cap flowadmin used).
const EntityTypeConfig = "config"
EntityTypeConfig is the entity type for child-flow-level key/value config
const EntityTypeCredential = "credential"
Entity types stored in the underlying entity store
const EntityTypeDeployRecord = "deploy_record"
const EntityTypeEdge = "edge"
const EntityTypeMessage = "message"
const EntityTypeNode = "node"
const EntityTypeNodeGroup = "node_group"
const EntityTypeWorkflow = "workflow"
const EntityTypeWorkflowGroup = "workflow_group"
Variables ¶
This section is empty.
Functions ¶
func ApplyWorkflowCredentials ¶
func ApplyWorkflowCredentials(w WorkflowInterface, creds map[string]map[string]string)
ApplyWorkflowCredentials merges stored credentials into node.Data so a deploy hands executors the real values while storage keeps only sentinel markers. Mutates the workflow in place — callers deploy a clone (the engine deploy path clones before expansion, so stored entities are never tainted).
func CredentialKeys ¶
CredentialKeys returns the config keys of a node type that are treated as credentials (masked in the editor, stored outside the exported flow document, stripped from exports).
func ExportNodeRED ¶
func ExportNodeRED(w WorkflowInterface) ([]byte, error)
ExportNodeRED converts a workflow into the Node-RED flow JSON array shape. Subflow definitions unfold: the type:"subflow" object is followed by its internal nodes as flat objects with z = <defId>.
func ExtractWorkflowCredentials ¶
func ExtractWorkflowCredentials(w WorkflowInterface, existing map[string]map[string]string) map[string]map[string]string
ExtractWorkflowCredentials moves credential values out of every node in the workflow into a nodeID → key → value map, leaving sentinel markers in node.Data. existing is the previously stored credential map (nil on create) used to preserve values the editor sent back as sentinels or omitted entirely. Persist the result via CredentialReplaceForWorkflow.
func ImportChildFlow ¶ added in v0.4.0
func ImportChildFlow(w WorkflowInterface, raw []byte) ([]string, error)
ImportChildFlow merges a child flow envelope into w as a NEW child flow. All ids are re-minted (child flow, nodes, edges, groups, definitions and their internal graphs) and every intra-payload reference is rewritten; references pointing outside the payload are kept verbatim and reported in the returned warnings when they do not resolve against the target workflow. Returns the list of warnings.
func IsComponentInstance ¶ added in v0.4.0
IsComponentInstance reports whether nodeType names a component instance ("component:<defId>").
func IsCredentialKey ¶
IsCredentialKey reports whether key is a credential field on the given node type.
func IsCredentialSentinel ¶
IsCredentialSentinel reports whether v is the sentinel string left in place of a stored credential value.
func RegisterCredentialKeys ¶
RegisterCredentialKeys marks config keys of a node type as credentials — the same treatment built-in types get: the editor masks them, storage moves them out of the flow document behind the CredentialSentinel marker, and exports strip them. Re-calling replaces the key list for the type.
Types ¶
type ChildFlowExport ¶ added in v0.4.0
type ChildFlowExport struct {
// Format identifies the envelope kind; always "child_flow".
Format string `json:"nodestore"`
// Version is the envelope schema version.
Version int `json:"version"`
// ChildFlow carries the meta entity {id,label,role,enabled,env}.
ChildFlow map[string]any `json:"child_flow"`
// Nodes are the child flow's nodes (backend shape; data.child flow is
// implied by the envelope and omitted).
Nodes []NodeInterface `json:"nodes"`
// Edges are the edges whose endpoints both live in the child flow.
Edges []EdgeInterface `json:"edges"`
// Groups are the view.groups entries belonging to the child flow.
Groups []any `json:"groups,omitempty"`
// Defs are the type:"component" definition nodes the child flow's
// component:<id> instances reference, resolved transitively
// (a definition may itself instantiate another definition).
Defs []NodeInterface `json:"defs,omitempty"`
// Warnings lists references that point outside the payload —
// kept verbatim in the export, so they only resolve when the
// target workflow already contains the referenced nodes.
Warnings []string `json:"warnings,omitempty"`
}
ChildFlowExport is the portable single-child flow payload.
func ExportChildFlow ¶ added in v0.4.0
func ExportChildFlow(w WorkflowInterface, flowRef string) (*ChildFlowExport, error)
ExportChildFlow builds the portable envelope for one child flow of w. flowRef is a child flow id or label. Nodes are the workflow nodes whose data.child flow resolves to the child flow; edges are those fully inside the set; groups and component definitions follow. References pointing at nodes outside the child flow are kept verbatim and listed in Warnings.
func ExportComponentDef ¶ added in v0.4.0
func ExportComponentDef(w WorkflowInterface, defID string) (*ChildFlowExport, error)
ExportComponentDef builds a child flow envelope carrying a single component definition (plus any definitions it nests). The envelope's child flow entity is a role:"component" template named after the definition, so importing it produces a navigable child flow plus a working definition.
func (ChildFlowExport) MarshalJSON ¶ added in v0.4.0
func (e ChildFlowExport) MarshalJSON() ([]byte, error)
MarshalJSON serializes the interface-typed node/edge slices through their persisted JSON shapes.
func (*ChildFlowExport) UnmarshalJSON ¶ added in v0.4.0
func (e *ChildFlowExport) UnmarshalJSON(raw []byte) error
UnmarshalJSON decodes the wire form back into interface-typed domain objects.
type CredentialCipher ¶ added in v0.2.0
type CredentialCipher interface {
// Encrypt returns the sealed (self-describing) form of plaintext.
Encrypt(plaintext []byte) (string, error)
// Decrypt opens a sealed value. Implementations must pass
// through values that are not in their sealed format so legacy
// plaintext rows still decode.
Decrypt(sealed string) ([]byte, error)
}
CredentialCipher seals the credential value map before it is persisted into the entity attribute (encryption at rest) and opens it on read. The Node-RED analogue is flows_cred.json's credentialSecret.
func NewAESCredentialCipher ¶ added in v0.2.0
func NewAESCredentialCipher(key []byte) (CredentialCipher, error)
NewAESCredentialCipher returns a CredentialCipher using AES-256-GCM with the given 32-byte key. The key is copied — callers may zero their buffer afterwards.
type CredentialInterface ¶
type CredentialInterface interface {
GetID() string
SetID(id string) CredentialInterface
GetWorkflowID() string
SetWorkflowID(workflowID string) CredentialInterface
GetNodeID() string
SetNodeID(nodeID string) CredentialInterface
// GetValues returns the stored key→value credential map.
GetValues() map[string]string
SetValues(values map[string]string) CredentialInterface
// GetValue returns one stored credential value ("" when unset).
GetValue(key string) string
// SetValue upserts one credential key; an empty value removes it.
SetValue(key, value string) CredentialInterface
GetCreatedAt() time.Time
SetCreatedAt(createdAt time.Time) CredentialInterface
GetUpdatedAt() time.Time
SetUpdatedAt(updatedAt time.Time) CredentialInterface
}
CredentialInterface is the entity form of a node's stored secrets — one entity per (workflow, node) pair carrying a key→value map. The workflow document keeps only CredentialSentinel markers; the real values live here and are merged back into node.Data at deploy time (Node-RED flows_cred.json convention).
func NewCredential ¶
func NewCredential(workflowID, nodeID string) CredentialInterface
NewCredential creates a new credential entity for a node. The ID may be left empty (entitystore assigns one); callers that need a deterministic handle (workflowID:nodeID) can SetID themselves.
type CredentialQueryInterface ¶
type CredentialQueryInterface interface {
Validate() error
HasID() bool
GetID() string
WithID(id string) CredentialQueryInterface
HasWorkflowID() bool
GetWorkflowID() string
WithWorkflowID(workflowID string) CredentialQueryInterface
HasNodeID() bool
GetNodeID() string
WithNodeID(nodeID string) CredentialQueryInterface
HasLimit() bool
GetLimit() uint64
WithLimit(limit uint64) CredentialQueryInterface
HasOffset() bool
GetOffset() uint64
WithOffset(offset uint64) CredentialQueryInterface
GetSortOrder() string
WithSortOrder(sortOrder string) CredentialQueryInterface
IsCountOnly() bool
WithCountOnly(countOnly bool) CredentialQueryInterface
}
CredentialQueryInterface is the fluent query builder for listing and counting credential entities.
func CredentialQuery ¶
func CredentialQuery() CredentialQueryInterface
CredentialQuery creates a new credential query builder
type DeployRecordInterface ¶
type DeployRecordInterface interface {
GetID() string
SetID(id string) DeployRecordInterface
GetWorkflowID() string
SetWorkflowID(workflowID string) DeployRecordInterface
GetActor() string
SetActor(actor string) DeployRecordInterface
// GetFlow returns the deployed flow document as raw JSON.
GetFlow() string
SetFlow(flow string) DeployRecordInterface
GetCreatedAt() time.Time
SetCreatedAt(createdAt time.Time) DeployRecordInterface
}
DeployRecordInterface is one immutable entry in a workflow's deploy history: who deployed (actor) and the exact flow document deployed (flow, raw JSON — credential fields carry sentinel markers, never secrets). The deploy timestamp comes from the entity's created_at — per the GOD ruling no duplicated time attributes exist.
func NewDeployRecord ¶
func NewDeployRecord(workflowID, actor, flow string) DeployRecordInterface
NewDeployRecord creates a new deploy record entity
type DeployRecordQueryInterface ¶
type DeployRecordQueryInterface interface {
Validate() error
HasID() bool
GetID() string
WithID(id string) DeployRecordQueryInterface
HasWorkflowID() bool
GetWorkflowID() string
WithWorkflowID(workflowID string) DeployRecordQueryInterface
HasLimit() bool
GetLimit() uint64
WithLimit(limit uint64) DeployRecordQueryInterface
HasOffset() bool
GetOffset() uint64
WithOffset(offset uint64) DeployRecordQueryInterface
GetSortOrder() string
WithSortOrder(sortOrder string) DeployRecordQueryInterface
IsCountOnly() bool
WithCountOnly(countOnly bool) DeployRecordQueryInterface
}
DeployRecordQueryInterface is the fluent query builder for listing and counting deploy record entities.
func DeployRecordQuery ¶
func DeployRecordQuery() DeployRecordQueryInterface
DeployRecordQuery creates a new deploy record query builder. Deploy history reads newest-first, so DESC is the default here (unlike the other entity queries).
type EdgeInterface ¶
type EdgeInterface interface {
GetID() string
SetID(id string) EdgeInterface
GetWorkflowID() string
SetWorkflowID(workflowID string) EdgeInterface
GetSource() string
SetSource(source string) EdgeInterface
GetSourceKey() string
SetSourceKey(sourceKey string) EdgeInterface
GetTarget() string
SetTarget(target string) EdgeInterface
GetTargetKey() string
SetTargetKey(targetKey string) EdgeInterface
GetCreatedAt() time.Time
SetCreatedAt(createdAt time.Time) EdgeInterface
GetUpdatedAt() time.Time
SetUpdatedAt(updatedAt time.Time) EdgeInterface
}
EdgeInterface is the interface form of flowrunner.Edge — a connection between two nodes. The edge IS an entitystore entity: its entity ID is the edge ID and created/updated timestamps come from the entity.
func NewEdge ¶
func NewEdge(id, source, target string) EdgeInterface
NewEdge creates a new workflow edge. Edge ids are never referenced by other entities (edges resolve via their source/target attributes), so an over-length id is deterministically shortened at the boundary.
type EdgeQueryInterface ¶
type EdgeQueryInterface interface {
Validate() error
HasID() bool
GetID() string
WithID(id string) EdgeQueryInterface
HasWorkflowID() bool
GetWorkflowID() string
WithWorkflowID(workflowID string) EdgeQueryInterface
HasLimit() bool
GetLimit() uint64
WithLimit(limit uint64) EdgeQueryInterface
HasOffset() bool
GetOffset() uint64
WithOffset(offset uint64) EdgeQueryInterface
GetSortOrder() string
WithSortOrder(sortOrder string) EdgeQueryInterface
IsCountOnly() bool
WithCountOnly(countOnly bool) EdgeQueryInterface
}
EdgeQueryInterface is the fluent query builder for listing and counting edge entities.
type MessageInterface ¶
type MessageInterface interface {
GetID() string
SetID(id string) MessageInterface
// GetPayload returns the message payload (typically
// map[string]any or []byte after JSON round-trip)
GetPayload() any
SetPayload(payload any) MessageInterface
// GetMetadata returns the message metadata
GetMetadata() map[string]any
SetMetadata(metadata map[string]any) MessageInterface
// GetError returns the error message if an upstream node failed
GetError() *string
SetError(err string) MessageInterface
ClearError() MessageInterface
// GetTimestamp returns the timestamp when the message was created/last modified
GetTimestamp() time.Time
SetTimestamp(timestamp time.Time) MessageInterface
// GetCreatedAt returns the creation timestamp
GetCreatedAt() time.Time
SetCreatedAt(createdAt time.Time) MessageInterface
// GetUpdatedAt returns the last update timestamp
GetUpdatedAt() time.Time
SetUpdatedAt(updatedAt time.Time) MessageInterface
}
MessageInterface is the interface form of flowrunner.Message — the standardized envelope for data flowing between nodes, persisted as an entity (type EntityTypeMessage) so the runner has durable messages.
type MessageQueryInterface ¶
type MessageQueryInterface interface {
Validate() error
HasID() bool
GetID() string
WithID(id string) MessageQueryInterface
HasLimit() bool
GetLimit() uint64
WithLimit(limit uint64) MessageQueryInterface
HasOffset() bool
GetOffset() uint64
WithOffset(offset uint64) MessageQueryInterface
GetSortOrder() string
WithSortOrder(sortOrder string) MessageQueryInterface
IsCountOnly() bool
WithCountOnly(countOnly bool) MessageQueryInterface
}
MessageQueryInterface is the fluent query builder for listing and counting messages.
func MessageQuery ¶
func MessageQuery() MessageQueryInterface
MessageQuery creates a new message query builder
type NewStoreOptions ¶
type NewStoreOptions struct {
// EntityStore is the underlying storage (required)
EntityStore entitystore.StoreInterface
// DebugEnabled enables debug logging
DebugEnabled bool
// CredentialCipher seals credential values at rest. When nil,
// credentials are stored as plaintext JSON (legacy behavior —
// prefer NewAESCredentialCipher for real secrets).
CredentialCipher CredentialCipher
}
NewStoreOptions define the options for creating a new node store
type NodeGroupInterface ¶
type NodeGroupInterface interface {
GetID() string
SetID(id string) NodeGroupInterface
GetWorkflowID() string
SetWorkflowID(workflowID string) NodeGroupInterface
GetName() string
SetName(name string) NodeGroupInterface
// GetData returns the group's freeform view payload (x, y, w, h,
// disabled, childFlow, env) — the view.groups entry minus id/name/
// nodeIds.
GetData() map[string]any
SetData(data map[string]any) NodeGroupInterface
GetCreatedAt() time.Time
SetCreatedAt(createdAt time.Time) NodeGroupInterface
GetUpdatedAt() time.Time
SetUpdatedAt(updatedAt time.Time) NodeGroupInterface
}
NodeGroupInterface is the entity form of an editor view group (one of the view.groups entries: {id, name, x, y, w, h, disabled, childFlow, nodeIds}). Membership is NOT stored here — it lives as group_id on the member node entities (GOD ruling 2026-11-24); the geometry and flags ride in the data attribute so the wire shape round-trips.
func NewNodeGroup ¶
func NewNodeGroup(workflowID, name string) NodeGroupInterface
NewNodeGroup creates a new node group entity
type NodeGroupQueryInterface ¶
type NodeGroupQueryInterface interface {
Validate() error
HasID() bool
GetID() string
WithID(id string) NodeGroupQueryInterface
HasWorkflowID() bool
GetWorkflowID() string
WithWorkflowID(workflowID string) NodeGroupQueryInterface
HasLimit() bool
GetLimit() uint64
WithLimit(limit uint64) NodeGroupQueryInterface
HasOffset() bool
GetOffset() uint64
WithOffset(offset uint64) NodeGroupQueryInterface
GetSortOrder() string
WithSortOrder(sortOrder string) NodeGroupQueryInterface
IsCountOnly() bool
WithCountOnly(countOnly bool) NodeGroupQueryInterface
}
NodeGroupQueryInterface is the fluent query builder for listing and counting node group entities.
func NodeGroupQuery ¶
func NodeGroupQuery() NodeGroupQueryInterface
NodeGroupQuery creates a new node group query builder
type NodeInterface ¶
type NodeInterface interface {
GetID() string
SetID(id string) NodeInterface
GetWorkflowID() string
SetWorkflowID(workflowID string) NodeInterface
// GetGroupID returns the node_group entity this node belongs to
// ("" = ungrouped) — group membership lives on the node, not on
// the group (GOD ruling 2026-11-24).
GetGroupID() string
SetGroupID(groupID string) NodeInterface
GetType() string
SetType(nodeType string) NodeInterface
GetPositionX() float64
SetPositionX(x float64) NodeInterface
GetPositionY() float64
SetPositionY(y float64) NodeInterface
SetPosition(x, y float64) NodeInterface
GetData() map[string]any
SetData(data map[string]any) NodeInterface
GetCreatedAt() time.Time
SetCreatedAt(createdAt time.Time) NodeInterface
GetUpdatedAt() time.Time
SetUpdatedAt(updatedAt time.Time) NodeInterface
}
NodeInterface is the interface form of flowrunner.Node — a single node in a workflow graph. The node IS an entitystore entity: its entity ID is the node ID and created/updated timestamps come from the entity.
type NodeQueryInterface ¶
type NodeQueryInterface interface {
Validate() error
HasID() bool
GetID() string
WithID(id string) NodeQueryInterface
HasWorkflowID() bool
GetWorkflowID() string
WithWorkflowID(workflowID string) NodeQueryInterface
HasLimit() bool
GetLimit() uint64
WithLimit(limit uint64) NodeQueryInterface
HasOffset() bool
GetOffset() uint64
WithOffset(offset uint64) NodeQueryInterface
GetSortOrder() string
WithSortOrder(sortOrder string) NodeQueryInterface
IsCountOnly() bool
WithCountOnly(countOnly bool) NodeQueryInterface
}
NodeQueryInterface is the fluent query builder for listing and counting node entities.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the nodestore implementation backed by an entity store
func NewStore ¶
func NewStore(opts NewStoreOptions) (*Store, error)
NewStore creates a new node store on top of an entity store
func (*Store) ConfigGet ¶
ConfigGet returns the raw value stored under a config key, or the empty string when the key does not exist.
func (*Store) CredentialCount ¶
func (*Store) CredentialCreate ¶
func (st *Store) CredentialCreate(ctx context.Context, credential CredentialInterface) error
func (*Store) CredentialDeleteByID ¶
func (*Store) CredentialDeleteByWorkflowID ¶
CredentialDeleteByWorkflowID drops every credential entity owned by the workflow (called when the workflow is deleted).
func (*Store) CredentialFindByID ¶
func (*Store) CredentialFindByNode ¶
func (st *Store) CredentialFindByNode(ctx context.Context, workflowID, nodeID string) (CredentialInterface, error)
CredentialFindByNode returns the single credential entity for a (workflow, node) pair, or nil when none is stored.
func (*Store) CredentialList ¶
func (st *Store) CredentialList(ctx context.Context, query CredentialQueryInterface) ([]CredentialInterface, error)
CredentialList lists credential entities. WithWorkflowID uses EntityListByAttribute (the single attribute-value lookup the store offers — see NodeList); node filtering, limit/offset and sort are applied in memory.
func (*Store) CredentialMapForWorkflow ¶
func (st *Store) CredentialMapForWorkflow(ctx context.Context, workflowID string) (map[string]map[string]string, error)
CredentialMapForWorkflow returns the workflow's stored credentials in the deploy-time shape nodeID → key → value — the single read the engine's credential provider needs.
func (*Store) CredentialReplaceForWorkflow ¶
func (st *Store) CredentialReplaceForWorkflow(ctx context.Context, workflowID string, creds map[string]map[string]string) error
CredentialReplaceForWorkflow bulk-replaces a workflow's credential entities from a nodeID → key → value map: entities not present in the map are deleted, changed ones updated, new ones created. Used by the workflow save path after extractWorkflowCredentials moves the secrets out of node.Data.
func (*Store) CredentialUpdate ¶
func (st *Store) CredentialUpdate(ctx context.Context, credential CredentialInterface) error
func (*Store) DeployRecordCount ¶
func (*Store) DeployRecordCreate ¶
func (st *Store) DeployRecordCreate(ctx context.Context, record DeployRecordInterface) error
DeployRecordCreate appends an immutable deploy record and prunes the workflow's history beyond DeployRecordRetention (oldest first — deploy records are append-only, never updated, so there is no DeployRecordUpdate on the contract).
func (*Store) DeployRecordDeleteByID ¶
func (*Store) DeployRecordDeleteByWorkflowID ¶
DeployRecordDeleteByWorkflowID drops the workflow's whole deploy history (called when the workflow is deleted).
func (*Store) DeployRecordFindByID ¶
func (*Store) DeployRecordList ¶
func (st *Store) DeployRecordList(ctx context.Context, query DeployRecordQueryInterface) ([]DeployRecordInterface, error)
DeployRecordList lists deploy record entities; WithWorkflowID uses EntityListByAttribute like the other per-workflow listings. Sort order applies to the entity created_at (the deploy timestamp).
func (*Store) EdgeCreate ¶
func (st *Store) EdgeCreate(ctx context.Context, edge EdgeInterface) error
func (*Store) EdgeDeleteByID ¶
func (*Store) EdgeFindByID ¶
func (*Store) EdgeList ¶
func (st *Store) EdgeList(ctx context.Context, query EdgeQueryInterface) ([]EdgeInterface, error)
EdgeList mirrors NodeList — WithWorkflowID goes through EntityListByAttribute (entities×attributes JOIN on workflow_id).
func (*Store) EdgeUpdate ¶
func (st *Store) EdgeUpdate(ctx context.Context, edge EdgeInterface) error
func (*Store) EnableDebug ¶
func (st *Store) EnableDebug(debugEnabled bool) StoreInterface
func (*Store) GetEntityStore ¶
func (st *Store) GetEntityStore() entitystore.StoreInterface
func (*Store) MessageCount ¶
func (*Store) MessageCreate ¶
func (st *Store) MessageCreate(ctx context.Context, message MessageInterface) error
func (*Store) MessageDeleteByID ¶
func (*Store) MessageFindByID ¶
func (*Store) MessageList ¶
func (st *Store) MessageList(ctx context.Context, query MessageQueryInterface) ([]MessageInterface, error)
func (*Store) MessageUpdate ¶
func (st *Store) MessageUpdate(ctx context.Context, message MessageInterface) error
func (*Store) MigrateViewGroups ¶
MigrateViewGroups converts each workflow's view.groups array into node_group entities and stamps group_id on the member node entities. Once converted, the "groups" key is stripped from the stored view attribute — since P5 the node_group entities are the authoritative read path (loadWorkflowGroups re-synthesizes the wire shape), so a lingering blob could only go stale. Returns the number of node groups upserted. Idempotent: group entities keep the entry ID, memberships are rewritten, and re-runs see a view attribute with no "groups" key.
func (*Store) MigrateWorkflowBlobAttributes ¶
MigrateWorkflowBlobAttributes is a one-shot migration for pre-change nodestore.db files: workflows that still carry the legacy ATTRIBUTE_NODES/ATTRIBUTE_EDGES JSON blobs get real node/edge child entities created (entity type node/edge, workflow_id link), and the blob attributes are removed afterwards.
It is idempotent — workflows already migrated have no blob keys and are skipped (children loaded by loadWorkflowChildren take precedence anyway). Callers invoke it explicitly, e.g. once at startup:
migrated, err := store.MigrateWorkflowBlobAttributes(ctx)
Returns the number of workflows migrated.
func (*Store) MigrateWorkflowGroupsConfig ¶
MigrateWorkflowGroupsConfig converts the "workflowGroups" section of the named config blob into workflow_group entities, then removes the section so the config store no longer carries structured domain data. Returns the number of groups upserted. Idempotent: groups are keyed by their original ID and updated in place on re-run.
func (*Store) NodeCreate ¶
func (st *Store) NodeCreate(ctx context.Context, node NodeInterface) error
func (*Store) NodeDeleteByID ¶
func (*Store) NodeFindByID ¶
func (*Store) NodeGroupCount ¶
func (*Store) NodeGroupCreate ¶
func (st *Store) NodeGroupCreate(ctx context.Context, group NodeGroupInterface) error
func (*Store) NodeGroupDeleteByID ¶
func (*Store) NodeGroupFindByID ¶
func (*Store) NodeGroupList ¶
func (st *Store) NodeGroupList(ctx context.Context, query NodeGroupQueryInterface) ([]NodeGroupInterface, error)
func (*Store) NodeGroupUpdate ¶
func (st *Store) NodeGroupUpdate(ctx context.Context, group NodeGroupInterface) error
func (*Store) NodeList ¶
func (st *Store) NodeList(ctx context.Context, query NodeQueryInterface) ([]NodeInterface, error)
NodeList lists node entities. WithWorkflowID uses entitystore.EntityListByAttribute — a single entities×attributes JOIN on entity type + workflow_id attribute (AttributeQuery has no value filter, so this is the only attribute-value lookup the store offers). Limit/offset/sort are applied in memory, consistent with WorkflowList.
func (*Store) NodeUpdate ¶
func (st *Store) NodeUpdate(ctx context.Context, node NodeInterface) error
func (*Store) WorkflowCount ¶
func (*Store) WorkflowCreate ¶
func (st *Store) WorkflowCreate(ctx context.Context, workflow WorkflowInterface) error
func (*Store) WorkflowDeleteByID ¶
WorkflowDeleteByID deletes the workflow AND its child node/edge entities (cascade — documented behavior; children are never orphaned).
func (*Store) WorkflowFindByID ¶
func (*Store) WorkflowFindByName ¶
func (*Store) WorkflowGroupCount ¶
func (*Store) WorkflowGroupCreate ¶
func (st *Store) WorkflowGroupCreate(ctx context.Context, group WorkflowGroupInterface) error
func (*Store) WorkflowGroupDeleteByID ¶
func (*Store) WorkflowGroupFindByID ¶
func (*Store) WorkflowGroupList ¶
func (st *Store) WorkflowGroupList(ctx context.Context, query WorkflowGroupQueryInterface) ([]WorkflowGroupInterface, error)
func (*Store) WorkflowGroupUpdate ¶
func (st *Store) WorkflowGroupUpdate(ctx context.Context, group WorkflowGroupInterface) error
func (*Store) WorkflowList ¶
func (st *Store) WorkflowList(ctx context.Context, query WorkflowQueryInterface) ([]WorkflowInterface, error)
WorkflowList lists workflows. entitystore can only filter on entity columns (type/handle/dates), so attribute criteria are applied in memory, then offset/limit. Children (nodes/edges) are loaded eagerly per workflow — see workflowFromEntity.
func (*Store) WorkflowTrashByID ¶
WorkflowTrashByID soft-deletes a workflow into the entitystore trash (children are left in place — restore semantics, same as before)
func (*Store) WorkflowUpdate ¶
func (st *Store) WorkflowUpdate(ctx context.Context, workflow WorkflowInterface) error
type StoreInterface ¶
type StoreInterface interface {
// GetEntityStore returns the underlying entity store
GetEntityStore() entitystore.StoreInterface
// EnableDebug enables debug mode
EnableDebug(debugEnabled bool) StoreInterface
WorkflowCount(ctx context.Context, query WorkflowQueryInterface) (int64, error)
WorkflowCreate(ctx context.Context, workflow WorkflowInterface) error
WorkflowDeleteByID(ctx context.Context, id string) error
WorkflowFindByID(ctx context.Context, id string) (WorkflowInterface, error)
WorkflowFindByName(ctx context.Context, name string) (WorkflowInterface, error)
WorkflowList(ctx context.Context, query WorkflowQueryInterface) ([]WorkflowInterface, error)
WorkflowTrashByID(ctx context.Context, id string) error
WorkflowUpdate(ctx context.Context, workflow WorkflowInterface) error
NodeCount(ctx context.Context, query NodeQueryInterface) (int64, error)
NodeCreate(ctx context.Context, node NodeInterface) error
NodeDeleteByID(ctx context.Context, id string) error
NodeFindByID(ctx context.Context, id string) (NodeInterface, error)
NodeList(ctx context.Context, query NodeQueryInterface) ([]NodeInterface, error)
NodeUpdate(ctx context.Context, node NodeInterface) error
EdgeCount(ctx context.Context, query EdgeQueryInterface) (int64, error)
EdgeCreate(ctx context.Context, edge EdgeInterface) error
EdgeDeleteByID(ctx context.Context, id string) error
EdgeFindByID(ctx context.Context, id string) (EdgeInterface, error)
EdgeList(ctx context.Context, query EdgeQueryInterface) ([]EdgeInterface, error)
EdgeUpdate(ctx context.Context, edge EdgeInterface) error
MessageCount(ctx context.Context, query MessageQueryInterface) (int64, error)
MessageCreate(ctx context.Context, message MessageInterface) error
MessageDeleteByID(ctx context.Context, id string) error
MessageFindByID(ctx context.Context, id string) (MessageInterface, error)
MessageList(ctx context.Context, query MessageQueryInterface) ([]MessageInterface, error)
MessageUpdate(ctx context.Context, message MessageInterface) error
CredentialCount(ctx context.Context, query CredentialQueryInterface) (int64, error)
CredentialCreate(ctx context.Context, credential CredentialInterface) error
CredentialDeleteByID(ctx context.Context, id string) error
CredentialDeleteByWorkflowID(ctx context.Context, workflowID string) error
CredentialFindByID(ctx context.Context, id string) (CredentialInterface, error)
CredentialFindByNode(ctx context.Context, workflowID, nodeID string) (CredentialInterface, error)
CredentialList(ctx context.Context, query CredentialQueryInterface) ([]CredentialInterface, error)
CredentialUpdate(ctx context.Context, credential CredentialInterface) error
// CredentialMapForWorkflow returns nodeID → key → value — the
// deploy-time credential injection map.
CredentialMapForWorkflow(ctx context.Context, workflowID string) (map[string]map[string]string, error)
// CredentialReplaceForWorkflow bulk-replaces a workflow's stored
// credentials (save path, after extraction).
CredentialReplaceForWorkflow(ctx context.Context, workflowID string, creds map[string]map[string]string) error
DeployRecordCount(ctx context.Context, query DeployRecordQueryInterface) (int64, error)
// DeployRecordCreate appends an immutable record and prunes the
// workflow's history beyond DeployRecordRetention.
DeployRecordCreate(ctx context.Context, record DeployRecordInterface) error
DeployRecordDeleteByID(ctx context.Context, id string) error
DeployRecordDeleteByWorkflowID(ctx context.Context, workflowID string) error
DeployRecordFindByID(ctx context.Context, id string) (DeployRecordInterface, error)
DeployRecordList(ctx context.Context, query DeployRecordQueryInterface) ([]DeployRecordInterface, error)
NodeGroupCount(ctx context.Context, query NodeGroupQueryInterface) (int64, error)
NodeGroupCreate(ctx context.Context, group NodeGroupInterface) error
NodeGroupDeleteByID(ctx context.Context, id string) error
NodeGroupFindByID(ctx context.Context, id string) (NodeGroupInterface, error)
NodeGroupList(ctx context.Context, query NodeGroupQueryInterface) ([]NodeGroupInterface, error)
NodeGroupUpdate(ctx context.Context, group NodeGroupInterface) error
WorkflowGroupCount(ctx context.Context, query WorkflowGroupQueryInterface) (int64, error)
WorkflowGroupCreate(ctx context.Context, group WorkflowGroupInterface) error
WorkflowGroupDeleteByID(ctx context.Context, id string) error
WorkflowGroupFindByID(ctx context.Context, id string) (WorkflowGroupInterface, error)
WorkflowGroupList(ctx context.Context, query WorkflowGroupQueryInterface) ([]WorkflowGroupInterface, error)
WorkflowGroupUpdate(ctx context.Context, group WorkflowGroupInterface) error
ConfigGet(ctx context.Context, key string) (string, error)
ConfigSet(ctx context.Context, key string, value string) error
}
StoreInterface is the nodestore contract — entitystore-backed persistence for the flowrunner domain: workflows (with nodes and edges) and messages.
type WorkflowGroupInterface ¶
type WorkflowGroupInterface interface {
GetID() string
SetID(id string) WorkflowGroupInterface
GetName() string
SetName(name string) WorkflowGroupInterface
// GetParentID returns the parent group ID ("" = top level).
GetParentID() string
SetParentID(parentID string) WorkflowGroupInterface
// GetWorkflowIDs returns the member workflow IDs.
GetWorkflowIDs() []string
SetWorkflowIDs(ids []string) WorkflowGroupInterface
GetCreatedAt() time.Time
SetCreatedAt(createdAt time.Time) WorkflowGroupInterface
GetUpdatedAt() time.Time
SetUpdatedAt(updatedAt time.Time) WorkflowGroupInterface
}
WorkflowGroupInterface is the entity form of a sidebar workflow grouping entry — previously the global-config "workflowGroups" JSON section shaped {id, name, parentId, workflows:[id]}. Members are the workflow IDs listed in the group.
func NewWorkflowGroup ¶
func NewWorkflowGroup(name string) WorkflowGroupInterface
NewWorkflowGroup creates a new workflow group entity
type WorkflowGroupQueryInterface ¶
type WorkflowGroupQueryInterface interface {
Validate() error
HasID() bool
GetID() string
WithID(id string) WorkflowGroupQueryInterface
HasParentID() bool
GetParentID() string
WithParentID(parentID string) WorkflowGroupQueryInterface
HasLimit() bool
GetLimit() uint64
WithLimit(limit uint64) WorkflowGroupQueryInterface
HasOffset() bool
GetOffset() uint64
WithOffset(offset uint64) WorkflowGroupQueryInterface
GetSortOrder() string
WithSortOrder(sortOrder string) WorkflowGroupQueryInterface
IsCountOnly() bool
WithCountOnly(countOnly bool) WorkflowGroupQueryInterface
}
WorkflowGroupQueryInterface is the fluent query builder for listing and counting workflow group entities.
func WorkflowGroupQuery ¶
func WorkflowGroupQuery() WorkflowGroupQueryInterface
WorkflowGroupQuery creates a new workflow group query builder
type WorkflowInterface ¶
type WorkflowInterface interface {
GetID() string
SetID(id string) WorkflowInterface
GetName() string
SetName(name string) WorkflowInterface
GetDescription() string
SetDescription(description string) WorkflowInterface
GetNodes() []NodeInterface
SetNodes(nodes []NodeInterface) WorkflowInterface
AddNode(node NodeInterface) WorkflowInterface
FindNodeByID(id string) NodeInterface
GetEdges() []EdgeInterface
SetEdges(edges []EdgeInterface) WorkflowInterface
AddEdge(edge EdgeInterface) WorkflowInterface
GetView() map[string]any
SetView(view map[string]any) WorkflowInterface
GetDeployed() bool
SetDeployed(deployed bool) WorkflowInterface
GetCreatedAt() time.Time
SetCreatedAt(createdAt time.Time) WorkflowInterface
GetUpdatedAt() time.Time
SetUpdatedAt(updatedAt time.Time) WorkflowInterface
}
WorkflowInterface is the interface form of flowrunner.Workflow — a complete workflow definition persisted in the entity store.
func DeepCloneWorkflow ¶
func DeepCloneWorkflow(w WorkflowInterface) WorkflowInterface
DeepCloneWorkflow returns a workflow carrying fresh node objects with deep-copied data maps (JSON round-trip — node data is always JSON-typed). The deploy path clones before credential injection so real secrets never land in the caller's stored document — the engine's own cloneWorkflow is shallow (nodes shared).
func ImportNodeRED ¶
func ImportNodeRED(data []byte) (WorkflowInterface, error)
ImportNodeRED converts a Node-RED flow JSON array into a workflow. Regular nodes keep their config keys verbatim in Data (engine node configs use the Node-RED field names); tab membership becomes Data["module"]; wires become edges. Subflow definitions and their internal nodes fold into a single type:"subflow" node.
func NewWorkflow ¶
func NewWorkflow(name string) WorkflowInterface
NewWorkflow creates a new workflow
type WorkflowQueryInterface ¶
type WorkflowQueryInterface interface {
Validate() error
HasID() bool
GetID() string
WithID(id string) WorkflowQueryInterface
HasName() bool
GetName() string
WithName(name string) WorkflowQueryInterface
HasDeployed() bool
GetDeployed() bool
WithDeployed(deployed bool) WorkflowQueryInterface
HasLimit() bool
GetLimit() uint64
WithLimit(limit uint64) WorkflowQueryInterface
HasOffset() bool
GetOffset() uint64
WithOffset(offset uint64) WorkflowQueryInterface
GetSortOrder() string
WithSortOrder(sortOrder string) WorkflowQueryInterface
IsCountOnly() bool
WithCountOnly(countOnly bool) WorkflowQueryInterface
}
WorkflowQueryInterface is the fluent query builder for listing and counting workflows.
func WorkflowQuery ¶
func WorkflowQuery() WorkflowQueryInterface
WorkflowQuery creates a new workflow query builder
Source Files
¶
- childflow_exchange.go
- component.go
- constants.go
- credential.go
- credential_cipher.go
- credential_query.go
- credentials.go
- deploy_record.go
- deploy_record_query.go
- edge.go
- edge_query.go
- functions.go
- message.go
- message_query.go
- node.go
- node_group.go
- node_group_query.go
- node_query.go
- nodered.go
- store.go
- store_config.go
- store_credential.go
- store_deploy_record.go
- store_edge.go
- store_message.go
- store_migrate.go
- store_migrate_groups.go
- store_node.go
- store_node_group.go
- store_workflow.go
- store_workflow_group.go
- store_workflow_groups.go
- workflow.go
- workflow_group.go
- workflow_group_query.go
- workflow_query.go