/** * ForgeHost Configuration * * Transforms a multi-project host config into a flat service map * that feeds directly into defineServices(). Each project's services * get namespaced (blog:api), grouped (blog:groupname), and assigned * sequential ports starting from a base port. * * Usage: * * import { defineHost } from 'threadforge'; * * export default defineHost({ * domain: 'myhost.dev', * projects: { * blog: { * domain: 'blog.myhost.dev', * config: './projects/blog/forge.config.js', * }, * gameapi: { * domain: 'game.myhost.dev', * config: './projects/gameapi/forge.config.js', * }, * }, * shared: { * auth: { * entry: './shared/auth.js', * type: 'edge', * port: 3100, * }, * }, * plugins: [postgres(), redis()], * }); */ 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 ProjectConfig { domain?: string; domains?: string[]; config?: string; services?: Record; frontend?: FrontendInput; static?: string; schema?: string; } interface HostConfig { domain?: string; projects: Record; shared?: Record; plugins?: unknown[]; frontendPlugins?: unknown[]; basePort?: number; metricsPort?: number; forgeProxy?: boolean | ForgeProxyConfig | null | undefined; } export interface HostMeta { domain: string | null; services: string[]; schema: string; keyPrefix: string; } interface SiteInfo { siteId: string; domains: string[]; basePath: string; services: string[]; frontend: NormalizedFrontend | null; staticDir: string | null; } interface ResolvedHostConfig { services: Record; hostMeta: Record; sites: Record; plugins: unknown[]; frontendPlugins: unknown[]; domain: string | null; metricsPort: number; } interface NamespacedService extends RawServiceConfig { _projectId: string; } interface DefinedHostConfig { _isHostConfig: true; _raw: HostConfig; forgeProxy: boolean | ForgeProxyConfig | null | undefined; domain: string | null; projects: Record; shared: Record; plugins: unknown[]; frontendPlugins: unknown[]; basePort: number; metricsPort: number; } export interface ResolvedAndDefinedConfig extends NormalizedConfig { _isHostMode: boolean; _hostMeta: Record; _hostDomain: string | null; _sites: Record; } /** * Resolve a host config: load each project's config, namespace services, * assign ports, and merge into a flat service map. * * @param {Object} hostConfig - The host config from defineHost() * @returns {Object} A flat services map ready for defineServices() */ export declare function resolveHostConfig(hostConfig: unknown): Promise; /** * Define a multi-project host config. * * Returns a config object marked as host mode that ForgeHost * can process. Can also be resolved immediately for direct use. */ export declare function defineHost(hostConfig: unknown): DefinedHostConfig; /** * Resolve a host config and feed it into defineServices(). * * @param {Object} hostConfig - Output from defineHost() * @returns {Object} A fully resolved config ready for Supervisor */ export declare function resolveAndDefine(hostConfig: DefinedHostConfig | HostConfig): Promise; export {}; //# sourceMappingURL=host-config.d.ts.map