{"version":3,"file":"update-a-function.mjs","names":[],"sources":["../../src/actions/update-a-function.ts"],"sourcesContent":["import type { AppAction } from \"@keystrokehq/keystroke/app\";\nimport { z } from \"zod\";\n\nimport { action } from \"../action\";\nimport { supabase } from \"../app\";\n\nexport const SupabaseUpdateAFunctionInput = z.object({\n  ref: z.string().describe(\"The unique reference ID of the Supabase project.\"),\n  body: z.string().describe(\"New source code (e.g., Deno/TypeScript) or base64-encoded ESZIP content for the function, sent in the request body.\").optional(),\n  name: z.string().describe(\"Optional new name for the function. This value is sent in the request body as 'name'.\").optional(),\n  slug: z.string().describe(\"Optional new slug for the function. If provided as a query parameter, this changes the function's access URL.\").optional(),\n  import_map: z.boolean().describe(\"Whether to use an import map for the function (query parameter).\").optional(),\n  verify_jwt: z.boolean().describe(\"Specifies whether JWT verification should be enabled. This value is sent in the request body as 'verify_jwt'.\").optional(),\n  function_slug: z.string().describe(\"The current slug (unique identifier) of the Edge Function to be updated.\"),\n  entrypoint_path: z.string().describe(\"Path to the main Deno script for the function (query parameter).\").optional(),\n  import_map_path: z.string().describe(\"Path to the import map file (query parameter).\").optional(),\n}).describe(\"Request schema for updating an existing Supabase Edge Function. Fields can be provided as path parameters, query parameters, or in the request body as specified.\");\nconst SupabaseUpdateAFunction_StatusSchema = z.enum([\"ACTIVE\", \"REMOVED\", \"THROTTLED\"]);\nexport const SupabaseUpdateAFunctionOutput = z.object({\n  id: z.string().describe(\"Unique identifier (UUID) of the function.\").nullable(),\n  name: z.string().describe(\"Human-readable name of the function.\").nullable(),\n  slug: z.string().describe(\"Function slug (URL-friendly identifier used to invoke the function).\").nullable(),\n  status: SupabaseUpdateAFunction_StatusSchema.nullable(),\n  version: z.number().int().describe(\"Function version number (typically an incrementing integer).\").nullable(),\n  created_at: z.number().int().describe(\"Timestamp when the function was created, as a Unix timestamp in milliseconds.\").nullable(),\n  import_map: z.boolean().describe(\"Whether the function uses an import map.\").nullable().optional(),\n  updated_at: z.number().int().describe(\"Timestamp when the function was last updated, as a Unix timestamp in milliseconds.\").nullable(),\n  verify_jwt: z.boolean().describe(\"Whether requests to this function require a valid JWT (JWT verification enabled).\").nullable(),\n  ezbr_sha256: z.string().describe(\"SHA-256 checksum associated with the function bundle.\").nullable().optional(),\n  entrypoint_path: z.string().describe(\"Entrypoint file path for the function.\").nullable().optional(),\n  import_map_path: z.string().describe(\"Path to the function's import map file if configured. May be an empty string or null when not set.\").nullable().optional(),\n}).passthrough().describe(\"Response body for Supabase Management API: Update a function (PATCH /v1/projects/{ref}/functions/{function_slug}).\\nMatches the official API response which returns the function object directly (no wrapper).\");\n\nexport const supabaseUpdateAFunction: AppAction<\n  typeof SupabaseUpdateAFunctionInput,\n  typeof SupabaseUpdateAFunctionOutput,\n  typeof supabase.credential\n> = action(\"SUPABASE_UPDATE_A_FUNCTION\", {\n  slug: \"supabase-update-a-function\",\n  name: \"Update a function\",\n  description: \"Updates an existing Supabase Edge Function's properties (like name, slug, source code, JWT settings, import map) identified by project `ref` and `function_slug`, supporting plain text code or ESZIP for the body. Use RETRIEVE_A_FUNCTION_BODY action first to get the current source code, as this action requires sending the complete function code, not just the changes.\",\n  input: SupabaseUpdateAFunctionInput,\n  output: SupabaseUpdateAFunctionOutput,\n});\n"],"mappings":";;;;AAMA,MAAa,+BAA+B,EAAE,OAAO;CACnD,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,kDAAkD;CAC3E,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,qHAAqH,CAAC,CAAC,SAAS;CAC1J,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,uFAAuF,CAAC,CAAC,SAAS;CAC5H,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,+GAA+G,CAAC,CAAC,SAAS;CACpJ,YAAY,EAAE,QAAQ,CAAC,CAAC,SAAS,kEAAkE,CAAC,CAAC,SAAS;CAC9G,YAAY,EAAE,QAAQ,CAAC,CAAC,SAAS,+GAA+G,CAAC,CAAC,SAAS;CAC3J,eAAe,EAAE,OAAO,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