{"version":3,"file":"action.mjs","names":[],"sources":["../src/action.ts"],"sourcesContent":["import type { AppAction } from \"@keystrokehq/keystroke/app\";\nimport { z } from \"zod\";\n\nimport { supabase } from \"./app\";\nimport { executeSupabaseTool } from \"./execute\";\n\n/** Bind one gateway tool to a typed app action; the call's output is parsed against `def.output`. */\nexport function action<TInput extends z.ZodType, TOutput extends z.ZodType>(\n  tool: string,\n  def: {\n    slug: string;\n    name: string;\n    description: string;\n    input: TInput;\n    output: TOutput;\n  },\n): AppAction<TInput, TOutput, typeof supabase.credential> {\n  return supabase.action({\n    slug: def.slug,\n    name: def.name,\n    description: def.description,\n    input: def.input,\n    output: def.output,\n    async run(input) {\n      return def.output.parse(await executeSupabaseTool(tool, input as Record<string, unknown>));\n    },\n  });\n}\n"],"mappings":";;;;;AAOA,SAAgB,OACd,MACA,KAOwD;CACxD,OAAO,SAAS,OAAO;EACrB,MAAM,IAAI;EACV,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,OAAO,IAAI;EACX,QAAQ,IAAI;EACZ,MAAM,IAAI,OAAO;GACf,OAAO,IAAI,OAAO,MAAM,MAAM,oBAAoB,MAAM,KAAgC,CAAC;EAC3F;CACF,CAAC;AACH"}