/** * Space Context for multi-tenant isolation * @internal - Not documented publicly * * This module provides advanced multi-tenant capabilities for DuckDB MCP. * These features are intentionally undocumented for public use. */ import { DuckDBService } from '../duckdb/service.js'; /** * Configuration for space contexts * @internal */ export interface SpaceConfig { tablePrefix?: string; metadata?: Record; dataPath?: string; isolation?: 'strict' | 'relaxed'; slmConfig?: { model?: string; contextBuilder?: (space: SpaceContext) => any; }; ducklake?: { enabled: boolean; format?: 'DELTA' | 'ICEBERG'; enableTimeTravel?: boolean; retentionDays?: number; compressionType?: 'ZSTD' | 'SNAPPY' | 'LZ4' | 'GZIP' | 'NONE'; versioning?: boolean; multiTenant?: boolean; catalogLocation?: string; }; } /** * Space Context for multi-tenant data isolation * @internal */ export declare class SpaceContext { private spaceId; private schema; private tablePrefix; private metadata; config: SpaceConfig; private tableMapping; private ducklakeCatalog?; constructor(spaceId: string, config?: SpaceConfig); /** * Get the space identifier */ getId(): string; /** * Get the schema name for this space */ getSchema(): string; /** * Get the table mapping for security audit */ getTableMappings(): Map; /** * Transform a table name to be space-scoped */ qualifyTableName(tableName: string): string; /** * Apply space context to a SQL query * This is a simple implementation that can be enhanced */ applyToQuery(sql: string): string; /** * Get metadata value */ getMetadata(key: string): any; /** * Set metadata value */ setMetadata(key: string, value: any): void; /** * Initialize space schema in database */ initialize(duckdb: DuckDBService): Promise; /** * Initialize DuckLake catalog for this space * @internal */ private initializeDuckLake; /** * Check if DuckLake is enabled for this space * @internal */ isDuckLakeEnabled(): boolean; /** * Get the DuckLake catalog name for this space * @internal */ getDuckLakeCatalog(): string | undefined; /** * Load data specific to this space */ private loadSpaceData; /** * Hidden feature: Prepare context for SLM integration * @internal */ __prepareSLMContext(): Promise<{ spaceId: string; schema: string; tables: string[]; metadata: Record; [key: string]: any; }>; /** * Hidden feature: Get space statistics * @internal */ __getStatistics?(duckdb: DuckDBService): Promise; } /** * Factory for managing multiple space contexts * @internal */ export declare class SpaceContextFactory { private contexts; private duckdb?; constructor(duckdb?: DuckDBService); /** * Get or create a space context */ getOrCreate(spaceId: string, config?: SpaceConfig): Promise; /** * Get a space context if it exists */ get(spaceId: string): SpaceContext | undefined; /** * Check if a space exists */ has(spaceId: string): boolean; /** * Remove a space context */ remove(spaceId: string): boolean; /** * Get all space IDs */ getSpaceIds(): string[]; /** * Clear all contexts */ clear(): void; /** * Hidden feature: Federation support * @internal */ __federateSpaces?(spaceIds: string[], query: string): Promise; /** * Hidden feature: Export space configuration * @internal */ __exportConfig?(): Record; } /** * Advanced space manager for complex scenarios * @internal - Not for public use */ export declare class SpaceManager { private factory; private activeSpace?; constructor(duckdb?: DuckDBService); /** * Switch to a different space */ switchSpace(spaceId: string, config?: SpaceConfig): Promise; /** * Get the current active space */ getCurrentSpace(): string | undefined; /** * Execute query in current space context */ executeInSpace(query: string, spaceId?: string): Promise; /** * Hidden: Prepare for SLM pilot integration * @internal */ __prepareSLMContext?(spaceId: string): Promise; } //# sourceMappingURL=SpaceContext.d.ts.map