import type { Hono } from "hono"; import { type LazyRoutesLoader } from "./lazy-routes.js"; import type { VoyantAppConfig, VoyantBindings, VoyantVariables } from "./types.js"; /** The composed app's Hono env (bindings + framework request variables). */ type MountEnv = { Bindings: TBindings; Variables: VoyantVariables; }; /** * A lazy route family recorded at mount time so a build-time OpenAPI generator * can eager-load it and merge its `.openapi()` operations (voyant#2114). Mirrors * `LazyMount` in `./openapi.ts` (kept structurally identical, but declared here * to avoid pulling the build-time-only openapi module into the runtime path). */ export interface LazyMount { /** Absolute surface mount prefix, or `"/"` for absolute `lazyRoutes`. */ prefix: string; load: LazyRoutesLoader; } /** * A single module route mount recorded at mount time so a build-time generator * can produce one self-contained OpenAPI document per module (voyant#2733). * Mirrors `ModuleMount` in `./openapi.ts` (structurally identical, declared here * to keep the build-time-only openapi module out of the runtime path). `load` * returns the sub-app without serving it — eager mounts wrap the already-built * routes as `() => routes`; lazy mounts pass their loader. */ export interface ModuleMount { moduleName: string; /** Absolute surface mount prefix, or `"/"` for absolute `lazyRoutes`. */ prefix: string; load: () => Hono | Promise>; } /** * App handle returned alongside the Hono instance. Carries `ready()` for * headless / sibling-process deployments that need to fire the lazy * bootstrap before the first HTTP request. Resident hosts and tests call this * so selected runtime registration completes without waiting for traffic. * * Returned via the augmented Hono instance: `app.ready` is attached * directly so the existing call sites (which destructure / pass `app` * around) keep working without a wrapper. */ export interface VoyantAppExtensions { /** Shared service registry populated by selected package bootstraps. */ services: import("@voyant-travel/core").ModuleContainer; /** * Resolves once the lazy bootstrap completes. Idempotent — multiple * calls share the same promise. Use from tests + node sibling * processes where no request will arrive to trigger boot. See * architecture doc §18 + §18.1. * * Accepts the runtime bindings that the bootstrap should run with. For * binding-dependent configs (for example a managed-cloud forwarding * driver that reads credentials from `env`) callers MUST pass the real * bindings. Node and InMemory drivers usually ignore bindings, so the * no-arg form is safe there (defaults to `{}` for back-compat with tests). */ ready(bindings?: TBindings): Promise; /** * The app's event bus (with every module/plugin subscriber attached). * Exposed for non-request contexts that must deliver events through * the same subscriber set — the outbox drain in a scheduled handler * being the canonical consumer: * * await app.ready(env) * await withNodeDatabase(env, (db) => drainOutbox(db, app.eventBus)) */ eventBus: import("@voyant-travel/core").EventBus; /** * Lazy route families recorded at mount time (the wildcard dispatch stubs in * `lazy-routes.ts` don't reach the composed `OpenAPIHono` registry). A * build-time OpenAPI generator reads this to eager-load + merge their * `.openapi()` operations via `mergeLazyOpenApiPaths`. Never read at runtime. */ lazyMounts: LazyMount[]; /** * Every module route mount (admin + public, eager + lazy), tagged with its * owning module name (voyant#2733). A build-time generator reads this to * produce one self-contained OpenAPI document per module via * `generateModuleOpenApiDocuments`, keeping the module boundary authoritative * rather than guessed from path prefixes. Never read at runtime. */ moduleMounts: ModuleMount[]; } /** * Low-level app factory: given an already-resolved `modules`/`extensions` set * (plus middleware config), build the Hono app. Most deployments use the * config-driven `createApp` (see `create-app.ts`), which derives the modules * from a manifest + registry + capabilities and delegates here. Use `mountApp` * directly only when you have the resolved set in hand (tests, advanced hosts). */ export declare function mountApp(config: VoyantAppConfig): Hono> & VoyantAppExtensions; export {};