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:
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from plugins.supabase.client import SupabaseClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator (12 tools)"""
|
||||
return [
|
||||
@@ -260,10 +261,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# =====================
|
||||
# Admin Operations (12 tools)
|
||||
# =====================
|
||||
|
||||
|
||||
async def enable_extension(client: SupabaseClient, name: str, schema: str = "extensions") -> str:
|
||||
"""Enable a PostgreSQL extension"""
|
||||
try:
|
||||
@@ -282,6 +285,7 @@ async def enable_extension(client: SupabaseClient, name: str, schema: str = "ext
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def disable_extension(client: SupabaseClient, name: str, cascade: bool = False) -> str:
|
||||
"""Disable (drop) a PostgreSQL extension"""
|
||||
try:
|
||||
@@ -302,6 +306,7 @@ async def disable_extension(client: SupabaseClient, name: str, cascade: bool = F
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def create_policy(
|
||||
client: SupabaseClient,
|
||||
table: str,
|
||||
@@ -350,6 +355,7 @@ async def create_policy(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def update_policy(
|
||||
client: SupabaseClient,
|
||||
table: str,
|
||||
@@ -380,6 +386,7 @@ async def update_policy(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def delete_policy(
|
||||
client: SupabaseClient, table: str, name: str, schema: str = "public"
|
||||
) -> str:
|
||||
@@ -400,6 +407,7 @@ async def delete_policy(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def enable_rls(client: SupabaseClient, table: str, schema: str = "public") -> str:
|
||||
"""Enable RLS on a table"""
|
||||
try:
|
||||
@@ -418,6 +426,7 @@ async def enable_rls(client: SupabaseClient, table: str, schema: str = "public")
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def disable_rls(client: SupabaseClient, table: str, schema: str = "public") -> str:
|
||||
"""Disable RLS on a table"""
|
||||
try:
|
||||
@@ -437,6 +446,7 @@ async def disable_rls(client: SupabaseClient, table: str, schema: str = "public"
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def create_table(
|
||||
client: SupabaseClient,
|
||||
name: str,
|
||||
@@ -491,6 +501,7 @@ async def create_table(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def drop_table(
|
||||
client: SupabaseClient, name: str, schema: str = "public", cascade: bool = False
|
||||
) -> str:
|
||||
@@ -513,6 +524,7 @@ async def drop_table(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def add_column(
|
||||
client: SupabaseClient,
|
||||
table: str,
|
||||
@@ -552,6 +564,7 @@ async def add_column(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def drop_column(
|
||||
client: SupabaseClient,
|
||||
table: str,
|
||||
@@ -582,6 +595,7 @@ async def drop_column(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_database_size(client: SupabaseClient) -> str:
|
||||
"""Get database and table sizes"""
|
||||
try:
|
||||
|
||||
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from plugins.supabase.client import SupabaseClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator (14 tools)"""
|
||||
return [
|
||||
@@ -281,10 +282,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# =====================
|
||||
# Auth Operations (14 tools)
|
||||
# =====================
|
||||
|
||||
|
||||
async def list_users(client: SupabaseClient, page: int = 1, per_page: int = 50) -> str:
|
||||
"""List all users with pagination"""
|
||||
try:
|
||||
@@ -307,6 +310,7 @@ async def list_users(client: SupabaseClient, page: int = 1, per_page: int = 50)
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_user(client: SupabaseClient, user_id: str) -> str:
|
||||
"""Get user by ID"""
|
||||
try:
|
||||
@@ -316,6 +320,7 @@ async def get_user(client: SupabaseClient, user_id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def create_user(
|
||||
client: SupabaseClient,
|
||||
email: str,
|
||||
@@ -344,6 +349,7 @@ async def create_user(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def update_user(
|
||||
client: SupabaseClient,
|
||||
user_id: str,
|
||||
@@ -376,6 +382,7 @@ async def update_user(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def delete_user(client: SupabaseClient, user_id: str) -> str:
|
||||
"""Delete a user"""
|
||||
try:
|
||||
@@ -389,6 +396,7 @@ async def delete_user(client: SupabaseClient, user_id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def invite_user(
|
||||
client: SupabaseClient,
|
||||
email: str,
|
||||
@@ -409,6 +417,7 @@ async def invite_user(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def generate_link(
|
||||
client: SupabaseClient, email: str, link_type: str = "magiclink", redirect_to: str | None = None
|
||||
) -> str:
|
||||
@@ -426,6 +435,7 @@ async def generate_link(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def ban_user(client: SupabaseClient, user_id: str, duration: str = "none") -> str:
|
||||
"""Ban a user"""
|
||||
try:
|
||||
@@ -439,6 +449,7 @@ async def ban_user(client: SupabaseClient, user_id: str, duration: str = "none")
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def unban_user(client: SupabaseClient, user_id: str) -> str:
|
||||
"""Unban a user"""
|
||||
try:
|
||||
@@ -452,6 +463,7 @@ async def unban_user(client: SupabaseClient, user_id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def list_user_factors(client: SupabaseClient, user_id: str) -> str:
|
||||
"""List user MFA factors"""
|
||||
try:
|
||||
@@ -463,6 +475,7 @@ async def list_user_factors(client: SupabaseClient, user_id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def delete_user_factor(client: SupabaseClient, user_id: str, factor_id: str) -> str:
|
||||
"""Delete an MFA factor"""
|
||||
try:
|
||||
@@ -476,6 +489,7 @@ async def delete_user_factor(client: SupabaseClient, user_id: str, factor_id: st
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_auth_config(client: SupabaseClient) -> str:
|
||||
"""Get auth configuration"""
|
||||
try:
|
||||
@@ -486,6 +500,7 @@ async def get_auth_config(client: SupabaseClient) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def search_users(
|
||||
client: SupabaseClient, query: str, page: int = 1, per_page: int = 50
|
||||
) -> str:
|
||||
@@ -515,6 +530,7 @@ async def search_users(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_user_by_email(client: SupabaseClient, email: str) -> str:
|
||||
"""Find user by email"""
|
||||
try:
|
||||
|
||||
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from plugins.supabase.client import SupabaseClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator (18 tools)"""
|
||||
return [
|
||||
@@ -439,10 +440,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# =====================
|
||||
# PostgREST Operations (6)
|
||||
# =====================
|
||||
|
||||
|
||||
async def query_table(
|
||||
client: SupabaseClient,
|
||||
table: str,
|
||||
@@ -478,6 +481,7 @@ async def query_table(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def insert_rows(
|
||||
client: SupabaseClient,
|
||||
table: str,
|
||||
@@ -509,6 +513,7 @@ async def insert_rows(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def update_rows(
|
||||
client: SupabaseClient,
|
||||
table: str,
|
||||
@@ -545,6 +550,7 @@ async def update_rows(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def delete_rows(
|
||||
client: SupabaseClient, table: str, filters: list[dict], use_service_role: bool = False
|
||||
) -> str:
|
||||
@@ -577,6 +583,7 @@ async def delete_rows(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def execute_rpc(
|
||||
client: SupabaseClient,
|
||||
function_name: str,
|
||||
@@ -597,6 +604,7 @@ async def execute_rpc(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def count_rows(
|
||||
client: SupabaseClient,
|
||||
table: str,
|
||||
@@ -622,10 +630,12 @@ async def count_rows(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
# =====================
|
||||
# Admin Operations via postgres-meta (12)
|
||||
# =====================
|
||||
|
||||
|
||||
async def list_tables(
|
||||
client: SupabaseClient, schema: str = "public", limit: int = 50, offset: int = 0
|
||||
) -> str:
|
||||
@@ -660,6 +670,7 @@ async def list_tables(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_table_schema(client: SupabaseClient, table: str, schema: str = "public") -> str:
|
||||
"""Get table schema/columns"""
|
||||
try:
|
||||
@@ -678,6 +689,7 @@ async def get_table_schema(client: SupabaseClient, table: str, schema: str = "pu
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def list_schemas(client: SupabaseClient) -> str:
|
||||
"""List all database schemas"""
|
||||
try:
|
||||
@@ -695,6 +707,7 @@ async def list_schemas(client: SupabaseClient) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def list_extensions(client: SupabaseClient) -> str:
|
||||
"""List installed extensions"""
|
||||
try:
|
||||
@@ -712,6 +725,7 @@ async def list_extensions(client: SupabaseClient) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def list_policies(client: SupabaseClient, table: str | None = None) -> str:
|
||||
"""List RLS policies"""
|
||||
try:
|
||||
@@ -730,6 +744,7 @@ async def list_policies(client: SupabaseClient, table: str | None = None) -> str
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def list_roles(client: SupabaseClient) -> str:
|
||||
"""List database roles"""
|
||||
try:
|
||||
@@ -747,6 +762,7 @@ async def list_roles(client: SupabaseClient) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def list_triggers(client: SupabaseClient, table: str | None = None) -> str:
|
||||
"""List database triggers"""
|
||||
try:
|
||||
@@ -765,6 +781,7 @@ async def list_triggers(client: SupabaseClient, table: str | None = None) -> str
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def list_functions(
|
||||
client: SupabaseClient, schema: str = "public", limit: int = 50, offset: int = 0
|
||||
) -> str:
|
||||
@@ -794,6 +811,7 @@ async def list_functions(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def execute_sql(client: SupabaseClient, query: str) -> str:
|
||||
"""Execute raw SQL query"""
|
||||
try:
|
||||
@@ -811,6 +829,7 @@ async def execute_sql(client: SupabaseClient, query: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_table_indexes(client: SupabaseClient, table: str, schema: str = "public") -> str:
|
||||
"""Get indexes for a table"""
|
||||
try:
|
||||
@@ -843,6 +862,7 @@ async def get_table_indexes(client: SupabaseClient, table: str, schema: str = "p
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_table_constraints(client: SupabaseClient, table: str, schema: str = "public") -> str:
|
||||
"""Get constraints for a table"""
|
||||
try:
|
||||
@@ -877,6 +897,7 @@ async def get_table_constraints(client: SupabaseClient, table: str, schema: str
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_table_relationships(
|
||||
client: SupabaseClient, table: str, schema: str = "public"
|
||||
) -> str:
|
||||
|
||||
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from plugins.supabase.client import SupabaseClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator (8 tools)"""
|
||||
return [
|
||||
@@ -144,10 +145,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# =====================
|
||||
# Functions Operations (8 tools)
|
||||
# =====================
|
||||
|
||||
|
||||
async def invoke_function(
|
||||
client: SupabaseClient,
|
||||
function_name: str,
|
||||
@@ -166,6 +169,7 @@ async def invoke_function(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def invoke_function_get(
|
||||
client: SupabaseClient, function_name: str, params: dict | None = None
|
||||
) -> str:
|
||||
@@ -193,6 +197,7 @@ async def invoke_function_get(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def list_edge_functions(client: SupabaseClient) -> str:
|
||||
"""List deployed Edge Functions"""
|
||||
try:
|
||||
@@ -223,6 +228,7 @@ async def list_edge_functions(client: SupabaseClient) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_function_info(client: SupabaseClient, function_name: str) -> str:
|
||||
"""Get function information"""
|
||||
try:
|
||||
@@ -251,6 +257,7 @@ async def get_function_info(client: SupabaseClient, function_name: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def test_function(
|
||||
client: SupabaseClient, function_name: str, test_data: dict | None = None, method: str = "POST"
|
||||
) -> str:
|
||||
@@ -291,6 +298,7 @@ async def test_function(
|
||||
ensure_ascii=False,
|
||||
)
|
||||
|
||||
|
||||
async def get_function_url(client: SupabaseClient, function_name: str) -> str:
|
||||
"""Get the full URL for a function"""
|
||||
try:
|
||||
@@ -309,6 +317,7 @@ async def get_function_url(client: SupabaseClient, function_name: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def check_function_health(client: SupabaseClient, function_name: str) -> str:
|
||||
"""Check if a function is healthy"""
|
||||
try:
|
||||
@@ -347,6 +356,7 @@ async def check_function_health(client: SupabaseClient, function_name: str) -> s
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def invoke_function_batch(
|
||||
client: SupabaseClient, function_name: str, payloads: list[dict]
|
||||
) -> str:
|
||||
|
||||
@@ -6,6 +6,7 @@ from typing import Any
|
||||
|
||||
from plugins.supabase.client import SupabaseClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator (12 tools)"""
|
||||
return [
|
||||
@@ -230,10 +231,12 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# =====================
|
||||
# Storage Operations (12 tools)
|
||||
# =====================
|
||||
|
||||
|
||||
async def list_buckets(client: SupabaseClient) -> str:
|
||||
"""List all storage buckets"""
|
||||
try:
|
||||
@@ -251,6 +254,7 @@ async def list_buckets(client: SupabaseClient) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_bucket(client: SupabaseClient, bucket_id: str) -> str:
|
||||
"""Get bucket details"""
|
||||
try:
|
||||
@@ -260,6 +264,7 @@ async def get_bucket(client: SupabaseClient, bucket_id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def create_bucket(
|
||||
client: SupabaseClient,
|
||||
name: str,
|
||||
@@ -284,6 +289,7 @@ async def create_bucket(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def update_bucket(
|
||||
client: SupabaseClient,
|
||||
bucket_id: str,
|
||||
@@ -312,6 +318,7 @@ async def update_bucket(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def delete_bucket(client: SupabaseClient, bucket_id: str) -> str:
|
||||
"""Delete a bucket"""
|
||||
try:
|
||||
@@ -325,6 +332,7 @@ async def delete_bucket(client: SupabaseClient, bucket_id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def empty_bucket(client: SupabaseClient, bucket_id: str) -> str:
|
||||
"""Empty a bucket (delete all files)"""
|
||||
try:
|
||||
@@ -338,6 +346,7 @@ async def empty_bucket(client: SupabaseClient, bucket_id: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def list_files(
|
||||
client: SupabaseClient, bucket: str, path: str = "", limit: int = 100, offset: int = 0
|
||||
) -> str:
|
||||
@@ -359,6 +368,7 @@ async def list_files(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def upload_file(
|
||||
client: SupabaseClient,
|
||||
bucket: str,
|
||||
@@ -399,6 +409,7 @@ async def upload_file(
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def download_file(client: SupabaseClient, bucket: str, path: str) -> str:
|
||||
"""Download a file (returns base64)"""
|
||||
try:
|
||||
@@ -426,6 +437,7 @@ async def download_file(client: SupabaseClient, bucket: str, path: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def delete_files(client: SupabaseClient, bucket: str, paths: list[str]) -> str:
|
||||
"""Delete files from bucket"""
|
||||
try:
|
||||
@@ -444,6 +456,7 @@ async def delete_files(client: SupabaseClient, bucket: str, paths: list[str]) ->
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def move_file(client: SupabaseClient, bucket: str, from_path: str, to_path: str) -> str:
|
||||
"""Move/rename a file"""
|
||||
try:
|
||||
@@ -464,6 +477,7 @@ async def move_file(client: SupabaseClient, bucket: str, from_path: str, to_path
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_public_url(client: SupabaseClient, bucket: str, path: str) -> str:
|
||||
"""Get public URL for a file"""
|
||||
try:
|
||||
|
||||
@@ -5,6 +5,7 @@ from typing import Any
|
||||
|
||||
from plugins.supabase.client import SupabaseClient
|
||||
|
||||
|
||||
def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
"""Return tool specifications for ToolGenerator (6 tools)"""
|
||||
return [
|
||||
@@ -62,6 +63,7 @@ def get_tool_specifications() -> list[dict[str, Any]]:
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
async def health_check(client: SupabaseClient) -> str:
|
||||
"""Check health of all Supabase services"""
|
||||
try:
|
||||
@@ -84,6 +86,7 @@ async def health_check(client: SupabaseClient) -> str:
|
||||
ensure_ascii=False,
|
||||
)
|
||||
|
||||
|
||||
async def get_service_status(client: SupabaseClient, service: str) -> str:
|
||||
"""Get status of a specific service"""
|
||||
try:
|
||||
@@ -142,6 +145,7 @@ async def get_service_status(client: SupabaseClient, service: str) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_database_stats(client: SupabaseClient) -> str:
|
||||
"""Get database statistics"""
|
||||
try:
|
||||
@@ -199,6 +203,7 @@ async def get_database_stats(client: SupabaseClient) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_storage_stats(client: SupabaseClient) -> str:
|
||||
"""Get storage statistics"""
|
||||
try:
|
||||
@@ -243,6 +248,7 @@ async def get_storage_stats(client: SupabaseClient) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_auth_stats(client: SupabaseClient) -> str:
|
||||
"""Get authentication statistics"""
|
||||
try:
|
||||
@@ -294,6 +300,7 @@ async def get_auth_stats(client: SupabaseClient) -> str:
|
||||
except Exception as e:
|
||||
return json.dumps({"success": False, "error": str(e)}, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
async def get_instance_info(client: SupabaseClient) -> str:
|
||||
"""Get Supabase instance information"""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user