Flows and dashboards are created by POST under an issued or superuser-pinned id; PUT only updates; deleted flows leave a tombstone with their key; the controller stores by id and runs by key, hooks live under /hooks/<flow id>; a key with state or queued work behind it is refused until cleared

This commit is contained in:
2026-11-02 17:41:23 +01:00
parent fae85f5ecb
commit 08a6376836
63 changed files with 2832 additions and 936 deletions
+30
View File
@@ -352,6 +352,36 @@ class FlowDef(BaseModel):
return _validate_name(value)
class FlowCreate(BaseModel):
"""A new flow as a client hands it over: a document but for what the
server owns. The fields mean what they do on `FlowDef`, but ``id``."""
#: Empty for an id the server issues. Anything else pins it, which only a
#: superuser may: an id that is free, or whose history this flow resumes.
id: str = ""
name: str
title: str = ""
nodes: list[NodeDef] = Field(default_factory=list)
inputs: list[FlowInput] = Field(default_factory=list)
mode: Literal["live", "batch"] = "live"
outputs: list[str] = Field(default_factory=list)
origin: FlowOrigin | None = None
@field_validator("id")
@classmethod
def _check_id(cls, value: str) -> str:
return _validate_id(value)
@field_validator("name")
@classmethod
def _check_name(cls, value: str) -> str:
return _validate_name(value)
def document(self) -> FlowDef:
"""The flow to store, before the store gives it an id."""
return FlowDef.model_validate(self.model_dump(exclude={"id"}))
class NodeSource(BaseModel):
"""The Python source of a node."""