supa-seed
Version:
A constraint-aware, framework-agnostic database seeding framework with deep PostgreSQL business logic discovery and MakerKit integration support
109 lines • 3.57 kB
TypeScript
/**
* Constraint-Aware Workflow Generator
* Generates executable workflows based on discovered PostgreSQL constraints
* Part of supa-seed v2.2.0 constraint-aware architecture
*/
import type { createClient } from '@supabase/supabase-js';
import { type ConstraintMetadata, type DependencyGraph } from '../analysis/constraint-discovery-engine';
import { type WorkflowConfiguration, type UserCreationWorkflow } from '../analysis/constraint-aware-executor';
type SupabaseClient = ReturnType<typeof createClient>;
export interface WorkflowGenerationOptions {
frameworkType?: 'makerkit' | 'nextjs' | 'custom';
userCreationStrategy: 'comprehensive' | 'minimal' | 'adaptive';
constraintHandling: 'strict' | 'permissive' | 'auto_fix';
generateOptionalSteps: boolean;
includeDependencyCreation: boolean;
enableAutoFixes: boolean;
}
export interface GeneratedWorkflowMetadata {
generatedAt: string;
constraintMetadata: ConstraintMetadata;
dependencyGraph: DependencyGraph;
generationOptions: WorkflowGenerationOptions;
confidence: number;
warnings: string[];
recommendations: string[];
}
export interface WorkflowTemplate {
id: string;
name: string;
description: string;
frameworkType: string;
steps: WorkflowStepTemplate[];
conditions: ConstraintConditionTemplate[];
}
export interface WorkflowStepTemplate {
id: string;
table: string;
operation: 'insert' | 'update' | 'validate';
priority: number;
fieldMappings: FieldMappingTemplate[];
}
export interface ConstraintConditionTemplate {
type: 'business_rule' | 'dependency' | 'validation';
ruleName: string;
condition: string;
required: boolean;
}
export interface FieldMappingTemplate {
fieldName: string;
sourceType: 'input' | 'generated' | 'dependency';
required: boolean;
validator?: string;
}
export declare class WorkflowGenerator {
private client;
private constraintEngine;
private templates;
constructor(client: SupabaseClient);
/**
* Generate a complete workflow configuration from discovered constraints
*/
generateWorkflowConfiguration(tableNames: string[], options: WorkflowGenerationOptions): Promise<{
configuration: WorkflowConfiguration;
metadata: GeneratedWorkflowMetadata;
}>;
/**
* Generate user creation workflow based on constraints
*/
generateUserCreationWorkflow(constraints: ConstraintMetadata, dependencyGraph: DependencyGraph, options: WorkflowGenerationOptions): Promise<UserCreationWorkflow>;
/**
* Generate a workflow step for a specific table
*/
private generateTableStep;
/**
* Generate field mappings for a table
*/
private generateFieldMappings;
/**
* Generate constraint-specific field mapping
*/
private generateConstraintFieldMapping;
/**
* Generate step conditions based on business rules
*/
private generateStepConditions;
/**
* Generate auto-fixes for common constraint violations
*/
private generateAutoFixes;
/**
* Generate validation steps
*/
private generateValidationSteps;
/**
* Load built-in workflow templates
*/
private loadBuiltInTemplates;
/**
* Utility methods
*/
private inferCreationOrder;
private isSystemTable;
private isRequiredTable;
private extractStepDependencies;
private calculateGenerationConfidence;
private addWarningsAndRecommendations;
}
export {};
//# sourceMappingURL=workflow-generator.d.ts.map