@molecule/api-flights 1.0.3 → 1.0.5

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.
Files changed (2) hide show
  1. package/README.md +160 -160
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -3,15 +3,11 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-08-04T01:48:14.014Z
6
+ Generated: 2026-10-26T04:22:46.981Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-flights
10
10
 
11
- > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
- > It is written to be read by coding agents as much as by people, and is generated from this
13
- > package's source — edit `src/index.ts` JSDoc, not this file.
14
-
15
11
  Provider-agnostic flights interface for molecule.dev.
16
12
 
17
13
  Defines the {@link FlightsProvider} interface for flight search +
@@ -20,6 +16,10 @@ interface. Application code uses the convenience functions
20
16
  (`searchFlights`, `getOffer`, `priceOffer`) which delegate to the bonded
21
17
  provider.
22
18
 
19
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
20
+ > It is written to be read by coding agents as much as by people, and is generated from this
21
+ > package's source — edit `src/index.ts` JSDoc, not this file.
22
+
23
23
  ## Quick Start
24
24
 
25
25
  ```typescript
@@ -50,6 +50,73 @@ npm install @molecule/api-flights @molecule/api-bond @molecule/api-i18n
50
50
 
51
51
  ### Interfaces
52
52
 
53
+ #### `Segment`
54
+
55
+ One leg of a {@link FlightOffer} — a single take-off / landing pair on a
56
+ single operated flight.
57
+
58
+ ```typescript
59
+ interface Segment {
60
+ /**
61
+ * Departure airport / instant.
62
+ */
63
+ departure: SegmentEndpoint
64
+
65
+ /**
66
+ * Arrival airport / instant.
67
+ */
68
+ arrival: SegmentEndpoint
69
+
70
+ /**
71
+ * Marketing carrier IATA code (e.g. `'AA'`, `'BA'`).
72
+ */
73
+ carrier: CarrierCode
74
+
75
+ /**
76
+ * Marketing flight number (e.g. `'100'`, `'1234'`).
77
+ *
78
+ * String rather than number to preserve any leading zeros and to
79
+ * accommodate alphanumeric carriers (e.g. EasyJet's `'EZY'` prefix).
80
+ */
81
+ flightNumber: string
82
+
83
+ /**
84
+ * IATA aircraft code (e.g. `'77W'`, `'320'`). `null` when the upstream
85
+ * does not supply aircraft data for this segment.
86
+ */
87
+ aircraft?: string | null
88
+
89
+ /**
90
+ * Block / total time the segment is in the air. `null` when the upstream
91
+ * does not supply per-segment duration.
92
+ */
93
+ duration?: IsoDuration | null
94
+ }
95
+ ```
96
+
97
+ #### `SegmentEndpoint`
98
+
99
+ Departure or arrival point on a {@link Segment}.
100
+
101
+ ```typescript
102
+ interface SegmentEndpoint {
103
+ /**
104
+ * IATA airport code (e.g. `'JFK'`).
105
+ */
106
+ airport: AirportCode
107
+
108
+ /**
109
+ * Local-time instant including timezone offset.
110
+ */
111
+ at: IsoDateTime
112
+
113
+ /**
114
+ * Terminal designator (e.g. `'4'`, `'2A'`). `null` when not supplied.
115
+ */
116
+ terminal?: string | null
117
+ }
118
+ ```
119
+
53
120
  #### `FlightOffer`
54
121
 
55
122
  Normalized flight offer returned by
@@ -105,45 +172,34 @@ interface FlightOfferDetail extends FlightOffer {
105
172
  }
106
173
  ```
107
174
 
108
- #### `FlightsProvider`
109
-
110
- Flights provider interface.
175
+ #### `TravelerPricing`
111
176
 
112
- All flight providers (Amadeus, Duffel, Sabre, etc.) implement this
113
- interface. The interface is deliberately minimal so providers with very
114
- different upstream APIs can satisfy it identically. Providers that lack
115
- a "fetch single offer" call typically implement {@link getOffer} by
116
- round-tripping through their pricing endpoint and returning the priced
117
- offer.
177
+ Per-passenger price row inside {@link FlightOfferDetail.travelerPricings}.
118
178
 
119
179
  ```typescript
120
- interface FlightsProvider {
180
+ interface TravelerPricing {
121
181
  /**
122
- * Searches for flight offers matching the supplied itinerary.
123
- *
124
- * @param options - Search parameters (origin, destination, dates,
125
- * passenger counts, cabin, etc.).
126
- * @returns Array of normalized flight offers.
182
+ * Provider-specific traveler id (typically a 1-indexed string).
127
183
  */
128
- searchFlights(options: SearchFlightsOptions): Promise<FlightOffer[]>
184
+ travelerId: string
129
185
 
130
186
  /**
131
- * Retrieves a previously-searched offer in detail.
132
- *
133
- * @param offerId - Opaque offer identifier returned by
134
- * {@link searchFlights}.
135
- * @returns The offer with per-passenger price breakdown when available.
187
+ * Adult, child, or infant. The infant variant is split between
188
+ * lap-infants (`'held-infant'`) and seated infants (`'seated-infant'`)
189
+ * because they are priced differently by most carriers.
136
190
  */
137
- getOffer(offerId: OfferId): Promise<FlightOfferDetail>
191
+ travelerType: 'adult' | 'child' | 'held-infant' | 'seated-infant'
138
192
 
139
193
  /**
140
- * Confirms the up-to-the-minute price for a previously-searched offer.
141
- *
142
- * @param offerId - Opaque offer identifier returned by
143
- * {@link searchFlights}.
144
- * @returns Authoritative price snapshot.
194
+ * Total price for this traveler in the offer's currency.
145
195
  */
146
- priceOffer(offerId: OfferId): Promise<PricingResult>
196
+ price: number
197
+
198
+ /**
199
+ * Cabin class booked for this traveler. `null` when mixed across
200
+ * segments or not supplied.
201
+ */
202
+ cabin?: CabinClass | null
147
203
  }
148
204
  ```
149
205
 
@@ -241,101 +297,45 @@ interface SearchFlightsOptions {
241
297
  }
242
298
  ```
243
299
 
244
- #### `Segment`
245
-
246
- One leg of a {@link FlightOffer} — a single take-off / landing pair on a
247
- single operated flight.
248
-
249
- ```typescript
250
- interface Segment {
251
- /**
252
- * Departure airport / instant.
253
- */
254
- departure: SegmentEndpoint
255
-
256
- /**
257
- * Arrival airport / instant.
258
- */
259
- arrival: SegmentEndpoint
260
-
261
- /**
262
- * Marketing carrier IATA code (e.g. `'AA'`, `'BA'`).
263
- */
264
- carrier: CarrierCode
265
-
266
- /**
267
- * Marketing flight number (e.g. `'100'`, `'1234'`).
268
- *
269
- * String rather than number to preserve any leading zeros and to
270
- * accommodate alphanumeric carriers (e.g. EasyJet's `'EZY'` prefix).
271
- */
272
- flightNumber: string
273
-
274
- /**
275
- * IATA aircraft code (e.g. `'77W'`, `'320'`). `null` when the upstream
276
- * does not supply aircraft data for this segment.
277
- */
278
- aircraft?: string | null
279
-
280
- /**
281
- * Block / total time the segment is in the air. `null` when the upstream
282
- * does not supply per-segment duration.
283
- */
284
- duration?: IsoDuration | null
285
- }
286
- ```
287
-
288
- #### `SegmentEndpoint`
289
-
290
- Departure or arrival point on a {@link Segment}.
291
-
292
- ```typescript
293
- interface SegmentEndpoint {
294
- /**
295
- * IATA airport code (e.g. `'JFK'`).
296
- */
297
- airport: AirportCode
298
-
299
- /**
300
- * Local-time instant including timezone offset.
301
- */
302
- at: IsoDateTime
303
-
304
- /**
305
- * Terminal designator (e.g. `'4'`, `'2A'`). `null` when not supplied.
306
- */
307
- terminal?: string | null
308
- }
309
- ```
300
+ #### `FlightsProvider`
310
301
 
311
- #### `TravelerPricing`
302
+ Flights provider interface.
312
303
 
313
- Per-passenger price row inside {@link FlightOfferDetail.travelerPricings}.
304
+ All flight providers (Amadeus, Duffel, Sabre, etc.) implement this
305
+ interface. The interface is deliberately minimal so providers with very
306
+ different upstream APIs can satisfy it identically. Providers that lack
307
+ a "fetch single offer" call typically implement {@link getOffer} by
308
+ round-tripping through their pricing endpoint and returning the priced
309
+ offer.
314
310
 
315
311
  ```typescript
316
- interface TravelerPricing {
317
- /**
318
- * Provider-specific traveler id (typically a 1-indexed string).
319
- */
320
- travelerId: string
321
-
312
+ interface FlightsProvider {
322
313
  /**
323
- * Adult, child, or infant. The infant variant is split between
324
- * lap-infants (`'held-infant'`) and seated infants (`'seated-infant'`)
325
- * because they are priced differently by most carriers.
314
+ * Searches for flight offers matching the supplied itinerary.
315
+ *
316
+ * @param options - Search parameters (origin, destination, dates,
317
+ * passenger counts, cabin, etc.).
318
+ * @returns Array of normalized flight offers.
326
319
  */
327
- travelerType: 'adult' | 'child' | 'held-infant' | 'seated-infant'
320
+ searchFlights(options: SearchFlightsOptions): Promise<FlightOffer[]>
328
321
 
329
322
  /**
330
- * Total price for this traveler in the offer's currency.
323
+ * Retrieves a previously-searched offer in detail.
324
+ *
325
+ * @param offerId - Opaque offer identifier returned by
326
+ * {@link searchFlights}.
327
+ * @returns The offer with per-passenger price breakdown when available.
331
328
  */
332
- price: number
329
+ getOffer(offerId: OfferId): Promise<FlightOfferDetail>
333
330
 
334
331
  /**
335
- * Cabin class booked for this traveler. `null` when mixed across
336
- * segments or not supplied.
332
+ * Confirms the up-to-the-minute price for a previously-searched offer.
333
+ *
334
+ * @param offerId - Opaque offer identifier returned by
335
+ * {@link searchFlights}.
336
+ * @returns Authoritative price snapshot.
337
337
  */
338
- cabin?: CabinClass | null
338
+ priceOffer(offerId: OfferId): Promise<PricingResult>
339
339
  }
340
340
  ```
341
341
 
@@ -353,17 +353,6 @@ upstream exposes.
353
353
  type AirportCode = string
354
354
  ```
355
355
 
356
- #### `CabinClass`
357
-
358
- Cabin class enumeration.
359
-
360
- Providers map each value onto whatever upstream code they require
361
- (e.g. Amadeus uses `'ECONOMY' | 'PREMIUM_ECONOMY' | 'BUSINESS' | 'FIRST'`).
362
-
363
- ```typescript
364
- type CabinClass = 'economy' | 'premium-economy' | 'business' | 'first'
365
- ```
366
-
367
356
  #### `CarrierCode`
368
357
 
369
358
  IATA two-character airline / marketing carrier code (e.g. `'AA'`,
@@ -373,17 +362,6 @@ IATA two-character airline / marketing carrier code (e.g. `'AA'`,
373
362
  type CarrierCode = string
374
363
  ```
375
364
 
376
- #### `CurrencyCode`
377
-
378
- ISO 4217 three-letter currency code (e.g. `'USD'`, `'EUR'`, `'JPY'`).
379
-
380
- Conventionally upper-case to match {@link FlightOffer.currency} and the
381
- vast majority of upstream travel APIs.
382
-
383
- ```typescript
384
- type CurrencyCode = string
385
- ```
386
-
387
365
  #### `IsoDate`
388
366
 
389
367
  ISO 8601 calendar date (e.g. `'2026-07-15'`). Time-of-day MUST NOT be
@@ -416,6 +394,17 @@ whether they expose seconds-precision, fractional minutes, etc.
416
394
  type IsoDuration = string
417
395
  ```
418
396
 
397
+ #### `CurrencyCode`
398
+
399
+ ISO 4217 three-letter currency code (e.g. `'USD'`, `'EUR'`, `'JPY'`).
400
+
401
+ Conventionally upper-case to match {@link FlightOffer.currency} and the
402
+ vast majority of upstream travel APIs.
403
+
404
+ ```typescript
405
+ type CurrencyCode = string
406
+ ```
407
+
419
408
  #### `OfferId`
420
409
 
421
410
  Provider-specific offer identifier.
@@ -429,19 +418,30 @@ and MUST NOT be parsed by consumers.
429
418
  type OfferId = string
430
419
  ```
431
420
 
432
- ### Functions
421
+ #### `CabinClass`
433
422
 
434
- #### `getOffer(offerId)`
423
+ Cabin class enumeration.
435
424
 
436
- Retrieves a previously-searched offer in detail.
425
+ Providers map each value onto whatever upstream code they require
426
+ (e.g. Amadeus uses `'ECONOMY' | 'PREMIUM_ECONOMY' | 'BUSINESS' | 'FIRST'`).
437
427
 
438
428
  ```typescript
439
- function getOffer(offerId: string): Promise<FlightOfferDetail>
429
+ type CabinClass = 'economy' | 'premium-economy' | 'business' | 'first'
440
430
  ```
441
431
 
442
- - `offerId` — Opaque offer identifier returned by `searchFlights`.
432
+ ### Functions
443
433
 
444
- **Returns:** The offer with per-passenger price breakdown when available.
434
+ #### `setProvider(provider)`
435
+
436
+ Registers a flights provider as the active singleton. Called by bond
437
+ packages (e.g. `@molecule/api-flights-amadeus`) during application
438
+ startup.
439
+
440
+ ```typescript
441
+ function setProvider(provider: FlightsProvider): void
442
+ ```
443
+
444
+ - `provider` — The flights provider implementation to bond.
445
445
 
446
446
  #### `getProvider()`
447
447
 
@@ -463,41 +463,41 @@ function hasProvider(): boolean
463
463
 
464
464
  **Returns:** `true` if a flights provider is bonded.
465
465
 
466
- #### `priceOffer(offerId)`
466
+ #### `searchFlights(options)`
467
467
 
468
- Confirms the up-to-the-minute price for a previously-searched offer.
468
+ Searches for flight offers matching the supplied itinerary.
469
469
 
470
470
  ```typescript
471
- function priceOffer(offerId: string): Promise<PricingResult>
471
+ function searchFlights(options: SearchFlightsOptions): Promise<FlightOffer[]>
472
472
  ```
473
473
 
474
- - `offerId` — Opaque offer identifier returned by `searchFlights`.
474
+ - `options` — Search parameters (origin, destination, dates, passenger counts, cabin, etc.).
475
475
 
476
- **Returns:** Authoritative price snapshot.
476
+ **Returns:** Array of normalized flight offers.
477
477
 
478
- #### `searchFlights(options)`
478
+ #### `getOffer(offerId)`
479
479
 
480
- Searches for flight offers matching the supplied itinerary.
480
+ Retrieves a previously-searched offer in detail.
481
481
 
482
482
  ```typescript
483
- function searchFlights(options: SearchFlightsOptions): Promise<FlightOffer[]>
483
+ function getOffer(offerId: OfferId): Promise<FlightOfferDetail>
484
484
  ```
485
485
 
486
- - `options` — Search parameters (origin, destination, dates, passenger counts, cabin, etc.).
486
+ - `offerId` — Opaque offer identifier returned by `searchFlights`.
487
487
 
488
- **Returns:** Array of normalized flight offers.
488
+ **Returns:** The offer with per-passenger price breakdown when available.
489
489
 
490
- #### `setProvider(provider)`
490
+ #### `priceOffer(offerId)`
491
491
 
492
- Registers a flights provider as the active singleton. Called by bond
493
- packages (e.g. `@molecule/api-flights-amadeus`) during application
494
- startup.
492
+ Confirms the up-to-the-minute price for a previously-searched offer.
495
493
 
496
494
  ```typescript
497
- function setProvider(provider: FlightsProvider): void
495
+ function priceOffer(offerId: OfferId): Promise<PricingResult>
498
496
  ```
499
497
 
500
- - `provider` — The flights provider implementation to bond.
498
+ - `offerId` — Opaque offer identifier returned by `searchFlights`.
499
+
500
+ **Returns:** Authoritative price snapshot.
501
501
 
502
502
  ## Available Providers
503
503
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-flights",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Flight search + offer pricing core interface for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -33,11 +33,11 @@
33
33
  "@molecule/api-i18n": "^1.0.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@molecule/api-bond": "1.0.2",
37
- "@molecule/api-i18n": "1.0.3",
38
- "@types/node": "26.1.2",
36
+ "@molecule/api-bond": "1.0.4",
37
+ "@molecule/api-i18n": "1.0.5",
38
+ "@types/node": "26.6.5",
39
39
  "typescript": "6.0.3",
40
- "vitest": "4.1.11"
40
+ "vitest": "4.1.12"
41
41
  },
42
42
  "repository": {
43
43
  "type": "git",