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:
@@ -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."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user