{"version":3,"file":"create-function.cjs","names":["z","action"],"sources":["../../src/actions/create-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 SupabaseCreateFunctionInput = z.object({\n  ref: z.string().describe(\"Project's unique identifier (path parameter).\"),\n  body: z.string().describe(\"JavaScript or TypeScript source code for the Edge Function.\"),\n  name: z.string().describe(\"Human-readable name for the function.\"),\n  slug: z.string().describe(\"URL-friendly identifier for the function's route prefix. Must be unique within the project.\"),\n  import_map: z.boolean().describe(\"If true, enable import map for ES module resolution.\").optional(),\n  verify_jwt: z.boolean().describe(\"If true, verify JWT in Authorization header before invoking the function. Set to false for public endpoints like webhooks.\").optional(),\n  entrypoint_path: z.string().describe(\"Path to main function code, relative to project's functions directory. Defaults to `./index.ts` or `./index.js` in function's slug directory.\").optional(),\n  import_map_path: z.string().describe(\"Path to import map JSON, relative to project's functions directory; used if `import_map` is true. Defaults to `import_map.json` in function's slug directory.\").optional(),\n}).describe(\"Request schema for creating a new Edge Function. Note: If a function with the same slug already exists, this will fail with 'Duplicated function slug'. Use UPDATE_A_FUNCTION action to modify existing functions, or DELETE_A_FUNCTION to remove and recreate.\");\nconst SupabaseCreateFunction_StatusSchema = z.enum([\"ACTIVE\", \"REMOVED\", \"THROTTLED\"]);\nexport const SupabaseCreateFunctionOutput = 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(\"URL-safe identifier used to invoke the function (function slug).\").nullable(),\n  status: SupabaseCreateFunction_StatusSchema.nullable(),\n  version: z.number().int().describe(\"Monotonically increasing version number of the function definition.\").nullable(),\n  created_at: z.number().int().describe(\"Server-generated creation timestamp in milliseconds since Unix epoch.\").nullable(),\n  import_map: z.boolean().describe(\"Whether an import map is used for the function.\").nullable().optional(),\n  updated_at: z.number().int().describe(\"Server-generated last-updated timestamp in milliseconds since Unix epoch.\").nullable(),\n  verify_jwt: z.boolean().describe(\"Whether the function requires a valid JWT for invocation.\").nullable(),\n  ezbr_sha256: z.string().describe(\"SHA-256 hash of the bundled function artifact.\").nullable().optional(),\n  entrypoint_path: z.string().describe(\"Path to the entrypoint file used by the function (optional).\").nullable().optional(),\n  import_map_path: z.string().describe(\"Path to the import map file for the function (optional).\").nullable().optional(),\n}).passthrough().describe(\"Response body returned when creating an Edge Function via POST /v1/projects/{ref}/functions (deprecated; superseded by deploy endpoint).\");\n\nexport const supabaseCreateFunction: AppAction<\n  typeof SupabaseCreateFunctionInput,\n  typeof SupabaseCreateFunctionOutput,\n  typeof supabase.credential\n> = action(\"SUPABASE_CREATE_FUNCTION\", {\n  slug: \"supabase-create-function\",\n  name: \"Create a function\",\n  description: \"Creates a new serverless Edge Function for a Supabase project (identified by `ref`), requiring valid JavaScript/TypeScript in `body` and a project-unique `slug` identifier.\",\n  input: SupabaseCreateFunctionInput,\n  output: SupabaseCreateFunctionOutput,\n});\n"],"mappings":";;;;AAMA,MAAa,8BAA8BA,IAAAA,EAAE,OAAO;CAClD,KAAKA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,+CAA+C;CACxE,MAAMA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,6DAA6D;CACvF,MAAMA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,uCAAuC;CACjE,MAAMA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,6FAA6F;CACvH,YAAYA,IAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,sDAAsD,CAAC,CAAC,SAAS;CAClG,YAAYA,IAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,4HAA4H,CAAC,CAAC,SAAS;CACxK,iBAAiBA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,+IAA+I,CAAC,CAAC,SAAS;CAC/L,iBAAiBA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,+JAA+J,CAAC,CAA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