UNPKG

supa-seed

Version:

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

86 lines 2.75 kB
/** * Identity Manager for Epic 1: Universal MakerKit Core System * Manages auth.identities records for complete MakerKit authentication flows * Part of Task 1.1: Implement Auth.Identities Support */ import type { createClient } from '@supabase/supabase-js'; type SupabaseClient = ReturnType<typeof createClient>; export interface IdentityProvider { provider: 'email' | 'google' | 'github' | 'discord' | 'apple' | 'facebook' | 'twitter'; providerId: string; metadata?: Record<string, any>; } export interface IdentityData { userId: string; provider: IdentityProvider['provider']; providerId: string; email?: string; providerMetadata?: Record<string, any>; lastSignInAt?: string; createdAt?: string; updatedAt?: string; } export interface IdentityCreationResult { success: boolean; identity?: any; error?: string; warnings: string[]; } export interface IdentityValidationResult { isValid: boolean; errors: string[]; warnings: string[]; recommendations: string[]; } export declare class IdentityManager { private client; constructor(client: SupabaseClient); /** * Create auth.identities record for complete MakerKit auth flow */ createIdentity(identityData: IdentityData): Promise<IdentityCreationResult>; /** * Create multiple identities for a user (supports multiple OAuth providers) */ createMultipleIdentities(userId: string, providers: IdentityProvider[]): Promise<IdentityCreationResult[]>; /** * Generate realistic OAuth provider data for testing */ generateOAuthProviderData(provider: 'email' | 'google' | 'github' | 'discord' | 'apple' | 'facebook' | 'twitter', email: string): IdentityProvider; /** * Validate identity data before creation */ private validateIdentityData; /** * Find existing identity for user and provider */ private findExistingIdentity; /** * Format identity data for auth.identities table structure */ private formatIdentityRecord; /** * Extract a reasonable name from email address */ private extractNameFromEmail; /** * Check if auth.identities table exists and is accessible */ validateIdentityTableAccess(): Promise<{ tableExists: boolean; hasPermissions: boolean; errors: string[]; warnings: string[]; }>; /** * Get identity statistics for debugging and validation */ getIdentityStats(): Promise<{ totalIdentities: number; providerBreakdown: Record<string, number>; usersWithMultipleProviders: number; orphanedIdentities: number; }>; } export {}; //# sourceMappingURL=identity-manager.d.ts.map