supa-seed
Version:
A constraint-aware, framework-agnostic database seeding framework with deep PostgreSQL business logic discovery and MakerKit integration support
135 lines • 3.81 kB
TypeScript
/**
* Complex Multi-Table Constraint Resolution System for Epic 1: Universal MakerKit Core System
* Advanced strategies for resolving constraints that span multiple tables and complex relationships
* Part of Task 1.5.4: Add complex multi-table constraint resolution strategies
*/
/**
* Configuration for multi-table constraint resolution
*/
export interface MultiTableResolverConfig {
enableCascadeResolution?: boolean;
enableDependencyCreation?: boolean;
maxResolutionDepth?: number;
enableParallelResolution?: boolean;
dryRun?: boolean;
strictMode?: boolean;
}
/**
* Result of multi-table constraint resolution
*/
export interface MultiTableResolutionResult {
success: boolean;
resolvedConstraints: number;
createdDependencies: DependencyOperation[];
modifiedRecords: RecordModification[];
warnings: string[];
errors: string[];
executionMetrics: {
totalExecutionTime: number;
tablesAnalyzed: number;
constraintsProcessed: number;
dependenciesCreated: number;
};
}
/**
* Dependency operation for creating related records
*/
export interface DependencyOperation {
operation: 'create' | 'update' | 'link';
targetTable: string;
data: any;
reason: string;
priority: number;
dependencies: string[];
}
/**
* Record modification tracking
*/
export interface RecordModification {
table: string;
recordId: string;
field: string;
oldValue: any;
newValue: any;
reason: string;
confidence: number;
}
/**
* Advanced Multi-Table Constraint Resolver
*/
export declare class MultiTableConstraintResolver {
private client;
private slugManager;
private config;
private dependencyGraph;
constructor(client: any, config?: Partial<MultiTableResolverConfig>);
/**
* Resolve complex multi-table constraints for MakerKit data
*/
resolveMultiTableConstraints(data: any, tableName: string, constraints: any[]): Promise<MultiTableResolutionResult>;
/**
* Build constraint dependency graph for resolution ordering
*/
private buildConstraintDependencyGraph;
/**
* Analyze dependencies for a specific constraint
*/
private analyzeConstraintDependencies;
/**
* Resolve constraints in dependency order
*/
private resolveConstraintsInOrder;
/**
* Resolve MakerKit-specific multi-table patterns
*/
private resolveMakerKitPatterns;
/**
* Resolve account-organization pattern
*/
private resolveAccountOrganizationPattern;
/**
* Resolve user-profile pattern
*/
private resolveUserProfilePattern;
/**
* Resolve organization-owner pattern
*/
private resolveOrganizationOwnerPattern;
/**
* Resolve subscription-account pattern
*/
private resolveSubscriptionAccountPattern;
/**
* Resolve invitation workflow pattern
*/
private resolveInvitationWorkflowPattern;
/**
* Execute dependency operations
*/
private executeDependencyOperations;
/**
* Execute dependency create operation
*/
private executeDependencyCreate;
/**
* Execute dependency update operation
*/
private executeDependencyUpdate;
/**
* Execute dependency link operation
*/
private executeDependencyLink;
/**
* Helper methods
*/
private resolveComplexConstraint;
private extractReferencedTables;
private isMakerKitAccountConstraint;
private isMakerKitOrganizationConstraint;
private calculateConstraintPriority;
private findNodeByDependency;
private convertToRecordModifications;
private storeCreatedReference;
}
export default MultiTableConstraintResolver;
//# sourceMappingURL=multi-table-constraint-resolver.d.ts.map