import type { ConfigFactory } from './adapters/ConfigFactory'; import type { MOSConfigInput } from './types'; /** Non-optional keys of `T`. */ type RequiredKeys = { [K in keyof T]-?: undefined extends T[K] ? never : K; }[keyof T]; /** Required config keys not supplied by base `B`. */ type MissingRequiredConfigKeys = Exclude, keyof B>; /** Rule config: the required keys `base` lacks, plus any other field optionally. */ type RuleConfig = Partial & Required>>; /** A host/path → config rule for {@link hostPathMatcher}. */ export interface HostPathRule> { /** Exact request hostname (case-insensitive, port-free, no wildcards). Omit to match any host. */ host?: string; /** Path prefix, matched on segment boundaries (`/news` matches `/news/x`, not `/newsletter`). Omit, or pass `/`, for any path. */ pathPrefix?: string; /** This rule's config, shallow-merged over `base`. Must contain every required field `base` lacks. */ config: RuleConfig; } /** * Builds a {@link ConfigFactory} from host/path rules. Each rule's `config` is shallow-merged over * `base`; the result must be a complete {@link MOSConfigInput}. * * Resolution order — the first match wins: * 1. Rules whose `host` is the request host, longest matching `pathPrefix` first (ties: earlier rule). * 2. Host-less rules, ranked the same way; one with no `pathPrefix` is the global catch-all (at most one). * 3. No match throws. * * `config` is type-checked to supply the keys `base` lacks, but only when `base` is written * `satisfies Partial` (not annotated). `normalizeMOSConfig` re-checks at runtime. */ export declare function hostPathMatcher = Record>(rules: HostPathRule[], base?: B): ConfigFactory; export {};