supa-seed
Version:
A constraint-aware, framework-agnostic database seeding framework with deep PostgreSQL business logic discovery and MakerKit integration support
115 lines • 3.11 kB
TypeScript
/**
* Configurable Workflow Execution Engine
* Executes dynamically generated workflows with constraint validation and error handling
* Replaces hardcoded business logic with configurable execution patterns
*/
import type { createClient } from '@supabase/supabase-js';
import { UserCreationWorkflow } from './workflow-builder';
type SupabaseClient = ReturnType<typeof createClient>;
export interface WorkflowExecutionContext {
client: SupabaseClient;
userId?: string;
userData: Record<string, any>;
stepResults: Map<string, any>;
rollbackData: Map<string, any>;
executionId: string;
startTime: Date;
}
export interface WorkflowExecutionResult {
success: boolean;
userId?: string;
executionId: string;
duration: number;
completedSteps: string[];
failedStep?: string;
error?: string;
rollbackRequired: boolean;
rollbackCompleted: boolean;
stepResults: Record<string, any>;
}
export interface ExecutionConfig {
enableRollback: boolean;
enableConstraintValidation: boolean;
continueOnError: boolean;
maxRetries: number;
timeoutMs: number;
generateMissingFields: boolean;
}
export declare class WorkflowExecutor {
private client;
private config;
constructor(client: SupabaseClient, config: ExecutionConfig);
/**
* Execute a complete user creation workflow
*/
executeWorkflow(workflow: UserCreationWorkflow, userData: Record<string, any>): Promise<WorkflowExecutionResult>;
/**
* Execute a single workflow step
*/
private executeStep;
/**
* Execute auth user creation step
*/
private executeCreateAuthUser;
/**
* Execute record insertion step
*/
private executeInsertRecord;
/**
* Execute constraint validation step
*/
private executeValidateConstraint;
/**
* Execute trigger execution step
*/
private executeExecuteTrigger;
/**
* Execute conditional action step
*/
private executeConditionalAction;
/**
* Resolve field values for a step
*/
private resolveStepFields;
/**
* Generate a field value based on the field configuration
*/
private generateFieldValue;
/**
* Generate faker value based on type
*/
private generateFakerValue;
/**
* Calculate execution order based on step dependencies
*/
private calculateExecutionOrder;
/**
* Validate step conditions
*/
private validateConditions;
/**
* Validate a single condition
*/
private validateSingleCondition;
/**
* Validate SQL condition (placeholder implementation)
*/
private validateSqlCondition;
/**
* Additional validation methods (placeholders)
*/
private validateConstraintCheck;
private validateRelationshipExists;
private validateFieldValue;
private computeFieldValue;
/**
* Retry a failed step
*/
private retryStep;
/**
* Execute rollback steps
*/
private executeRollback;
}
export {};
//# sourceMappingURL=workflow-executor.d.ts.map