supa-seed
Version:
A constraint-aware, framework-agnostic database seeding framework with deep PostgreSQL business logic discovery and MakerKit integration support
71 lines • 2.49 kB
TypeScript
/**
* Multi-Tenant Data Manager
* Handles tenant-scoped data creation, validation, and isolation
*/
import type { createClient } from '@supabase/supabase-js';
import { TenantInfo, TenantScopeInfo, TenantBoundaryValidation, TenantDataGenerationOptions, TenantDiscoveryResult, TenantIsolationReport, TenantSeederConfig } from './tenant-types';
type SupabaseClient = ReturnType<typeof createClient>;
export declare class MultiTenantManager {
private client;
private config;
private detectedTenantScopes;
private tenantCache;
constructor(client: SupabaseClient, config?: Partial<TenantSeederConfig>);
/**
* Discover tenant-scoped tables in the database
*/
discoverTenantScopes(): Promise<TenantDiscoveryResult>;
/**
* Analyze a specific table for tenant scope indicators
*/
private analyzeTenantScope;
/**
* Check if table has RLS policies
*/
private checkRLSPolicies;
/**
* Get tenant-related foreign keys for a table
*/
private getTenantForeignKeys;
/**
* Create tenant-scoped data with proper account_id assignment
*/
createTenantScopedData(tableName: string, tenantId: string, data: any[], options?: Partial<TenantDataGenerationOptions>): Promise<any[]>;
/**
* Validate tenant boundaries for data
*/
validateTenantBoundaries(tableName: string, data: any[]): Promise<TenantBoundaryValidation>;
/**
* Generate tenant accounts (personal and team)
*/
generateTenantAccounts(count: number, options?: Partial<TenantDataGenerationOptions>): Promise<TenantInfo[]>;
/**
* Generate a personal account
*/
private generatePersonalAccount;
/**
* Generate a team account
*/
private generateTeamAccount;
/**
* Create tenant isolation report
*/
createTenantIsolationReport(tenantId: string): Promise<TenantIsolationReport>;
/**
* Helper methods
*/
private createDefaultScopeInfo;
private generateTenantRecommendations;
private generateIsolationRecommendations;
/**
* Public getters
*/
getTenantScopeInfo(tableName: string): TenantScopeInfo | undefined;
getAllTenantScopes(): TenantScopeInfo[];
getTenantInfo(tenantId: string): TenantInfo | undefined;
getAllTenants(): TenantInfo[];
getConfig(): TenantSeederConfig;
updateConfig(updates: Partial<TenantSeederConfig>): void;
}
export {};
//# sourceMappingURL=multi-tenant-manager.d.ts.map