@voyantjs/flights-contracts 0.96.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @voyantjs/flights-contracts
2
+
3
+ Pure flight `SourceAdapter` contracts, schemas, and reference-data shapes for
4
+ adapter implementers and external consumers that need to integrate flight
5
+ providers without the flights runtime.
6
+
7
+ Use this package for the `FlightConnectorAdapter` contract, the flight contract
8
+ types (offers, orders, segments, search, booking, post-book operations), the
9
+ matching Zod schemas, and the `ReferenceDataProvider` reference-data shapes
10
+ (plus the static-bundle provider). Use `@voyantjs/flights` when you also need
11
+ the orchestration fan-out, snapshot capture, local-Postgres reference provider,
12
+ or other runtime integration with the catalog plane.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pnpm add @voyantjs/flights-contracts zod
18
+ ```
19
+
20
+ ## Exports
21
+
22
+ - `./contract/types` — flight contract types (offers, orders, segments,
23
+ search, booking, ancillaries, seat maps, capability ids).
24
+ - `./contract/adapter` — the `FlightConnectorAdapter` contract + adapter
25
+ context/capabilities and the `CAPABILITY_NOT_SUPPORTED` helpers.
26
+ - `./contract/schemas` — Zod schemas mirroring the contract types.
27
+ - `./contract/post-book-types` — post-book operation types (seat selection,
28
+ check-in, modify, refund, void, SSR).
29
+ - `./reference/contract` — the `ReferenceDataProvider` contract + reference
30
+ data shapes (airline, airport, aircraft).
31
+ - `./reference/static-bundle` — the in-memory static-bundle reference provider.
32
+
33
+ ## Usage
34
+
35
+ ```ts
36
+ import {
37
+ flightSearchRequestSchema,
38
+ type FlightConnectorAdapter,
39
+ } from "@voyantjs/flights-contracts"
40
+ ```
41
+
42
+ `@voyantjs/flights` re-exports this contract surface, so existing
43
+ `@voyantjs/flights/contract/*` and `@voyantjs/flights/reference/*` import paths
44
+ remain unchanged for applications that already depend on the full runtime
45
+ package.
@@ -0,0 +1,210 @@
1
+ /**
2
+ * `FlightConnectorAdapter` contract — the seam through which any flight
3
+ * provider integrates with Voyant.
4
+ *
5
+ * Five core methods every adapter must implement; capability-gated
6
+ * methods exist as optional members on the interface and stub with
7
+ * `CAPABILITY_NOT_SUPPORTED` if the adapter doesn't declare them.
8
+ *
9
+ * Implementations come from anywhere — Voyant Connect, a wholesaler's own
10
+ * engineering team, a cruise line direct API, an operator-built GDS
11
+ * connector, a third-party integrator. No implementer is privileged.
12
+ *
13
+ * See `docs/architecture/catalog-flights-architecture.md` §3.
14
+ */
15
+ import type { AncillaryRequest, AncillaryResponse, CheckInRequest, CheckInResponse, FlightBookRequest, FlightCapability, FlightModifyRequest, FlightModifyResponse, FlightOffer, FlightOrder, FlightOrderStatus, FlightRefundRequest, FlightRefundResponse, FlightSearchPaginationMeta, FlightSearchRequest, FlightVoidResponse, SeatMapRequest, SeatMapResponse, SeatSelectionRequest, SeatSelectionResponse, SsrRequest, SsrResponse } from "./types.js";
16
+ export interface AdapterLogger {
17
+ debug(message: string, meta?: Record<string, unknown>): void;
18
+ info(message: string, meta?: Record<string, unknown>): void;
19
+ warn(message: string, meta?: Record<string, unknown>): void;
20
+ error(message: string, meta?: Record<string, unknown>): void;
21
+ }
22
+ export type FlightAdapterEnvironment = "sandbox" | "production";
23
+ /**
24
+ * Context passed to every adapter call. Identifies the connection and
25
+ * carries credentials, optional point-of-sale, tracing identifiers,
26
+ * cancellation, idempotency, logging, and environment selection signals.
27
+ *
28
+ * `deps` is an escape hatch for adapter-specific runtime dependencies that
29
+ * shouldn't bleed into the contract — e.g. a Postgres handle for a demo
30
+ * adapter that self-persists, or a feature-flag client. Real connectors
31
+ * (Sabre, Amadeus, Duffel) ignore it.
32
+ */
33
+ export interface FlightAdapterContext {
34
+ connectionId: string;
35
+ credentials?: Record<string, string>;
36
+ /** Operator's IATA office id / pseudo-city / point-of-sale, when applicable. */
37
+ pointOfSale?: string;
38
+ /** Upstream trace id, usually propagated from the caller. */
39
+ correlationId?: string;
40
+ /** Per-call request id for adapter-local tracing. */
41
+ requestId?: string;
42
+ /** Idempotency key for replay-safe writes: book, modify, refund, void. */
43
+ idempotencyKey?: string;
44
+ /** Adapter-scoped logger with provider/connection/request metadata bound in. */
45
+ logger?: AdapterLogger;
46
+ /** Cancellation signal propagated from the orchestration layer. */
47
+ signal?: AbortSignal;
48
+ /** Selects the supplier environment when the adapter supports both. */
49
+ environment?: FlightAdapterEnvironment;
50
+ deps?: Record<string, unknown>;
51
+ }
52
+ export interface FlightSearchResponse {
53
+ offers: FlightOffer[];
54
+ /**
55
+ * Pagination metadata, present when the adapter honors
56
+ * `request.pagination`. Omitted by adapters that always return the
57
+ * full result set in one call.
58
+ */
59
+ pagination?: FlightSearchPaginationMeta;
60
+ /** Provider-specific data, opaque to the consumer. */
61
+ providerData?: Record<string, unknown>;
62
+ }
63
+ export interface FlightPriceRequest {
64
+ offerId: string;
65
+ /** Some providers require the offer payload echoed back to re-price. */
66
+ offer?: FlightOffer;
67
+ }
68
+ export interface FlightPriceResponse {
69
+ offer: FlightOffer;
70
+ /** Whether the offer's price/availability is still valid for booking. */
71
+ valid: boolean;
72
+ /** When `valid: false`, why the offer was invalidated. */
73
+ invalidReason?: string;
74
+ }
75
+ export interface FlightBookResponse {
76
+ order: FlightOrder;
77
+ }
78
+ export interface FlightGetOrderResponse {
79
+ order: FlightOrder;
80
+ }
81
+ export interface FlightCancelResponse {
82
+ order: FlightOrder;
83
+ refundedAmount?: {
84
+ amount: string;
85
+ currency: string;
86
+ };
87
+ }
88
+ export type FlightCancelReason = "customer_request" | "schedule_change" | "operational" | "fraud";
89
+ export interface FlightOrdersListQuery {
90
+ /** Pagination cursor — opaque, returned by the previous response. */
91
+ cursor?: string;
92
+ limit?: number;
93
+ /** Restrict to orders in any of these statuses. */
94
+ status?: FlightOrderStatus[];
95
+ /** Free-text match against PNR, passenger name, or contact email. */
96
+ search?: string;
97
+ }
98
+ export interface FlightOrdersListResponse {
99
+ orders: FlightOrder[];
100
+ pagination: {
101
+ total: number;
102
+ hasMore: boolean;
103
+ cursor?: string;
104
+ };
105
+ }
106
+ /**
107
+ * Capability declaration returned by the adapter at registration time.
108
+ * The orchestration layer reads `capabilities` to route requests and to
109
+ * fail fast on unsupported operations.
110
+ */
111
+ export interface FlightAdapterCapabilities {
112
+ /** Provider identifier — e.g. `"hisky"`, `"amadeus"`, `"duffel"`, `"sabre"`, `"travelport-ndc"`. */
113
+ provider: string;
114
+ /** Capabilities declared by this connection. */
115
+ declared: FlightCapability[];
116
+ /**
117
+ * Maximum slices per search request supported. Many providers cap at
118
+ * 1 (single-carrier point-to-point), 2 (round-trip), or 4-6 (multi-city).
119
+ */
120
+ maxSlicesPerSearch?: number;
121
+ /**
122
+ * Default per-source timeout hint for the orchestration layer.
123
+ */
124
+ defaultTimeoutMs?: number;
125
+ }
126
+ /**
127
+ * The flight connector contract. Five core methods + optional capability-
128
+ * gated methods. Adapters that don't support a capability either omit the
129
+ * method or have it throw `CAPABILITY_NOT_SUPPORTED`.
130
+ */
131
+ export interface FlightConnectorAdapter {
132
+ readonly capabilities: FlightAdapterCapabilities;
133
+ /** Search flights matching the request's slices + passengers + cabin. */
134
+ searchFlights(ctx: FlightAdapterContext, request: FlightSearchRequest): Promise<FlightSearchResponse>;
135
+ /**
136
+ * Re-price an offer immediately before booking.
137
+ *
138
+ * This is also the canonical re-quote path for offers approaching
139
+ * `FlightOffer.expiresAt` or `lastTicketingDate`. Callers should invoke it
140
+ * before booking whenever the offer is older than the provider's freshness
141
+ * window or the UI is resuming a saved/held offer.
142
+ */
143
+ priceOffer(ctx: FlightAdapterContext, request: FlightPriceRequest): Promise<FlightPriceResponse>;
144
+ /**
145
+ * Book the flight. Behavior depends on `paymentIntent`:
146
+ * - `hold` → returns order with status `confirmed`; caller must call
147
+ * `ticketOrder` later (capability-gated).
148
+ * - `card` / `ticket_on_credit` → returns order with status `ticketed`.
149
+ */
150
+ bookFlight(ctx: FlightAdapterContext, request: FlightBookRequest): Promise<FlightBookResponse>;
151
+ /** Get an order by id (for status checks, post-book operations). */
152
+ getOrder(ctx: FlightAdapterContext, orderId: string): Promise<FlightGetOrderResponse>;
153
+ /** Cancel an order. */
154
+ cancelOrder(ctx: FlightAdapterContext, orderId: string, reason?: FlightCancelReason): Promise<FlightCancelResponse>;
155
+ /**
156
+ * `flight/list-orders` — return a paginated list of orders the adapter
157
+ * has visibility on. Real GDS connectors typically only support listing
158
+ * by PNR/locator (not the full agency book of business), but persistent
159
+ * adapters and self-hosted demos can list everything they've stored.
160
+ */
161
+ listOrders?(ctx: FlightAdapterContext, query: FlightOrdersListQuery): Promise<FlightOrdersListResponse>;
162
+ /** `flight/holds` — promote a held order to ticketed. */
163
+ ticketOrder?(ctx: FlightAdapterContext, orderId: string): Promise<FlightGetOrderResponse>;
164
+ /**
165
+ * `flight/ancillaries` — list bag / assistance / extra options for an offer.
166
+ * Catalog is per-offer because availability depends on the booked itinerary;
167
+ * for round-trip flows where each leg is its own offer, callers fetch one
168
+ * catalog per leg and merge the picks at book time via
169
+ * `FlightBookRequest.ancillaries`.
170
+ */
171
+ getAncillaries?(ctx: FlightAdapterContext, request: AncillaryRequest): Promise<AncillaryResponse>;
172
+ /**
173
+ * `flight/seatmap` — fetch the seat map for one segment of an offer.
174
+ * Maps are per-segment because layouts differ by aircraft and cabin
175
+ * (a multi-stop itinerary may use different equipment per leg). Picks
176
+ * are submitted at book time via `FlightBookRequest.ancillaries.seats`.
177
+ */
178
+ getSeatMap?(ctx: FlightAdapterContext, request: SeatMapRequest): Promise<SeatMapResponse>;
179
+ /** `flight/seat-selection` — change/add seat selections on an existing order. */
180
+ selectSeats?(ctx: FlightAdapterContext, request: SeatSelectionRequest): Promise<SeatSelectionResponse>;
181
+ /** `flight/checkin` — initiate or complete online check-in for passengers. */
182
+ checkIn?(ctx: FlightAdapterContext, request: CheckInRequest): Promise<CheckInResponse>;
183
+ /** `flight/exchange` — change an existing order's itinerary, fare, pax, or extras. */
184
+ modifyOrder?(ctx: FlightAdapterContext, request: FlightModifyRequest): Promise<FlightModifyResponse>;
185
+ /** `flight/refund` — refund a ticketed order after the ticketing/void window. */
186
+ refundOrder?(ctx: FlightAdapterContext, request: FlightRefundRequest): Promise<FlightRefundResponse>;
187
+ /** `flight/void` — void a ticketed order inside the supplier void window. */
188
+ voidOrder?(ctx: FlightAdapterContext, orderId: string): Promise<FlightVoidResponse>;
189
+ /** `flight/ssr` — add a special service request such as wheelchair, meal, or UMNR. */
190
+ addSpecialServiceRequest?(ctx: FlightAdapterContext, request: SsrRequest): Promise<SsrResponse>;
191
+ }
192
+ /**
193
+ * Standard error code for capability-gated methods that aren't supported
194
+ * by the adapter. Mirrors voyant-cloud's convention so behavior is
195
+ * portable across runtimes.
196
+ */
197
+ export declare const CAPABILITY_NOT_SUPPORTED: "CAPABILITY_NOT_SUPPORTED";
198
+ export declare class FlightCapabilityNotSupportedError extends Error {
199
+ readonly provider: string;
200
+ readonly capability: FlightCapability;
201
+ readonly operation: string;
202
+ readonly code: "CAPABILITY_NOT_SUPPORTED";
203
+ constructor(provider: string, capability: FlightCapability, operation: string);
204
+ }
205
+ /**
206
+ * Helper for adapters that want to short-circuit at the start of a method
207
+ * when a required capability isn't declared.
208
+ */
209
+ export declare function requireCapability(capabilities: FlightAdapterCapabilities, capability: FlightCapability, operation: string): void;
210
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/contract/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,UAAU,EACV,WAAW,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BAAgB,iBAAiB,CAC/B,YAAY,EAAE,yBAAyB,EACvC,UAAU,EAAE,gBAAgB,EAC5B,SAAS,EAAE,MAAM,GAChB,IAAI,CAIN"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * `FlightConnectorAdapter` contract — the seam through which any flight
3
+ * provider integrates with Voyant.
4
+ *
5
+ * Five core methods every adapter must implement; capability-gated
6
+ * methods exist as optional members on the interface and stub with
7
+ * `CAPABILITY_NOT_SUPPORTED` if the adapter doesn't declare them.
8
+ *
9
+ * Implementations come from anywhere — Voyant Connect, a wholesaler's own
10
+ * engineering team, a cruise line direct API, an operator-built GDS
11
+ * connector, a third-party integrator. No implementer is privileged.
12
+ *
13
+ * See `docs/architecture/catalog-flights-architecture.md` §3.
14
+ */
15
+ /**
16
+ * Standard error code for capability-gated methods that aren't supported
17
+ * by the adapter. Mirrors voyant-cloud's convention so behavior is
18
+ * portable across runtimes.
19
+ */
20
+ export const CAPABILITY_NOT_SUPPORTED = "CAPABILITY_NOT_SUPPORTED";
21
+ export class FlightCapabilityNotSupportedError extends Error {
22
+ provider;
23
+ capability;
24
+ operation;
25
+ code = CAPABILITY_NOT_SUPPORTED;
26
+ constructor(provider, capability, operation) {
27
+ super(`Flight provider "${provider}" does not declare capability "${capability}" (operation: ${operation}). ` +
28
+ `Either configure the request to skip this operation or register a connector that supports it.`);
29
+ this.provider = provider;
30
+ this.capability = capability;
31
+ this.operation = operation;
32
+ this.name = "FlightCapabilityNotSupportedError";
33
+ }
34
+ }
35
+ /**
36
+ * Helper for adapters that want to short-circuit at the start of a method
37
+ * when a required capability isn't declared.
38
+ */
39
+ export function requireCapability(capabilities, capability, operation) {
40
+ if (!capabilities.declared.includes(capability)) {
41
+ throw new FlightCapabilityNotSupportedError(capabilities.provider, capability, operation);
42
+ }
43
+ }
@@ -0,0 +1,90 @@
1
+ import type { AncillarySelection, FlightOffer, FlightOrder, FlightPassenger, Money } from "./types.js";
2
+ export interface SeatAssignment {
3
+ passengerId: string;
4
+ segmentId: string;
5
+ seatNumber: string;
6
+ /** Per-pax seat fee. Omitted = included in fare or already paid. */
7
+ price?: Money;
8
+ /** Provider-specific data — opaque round-trip. */
9
+ providerData?: Record<string, unknown>;
10
+ }
11
+ export interface SeatSelectionRequest {
12
+ orderId: string;
13
+ selections: SeatAssignment[];
14
+ }
15
+ export interface SeatSelectionResponse {
16
+ order: FlightOrder;
17
+ selections: SeatAssignment[];
18
+ /** Total additional charge collected for the seat change, if any. */
19
+ additionalAmount?: Money;
20
+ }
21
+ export type CheckInStatus = "initiated" | "checked_in" | "failed";
22
+ export interface CheckInRequest {
23
+ orderId: string;
24
+ passengerIds?: string[];
25
+ segmentIds?: string[];
26
+ }
27
+ export interface FlightBoardingPass {
28
+ passengerId: string;
29
+ segmentId: string;
30
+ boardingPassId?: string;
31
+ seatNumber?: string;
32
+ sequenceNumber?: string;
33
+ zone?: string;
34
+ /** Provider-specific data — opaque round-trip. */
35
+ providerData?: Record<string, unknown>;
36
+ }
37
+ export interface CheckInResponse {
38
+ order: FlightOrder;
39
+ status: CheckInStatus;
40
+ boardingPasses?: FlightBoardingPass[];
41
+ }
42
+ export type FlightModifyReason = "customer_request" | "schedule_change" | "name_correction" | "disruption" | "operational";
43
+ export interface FlightModifyRequest {
44
+ orderId: string;
45
+ /** Re-priced replacement offer when the modification changes itinerary/fare. */
46
+ offer?: FlightOffer;
47
+ /** Replacement passenger details for corrections allowed by the provider. */
48
+ passengers?: FlightPassenger[];
49
+ /** Add or replace ancillary picks as part of the modification. */
50
+ ancillaries?: AncillarySelection;
51
+ reason?: FlightModifyReason;
52
+ }
53
+ export interface FlightModifyResponse {
54
+ order: FlightOrder;
55
+ /** Positive means collect more from the traveler; negative means credit due. */
56
+ priceDifference?: Money;
57
+ penalties?: Money[];
58
+ }
59
+ export type FlightRefundReason = "customer_request" | "schedule_change" | "disruption" | "duplicate_booking" | "medical" | "other";
60
+ export interface FlightRefundRequest {
61
+ orderId: string;
62
+ reason?: FlightRefundReason;
63
+ /** Omit for a full refund; provide for supplier-supported partial refunds. */
64
+ amount?: Money;
65
+ }
66
+ export interface FlightRefundResponse {
67
+ order: FlightOrder;
68
+ refundId?: string;
69
+ refundedAmount: Money;
70
+ penalties?: Money[];
71
+ }
72
+ export interface FlightVoidResponse {
73
+ order: FlightOrder;
74
+ voidId?: string;
75
+ voidedAt: string;
76
+ }
77
+ export type SsrCode = "WCHR" | "WCHS" | "WCHC" | "BLND" | "DEAF" | "MAAS" | "UMNR" | "INFT" | "PETC" | "VGML" | "KSML" | "MOML" | "OTHER";
78
+ export interface SsrRequest {
79
+ orderId: string;
80
+ code: SsrCode;
81
+ passengerIds?: string[];
82
+ segmentIds?: string[];
83
+ text?: string;
84
+ }
85
+ export interface SsrResponse {
86
+ order: FlightOrder;
87
+ ssrId?: string;
88
+ status: "requested" | "confirmed" | "rejected";
89
+ }
90
+ //# sourceMappingURL=post-book-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-book-types.d.ts","sourceRoot":"","sources":["../../src/contract/post-book-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,eAAe,EACf,KAAK,EACN,MAAM,YAAY,CAAA;AAEnB,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,oEAAoE;IACpE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,cAAc,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,WAAW,CAAA;IAClB,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,qEAAqE;IACrE,gBAA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