/** * Platform Mode Configuration * * Transforms a user-facing `platform.apps` config into ForgeHost's * internal `projects` format. Platform Mode is a config transformation * layer on top of ForgeHost — it reuses resolveHostConfig() as the engine. * * Usage: * * import { definePlatform } from 'threadforge'; * * export default definePlatform({ * platform: { * globalAuth: true, * apps: { * coolapp: { * domains: ['coolapp.io'], * services: ['coolapp-api'], * schema: 'coolapp', * }, * }, * }, * plugins: [redis(), postgres()], * identity: { entry: './services/identity.js', type: 'edge', port: 3001 }, * auth: { entry: './services/auth.js', type: 'edge', port: 3002 }, * 'coolapp-api': { entry: './apps/coolapp/api.js', type: 'edge', port: 4001 }, * }); */ import type { NormalizedConfig, RawServiceConfig } from "./config.js"; interface ForgeProxyConfig { enabled?: boolean; host?: string; port?: number; keepalive?: number; } interface FrontendInput { plugin?: string; root?: string; outDir?: string; basePath?: string; spaFallback?: boolean; env?: Record; options?: Record; } interface NormalizedFrontend { plugin: string; root: string; outDir: string; basePath: string; spaFallback: boolean; env: Record; options: Record; } interface AppConfig { domains?: string[]; domain?: string; services?: string[]; config?: string; frontend?: FrontendInput; static?: string | null; schema?: string; } interface PlatformBlock { globalAuth?: boolean; apps: Record; domain?: string; basePort?: number; metricsPort?: number; forgeProxy?: boolean | ForgeProxyConfig | null | undefined; } export interface PlatformConfig { platform: PlatformBlock; plugins?: unknown[]; frontendPlugins?: unknown[]; [key: string]: unknown; } export interface DefinedPlatformConfig { _isPlatformConfig: true; _raw: PlatformConfig; platform: PlatformBlock; plugins: unknown[]; frontendPlugins: unknown[]; } interface HostConfigInput { domain: string | null; basePort: number; metricsPort: number; projects: Record; shared: Record; plugins: unknown[]; frontendPlugins: unknown[]; } interface ProjectEntry { domain: string; domains: string[]; schema: string; static: string | null; frontend: NormalizedFrontend | null; services: Record | undefined; config: string | undefined; } export interface ResolvedPlatformConfig extends NormalizedConfig { _isPlatformMode: boolean; _isHostMode: boolean; _hostMeta: unknown; _hostDomain: string | null; _sites: Record; _platformConfig: PlatformBlock; } /** * Normalize an app's domain(s) to an array. * Accepts either `domains: [...]` or `domain: '...'`. */ export declare function resolveAppDomains(app: { domains?: string[]; domain?: string; }): string[]; /** * Validate the platform config shape. * * @throws {Error} On invalid config */ export declare function validatePlatformConfig(config: unknown): asserts config is PlatformConfig; /** * Transform platform config into ForgeHost's internal projects format. * * Maps platform.apps -> hostConfig.projects, preserving custom schemas * and auto-injecting identity+auth when globalAuth is enabled. */ export declare function transformToHostConfig(config: PlatformConfig): HostConfigInput; /** * Define a Platform Mode config. * * Validates the config and returns a marked config object. */ export declare function definePlatform(config: PlatformConfig): DefinedPlatformConfig; /** * Resolve a platform config fully: transform -> resolveHostConfig -> defineServices. */ export declare function resolveAndDefinePlatform(config: DefinedPlatformConfig | PlatformConfig): Promise; export {}; //# sourceMappingURL=platform-config.d.ts.map