import { Kysely } from 'kysely'; import { R as RLSSchema } from '../types-D3hQINlj.js'; /** * Options for PostgreSQL RLS generation */ interface PostgresRLSOptions { /** Force RLS on table owners */ force?: boolean; /** Schema name (default: public) */ schemaName?: string; /** Prefix for generated policy names */ policyPrefix?: string; } /** * PostgreSQL RLS Generator * Generates native PostgreSQL RLS statements from Kysera RLS schema */ declare class PostgresRLSGenerator { /** * Generate all PostgreSQL RLS statements from schema */ generateStatements(schema: RLSSchema, options?: PostgresRLSOptions): string[]; /** * Generate a single policy statement */ private generatePolicy; /** * Map Kysera operation to PostgreSQL operation */ private mapOperation; /** * Map single operation */ private mapSingleOperation; /** * Generate context-setting functions for PostgreSQL * These functions should be STABLE for optimal performance */ generateContextFunctions(): string; /** * Generate DROP statements for cleaning up */ generateDropStatements(schema: RLSSchema, options?: PostgresRLSOptions): string[]; } /** * Sync RLS context to PostgreSQL session settings * Call this at the start of each request/transaction */ declare function syncContextToPostgres(db: Kysely, context: { userId: string | number; tenantId?: string | number; roles?: string[]; permissions?: string[]; isSystem?: boolean; }): Promise; /** * Clear RLS context from PostgreSQL session */ declare function clearPostgresContext(db: Kysely): Promise; /** * Options for migration generation */ interface MigrationOptions extends PostgresRLSOptions { /** Migration name */ name?: string; /** Include context functions in migration */ includeContextFunctions?: boolean; } /** * RLS Migration Generator * Generates Kysely migration files for RLS policies */ declare class RLSMigrationGenerator { private generator; /** * Generate migration file content */ generateMigration(schema: RLSSchema, options?: MigrationOptions): string; /** * Escape template literal for embedding in string */ private escapeTemplate; /** * Generate migration filename with timestamp */ generateFilename(name?: string): string; } export { type MigrationOptions, PostgresRLSGenerator, type PostgresRLSOptions, RLSMigrationGenerator, clearPostgresContext, syncContextToPostgres };