/** * Cruise content routes — sourced-aware detail endpoint. * * GET /:key/content * * Returns the full `CruiseContent` payload for sourced cruises: * cache hit → cached row + overlay merge; cache miss with rich adapter * → adapter fetch + write-through; cache miss with thin adapter → * synthesizer fallback (sourced-content §3.3, §3.4, §3.6). When * `allowOwnedKeys` is enabled, owned `cru_*` ids are projected from the * cruises module's own tables. * * The cruise vertical's unified key parser (`:` for * external, plain TypeID for owned) is reused; this route accepts * either form. Plain owned TypeIDs require `allowOwnedKeys` so existing * sourced-only mounts can keep their previous contract. * * The catalog SourceAdapterRegistry is starter-owned and resolved via * the `resolveRegistry` callback. For cruise adapters wrapped via * `cruiseAdapterToSourceAdapter`, registry registration alongside the * cruise vertical's per-vertical registry enables both detail surfaces * (`/:key` for ad-hoc fetchCruise + `/:key/content` for cached * CruiseContent) without code duplication. * * See `docs/architecture/catalog-sourced-content.md` §3.3. */ import { OpenAPIHono } from "@hono/zod-openapi"; import type { SourceAdapterRegistry } from "@voyant-travel/catalog/booking-engine"; import type { Extension } from "@voyant-travel/core"; import type { AnyDrizzleDb } from "@voyant-travel/db"; import type { ApiExtension } from "@voyant-travel/hono/module"; import type { Context } from "hono"; export interface CruiseContentRoutesEnv { Variables: { db: AnyDrizzleDb; }; } export interface CreateCruiseContentRoutesOptions { resolveRegistry: (c: Context) => SourceAdapterRegistry; onOverlayError?: (event: { field_path: string; reason: string; }) => void; defaultAcceptMachineTranslated?: boolean; /** * When the unified key resolves to a cruise typeid (`cru_*` — * owned cruise), the route returns 404 by default. Set this to * `true` to also dispatch through `getCruiseContent` for owned ids * and let the service project content from owned cruise tables. */ allowOwnedKeys?: boolean; } export declare const CRUISE_CONTENT_OPENAPI_API_IDS: { readonly admin: "@voyant-travel/cruises#content-extension.api.admin"; readonly public: "@voyant-travel/cruises#content-extension.api.public"; }; export declare function createCruiseContentRoutes(options: CreateCruiseContentRoutesOptions, apiId?: (typeof CRUISE_CONTENT_OPENAPI_API_IDS)[keyof typeof CRUISE_CONTENT_OPENAPI_API_IDS]): OpenAPIHono; export interface CruiseContentApiExtensionOptions { admin: CreateCruiseContentRoutesOptions; public: CreateCruiseContentRoutesOptions; } export declare const cruiseContentExtension: Extension; /** Build sourced-aware cruise content routes for both API surfaces. */ export declare function createCruiseContentApiExtension(options: CruiseContentApiExtensionOptions): ApiExtension; export declare function parseAcceptLanguage(header: string): string[]; export type CruiseContentRoutes = ReturnType;