|
|
|
@ -1,4 +1,5 @@
|
|
|
|
import dataclasses
|
|
|
|
import dataclasses
|
|
|
|
|
|
|
|
import logging
|
|
|
|
from collections.abc import Mapping, Sequence
|
|
|
|
from collections.abc import Mapping, Sequence
|
|
|
|
from typing import Any
|
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
|
|
|
|
@ -15,6 +16,8 @@ from core.workflow.nodes import NodeType
|
|
|
|
from factories import variable_factory
|
|
|
|
from factories import variable_factory
|
|
|
|
from models.workflow import WorkflowDraftVariable, is_system_variable_editable
|
|
|
|
from models.workflow import WorkflowDraftVariable, is_system_variable_editable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
|
|
class WorkflowDraftVariableList:
|
|
|
|
class WorkflowDraftVariableList:
|
|
|
|
@ -298,6 +301,24 @@ class _DraftVariableBuilder:
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def _normalize_variable_for_start_node(node_type: NodeType, node_id: str, name: str):
|
|
|
|
|
|
|
|
if node_type != NodeType.START:
|
|
|
|
|
|
|
|
return node_id, name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO(QuantumGhost): need special handling for dummy output variable in
|
|
|
|
|
|
|
|
# `Start` node.
|
|
|
|
|
|
|
|
if not name.startswith(f"{SYSTEM_VARIABLE_NODE_ID}."):
|
|
|
|
|
|
|
|
return node_id, name
|
|
|
|
|
|
|
|
_logger.debug(
|
|
|
|
|
|
|
|
"Normalizing variable: node_type=%s, node_id=%s, name=%s",
|
|
|
|
|
|
|
|
node_type,
|
|
|
|
|
|
|
|
node_id,
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
node_id, name_ = name.split(".", maxsplit=1)
|
|
|
|
|
|
|
|
return node_id, name_
|
|
|
|
|
|
|
|
|
|
|
|
def _build_variables_from_mapping(
|
|
|
|
def _build_variables_from_mapping(
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
node_id: str,
|
|
|
|
node_id: str,
|
|
|
|
|