@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.
@@ -0,0 +1,504 @@
1
+ /**
2
+ * Flight contract types — shapes mirror voyant-cloud's `connect-flight-contract`
3
+ * so adapters are portable across Voyant Cloud and Voyant Catalog deployments.
4
+ *
5
+ * These are the load-bearing data structures: `FlightSegment`, `Itinerary`,
6
+ * `FlightOffer`, `FlightOrder`, `FlightSearchRequest`, `FlightBookRequest`,
7
+ * the `paymentIntent` discriminated union, and the capability id namespace.
8
+ *
9
+ * **Drift policy:** when voyant-cloud's `connect-flight-contract` evolves,
10
+ * mirror the additive changes here. Breaking changes flow through a
11
+ * coordinated release across both packages.
12
+ *
13
+ * See `docs/architecture/catalog-flights-architecture.md` §3.
14
+ */
15
+ /** Cabin class. Standard IATA-aligned vocabulary. */
16
+ export type CabinClass = "economy" | "premium_economy" | "business" | "first";
17
+ /** Passenger type. Affects fare lookup and ticketing rules. */
18
+ export type PassengerType = "adult" | "child" | "infant" | "senior" | "youth";
19
+ /** Currency + amount. */
20
+ export interface Money {
21
+ amount: string;
22
+ currency: string;
23
+ }
24
+ /**
25
+ * One segment of an itinerary — from departure airport to arrival airport
26
+ * on a specific carrier + flight number.
27
+ */
28
+ export interface FlightSegment {
29
+ segmentId: string;
30
+ carrierCode: string;
31
+ flightNumber: string;
32
+ /** Operating carrier when different from the marketing carrier. */
33
+ operatingCarrierCode?: string;
34
+ operatingFlightNumber?: string;
35
+ departure: {
36
+ iataCode: string;
37
+ terminal?: string;
38
+ at: string;
39
+ };
40
+ arrival: {
41
+ iataCode: string;
42
+ terminal?: string;
43
+ at: string;
44
+ };
45
+ duration?: string;
46
+ aircraft?: string;
47
+ cabin: CabinClass;
48
+ fareClass?: string;
49
+ fareBasis?: string;
50
+ status?: string;
51
+ /** Provider-specific data — opaque round-trip. */
52
+ providerData?: Record<string, unknown>;
53
+ }
54
+ /**
55
+ * One itinerary (journey leg) — a sequence of segments. Round-trip and
56
+ * multi-city offers have multiple itineraries.
57
+ */
58
+ export interface Itinerary {
59
+ segments: FlightSegment[];
60
+ duration?: string;
61
+ }
62
+ /** Per-passenger fare breakdown line. */
63
+ export interface FareBreakdown {
64
+ passengerType: PassengerType;
65
+ passengerCount: number;
66
+ baseFare: Money;
67
+ taxes: Money;
68
+ fees?: Money;
69
+ total: Money;
70
+ fareFamily?: string;
71
+ }
72
+ /**
73
+ * A priced flight proposition. Returned by `searchFlights`; passed back to
74
+ * `priceOffer` and `bookFlight`. Always vertical-specific — never collapse
75
+ * into a generic `Offer` (per architecture §1.1 and `UBIQUITOUS_LANGUAGE.md`).
76
+ */
77
+ export interface FlightOffer {
78
+ offerId: string;
79
+ /** Source identifier — typically the connection id or adapter slug. */
80
+ source: string;
81
+ itineraries: Itinerary[];
82
+ fareBreakdowns: FareBreakdown[];
83
+ totalPrice: Money;
84
+ validatingCarrier?: string;
85
+ /** ISO 8601 — when the offer expires (provider may refuse to book after). */
86
+ expiresAt?: string;
87
+ /** ISO 8601 — last ticketing date. */
88
+ lastTicketingDate?: string;
89
+ instantTicketing?: boolean;
90
+ /**
91
+ * Branded fare bundles available for this offer (Basic / Standard / Plus
92
+ * style). Optional — adapters that don't surface branded fares omit this
93
+ * field; the offer's `totalPrice` is then the only fare. Bundles are
94
+ * defined per-offer; for round-trip flows where each leg is its own
95
+ * offer, callers fetch bundles per leg and submit picks via
96
+ * `AncillarySelection.fareBundle`.
97
+ */
98
+ fareBundles?: FareBundle[];
99
+ /** Provider-specific data — opaque round-trip. */
100
+ providerData?: Record<string, unknown>;
101
+ }
102
+ /**
103
+ * A branded fare upsell tier. Tiers add inclusions (bag, seat, refund
104
+ * flexibility) on top of the offer's base fare for a per-pax delta.
105
+ */
106
+ export interface FareBundle {
107
+ id: string;
108
+ /** Display label, e.g. "Wizz Standard", "Plus", "Lufthansa Light". */
109
+ label: string;
110
+ /** Tier hint — UI uses it to badge / order tiles. */
111
+ tier: "basic" | "standard" | "plus" | "premium";
112
+ /** Per-adult price delta on top of `FlightOffer.totalPrice`. */
113
+ priceDelta: Money;
114
+ /** Highlights the recommended tier in the UI (typically "standard"). */
115
+ recommended?: boolean;
116
+ /** Structured inclusions — UI renders as a checklist on the tile. */
117
+ inclusions: FareBundleInclusions;
118
+ /** Provider-specific data — opaque round-trip. */
119
+ providerData?: Record<string, unknown>;
120
+ }
121
+ export interface FareBundleInclusions {
122
+ /** Cabin / personal item allowance. */
123
+ cabinBag?: {
124
+ included: boolean;
125
+ weightKg?: number;
126
+ };
127
+ /** Checked baggage allowance. */
128
+ checkedBag?: {
129
+ included: boolean;
130
+ pieces?: number;
131
+ weightKg?: number;
132
+ };
133
+ /** Seat selection rights. `free` = pick any seat; `standard` = standard only. */
134
+ seatSelection?: "none" | "standard" | "free";
135
+ /** Priority boarding. */
136
+ priorityBoarding?: boolean;
137
+ /** Lounge access. */
138
+ loungeAccess?: boolean;
139
+ /** Refundable status — typically false for basic, partial for standard, true for plus. */
140
+ refundable?: boolean;
141
+ /** Date / time changes allowed without fee. */
142
+ changeable?: boolean;
143
+ /** Free-text additional perks the carrier wants to surface. */
144
+ notes?: string[];
145
+ }
146
+ /**
147
+ * One slice of a search request. Slice count determines trip type:
148
+ * - 1 slice → one-way
149
+ * - 2 slices → round-trip
150
+ * - 3+ → multi-city / open-jaw
151
+ */
152
+ export interface FlightSlice {
153
+ origin: string;
154
+ destination: string;
155
+ departureDate: string;
156
+ departureTimeWindow?: {
157
+ earliest?: string;
158
+ latest?: string;
159
+ };
160
+ }
161
+ export interface PassengerCounts {
162
+ adults: number;
163
+ children?: number;
164
+ infants?: number;
165
+ }
166
+ /**
167
+ * Pagination cursor for results. Adapters that don't support pagination
168
+ * may ignore this entirely and return the full result set on every call.
169
+ *
170
+ * `cursor` is opaque to the caller — it's whatever the previous response
171
+ * returned in `pagination.cursor`. The demo adapter uses 1-indexed page
172
+ * numbers; real connectors typically return GDS-issued continuation tokens.
173
+ */
174
+ export interface FlightSearchPagination {
175
+ /** Max offers per page. Adapters may cap or ignore. */
176
+ limit?: number;
177
+ /** Continuation token from the prior response, or omitted for first page. */
178
+ cursor?: string;
179
+ }
180
+ /**
181
+ * Pagination metadata returned by the adapter alongside the offer page.
182
+ * `total` is the count BEFORE pagination but AFTER any server-side filters
183
+ * declared on the request — so the UI can render "Showing 1-20 of 47".
184
+ */
185
+ export interface FlightSearchPaginationMeta {
186
+ total: number;
187
+ /** Cursor to pass for the next page, omitted on the last page. */
188
+ cursor?: string;
189
+ /** Convenience flag — equivalent to `cursor != null`. */
190
+ hasMore: boolean;
191
+ }
192
+ export interface FlightSearchRequest {
193
+ slices: FlightSlice[];
194
+ passengers: PassengerCounts;
195
+ cabin?: CabinClass;
196
+ searchOptions?: {
197
+ directOnly?: boolean;
198
+ maxStops?: number;
199
+ minConnectionMinutes?: number;
200
+ includeCarriers?: string[];
201
+ excludeCarriers?: string[];
202
+ /**
203
+ * Cap the offer total price (in offer currency). Adapters that don't
204
+ * declare currency-aware filtering should treat this as a same-currency
205
+ * cap and skip offers priced above it.
206
+ */
207
+ maxPrice?: number;
208
+ };
209
+ /**
210
+ * Optional pagination cursor. Adapters that don't support pagination
211
+ * may ignore this and return the full result set.
212
+ */
213
+ pagination?: FlightSearchPagination;
214
+ }
215
+ /**
216
+ * Intent-driven booking — caller declares what they want, system honors
217
+ * or rejects per the adapter's declared capabilities. Default if omitted:
218
+ * `{ type: "hold" }`.
219
+ */
220
+ export type PaymentIntent = {
221
+ type: "hold";
222
+ } | {
223
+ type: "card";
224
+ token: string;
225
+ cardholderName?: string;
226
+ billingAddress?: BillingAddress;
227
+ } | {
228
+ type: "ticket_on_credit";
229
+ iataCode?: string;
230
+ };
231
+ export interface BillingAddress {
232
+ line1: string;
233
+ line2?: string;
234
+ city: string;
235
+ region?: string;
236
+ postalCode?: string;
237
+ countryCode: string;
238
+ }
239
+ export interface FlightPassenger {
240
+ passengerId: string;
241
+ type: PassengerType;
242
+ firstName: string;
243
+ middleName?: string;
244
+ lastName: string;
245
+ dateOfBirth: string;
246
+ gender?: "M" | "F" | "X";
247
+ email?: string;
248
+ phone?: string;
249
+ documents?: TravelDocument[];
250
+ }
251
+ export interface TravelDocument {
252
+ type: "passport" | "national_id" | "visa";
253
+ number: string;
254
+ countryOfIssue: string;
255
+ countryOfNationality?: string;
256
+ expiryDate?: string;
257
+ }
258
+ export interface FlightBookRequest {
259
+ offerId: string;
260
+ /** Provider-specific re-priced offer payload, when the adapter requires it. */
261
+ offer?: FlightOffer;
262
+ passengers: FlightPassenger[];
263
+ contact?: {
264
+ email?: string;
265
+ phone?: string;
266
+ };
267
+ paymentIntent?: PaymentIntent;
268
+ /**
269
+ * Optional ancillary picks (bags / assistance / extras) collected at
270
+ * checkout. Adapters that don't declare `flight/ancillaries` must accept
271
+ * this field but ignore it; supporting adapters echo the picks back on
272
+ * the resulting `FlightOrder.providerData` and reflect prices in the
273
+ * order total.
274
+ */
275
+ ancillaries?: AncillarySelection;
276
+ }
277
+ export type FlightOrderStatus = "pending" | "confirmed" | "ticketed" | "cancelled" | "failed";
278
+ export interface FlightTicket {
279
+ ticketNumber: string;
280
+ passengerId: string;
281
+ segmentIds: string[];
282
+ status?: string;
283
+ }
284
+ export interface FlightOrder {
285
+ orderId: string;
286
+ /** PNR / record locator. */
287
+ pnr?: string;
288
+ status: FlightOrderStatus;
289
+ offer: FlightOffer;
290
+ passengers: FlightPassenger[];
291
+ contact?: {
292
+ email?: string;
293
+ phone?: string;
294
+ };
295
+ tickets?: FlightTicket[];
296
+ totalPrice: Money;
297
+ /** ISO 8601 — deadline before the hold expires (held orders only). */
298
+ paymentDeadline?: string;
299
+ createdAt: string;
300
+ updatedAt?: string;
301
+ /** Provider-specific data — opaque round-trip. */
302
+ providerData?: Record<string, unknown>;
303
+ }
304
+ /**
305
+ * Bag option offered for a single itinerary. Per-pax pricing — the UI
306
+ * multiplies by quantity + selected pax count.
307
+ */
308
+ export interface AncillaryBaggageOption {
309
+ id: string;
310
+ /** Display label, e.g. "20 kg checked bag". */
311
+ label: string;
312
+ /** Bag category. `personal_item` is the under-seat bag; `cabin` is overhead. */
313
+ category: "checked" | "cabin" | "personal_item" | "sports" | "oversized";
314
+ weightKg?: number;
315
+ dimensions?: {
316
+ lengthCm?: number;
317
+ widthCm?: number;
318
+ heightCm?: number;
319
+ };
320
+ /** Per-pax per-leg price. */
321
+ price: Money;
322
+ /** Hint that the UI should highlight this tier (typical: 20kg). */
323
+ recommended?: boolean;
324
+ /** Provider-specific data — opaque round-trip. */
325
+ providerData?: Record<string, unknown>;
326
+ }
327
+ /** Special-assistance option. Most are free; a few carriers charge. */
328
+ export interface AncillaryAssistanceOption {
329
+ id: string;
330
+ label: string;
331
+ category: "wheelchair" | "visual" | "hearing" | "cognitive" | "medical" | "other";
332
+ /** Free when omitted. */
333
+ price?: Money;
334
+ /** Free-text guidance for the operator (e.g. "Bring own equipment"). */
335
+ notes?: string;
336
+ }
337
+ /** Catch-all extras: priority boarding, pet in cabin, lounge access, etc. */
338
+ export interface AncillaryExtraOption {
339
+ id: string;
340
+ label: string;
341
+ /** Provider-defined tag — UI may group by this. */
342
+ category: string;
343
+ price: Money;
344
+ /** Per-pax (default) vs per-booking pricing. */
345
+ pricingScope?: "per_passenger" | "per_booking";
346
+ }
347
+ /**
348
+ * Catalog of ancillaries available for one offer. The catalog is offer-scoped
349
+ * because availability and pricing depend on the booked itinerary (carrier,
350
+ * cabin, route, fare class). For round-trip flows where the journey is
351
+ * composed of two single-leg offers, the UI fetches one catalog per leg.
352
+ */
353
+ export interface AncillaryCatalog {
354
+ baggage: AncillaryBaggageOption[];
355
+ assistance: AncillaryAssistanceOption[];
356
+ extras: AncillaryExtraOption[];
357
+ }
358
+ export interface AncillaryRequest {
359
+ offerId: string;
360
+ /** Some providers require the offer payload echoed back. */
361
+ offer?: FlightOffer;
362
+ }
363
+ export interface AncillaryResponse {
364
+ catalog: AncillaryCatalog;
365
+ /** ISO 8601 — when this catalog quote stops being valid for booking. */
366
+ validUntil?: string;
367
+ }
368
+ /**
369
+ * Ancillary selection submitted with `bookFlight`. Picks are indexed by
370
+ * passenger id and (for per-leg picks) by slice index — slice 0 = outbound,
371
+ * slice 1 = return (matching the order in `FlightOffer.itineraries`).
372
+ *
373
+ * The shape stays additive: providers that introduce per-segment seat picks
374
+ * later get a sibling field on this interface, not a breaking change.
375
+ */
376
+ export interface AncillarySelection {
377
+ /** Per-pax per-slice baggage picks. */
378
+ baggage?: Array<{
379
+ passengerId: string;
380
+ sliceIndex: number;
381
+ optionId: string;
382
+ /** Defaults to 1 — same option may be picked multiple times per pax. */
383
+ quantity?: number;
384
+ }>;
385
+ /** Per-pax assistance picks. Trip-wide (not per-slice) by convention. */
386
+ assistance?: Array<{
387
+ passengerId: string;
388
+ optionId: string;
389
+ }>;
390
+ /** Per-pax per-slice extras (priority boarding, sports equipment, etc.). */
391
+ extras?: Array<{
392
+ passengerId: string;
393
+ sliceIndex: number;
394
+ optionId: string;
395
+ quantity?: number;
396
+ }>;
397
+ /**
398
+ * Per-pax per-segment seat picks. Seats are assigned at the segment level
399
+ * (not the slice level) because a multi-stop itinerary requires distinct
400
+ * picks per leg of the journey. Omit any pax/segment combination to defer
401
+ * the assignment to airline auto-allocation.
402
+ */
403
+ seats?: Array<{
404
+ passengerId: string;
405
+ segmentId: string;
406
+ seatNumber: string;
407
+ }>;
408
+ /**
409
+ * Per-pax per-slice branded fare bundle picks (e.g. Adult 1 on Standard
410
+ * outbound + Plus return; Adult 2 on Basic both legs). Omit any
411
+ * pax/slice combination to keep that pax on the offer's base "Basic"
412
+ * fare for that leg. The shell defaults to applying one pick to all pax
413
+ * on a leg ("Same fare for all passengers" toggle), but the contract
414
+ * stays honest about the per-pax shape — many full-service carriers
415
+ * (LH, BA, AF) and B2B agency bookings actually exercise per-pax mixes.
416
+ */
417
+ fareBundle?: Array<{
418
+ passengerId: string;
419
+ sliceIndex: number;
420
+ bundleId: string;
421
+ }>;
422
+ }
423
+ /**
424
+ * One seat on a seat map. Seats are addressed by an airline-style
425
+ * row+column code (e.g. "12A") — the canonical identifier for booking. The
426
+ * `category` drives how the UI styles + prices the seat.
427
+ */
428
+ export interface Seat {
429
+ /** Combined row+column, e.g. "12A". Stable across the seat map call. */
430
+ seatNumber: string;
431
+ /** Row number, 1-indexed (matches airline numbering). */
432
+ row: number;
433
+ /** Column letter, e.g. "A", "B", "F". */
434
+ column: string;
435
+ status: "available" | "blocked" | "unavailable" | "selected";
436
+ category: "standard" | "preferred" | "extra_legroom" | "exit_row" | "premium" | "bulkhead";
437
+ /** Per-pax seat fee. Omitted = included in fare. */
438
+ price?: Money;
439
+ /**
440
+ * Provider hint about restrictions: e.g. "exit_row_restrictions",
441
+ * "no_recline". Free-text, opaque to the UI; surface as a tooltip badge.
442
+ */
443
+ notes?: string;
444
+ /** True for window seats. */
445
+ window?: boolean;
446
+ /** True for aisle seats. */
447
+ aisle?: boolean;
448
+ /** Provider-specific data — opaque round-trip. */
449
+ providerData?: Record<string, unknown>;
450
+ }
451
+ export interface SeatRow {
452
+ /** 1-indexed row number. */
453
+ row: number;
454
+ /** Seats in cabin-order (left-to-right). Sparse: gaps render as aisles. */
455
+ seats: Seat[];
456
+ }
457
+ export interface SeatMap {
458
+ segmentId: string;
459
+ /** Aircraft IATA code if known — UI may display the model name. */
460
+ aircraft?: string;
461
+ /** Cabin class this map applies to. */
462
+ cabin: CabinClass;
463
+ /**
464
+ * Column layout — letters in cabin order, with `null` for aisle gaps.
465
+ * Example narrow-body 3-3: `["A","B","C",null,"D","E","F"]`.
466
+ * Example wide-body 3-3-3: `["A","B","C",null,"D","E","F",null,"G","H","J"]`.
467
+ */
468
+ columnLayout: Array<string | null>;
469
+ rows: SeatRow[];
470
+ /** Provider-specific data — opaque round-trip. */
471
+ providerData?: Record<string, unknown>;
472
+ }
473
+ export interface SeatMapRequest {
474
+ offerId: string;
475
+ segmentId: string;
476
+ /** Some providers require the offer payload echoed back. */
477
+ offer?: FlightOffer;
478
+ }
479
+ export interface SeatMapResponse {
480
+ seatMap: SeatMap;
481
+ /** ISO 8601 — when this seat map quote stops being valid for booking. */
482
+ validUntil?: string;
483
+ }
484
+ export type { CheckInRequest, CheckInResponse, CheckInStatus, FlightBoardingPass, FlightModifyReason, FlightModifyRequest, FlightModifyResponse, FlightRefundReason, FlightRefundRequest, FlightRefundResponse, FlightVoidResponse, SeatAssignment, SeatSelectionRequest, SeatSelectionResponse, SsrCode, SsrRequest, SsrResponse, } from "./post-book-types.js";
485
+ /**
486
+ * Capability ids declared per connection. Adapters that don't declare a
487
+ * capability stub the corresponding method with `CAPABILITY_NOT_SUPPORTED`.
488
+ */
489
+ export declare const FLIGHT_CAPABILITIES: {
490
+ readonly HOLDS: "flight/holds";
491
+ readonly SEATMAP: "flight/seatmap";
492
+ readonly SEAT_SELECTION: "flight/seat-selection";
493
+ readonly ANCILLARIES: "flight/ancillaries";
494
+ readonly CHECKIN: "flight/checkin";
495
+ readonly EXCHANGE: "flight/exchange";
496
+ readonly REFUND: "flight/refund";
497
+ readonly VOID: "flight/void";
498
+ readonly SSR: "flight/ssr";
499
+ readonly BRANDED_FARES: "flight/branded-fares";
500
+ /** `listOrders(ctx, query)` is queryable — the adapter persists orders. */
501
+ readonly LIST_ORDERS: "flight/list-orders";
502
+ };
503
+ export type FlightCapability = (typeof FLIGHT_CAPABILITIES)[keyof typeof FLIGHT_CAPABILITIES];
504
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/contract/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,qDAAqD;AACrD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,iBAAiB,GAAG,UAAU,GAAG,OAAO,CAAA;AAE7E,+DAA+D;AAC/D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE7E,yBAAyB;AACzB,M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AA;CACvC;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,WAAW,CAAA;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,YAAY,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,EACP,UAAU,EACV,WAAW,GACZ,MAAM,sBAAsB,CAAA;AAM7B;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;IAW9B,2EAA2E;;CAEnE,CAAA;AAEV,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAA"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Flight contract types — shapes mirror voyant-cloud's `connect-flight-contract`
3
+ * so adapters are portable across Voyant Cloud and Voyant Catalog deployments.
4
+ *
5
+ * These are the load-bearing data structures: `FlightSegment`, `Itinerary`,
6
+ * `FlightOffer`, `FlightOrder`, `FlightSearchRequest`, `FlightBookRequest`,
7
+ * the `paymentIntent` discriminated union, and the capability id namespace.
8
+ *
9
+ * **Drift policy:** when voyant-cloud's `connect-flight-contract` evolves,
10
+ * mirror the additive changes here. Breaking changes flow through a
11
+ * coordinated release across both packages.
12
+ *
13
+ * See `docs/architecture/catalog-flights-architecture.md` §3.
14
+ */
15
+ // ─────────────────────────────────────────────────────────────────────────────
16
+ // Capability ids
17
+ // ─────────────────────────────────────────────────────────────────────────────
18
+ /**
19
+ * Capability ids declared per connection. Adapters that don't declare a
20
+ * capability stub the corresponding method with `CAPABILITY_NOT_SUPPORTED`.
21
+ */
22
+ export const FLIGHT_CAPABILITIES = {
23
+ HOLDS: "flight/holds",
24
+ SEATMAP: "flight/seatmap",
25
+ SEAT_SELECTION: "flight/seat-selection",
26
+ ANCILLARIES: "flight/ancillaries",
27
+ CHECKIN: "flight/checkin",
28
+ EXCHANGE: "flight/exchange",
29
+ REFUND: "flight/refund",
30
+ VOID: "flight/void",
31
+ SSR: "flight/ssr",
32
+ BRANDED_FARES: "flight/branded-fares",
33
+ /** `listOrders(ctx, query)` is queryable — the adapter persists orders. */
34
+ LIST_ORDERS: "flight/list-orders",
35
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contracts.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.test.d.ts","sourceRoot":"","sources":["../src/contracts.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { flightSearchRequestSchema, moneySchema } from "./index.js";
3
+ describe("@voyantjs/flights-contracts barrel", () => {
4
+ it("parses a minimal valid flight search request", () => {
5
+ const value = {
6
+ slices: [{ origin: "LHR", destination: "JFK", departureDate: "2026-10-15" }],
7
+ passengers: { adults: 1 },
8
+ cabin: "economy",
9
+ };
10
+ expect(flightSearchRequestSchema.parse(value)).toEqual(value);
11
+ });
12
+ it("rejects an invalid flight search request", () => {
13
+ expect(flightSearchRequestSchema.safeParse({ slices: [], passengers: { adults: -1 } }).success).toBe(false);
14
+ });
15
+ it("rejects money with a non-decimal-string amount", () => {
16
+ expect(moneySchema.safeParse({ amount: 600, currency: "USD" }).success).toBe(false);
17
+ });
18
+ });
@@ -0,0 +1,7 @@
1
+ export * from "./contract/adapter.js";
2
+ export * from "./contract/post-book-types.js";
3
+ export * from "./contract/schemas.js";
4
+ export * from "./contract/types.js";
5
+ export * from "./reference/contract.js";
6
+ export * from "./reference/static-bundle.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./contract/adapter.js";
2
+ export * from "./contract/post-book-types.js";
3
+ export * from "./contract/schemas.js";
4
+ export * from "./contract/types.js";
5
+ export * from "./reference/contract.js";
6
+ export * from "./reference/static-bundle.js";