projects -> scripts (#3123)
This commit is contained in:
@@ -14,10 +14,10 @@ class FileEncoding(StrEnum):
|
||||
UTF8 = "utf-8"
|
||||
|
||||
|
||||
class ProjectFile(BaseModel):
|
||||
class ScriptFile(BaseModel):
|
||||
file_id: str
|
||||
project_revision_id: str
|
||||
project_id: str
|
||||
script_revision_id: str
|
||||
script_id: str
|
||||
organization_id: str
|
||||
|
||||
file_path: str # e.g., "src/utils.py"
|
||||
@@ -41,21 +41,21 @@ class ProjectFile(BaseModel):
|
||||
return self.content
|
||||
|
||||
|
||||
class ProjectFileCreate(BaseModel):
|
||||
"""Model representing a file in a project."""
|
||||
class ScriptFileCreate(BaseModel):
|
||||
"""Model representing a file in a script."""
|
||||
|
||||
path: str = Field(..., description="File path relative to project root", examples=["src/main.py"])
|
||||
path: str = Field(..., description="File path relative to script root", examples=["src/main.py"])
|
||||
content: str = Field(..., description="Base64 encoded file content")
|
||||
encoding: FileEncoding = Field(default=FileEncoding.BASE64, description="Content encoding")
|
||||
mime_type: str | None = Field(default=None, description="MIME type (auto-detected if not provided)")
|
||||
|
||||
|
||||
class CreateProjectRequest(BaseModel):
|
||||
class CreateScriptRequest(BaseModel):
|
||||
workflow_id: str | None = Field(default=None, description="Associated workflow ID")
|
||||
run_id: str | None = Field(default=None, description="Associated run ID")
|
||||
files: list[ProjectFileCreate] | None = Field(
|
||||
files: list[ScriptFileCreate] | None = Field(
|
||||
default=None,
|
||||
description="Array of files to include in the project",
|
||||
description="Array of files to include in the script",
|
||||
examples=[
|
||||
{
|
||||
"path": "main.py",
|
||||
@@ -84,12 +84,12 @@ class FileNode(BaseModel):
|
||||
children: dict[str, FileNode] | None = Field(default=None, description="Child nodes for directories")
|
||||
|
||||
|
||||
class DeployProjectRequest(BaseModel):
|
||||
"""Request model for deploying a project with updated files."""
|
||||
class DeployScriptRequest(BaseModel):
|
||||
"""Request model for deploying a script with updated files."""
|
||||
|
||||
files: list[ProjectFileCreate] = Field(
|
||||
files: list[ScriptFileCreate] = Field(
|
||||
...,
|
||||
description="Array of files to include in the project",
|
||||
description="Array of files to include in the script",
|
||||
examples=[
|
||||
{
|
||||
"path": "src/main.py",
|
||||
@@ -101,27 +101,27 @@ class DeployProjectRequest(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class CreateProjectResponse(BaseModel):
|
||||
project_id: str = Field(..., description="Unique project identifier", examples=["proj_abc123"])
|
||||
version: int = Field(..., description="Project version number", examples=[1])
|
||||
class CreateScriptResponse(BaseModel):
|
||||
script_id: str = Field(..., description="Unique script identifier", examples=["s_abc123"])
|
||||
version: int = Field(..., description="Script version number", examples=[1])
|
||||
run_id: str | None = Field(
|
||||
default=None, description="ID of the workflow run or task run that generated this project"
|
||||
default=None, description="ID of the workflow run or task run that generated this script"
|
||||
)
|
||||
file_count: int = Field(..., description="Total number of files in the project")
|
||||
file_count: int = Field(..., description="Total number of files in the script")
|
||||
file_tree: dict[str, FileNode] = Field(..., description="Hierarchical file tree structure")
|
||||
created_at: datetime = Field(..., description="Timestamp when the project was created")
|
||||
created_at: datetime = Field(..., description="Timestamp when the script was created")
|
||||
|
||||
|
||||
class Project(BaseModel):
|
||||
class Script(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
project_revision_id: str = Field(description="Unique identifier for this specific project revision")
|
||||
project_id: str = Field(description="User-facing project identifier, consistent across versions")
|
||||
organization_id: str = Field(description="ID of the organization that owns this project")
|
||||
script_revision_id: str = Field(description="Unique identifier for this specific script revision")
|
||||
script_id: str = Field(description="User-facing script identifier, consistent across versions")
|
||||
organization_id: str = Field(description="ID of the organization that owns this script")
|
||||
run_id: str | None = Field(
|
||||
default=None, description="ID of the workflow run or task run that generated this project"
|
||||
default=None, description="ID of the workflow run or task run that generated this script"
|
||||
)
|
||||
version: int = Field(description="Version number of the project")
|
||||
created_at: datetime = Field(description="Timestamp when the project was created")
|
||||
modified_at: datetime = Field(description="Timestamp when the project was last modified")
|
||||
deleted_at: datetime | None = Field(default=None, description="Timestamp when the project was soft deleted")
|
||||
version: int = Field(description="Version number of the script")
|
||||
created_at: datetime = Field(description="Timestamp when the script was created")
|
||||
modified_at: datetime = Field(description="Timestamp when the script was last modified")
|
||||
deleted_at: datetime | None = Field(default=None, description="Timestamp when the script was soft deleted")
|
||||
Reference in New Issue
Block a user