UNPKG

supa-seed

Version:

A constraint-aware, framework-agnostic database seeding framework with deep PostgreSQL business logic discovery and MakerKit integration support

115 lines 3.55 kB
/** * MakerKit Compatibility Layer * Ensures seamless integration with all MakerKit versions and patterns * Phase 1, Checkpoint A2 */ import type { createClient } from '@supabase/supabase-js'; import { SchemaAdapter } from '../../core/schema-adapter'; type SupabaseClient = ReturnType<typeof createClient>; export interface MakerKitCompatibilityConfig { standardTestUsers: boolean; customTestEmails?: string[]; preserveAuthFlow: boolean; preserveRLS: boolean; makerkitVersion?: 'v1' | 'v2' | 'v3' | 'auto'; teamAccountCreation: boolean; personalAccountCreation: boolean; roleHierarchy: boolean; subscriptionSupport: boolean; notificationSystem: boolean; overrides?: { primaryUserTable?: 'accounts' | 'profiles' | 'users'; accountsTable?: { useSlug?: boolean; usePersonalAccounts?: boolean; customFields?: Record<string, any>; }; testUserPasswords?: { default?: string; perUser?: Record<string, string>; }; }; } export interface StandardTestUser { email: string; name: string; username: string; role: 'admin' | 'owner' | 'member' | 'custom' | 'super-admin'; password: string; metadata?: Record<string, any>; } export interface MakerKitValidationResult { isValid: boolean; compatibility: 'full' | 'partial' | 'custom' | 'incompatible'; issues: string[]; recommendations: string[]; detectedVersion: 'v1' | 'v2' | 'v3' | 'custom' | 'none'; } export declare class MakerKitCompatibilityLayer { private client; private schemaAdapter; private config; private schemaInfo; constructor(client: SupabaseClient, config: MakerKitCompatibilityConfig, schemaAdapter?: SchemaAdapter); /** * Initialize and validate MakerKit compatibility */ initialize(): Promise<MakerKitValidationResult>; /** * Get the standard MakerKit test users based on version and config */ getStandardTestUsers(): StandardTestUser[]; /** * Create standard test users with proper MakerKit integration */ createStandardTestUsers(): Promise<{ created: StandardTestUser[]; failed: Array<{ user: StandardTestUser; error: string; }>; }>; /** * Create a single MakerKit user with proper auth flow and account creation */ private createMakerKitUser; /** * Handle account creation based on MakerKit version and configuration */ private handleAccountCreation; /** * Create team account for users with appropriate roles */ private createTeamAccountForUser; /** * Set up user roles in the role hierarchy system */ private setupUserRoles; /** * Validate MakerKit compatibility and provide recommendations */ private validateMakerKitCompatibility; /** * Get password for a user (from config overrides or default) */ private getPasswordForUser; /** * Generate appropriate user bio based on role and config */ private generateUserBio; /** * Generate profile image URL for user */ private generateProfileImage; /** * Get comprehensive compatibility information */ getCompatibilityInfo(): { detectedVersion: string; supportedFeatures: string[]; recommendedSettings: Partial<MakerKitCompatibilityConfig>; limitations: string[]; }; } export {}; //# sourceMappingURL=makerkit-compatibility.d.ts.map