{"version":3,"file":"create-function.mjs","names":[],"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,8BAA8B,EAAE,OAAO;CAClD,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,+CAA+C;CACxE,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,6DAA6D;CACvF,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,uCAAuC;CACjE,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,6FAA6F;CACvH,YAAY,EAAE,QAAQ,CAAC,CAAC,SAAS,sDAAsD,CAAC,CAAC,SAAS;CAClG,YAAY,EAAE,QAAQ,CAAC,CAAC,SAAS,4HAA4H,CAAC,CAAC,SAAS;CACxK,iBAAiB,EAAE,OAAO,CAAC,CAAC,SAAS,+IAA+I,CAAC,CAAC,SAAS;CAC/L,iBAAiB,EAAE,OAAO,CAAC,CAAC,SAAS,+JAA+J,CAAC,CAAC,SAAS;AACjN,CAAC,CAAC,CAAC,SAAS,iQAAiQ;AAC7Q,MAAM,sCAAsC,EAAE,KAA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