feat: integrate Supabase for database operations and migrations
Add support for Supabase database operations, including migrations and queries. Implement new Supabase-related types, actions, and components to handle database interactions. Enhance the prompt system to include Supabase-specific instructions and constraints. Ensure data integrity and security by enforcing row-level security and proper migration practices.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { ActionType, BoltAction, BoltActionData, FileAction, ShellAction } from '~/types/actions';
|
||||
import type { ActionType, BoltAction, BoltActionData, FileAction, ShellAction, SupabaseAction } from '~/types/actions';
|
||||
import type { BoltArtifactData } from '~/types/artifact';
|
||||
import { createScopedLogger } from '~/utils/logger';
|
||||
import { unreachable } from '~/utils/unreachable';
|
||||
@@ -293,7 +293,27 @@ export class StreamingMessageParser {
|
||||
content: '',
|
||||
};
|
||||
|
||||
if (actionType === 'file') {
|
||||
if (actionType === 'supabase') {
|
||||
const operation = this.#extractAttribute(actionTag, 'operation');
|
||||
|
||||
if (!operation || !['migration', 'query'].includes(operation)) {
|
||||
logger.warn(`Invalid or missing operation for Supabase action: ${operation}`);
|
||||
throw new Error(`Invalid Supabase operation: ${operation}`);
|
||||
}
|
||||
|
||||
(actionAttributes as SupabaseAction).operation = operation as 'migration' | 'query';
|
||||
|
||||
if (operation === 'migration') {
|
||||
const filePath = this.#extractAttribute(actionTag, 'filePath');
|
||||
|
||||
if (!filePath) {
|
||||
logger.warn('Migration requires a filePath');
|
||||
throw new Error('Migration requires a filePath');
|
||||
}
|
||||
|
||||
(actionAttributes as SupabaseAction).filePath = filePath;
|
||||
}
|
||||
} else if (actionType === 'file') {
|
||||
const filePath = this.#extractAttribute(actionTag, 'filePath') as string;
|
||||
|
||||
if (!filePath) {
|
||||
|
||||
Reference in New Issue
Block a user