/** * Provenance shape carried by every CatalogEntry. * * Every vertical's CatalogEntry rows include this tuple. It records where the * data came from (owned vs sourced), how to call the source back for live * resolution and post-book operations, and how the source freshens. * * See `docs/architecture/catalog-architecture.md` §5.1 for the full design. */ import { type FieldPolicy, type SourceFreshness } from "./contract.js"; /** * Identifies a source of CatalogEntry data. Open-ended at the type level — * deployments declare their source kinds at adapter registration time. * * Conventions: * - `"owned"` — operator's own inventory * - `"voyant-connect"` — Voyant Connect peer (cloud or self-hosted) * - `"gds:amadeus"` / `"gds:sabre"` / `"gds:travelport"` — GDS providers * - `"direct:tui"` / `"direct:viking"` / `"direct:hilton"` — direct supplier APIs * - `"bedbank:hotelbeds"` / `"bedbank:expedia"` — bedbanks * - `"manual"` — manual / CSV import */ export type SourceKind = string; /** * Provenance tuple recorded on every CatalogEntry. Every field except * `source_kind` and `source_freshness` is optional because owned inventory * has no upstream connection or external reference. */ export interface Provenance { /** Source identifier — see {@link SourceKind} conventions. */ source_kind: SourceKind; /** * Optional sub-identifier for the source provider (e.g. specific Connect peer, * specific GDS office id). */ source_provider?: string; /** * FK to the connection / adapter instance that produced this row. For * `voyant-connect` sources this points to the connection record; for * direct-API sources it points to the local adapter config. */ source_connection_id?: string; /** Upstream identifier (e.g. Viking sailing code, Hotelbeds property id). */ source_ref?: string; /** How the source side of this row's fields refreshes. */ source_freshness: SourceFreshness; /** When this row was last refreshed from the source. */ last_sourced_at?: Date; } /** * Returns true if the provenance describes operator-owned inventory. */ export declare function isOwned(provenance: Provenance): boolean; /** * Returns true if the provenance describes externally-sourced inventory * (anything that's not `owned`). */ export declare function isSourced(provenance: Provenance): boolean; /** * Returns a stable composite identifier for the source connection + * external ref, used for deduplication and reverse-lookup queries. * * Returns `undefined` if either piece is missing — useful for skipping * rows that have no upstream identity. */ export declare function sourceCompositeKey(provenance: Provenance): string | undefined; /** * Ownership is a catalog-plane fact, not a vertical one: an entry in the * `products` collection may be an operator's own programme or a supplier's * package pulled through a supply connection, and the two need different * treatment on a storefront. Before these policies existed, nothing in an * indexed document recorded which it was — `catalog_sourced_entries` held the * answer and search could not see it, so consumers were reduced to inferring * ownership from `supplyModel` or an id prefix. Both correlate with ownership * today; neither states it (#4089). * * These policies are composed into every vertical registry rather than * declared per vertical, so the facet means the same thing in every collection * and no vertical can ship a registry that silently drops it. */ /** Value of `sourceKind` on a document built from a vertical's owned table. */ export declare const OWNED_SOURCE_KIND = "owned"; /** * Provenance of one indexed entry, as the document builders resolve it. * `sourceConnectionId` is null for owned entries and for connectionless * connectors. */ export interface CatalogDocumentProvenance { sourceKind: string; sourceConnectionId: string | null; } export declare const OWNED_DOCUMENT_PROVENANCE: CatalogDocumentProvenance; /** * Provenance fields every catalog collection carries. * * `isSourced` is redundant with `sourceKind` but is the field storefronts * actually want to filter on, and a boolean facet is cheaper to scope than a * negated string match against a growing set of connector kinds. * * `sourceConnectionId` is staff-only: which supplier account inventory came * from is commercially sensitive and not a customer-facing fact. `sourceKind` * and `isSourced` are customer-visible so a storefront can render and scope * mixed inventory deliberately. */ export declare const CATALOG_PROVENANCE_FIELD_POLICY: readonly FieldPolicy[]; /** * Field-keyed projection entries for one entry's provenance, ready to merge * into a projection map before {@link buildIndexerDocument} filters it through * the registry. */ export declare function provenanceProjectionEntries(provenance: CatalogDocumentProvenance): ReadonlyArray;