> ## Documentation Index
> Fetch the complete documentation index at: https://voyant.travel/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect adapter

> Register Connect inventory as a catalog SourceAdapter inside a Voyant app, so sourced inventory appears alongside your own products.

`@voyant-travel/connect-adapter` is the integration layer for consuming Connect inventory inside a Voyant app. It adapts Connect's normalized inventory into the platform catalog's `SourceAdapter` contract, so Connect-sourced products show up in search, content, and booking flows right next to inventory you operate yourself.

Use this package when a Voyant operator template should register Connect as a catalog source. The raw [`@voyant-travel/connect-sdk`](/docs/connect/connect-sdk) remains the right choice for non-Voyant consumers and low-level tools.

## Install

```bash theme={null}
pnpm add @voyant-travel/connect-adapter @voyant-travel/connect-sdk @voyant-travel/catalog
```

## Register the adapter

Create an adapter from your Connect credentials and register it in the catalog's source adapter registry, keyed by the connection it serves:

```ts theme={null}
import { createSourceAdapterRegistry } from "@voyant-travel/catalog/booking-engine";
import { createVoyantConnectSourceAdapter } from "@voyant-travel/connect-adapter";

const registry = createSourceAdapterRegistry();

const adapter = createVoyantConnectSourceAdapter({
  connect: {
    apiKey: process.env.VOYANT_API_KEY!,
    operatorId: "op_123",
    baseUrl: "https://api.voyant.travel",
  },
});

registry.register("conn_123", adapter);
```

## How discovery works

Discovery reads Connect search documents and emits catalog projections with stable provenance and field-policy-aligned keys such as `name`, `source.kind`, `source.ref`, `seller.operator_id`, `thumbnailUrl`, `cruiseType`, `nights`, and `price_from`, where Connect provides the underlying minor-unit money data. The `source_connection_id` is always populated, so quote, reserve, cancel, and status calls route back to the same Connect connection that produced the projection.

## Routing bookings back to the source

Booking dispatch must reach the same connection that produced the quote. When wiring catalog booking routes, resolve the adapter context from the quote or sourced-row provenance instead of using the default context:

```ts theme={null}
import { resolveVoyantConnectAdapterContext } from "@voyant-travel/connect-adapter";

const resolveAdapterContext = (input: {
  sourceKind?: string | null;
  sourceConnectionId?: string | null;
  correlationId?: string;
}) =>
  resolveVoyantConnectAdapterContext({
    sourceKind: input.sourceKind,
    sourceConnectionId: input.sourceConnectionId,
    correlationId: input.correlationId,
  });
```

The helper throws when `sourceConnectionId` is missing. That is intentional: quote, reserve, cancel, and reservation status must route to the connection that emitted the projection.

## Rich content and live resolution

Rich content reads go through `SourceAdapter.getContent`. For cruises, the adapter resolves a Connect search-document id back to the cruise source ref and returns the Voyant cruises content shape (`content_schema_version: "cruises/v1"`) with `cruise`, `ship`, `sailings`, `cabin_categories`, `itinerary_stops`, and `policies`.

Live resolution uses Connect's fresher routes rather than relying on stale search documents, selected with `parameters.connectRoute`:

| Inventory        | Route                                     |
| ---------------- | ----------------------------------------- |
| Default products | `client.availability.list`                |
| Stays            | set `parameters.connectRoute = "stays"`   |
| Cruises          | set `parameters.connectRoute = "cruises"` |

Apps with vertical-specific payloads can override `liveResolve`, `reserve`, `cancel`, or `getContent` while keeping the same `SourceAdapter` registration.

## Next steps

<CardGroup cols={2}>
  <Card title="Connect cruises" icon="ship" href="/docs/connect/connect-cruises">
    A dedicated cruises adapter boundary.
  </Card>

  <Card title="Catalog module" icon="cubes" href="/docs/platform/modules">
    How the platform catalog consumes source adapters.
  </Card>
</CardGroup>
