{"version":3,"file":"upsert-migration.mjs","names":[],"sources":["../../src/actions/upsert-migration.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 SupabaseUpsertMigrationInput = z.object({\n  ref: z.string().describe(\"Project's unique reference identifier (20 lowercase letters).\"),\n  name: z.string().describe(\"Optional name for the migration. Used for tracking and identification purposes.\").optional(),\n  query: z.string().describe(\"The SQL migration query to be stored. This query will be tracked but not executed. Must be non-empty.\"),\n  rollback: z.string().describe(\"Optional rollback SQL query to undo this migration if needed.\").optional(),\n  idempotency_key: z.string().describe(\"A unique key to ensure the same migration is tracked only once. If provided, prevents duplicate migrations with the same key.\").optional(),\n}).describe(\"Request schema for upserting a database migration without applying it.\");\nexport const SupabaseUpsertMigrationOutput = z.object({\n  message: z.string().describe(\"Response message from the API.\").nullable().optional(),\n  success: z.boolean().default(true).describe(\"Indicates if the migration was successfully upserted.\").nullable().optional(),\n  migration_id: z.string().describe(\"Unique identifier of the upserted migration.\").nullable().optional(),\n}).passthrough().describe(\"Response from upserting a database migration.\\n\\nNote: The API returns an empty array on success.\");\n\nexport const supabaseUpsertMigration: AppAction<\n  typeof SupabaseUpsertMigrationInput,\n  typeof SupabaseUpsertMigrationOutput,\n  typeof supabase.credential\n> = action(\"SUPABASE_UPSERT_MIGRATION\", {\n  slug: \"supabase-upsert-migration\",\n  name: \"Upsert migration\",\n  description: \"Tool to upsert a database migration without applying it. Use when you need to track migration changes for a project. [Beta] This endpoint stores migration metadata without executing the SQL.\",\n  input: SupabaseUpsertMigrationInput,\n  output: SupabaseUpsertMigrationOutput,\n});\n"],"mappings":";;;AAmBA,MAAa,0BAIT,OAAO,6BAA6B;CACtC,MAAM;CACN,MAAM;CACN,aAAa;CACb,OArB0C,EAAE,OAAO;EACnD,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,+DAA+D;EACxF,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,iFAAiF,CAAC,CAAC,SAAS;EACtH,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,uGAAuG;EAClI,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,+DAA+D,CAAC,CAAC,SAAS;EACxG,iBAAiB,EAAE,OAAO,CAAC,CAAC,SAAS,+HAA+H,CAAC,CAAC,SAAS;CACjL,CAAC,CAAC,CAAC,SAAS,wEAeH;CACP,QAf2C,EAAE,OAAO;EACpD,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,gCAAgC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;EACnF,SAAS,EAAE,QAAQ,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,SAAS,uDAAuD,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;EACzH,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS,8CAA8C,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACxG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,mGAWhB;AACV,CAAC"}