{"version":3,"file":"update-functions.mjs","names":[],"sources":["../../src/actions/update-functions.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 SupabaseUpdateFunctionsInput = z.object({\n  ref: z.string().describe(\"Supabase project reference ID.\"),\n  functions: z.array(z.object({\n  id: z.string().describe(\"Unique identifier of the function to update.\"),\n  name: z.string().describe(\"Human-readable name of the function.\"),\n  slug: z.string().describe(\"Function slug (URL-friendly identifier). Must start with a letter and contain only alphanumeric characters, hyphens, and underscores.\"),\n  status: z.enum([\"ACTIVE\", \"REMOVED\", \"THROTTLED\"]).describe(\"Deployment status of the function.\"),\n  version: z.number().int().describe(\"Version number of the function.\"),\n  created_at: z.number().int().describe(\"Creation timestamp of the function (Unix timestamp in seconds).\").optional(),\n  import_map: z.boolean().describe(\"Indicates whether an import map is used by this function.\").optional(),\n  verify_jwt: z.boolean().describe(\"Whether the function requires a valid JWT for invocation.\").optional(),\n  ezbr_sha256: z.string().describe(\"SHA-256 hash of the deployed bundle.\").optional(),\n  entrypoint_path: z.string().describe(\"Path to the function entrypoint file.\").optional(),\n  import_map_path: z.string().describe(\"Path to the import map file, if used.\").optional(),\n}).passthrough().describe(\"Schema for a single function to update.\")).describe(\"List of functions to update. Each function must have id, slug, name, status, and version.\"),\n}).describe(\"Request schema for bulk updating Edge Functions.\");\nconst SupabaseUpdateFunctions_UpdatedFunctionSchema = z.object({\n  id: z.string().describe(\"Unique identifier 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).\").nullable(),\n  status: z.string().describe(\"Deployment status of the function.\").nullable(),\n  version: z.number().int().describe(\"Version number of the function.\").nullable(),\n  created_at: z.number().int().describe(\"Creation timestamp of the function (Unix timestamp in seconds).\").nullable(),\n  import_map: z.boolean().describe(\"Indicates whether an import map is used by this function.\").nullable().optional(),\n  updated_at: z.number().int().describe(\"Last update timestamp of the function (Unix timestamp in seconds).\").nullable(),\n  verify_jwt: z.boolean().describe(\"Whether the function requires a valid JWT for invocation.\").nullable().optional(),\n  ezbr_sha256: z.string().describe(\"SHA-256 hash of the deployed bundle.\").nullable().optional(),\n  entrypoint_path: z.string().describe(\"Path to the function entrypoint file.\").nullable().optional(),\n  import_map_path: z.string().describe(\"Path to the import map file, if used.\").nullable().optional(),\n}).passthrough().describe(\"Schema for a function returned in the response.\");\nexport const SupabaseUpdateFunctionsOutput = z.object({\n  functions: z.array(SupabaseUpdateFunctions_UpdatedFunctionSchema).describe(\"List of updated functions with their current state.\"),\n}).passthrough().describe(\"Response schema containing the updated functions.\");\n\nexport const supabaseUpdateFunctions: AppAction<\n  typeof SupabaseUpdateFunctionsInput,\n  typeof SupabaseUpdateFunctionsOutput,\n  typeof supabase.credential\n> = action(\"SUPABASE_UPDATE_FUNCTIONS\", {\n  slug: \"supabase-update-functions\",\n  name: \"Bulk update functions\",\n  description: \"Tool to bulk update Edge Functions in a Supabase project. Use when you need to update multiple functions at once with new configurations such as status, version, or other properties.\",\n  input: SupabaseUpdateFunctionsInput,\n  output: SupabaseUpdateFunctionsOutput,\n});\n"],"mappings":";;;;AAMA,MAAa,+BAA+B,EAAE,OAAO;CACnD,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,gCAAgC;CACzD,WAAW,EAAE,MAAM,EAAE,OAAO;EAC5B,IAAI,EAAE,OAAO,CAAC,CAAC,SAAS,8CAA8C;EACtE,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,sCAAsC;EAChE,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,uIAAuI;EACjK,QAAQ,EAAE,KAAK;GAAC;GAAU;GAAW;EAAW,CAAC,CAAC,CAAC,SAAS,oCAAoC;EAChG,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,iCAAiC;EACpE,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,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