fix(ci): fix black/ruff failures, add CoC and PR template
- Fix Python formatting (sync no longer strips blank lines from .py files) - Remove test_community_build.py (tests private sync module) - Fix ruff warnings in test files - Add CODE_OF_CONDUCT.md - Add .github/PULL_REQUEST_TEMPLATE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ from typing import Any
|
||||
|
||||
from plugins.directus.client import DirectusClient
|
||||
|
||||
|
||||
def _parse_json_param(value: Any, param_name: str = "parameter") -> Any:
|
||||
"""Parse a parameter that may be a JSON string or already a native type."""
|
||||
if value is None:
|
||||
@@ -27,6 +28,7 @@ def _parse_json_param(value: Any, param_name: str = "parameter") -> Any:
|
||||
raise ValueError(f"Invalid JSON in '{param_name}': {e}")
|
||||
return value
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator (12 tools)"""
|
||||
return [
|
||||
@@ -303,10 +305,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# =====================
|
||||
# HANDLER FUNCTIONS
|
||||
# =====================
|
||||
|
||||
|
||||
async def list_flows(
|
||||
client: DirectusClient,
|
||||
filter: dict | None = None,
|
||||
@@ -327,6 +331,7 @@ async def list_flows(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def get_flow(client: DirectusClient, id: str) -> str:
|
||||
"""Get flow by ID."""
|
||||
try:
|
||||
@@ -337,6 +342,7 @@ async def get_flow(client: DirectusClient, id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def create_flow(
|
||||
client: DirectusClient,
|
||||
name: str,
|
||||
@@ -369,6 +375,7 @@ async def create_flow(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def update_flow(client: DirectusClient, id: str, data: dict[str, Any]) -> str:
|
||||
"""Update flow."""
|
||||
try:
|
||||
@@ -383,6 +390,7 @@ async def update_flow(client: DirectusClient, id: str, data: dict[str, Any]) ->
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def delete_flow(client: DirectusClient, id: str) -> str:
|
||||
"""Delete a flow."""
|
||||
try:
|
||||
@@ -391,6 +399,7 @@ async def delete_flow(client: DirectusClient, id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def trigger_flow(client: DirectusClient, id: str, data: dict | None = None) -> str:
|
||||
"""Trigger a flow manually."""
|
||||
try:
|
||||
@@ -409,6 +418,7 @@ async def trigger_flow(client: DirectusClient, id: str, data: dict | None = None
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def list_operations(
|
||||
client: DirectusClient, filter: dict | None = None, limit: int = 100
|
||||
) -> str:
|
||||
@@ -426,6 +436,7 @@ async def list_operations(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def create_operation(
|
||||
client: DirectusClient,
|
||||
flow: str,
|
||||
@@ -462,6 +473,7 @@ async def create_operation(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def list_webhooks(
|
||||
client: DirectusClient, filter: dict | None = None, limit: int = 100
|
||||
) -> str:
|
||||
@@ -484,6 +496,7 @@ async def list_webhooks(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2)
|
||||
|
||||
|
||||
async def create_webhook(
|
||||
client: DirectusClient,
|
||||
name: str,
|
||||
@@ -531,6 +544,7 @@ async def create_webhook(
|
||||
indent=2,
|
||||
)
|
||||
|
||||
|
||||
async def update_webhook(client: DirectusClient, id: str, data: dict[str, Any]) -> str:
|
||||
"""Update webhook. DEPRECATED: Use Flows instead in Directus 10+."""
|
||||
try:
|
||||
@@ -557,6 +571,7 @@ async def update_webhook(client: DirectusClient, id: str, data: dict[str, Any])
|
||||
indent=2,
|
||||
)
|
||||
|
||||
|
||||
async def delete_webhook(client: DirectusClient, id: str) -> str:
|
||||
"""Delete a webhook. DEPRECATED: Use Flows instead in Directus 10+."""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user