{"version":3,"file":"upsert-migration.cjs","names":["z","action"],"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":";;;;AAMA,MAAa,+BAA+BA,IAAAA,EAAE,OAAO;CACnD,KAAKA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,+DAA+D;CACxF,MAAMA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,iFAAiF,CAAC,CAAC,SAAS;CACtH,OAAOA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,uGAAuG;CAClI,UAAUA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,+DAA+D,CAAC,CAAC,SAAS;CACxG,iBAAiBA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,+HAA+H,CAAC,CAAC,SAAS;AACjL,CAAC,CAAC,CAAC,SAAS,wEAAwE;AACpF,MAAa,gCAAgCA,IAAAA,EAAE,OAAO;CACpD,SAASA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,gCAAgC,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACnF,SAASA,IAAAA,EAAE,QAAQ,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,SAAS,uDAAuD,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CACzH,cAAcA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS,8CAA8C,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;AACxG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,mGAAmG;AAE7H,MAAa,0BAITC,eAAAA,OAAO,6BAA6B;CACtC,MAAM;CACN,MAAM;CACN,aAAa;CACb,OAAO;CACP,QAAQ;AACV,CAAC"}