sabre-client 0.3.0-next.1 → 0.3.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/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Q as QueueRef } from './queue-ref-BDGh8FrV.js';
2
+
1
3
  /** Token ATK tal cual se guarda: tiempos absolutos, para que otro proceso sepa cuánto le queda. */
2
4
  interface StoredToken {
3
5
  accessToken: string;
@@ -39,7 +41,13 @@ interface SabreLogger {
39
41
  }
40
42
  type SabreLogLevel = keyof SabreLogger;
41
43
  /** Eventos estables que emite el SDK como `message`. */
42
- type SabreLogEvent = 'sabre.request.start' | 'sabre.request.end' | 'sabre.request.retry' | 'sabre.request.rawResponseHookFailed' | 'sabre.auth.token.refresh' | 'sabre.auth.token.store';
44
+ type SabreLogEvent = 'sabre.request.start' | 'sabre.request.end' | 'sabre.request.retry' | 'sabre.request.rawResponseHookFailed' | 'sabre.auth.token.refresh' | 'sabre.auth.token.store' | 'sabre.booking.seat.priced' | 'sabre.session.open' | 'sabre.session.close' | 'sabre.session.closeFailed' | 'sabre.session.keepAliveFailed' | 'sabre.queue.exitTolerated' | 'sabre.queue.exitFailed';
45
+ /** Logger interno: redacta siempre el contexto y no hace nada si no hay logger. */
46
+ declare class EventLogger {
47
+ #private;
48
+ constructor(logger?: SabreLogger);
49
+ emit(level: SabreLogLevel, event: SabreLogEvent, context?: Record<string, unknown>): void;
50
+ }
43
51
 
44
52
  type SabreEnvironment = 'sandbox' | 'production';
45
53
  type SabreAuthVersion = 'v3' | 'v2';
@@ -93,6 +101,7 @@ interface ResolvedConfig {
93
101
  credentials: Readonly<SabreCredentials | SabreCredentialsV2>;
94
102
  environment: SabreEnvironment;
95
103
  baseUrl: string;
104
+ soapBaseUrl: string;
96
105
  authVersion: SabreAuthVersion;
97
106
  pcc: string | undefined;
98
107
  logger: SabreLogger | undefined;
@@ -138,6 +147,24 @@ declare class SabreGatewayError extends SabreError {
138
147
  readonly code: string | undefined;
139
148
  constructor(message: string, options: SabreGatewayErrorOptions);
140
149
  }
150
+ /**
151
+ * Por qué una sesión SOAP no sirve: `'limit'` (más de 50 sesiones), `'invalid'` (uso
152
+ * concurrente de la sesión), `'expired'` (sesión vencida) o `'blocked'` (creación de sesión
153
+ * bloqueada para el usuario).
154
+ */
155
+ type SabreSessionErrorKind = 'limit' | 'invalid' | 'expired' | 'blocked';
156
+ interface SabreSessionErrorOptions extends Omit<SabreGatewayErrorOptions, 'protocol'> {
157
+ kind: SabreSessionErrorKind;
158
+ }
159
+ /**
160
+ * Error de la sesión SOAP de `SabreLegacy`. Se distingue con `instanceof` y `kind`, sin comparar
161
+ * mensajes. La sesión que lo lanzó queda inutilizable: las llamadas siguientes lanzan sin red.
162
+ */
163
+ declare class SabreSessionError extends SabreGatewayError {
164
+ name: string;
165
+ readonly kind: SabreSessionErrorKind;
166
+ constructor(message: string, options: SabreSessionErrorOptions);
167
+ }
141
168
  interface SabreOrchestrationErrorOptions extends Omit<SabreErrorOptions, 'retryable'> {
142
169
  /** `SP.PROVIDER_ERROR` o `SP.INTERNAL_ERROR`. */
143
170
  code: string;
@@ -204,11 +231,14 @@ declare class SabreWarning extends SabreError {
204
231
  interface SabreRawResponse {
205
232
  /** Método público sin `sabre.`, p. ej. `'booking.get'` o `'air.bargainFinderMax'`. */
206
233
  operation: string;
207
- protocol: 'rest';
234
+ protocol: 'rest' | 'soap';
208
235
  /** HTTP status del intento que se entrega. */
209
236
  status: number;
210
237
  headers: Headers;
211
- /** Texto tal cual llegó, sin parsear. `''` si vino vacío. */
238
+ /**
239
+ * Texto tal cual llegó, sin parsear. `''` si vino vacío. En SOAP es el sobre completo, con
240
+ * una sola modificación: el valor de cada `BinarySecurityToken` va como `[REDACTED]`.
241
+ */
212
242
  body: string;
213
243
  /** Intentos HTTP hechos, contando los reintentos (1 si no hubo). */
214
244
  attempts: number;
@@ -271,6 +301,8 @@ interface RestTransportOptions {
271
301
  declare class RestTransport {
272
302
  #private;
273
303
  constructor(config: ResolvedConfig, options?: RestTransportOptions);
304
+ /** @internal Para los avisos de las operaciones que no son de una request (p. ej. asientos con precio). */
305
+ get log(): EventLogger;
274
306
  /** Punto de enganche para `AuthManager`. */
275
307
  setAuthorizationProvider(provider: AuthorizationProvider | undefined): void;
276
308
  request<T>(request: RestRequest): Promise<T>;
@@ -715,6 +747,309 @@ interface RequestOptions {
715
747
  retry?: Partial<RetryOptions>;
716
748
  }
717
749
 
750
+ /** `KeyValuePair` del spec. */
751
+ interface SeatKeyValuePair {
752
+ key: string;
753
+ value: string;
754
+ }
755
+ /** `LoyaltyProgramAccount` del spec. */
756
+ interface SeatLoyaltyProgramAccount {
757
+ airlineCode?: string;
758
+ accountNumber?: string;
759
+ programName?: string;
760
+ }
761
+ /** `SegmentBase` del spec. Fechas `YYYY-MM-DD` y horas `HH:MM`, locales del aeropuerto. */
762
+ interface SeatSegment {
763
+ /** Identifica el segmento dentro del mensaje (`IdType`: `^[a-zA-Z_][a-zA-Z0-9_\-.]*$`). */
764
+ id: string;
765
+ bookingAirlineCode: string;
766
+ bookingFlightNumber: number;
767
+ departureAirportCode: string;
768
+ arrivalAirportCode: string;
769
+ departureDate: string;
770
+ bookingClassCode: string;
771
+ departureTime?: string;
772
+ arrivalDate?: string;
773
+ arrivalTime?: string;
774
+ operatingAirlineCode?: string;
775
+ operatingFlightNumber?: number;
776
+ operatingBookingClassCode?: string;
777
+ cabinCode?: string;
778
+ }
779
+ /** `SegmentPayloadRq` del spec. */
780
+ interface SeatSegmentPayloadRq extends SeatSegment {
781
+ /** Si el segmento tiene el tag `/RCRQ`. */
782
+ hasRecordCreateTag?: boolean;
783
+ }
784
+ /** `FareSegmentAssociation` del spec. */
785
+ interface SeatFareSegmentAssociation {
786
+ segmentRef: string;
787
+ fareComponentRef: string;
788
+ }
789
+ /** `SpecialServiceRequest` del spec. */
790
+ interface SeatSpecialServiceRequest {
791
+ codes: string[];
792
+ segmentRef?: string;
793
+ }
794
+ /** `PassengerBase` del spec. */
795
+ interface SeatPassenger {
796
+ id: string;
797
+ passengerType?: string;
798
+ givenName?: string;
799
+ surname?: string;
800
+ loyaltyProgramAccounts?: SeatLoyaltyProgramAccount[];
801
+ }
802
+ /** `PassengerPayloadRq` del spec. */
803
+ interface SeatPassengerPayloadRq extends SeatPassenger {
804
+ fareSegmentAssociation?: SeatFareSegmentAssociation[];
805
+ specialServiceRequests?: SeatSpecialServiceRequest[];
806
+ /** Pasajero con un infante sin asiento. Por defecto `false`. */
807
+ isAccompaniedByInfant?: boolean;
808
+ customAttributes?: SeatKeyValuePair[];
809
+ }
810
+ /** `FareDetail` del spec. */
811
+ interface SeatFareDetail {
812
+ fareType?: string;
813
+ fareTariff?: string;
814
+ fareRule?: string;
815
+ fareIndicator?: number;
816
+ fareTypeBitmap?: string;
817
+ hasPrivateTariff?: boolean;
818
+ }
819
+ /** `FareComponent` del spec. */
820
+ interface SeatFareComponent {
821
+ fareComponentId: string;
822
+ fareBasis: string;
823
+ governingCarrier?: string;
824
+ /** Número como string, p. ej. `'500.00'`. Exige `totalPriceCurrencyCode`. */
825
+ totalPrice?: string;
826
+ totalPriceCurrencyCode?: string;
827
+ brandCode?: string;
828
+ fareDetail?: SeatFareDetail;
829
+ }
830
+ /** `SeatAvailabilityByPayloadRq` del spec 3.0: la reserva armada a mano. */
831
+ interface SeatAvailabilityByPayloadRq {
832
+ /** `id` de los segmentos para los que se piden mapas. */
833
+ returnSeatMapsOnlyForSegmentRefs: string[];
834
+ segments: SeatSegmentPayloadRq[];
835
+ passengers: SeatPassengerPayloadRq[];
836
+ returnSeatOffersOnlyForPassengerRefs?: string[];
837
+ fareComponents?: SeatFareComponent[];
838
+ /** ISO 4217. Si falta, Sabre la elige según otros factores. */
839
+ currencyCode?: string;
840
+ /** `true`: mapa de check-in; `false`: mapa de reserva. */
841
+ isCheckinMode?: boolean;
842
+ customAttributes?: SeatKeyValuePair[];
843
+ }
844
+ /**
845
+ * `SeatAvailabilityByPnrLocatorRq` del spec 3.0: un PNR ya creado. Sabre lo lee sin estado,
846
+ * así que no ve los cambios sin confirmar.
847
+ */
848
+ interface SeatAvailabilityByPnrLocatorRq {
849
+ /** Localizador del PNR (`^[A-Z]{6}$`). */
850
+ pnrLocator: string;
851
+ /** IDs de segmento del PNR para los que se piden mapas. */
852
+ returnSeatMapsOnlyForSegmentIds?: string[];
853
+ /** Name reference numbers del PNR, p. ej. `'01.01'`. */
854
+ returnSeatOffersOnlyForPassengerNameReferenceNumbers?: string[];
855
+ currencyCode?: string;
856
+ isCheckinMode?: boolean;
857
+ customAttributes?: SeatKeyValuePair[];
858
+ }
859
+ /** Entrada de `sabre.air.getSeats`: con `pnrLocator` va a `byPnrLocator`; sin él, a `byReservationPayload`. */
860
+ type GetSeatsRequest = SeatAvailabilityByPayloadRq | SeatAvailabilityByPnrLocatorRq;
861
+ /** `FlightLeg` del spec. */
862
+ interface SeatFlightLeg {
863
+ id: string;
864
+ departureAirportCode: string;
865
+ arrivalAirportCode: string;
866
+ departureScheduledDateTime?: string;
867
+ aircraftCode?: string;
868
+ }
869
+ /** `SegmentRs` del spec. */
870
+ interface SeatSegmentRs extends SeatSegment {
871
+ isChangeOfGauge?: boolean;
872
+ flightLegs?: SeatFlightLeg[];
873
+ }
874
+ /** `PassengerRs` del spec. */
875
+ type SeatPassengerRs = SeatPassenger;
876
+ /** `TaxType` del spec. */
877
+ interface SeatTax {
878
+ taxAmount?: number | string;
879
+ taxCode?: string;
880
+ description?: string;
881
+ }
882
+ /**
883
+ * `PriceBreakdown` del spec, en la moneda del `PriceDefinition`. El spec dice string, pero en
884
+ * producción los importes llegaron como número (`1200`, 2026-10-31): se acepta cualquiera.
885
+ */
886
+ interface SeatPriceBreakdown {
887
+ /** Con impuestos. */
888
+ amount: number | string;
889
+ amountWithoutTaxes?: number | string;
890
+ taxesTotal?: number | string;
891
+ taxes?: SeatTax[];
892
+ isTaxExempt?: boolean;
893
+ }
894
+ /** `PriceDefinition` del spec. */
895
+ interface SeatPriceDefinition {
896
+ id: string;
897
+ currencyCode: string;
898
+ totalPrice: SeatPriceBreakdown;
899
+ referenceBasePrice?: SeatPriceBreakdown;
900
+ }
901
+ /** `OfferItemDetails` del spec. */
902
+ interface SeatOfferItemDetails {
903
+ serviceDefinitionRef: string;
904
+ /** `id` de un `PriceDefinition` del mismo mensaje: ahí está el precio del asiento. */
905
+ priceDefinitionRef?: string;
906
+ segmentRefs: string[];
907
+ passengerRefs: string[];
908
+ refundableReissuableIndicator?: 'Yes' | 'No' | 'Reuse';
909
+ isInterlineable?: boolean;
910
+ sectorPortionIndicator?: 'Sector' | 'Portion' | 'Journey';
911
+ feeApplicationMethod?: string;
912
+ purchaseByDateTime?: string;
913
+ annotations?: SeatKeyValuePair[];
914
+ }
915
+ /** `OfferItem` del spec: ítem reservable asignado a asientos. */
916
+ interface SeatOfferItem extends SeatOfferItemDetails {
917
+ id: string;
918
+ }
919
+ /** `DisplayOnlyItem` del spec: ítem solo informativo. */
920
+ interface SeatDisplayOnlyItem extends SeatOfferItemDetails {
921
+ id: string;
922
+ displayOnlyReason?: 'Unavailable' | 'Unable To Book' | 'Restricted' | 'Unknown';
923
+ displayOnlySource?: string;
924
+ displayOnlyReasonDetails?: SeatKeyValuePair[];
925
+ }
926
+ /** `ServiceDefinition` del spec. */
927
+ interface SeatServiceDefinition {
928
+ id: string;
929
+ serviceCode?: string;
930
+ airlineCode?: string;
931
+ commercialName?: string;
932
+ /** Group code de ATPCO. */
933
+ groupCode?: string;
934
+ emdType?: 'Standalone' | 'Flight Coupon Associated' | 'Standalone Ticket Associated' | 'Other Than Emd' | 'Eticket';
935
+ emdTypeCode?: number;
936
+ specialServiceCode?: string;
937
+ reasonForIssuance?: string;
938
+ reasonForIssuanceCode?: string;
939
+ isCommissionable?: boolean;
940
+ isFeeGuaranteed?: boolean;
941
+ }
942
+ /** `SeatCharacteristic` / `RowCharacteristic` del spec (PADIS 9825). */
943
+ interface SeatCharacteristic {
944
+ code: string;
945
+ description?: string;
946
+ }
947
+ /** `SeatType` del spec. El número de asiento es `row` de la fila más `column`. */
948
+ interface Seat {
949
+ column: string;
950
+ /** PADIS 9865: `F` libre, `O` ocupado, … */
951
+ occupationStatusCode?: string;
952
+ characteristics?: SeatCharacteristic[];
953
+ isOperative?: boolean;
954
+ /** Ítems reservables (`offerItems[].id`) del asiento. */
955
+ offerItemRefIds?: string[];
956
+ /** Ítems solo informativos (`displayOnlyItems[].id`) del asiento. */
957
+ displayOnlyItemRefIds?: string[];
958
+ }
959
+ /** `SeatRow` del spec. */
960
+ interface SeatRow {
961
+ row: number;
962
+ characteristics?: SeatCharacteristic[];
963
+ seats: Seat[];
964
+ }
965
+ /** `CabinLayoutRowPosition` del spec. */
966
+ interface SeatCabinRowPosition {
967
+ firstRow: number;
968
+ lastRow: number;
969
+ }
970
+ /** `Facility` del spec. */
971
+ interface SeatCabinFacility {
972
+ firstRow: number;
973
+ lastRow: number;
974
+ columnIds?: string[];
975
+ orientationCode: string;
976
+ positionCodes: string[];
977
+ facilityTypeCode: string;
978
+ }
979
+ /** `CabinLayoutType` del spec. */
980
+ interface SeatCabinLayout {
981
+ columns: Array<{
982
+ id: string;
983
+ position?: string[];
984
+ }>;
985
+ rows: SeatCabinRowPosition;
986
+ wingRowPosition?: SeatCabinRowPosition[];
987
+ exitRowPosition?: SeatCabinRowPosition[];
988
+ seatCount?: number;
989
+ authorizedSeatCount?: number;
990
+ missingRowNumbers?: number[];
991
+ missingSeats?: string[];
992
+ facilities?: SeatCabinFacility[];
993
+ deckCode?: string;
994
+ }
995
+ /** `CabinCompartment` del spec. */
996
+ interface SeatCabinCompartment {
997
+ firstRow?: number;
998
+ lastRow?: number;
999
+ columnIds?: string[];
1000
+ cabinCode?: string;
1001
+ cabinName?: string;
1002
+ cabinLayout?: SeatCabinLayout;
1003
+ seatRows?: SeatRow[];
1004
+ }
1005
+ /** `SeatMap` del spec. */
1006
+ interface SeatMap {
1007
+ /** `id` del segmento, del request o de `segments[]` de la respuesta. */
1008
+ segmentRef: string;
1009
+ flightLegRef?: string;
1010
+ cabinCompartments?: SeatCabinCompartment[];
1011
+ }
1012
+ /** `SeatAvailabilityResponse` del spec 3.0. */
1013
+ interface SeatAvailabilityResponse {
1014
+ /** Solo lo usa `seatOffers` (NDC); por ATPCO el asiento se reserva por número. */
1015
+ offerId?: string;
1016
+ offerExpirationDateTime?: string;
1017
+ segments: SeatSegmentRs[];
1018
+ passengers: SeatPassengerRs[];
1019
+ serviceDefinitions: SeatServiceDefinition[];
1020
+ priceDefinitions?: SeatPriceDefinition[];
1021
+ offerItems: SeatOfferItem[];
1022
+ displayOnlyItems?: SeatDisplayOnlyItem[];
1023
+ seatMaps: SeatMap[];
1024
+ }
1025
+ /** `Error` / `Warning` del spec: la misma forma que los de Booking Management. */
1026
+ interface SeatAvailabilityIssue {
1027
+ category: string;
1028
+ type: string;
1029
+ description?: string;
1030
+ fieldName?: string;
1031
+ fieldPath?: string;
1032
+ /** Puede traer datos del request: no se copia a los errores del SDK. */
1033
+ fieldValue?: string;
1034
+ }
1035
+ /** `SeatAvailabilityRs` tal cual llega de Sabre. */
1036
+ interface RawSeatAvailabilityRs {
1037
+ response?: SeatAvailabilityResponse;
1038
+ errors?: SeatAvailabilityIssue[];
1039
+ warnings?: SeatAvailabilityIssue[];
1040
+ }
1041
+ /**
1042
+ * Resultado de `sabre.air.getSeats`: el `SeatAvailabilityRs` del spec con `errors[]` y
1043
+ * `warnings[]` reemplazados por los del SDK.
1044
+ */
1045
+ interface GetSeatsResponse {
1046
+ response: SeatAvailabilityResponse;
1047
+ /** `warnings[]` de Sabre. Nunca se lanzan. */
1048
+ warnings: SabreWarning[];
1049
+ /** `errors[]` que llegaron junto con un `response`: el mapa existe, pero puede faltar algo. */
1050
+ errors: SabreBusinessError[];
1051
+ }
1052
+
718
1053
  /** Body de Revalidate Itinerary v5: el mismo `OTA_AirLowFareSearchRQ` que BFM, con los vuelos fijados. */
719
1054
  interface RevalidateItineraryRequest {
720
1055
  OTA_AirLowFareSearchRQ: OtaAirLowFareSearchRq;
@@ -754,6 +1089,13 @@ declare class Air {
754
1089
  * sin sostener inventario. El request se arma con `buildRevalidateItineraryRequest`.
755
1090
  */
756
1091
  revalidateItinerary(request: RevalidateItineraryRequest, options?: RequestOptions): Promise<RevalidateItineraryResponse>;
1092
+ /**
1093
+ * Get Seats v3: mapa de asientos con disponibilidad y precio. Sin `pnrLocator` va a
1094
+ * `byReservationPayload`, armado con `buildSeatAvailabilityRequest`; con `pnrLocator`, a
1095
+ * `byPnrLocator`. Un `pnrLocator` vacío o mezclado con `segments`, `passengers` o
1096
+ * `returnSeatMapsOnlyForSegmentRefs` lanza `TypeError` sin llamar a la red.
1097
+ */
1098
+ getSeats(request: GetSeatsRequest, options?: RequestOptions): Promise<GetSeatsResponse>;
757
1099
  }
758
1100
 
759
1101
  /** Elemento de `errors[]` tal cual lo manda Sabre (`Error` del spec; los avisos comparten forma). */
@@ -1143,7 +1485,9 @@ declare class BookingManagement {
1143
1485
  * Nunca se reintenta automáticamente. Si la reserva se crea con avisos o errores no fatales,
1144
1486
  * no lanza: los devuelve en `warnings` y `errors`. Si no se crea, lanza `SabreBusinessError`.
1145
1487
  * Con `agency.ticketingPolicy: 'FUTURE_TICKETING'` y sin `agency.futureTicketingPolicy`, lanza
1146
- * `TypeError` sin llamar a la red: Sabre lo rechaza seguro.
1488
+ * `TypeError` sin llamar a la red: Sabre lo rechaza seguro. Lo mismo con un asiento cuyo
1489
+ * `travelerIndex` no está en `travelers`. Un asiento con precio en Get Seats (ver
1490
+ * `buildBookingFlightDetails`) solo emite `sabre.booking.seat.priced` en `warn`.
1147
1491
  */
1148
1492
  create(request: CreateBookingRequest, options?: CreateBookingOptions): Promise<CreateBookingResponse>;
1149
1493
  /**
@@ -1179,6 +1523,667 @@ declare class Sabre {
1179
1523
  get baseUrl(): string;
1180
1524
  }
1181
1525
 
1526
+ /** Credencial del header `wsse:Security`. */
1527
+ type SoapSecurity =
1528
+ /** Token de sesión (ATH) o stateless (ATK). */
1529
+ {
1530
+ binarySecurityToken: string;
1531
+ }
1532
+ /** Credenciales de `SessionCreateRQ`. `clientId` y `clientSecret` solo van en la 2.0.0. */
1533
+ | {
1534
+ usernameToken: {
1535
+ username: string;
1536
+ password: string;
1537
+ organization: string;
1538
+ domain: string;
1539
+ clientId?: string;
1540
+ clientSecret?: string;
1541
+ };
1542
+ };
1543
+ interface SoapRequest {
1544
+ /** Nombre del servicio para errores y logs, p. ej. `'queueAccess'`. */
1545
+ service: string;
1546
+ /** `eb:Service` y `eb:Action`, p. ej. `'QueueAccessLLSRQ'`. */
1547
+ action: string;
1548
+ /** Payload del `soap-env:Body`, ya armado y escapado (ver `xmlEscape`). */
1549
+ payload: string;
1550
+ /** `eb:CPAId`: el PCC. */
1551
+ cpaId: string;
1552
+ /** `eb:ConversationId` de la sesión. */
1553
+ conversationId: string;
1554
+ security: SoapSecurity;
1555
+ /**
1556
+ * Si la operación se puede repetir sin efectos (`count`, `list`, `ping`). Las que mueven el
1557
+ * cursor de una cola van en `false`: nunca se reintentan ante un fallo de red.
1558
+ */
1559
+ idempotent: boolean;
1560
+ retry?: Partial<RetryOptions>;
1561
+ /** `true` para devolver el `BinarySecurityToken` de la respuesta (solo `SessionCreateRQ`). */
1562
+ readSecurityToken?: boolean;
1563
+ signal?: AbortSignal;
1564
+ /** Método público sin `legacy.`, p. ej. `'queue.access'`. Lo recibe `onRawResponse`. */
1565
+ operation?: string;
1566
+ onRawResponse?: SabreRawResponseCallback;
1567
+ }
1568
+ interface SoapResponse {
1569
+ /** Elemento hijo del `Body` (p. ej. `QueueAccessRS`), parseado y sin prefijos de namespace. */
1570
+ payload: Record<string, unknown>;
1571
+ /** Nombre local de ese elemento, p. ej. `'QueueAccessRS'`. */
1572
+ payloadName: string;
1573
+ /** Los `stl:Warning` de `stl:ApplicationResults`. */
1574
+ warnings: SabreWarning[];
1575
+ /** `eb:MessageId` de la respuesta, el dato que pide soporte de Sabre. */
1576
+ messageId: string | undefined;
1577
+ /** El sobre redactado, como `raw` de los errores que arme la operación al leer el payload. */
1578
+ raw: string;
1579
+ /** El `BinarySecurityToken` del header, solo con `readSecurityToken`. */
1580
+ securityToken: string | undefined;
1581
+ status: number;
1582
+ }
1583
+ interface SoapTransportOptions {
1584
+ /** Solo para tests: id del `eb:MessageId`. */
1585
+ messageId?: () => string;
1586
+ /** Solo para tests: reloj del `eb:Timestamp`. */
1587
+ now?: () => Date;
1588
+ /** Solo para tests: fuente de aleatoriedad del jitter. */
1589
+ random?: () => number;
1590
+ /** Solo para tests: espera entre reintentos. */
1591
+ sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
1592
+ }
1593
+ declare class SoapTransport {
1594
+ #private;
1595
+ constructor(config: ResolvedConfig, options?: SoapTransportOptions);
1596
+ /** @internal Para los eventos de sesión que no son una request. */
1597
+ get log(): EventLogger;
1598
+ request(request: SoapRequest): Promise<SoapResponse>;
1599
+ }
1600
+
1601
+ /** Por qué terminó la cola: el fin de cola de siempre o una cola vacía al entrar. */
1602
+ type QueueEndReason = 'end-of-display' | 'empty';
1603
+ /**
1604
+ * Un filtro al entrar a una cola: un calificador de host, p. ej. `{ function: 'AL', criteria: 'DL' }`
1605
+ * (solo los PNR de esa aerolínea). Las reglas de combinación las valida Sabre.
1606
+ */
1607
+ interface QueueSelection {
1608
+ function: string;
1609
+ criteria: string;
1610
+ }
1611
+ interface QueueAccessRequest {
1612
+ queue: QueueRef;
1613
+ /** PCC de la cola. Por defecto, el de la sesión. */
1614
+ pcc?: string;
1615
+ /** Hasta 8 filtros. Con selección, la cola abre solo los PNR que cumplen el criterio. */
1616
+ selection?: readonly QueueSelection[];
1617
+ }
1618
+ /** Una cola de la que `remove` saca el PNR actual. */
1619
+ interface QueueRemoveTarget {
1620
+ queue: QueueRef;
1621
+ /** Por defecto, el PCC de la sesión. */
1622
+ pcc?: string;
1623
+ }
1624
+ interface QueueRemoveRequest {
1625
+ /** De 1 a 3 colas de las que sacar el PNR actual a la vez. Sin `from`, sale de la cola en curso. */
1626
+ from?: readonly QueueRemoveTarget[];
1627
+ }
1628
+ type QueueAccessOptions = RequestOptions;
1629
+ type QueueNavigationOptions = RequestOptions;
1630
+ /** El PNR en el que quedó parada la cola. */
1631
+ interface QueueItem {
1632
+ /** Localizador: `Line/UniqueID@ID`. */
1633
+ locator: string;
1634
+ /**
1635
+ * `Line/DateTime`, tal cual llegó: con año en las respuestas reales (`"2024-05-15T13:24"`), sin
1636
+ * año en el design (`"12-21T07:00"`). Se toma como la colocación en la cola, pero en producción
1637
+ * el de `list` y el de `access` no coinciden para un mismo PNR (#96): el de `list` es siempre
1638
+ * posterior, y ninguna fuente dice qué fecha es cada uno. Se devuelve tal cual.
1639
+ */
1640
+ placedAt?: string;
1641
+ /** `Line/POS/Source`: quién colocó el PNR. `agentSine` puede ser `SABRE`. */
1642
+ placedBy?: {
1643
+ agentSine?: string;
1644
+ pseudoCityCode?: string;
1645
+ };
1646
+ /** `Line/PassengerName`. Las respuestas reales de entrar a una cola no lo traen. */
1647
+ primaryPassenger?: string;
1648
+ /** `Line/Group`. Las respuestas reales de entrar a una cola no lo traen. */
1649
+ group?: string;
1650
+ /**
1651
+ * `Paragraph/Text`: el PNR en formato de host, línea por línea y tal cual, con su sangría. Las
1652
+ * líneas vacías llegan como `""`. Se interpreta con `parseQueueParagraph`.
1653
+ */
1654
+ paragraph: readonly string[];
1655
+ }
1656
+ /**
1657
+ * Resultado de una operación que avanza en la cola. El fin de cola es un resultado, no un error:
1658
+ * `END OF DISPLAY FOR REQUESTED DATA` llega como `{ done: true }`, también al entrar a una cola
1659
+ * vacía, y deja la sesión fuera de la cola.
1660
+ */
1661
+ type QueueStep = {
1662
+ done: false;
1663
+ item: QueueItem;
1664
+ warnings: SabreWarning[];
1665
+ } | {
1666
+ done: true;
1667
+ reason: QueueEndReason;
1668
+ message: string;
1669
+ warnings: SabreWarning[];
1670
+ };
1671
+
1672
+ interface QueueCountRequest {
1673
+ /** PCC cuyas colas se cuentan. Por defecto, el de la sesión. */
1674
+ pcc?: string;
1675
+ }
1676
+ type QueueCountOptions = RequestOptions;
1677
+ /** Una cola con mensajes o PNR. */
1678
+ interface QueueCount {
1679
+ queue: QueueRef;
1680
+ count: number;
1681
+ }
1682
+ interface QueueCountResponse {
1683
+ /** Las colas que trae la respuesta, en el orden de Sabre. Sabre no lista las vacías. */
1684
+ queues: QueueCount[];
1685
+ /**
1686
+ * Los `Totals` por `Type`: `MESSAGES`, `SPECIALS` y `PNRS`. Si Sabre no manda alguno, queda en
1687
+ * `undefined`.
1688
+ */
1689
+ totals: {
1690
+ messages?: number;
1691
+ specials?: number;
1692
+ pnrs?: number;
1693
+ };
1694
+ /**
1695
+ * `QueueInfo@DateTime` tal cual llegó, sin año (`"06-25T09:46"`): la hora del host al contar.
1696
+ * Es un hecho pasado, así que el año se resuelve hacia atrás desde una fecha de referencia.
1697
+ */
1698
+ countedAt?: string;
1699
+ /** Los `stl:Warning` de la respuesta. No lanzan. */
1700
+ warnings: SabreWarning[];
1701
+ }
1702
+
1703
+ interface QueueListRequest {
1704
+ queue: QueueRef;
1705
+ /** PCC de la cola. Por defecto, el de la sesión. */
1706
+ pcc?: string;
1707
+ /** `true` para pedir también el pasajero principal de cada PNR (`Q/…/LN`). */
1708
+ primaryPassenger?: boolean;
1709
+ }
1710
+ type QueueListOptions = RequestOptions;
1711
+ /** Un PNR de la lista: los campos de su `Line`. */
1712
+ interface QueueListEntry extends Omit<QueueItem, 'paragraph'> {
1713
+ /** `Line@Number`: la posición en la lista. */
1714
+ position?: number;
1715
+ }
1716
+ interface QueueListResponse {
1717
+ /** Los localizadores, en el orden de la cola. */
1718
+ locators: string[];
1719
+ /** Un elemento por PNR, en el mismo orden que `locators`. */
1720
+ entries: QueueListEntry[];
1721
+ /** `Paragraph/Text` tal cual: empieza con la cabecera `QUEUE LIST FOR <PCC> QUEUE <n>`. */
1722
+ paragraph: string[];
1723
+ warnings: SabreWarning[];
1724
+ }
1725
+
1726
+ /** Una cola de destino. */
1727
+ interface QueuePlaceTarget {
1728
+ queue: QueueRef;
1729
+ /** Por defecto, el PCC de la sesión. */
1730
+ pcc?: string;
1731
+ /**
1732
+ * Código PIC (`PrefatoryInstructionCode`): 0–191 o 200–254. **Obligatorio**, aunque el design
1733
+ * 2.0.4 lo da como opcional: sin PIC, producción rechaza el place con `INSTRUCTION NUMBER NOT IN
1734
+ * RANGE` fuera de una cola y con `NEED INSTRUCTION NUMBER` dentro (#97). Sin valor por defecto.
1735
+ */
1736
+ instructionCode: number;
1737
+ }
1738
+ interface QueuePlaceRequest {
1739
+ /** De 1 a 10 colas de destino. */
1740
+ to: readonly QueuePlaceTarget[];
1741
+ /**
1742
+ * Hasta 6 localizadores a colocar, sin tenerlos en el AAA. Solo fuera de una cola: dentro,
1743
+ * `place` coloca el PNR actual.
1744
+ */
1745
+ locators?: readonly string[];
1746
+ }
1747
+ type QueuePlaceOptions = RequestOptions;
1748
+ /** Una colocación que confirma Sabre (`QueueInfo`). */
1749
+ interface QueuePlacement {
1750
+ queue?: QueueRef;
1751
+ pcc?: string;
1752
+ locator?: string;
1753
+ /** `QueueInfo@DateTime` tal cual, sin año (`"12-21T12:00"`). */
1754
+ placedAt?: string;
1755
+ }
1756
+ /** Lo que devuelve `place` fuera de una cola: no avanza nada. */
1757
+ interface QueuePlaceResult {
1758
+ /** Las colocaciones de `QueueInfo`, si Sabre las manda. */
1759
+ placements: QueuePlacement[];
1760
+ /** Las líneas `Text`, tal cual (p. ej. `"OK 1030 NMIUTF"`). */
1761
+ text: string[];
1762
+ warnings: SabreWarning[];
1763
+ }
1764
+ /**
1765
+ * Lo que devuelve `place`: un `QueueStep` dentro de una cola, y un `QueuePlaceResult` fuera. Se
1766
+ * distinguen con `'done' in result`. Con `locators`, el tipo ya es `QueuePlaceResult`.
1767
+ */
1768
+ type QueuePlaceResponse = QueueStep | QueuePlaceResult;
1769
+
1770
+ /**
1771
+ * Dónde está la sesión respecto de las colas: `'outside'`, `'inside'` (hay un PNR de una cola en
1772
+ * el AAA) o `'unknown'` (una operación falló dentro de una cola, o un `access` falló sin respuesta
1773
+ * de Sabre, y no se sabe si Sabre dejó la sesión adentro). De `'unknown'` se sale con `exit()`.
1774
+ */
1775
+ type QueueState = 'outside' | 'inside' | 'unknown';
1776
+ /** Qué hacer con un PNR en `queue.process`. */
1777
+ type QueueProcessAction = {
1778
+ action: 'remove';
1779
+ } | {
1780
+ action: 'ignore';
1781
+ } | {
1782
+ action: 'place';
1783
+ to: readonly QueuePlaceTarget[];
1784
+ };
1785
+ interface QueueProcessRequest extends QueueAccessRequest {
1786
+ /** Cuántos PNR visitar como máximo. Al llegar, sale con `QXI`. Sin tope por defecto. */
1787
+ limit?: number;
1788
+ }
1789
+ interface QueueProcessResult {
1790
+ /** Cuántos PNR se pasaron al callback. */
1791
+ visited: number;
1792
+ /** Por qué terminó: el fin de cola, una cola vacía al entrar, o `limit`. */
1793
+ ended: QueueEndReason | 'limit';
1794
+ }
1795
+ /** @internal Lo que la sesión le presta al módulo de colas. */
1796
+ interface QueueContext {
1797
+ /** Una llamada a Sabre dentro de la sesión, con uso exclusivo. */
1798
+ send(request: SessionRequest): Promise<SoapResponse>;
1799
+ /** PCC de la sesión: el default de cada operación. */
1800
+ pcc: string;
1801
+ log: EventLogger;
1802
+ }
1803
+ declare class QueueManagement {
1804
+ #private;
1805
+ /** @internal Lo construye `SabreSession`. */
1806
+ constructor(context: QueueContext);
1807
+ /**
1808
+ * Si la sesión está dentro de una cola. Lo lleva el SDK: `access` con un PNR la deja en
1809
+ * `'inside'`, y el fin de cola o `exit()`, en `'outside'`.
1810
+ */
1811
+ get state(): QueueState;
1812
+ /**
1813
+ * Get Queue Count (`QueueCountLLSRQ` 2.2.1): cuántos mensajes o PNR hay en cada cola del PCC,
1814
+ * más los totales. Cada `queue` de la respuesta se puede pasar tal cual a las demás operaciones
1815
+ * de cola.
1816
+ *
1817
+ * Se puede llamar dentro o fuera de una cola, y no cambia `state`. Es una lectura: se reintenta
1818
+ * ante fallos transitorios. Un PCC que no tiene 3 o 4 caracteres alfanuméricos lanza
1819
+ * `TypeError` sin red.
1820
+ */
1821
+ count(request?: QueueCountRequest, options?: QueueCountOptions): Promise<QueueCountResponse>;
1822
+ /**
1823
+ * La lista de localizadores de una cola (`QueueAccessLLSRQ` con `List`), sin recorrerla. Con
1824
+ * `primaryPassenger: true`, cada entrada trae también el pasajero principal. Una cola vacía da
1825
+ * una lista vacía.
1826
+ *
1827
+ * No cambia `state`. Es una lectura: se reintenta ante fallos transitorios. Lanza `TypeError`
1828
+ * sin red si `queue` o `pcc` no son válidos, o si `primaryPassenger` no es un boolean.
1829
+ */
1830
+ list(request: QueueListRequest, options?: QueueListOptions): Promise<QueueListResponse>;
1831
+ /**
1832
+ * Access Queue (`QueueAccessLLSRQ` 2.1.1): entra a una cola y devuelve su primer PNR. Una cola
1833
+ * vacía, o sin PNR que cumplan `selection`, devuelve `{ done: true }` y la sesión sigue afuera.
1834
+ *
1835
+ * Lanza `TypeError` sin red si la sesión ya está dentro de una cola (o en `'unknown'`: hay que
1836
+ * llamar a `exit()` primero), si `queue` no es de 0 a 511 o `{ name }`, o con más de 8 filtros.
1837
+ * Mueve el cursor: nunca se reintenta ante un fallo de red, y ese fallo deja `state` en
1838
+ * `'unknown'`.
1839
+ */
1840
+ access(request: QueueAccessRequest, options?: QueueAccessOptions): Promise<QueueStep>;
1841
+ /**
1842
+ * Deja el PNR actual en la cola y pasa al siguiente (`I`). Fuera de una cola lanza `TypeError`
1843
+ * sin red.
1844
+ */
1845
+ ignore(options?: QueueNavigationOptions): Promise<QueueStep>;
1846
+ /**
1847
+ * Saca el PNR actual de la cola y pasa al siguiente (`QR`). Con `from` (de 1 a 3 colas), lo saca
1848
+ * de esas colas a la vez. Fuera de una cola lanza `TypeError` sin red.
1849
+ */
1850
+ remove(request?: QueueRemoveRequest, options?: QueueNavigationOptions): Promise<QueueStep>;
1851
+ /**
1852
+ * Sale de la cola sin cerrar la transacción (`QXI`) y deja `state` en `'outside'`. Fuera de una
1853
+ * cola lanza `TypeError` sin red. En `'unknown'` manda `QXI` igual y, si Sabre lo rechaza con
1854
+ * `CANNOT DO THIS IF OFF QUEUE` (la sesión ya no estaba en una cola), lo da por bueno. Cualquier
1855
+ * otro error lanza y deja `'unknown'`.
1856
+ */
1857
+ exit(options?: QueueNavigationOptions): Promise<void>;
1858
+ /**
1859
+ * Recorre una cola: entra con `access`, llama a `callback` con cada PNR, ejecuta la acción que
1860
+ * devuelve (`remove`, `ignore` o `place`) y termina en el fin de cola. No hace nada que no se
1861
+ * pueda hacer con las primitivas.
1862
+ *
1863
+ * - Con `limit`, después de visitar esa cantidad de PNR sale con `QXI`. No tiene tope por
1864
+ * defecto: con una cola anómala que nunca llega al fin, el recorrido no termina. Conviene
1865
+ * pasarlo.
1866
+ * - Si el callback lanza, o devuelve una acción inválida, sale con `QXI` y propaga el error. No
1867
+ * lo convierte en `ignore`: para seguir de largo, el callback atrapa su error y devuelve
1868
+ * `{ action: 'ignore' }`.
1869
+ * - Si una operación falla, sale con `QXI` (tolerando que la sesión ya no esté en la cola) y
1870
+ * propaga el error. Con un `SabreSessionError` no intenta salir: la sesión ya no sirve.
1871
+ *
1872
+ * `options` se aplica a cada llamada a Sabre del recorrido.
1873
+ */
1874
+ process(request: QueueProcessRequest, callback: (item: QueueItem) => QueueProcessAction | Promise<QueueProcessAction>, options?: QueueNavigationOptions): Promise<QueueProcessResult>;
1875
+ /**
1876
+ * Place Queue Message (`QueuePlaceLLSRQ` 2.0.4): coloca un PNR en 1 a 10 colas.
1877
+ *
1878
+ * - **Dentro de una cola**, coloca el PNR actual y devuelve un `QueueStep` con el siguiente,
1879
+ * como `ignore` y `remove`. El PNR se mueve: sale de la cola en curso (producción, #97). El localizador sale de la línea de firma del PNR; `placedAt` y
1880
+ * `placedBy` quedan en `undefined`. Con `locators` lanza `TypeError` sin red: para colocar
1881
+ * otros PNR, primero `exit()`.
1882
+ * - **Fuera de una cola**, coloca los `locators` (hasta 6) o el PNR del AAA, no avanza nada y
1883
+ * devuelve `{ placements, text, warnings }`.
1884
+ *
1885
+ * Cada destino necesita `instructionCode` (0–191 o 200–254), sin valor por defecto: sin él
1886
+ * lanza `TypeError` sin red, porque Sabre lo exige dentro y fuera de una cola. Nunca se
1887
+ * reintenta ante un fallo de red. Errores como `BAD PNR LOCATOR` o `NEED RECEIVED FROM FIELD`
1888
+ * salen como `SabreBusinessError` (`service: 'queuePlace'`).
1889
+ */
1890
+ place(request: QueuePlaceRequest & {
1891
+ locators: readonly string[];
1892
+ }, options?: QueuePlaceOptions): Promise<QueuePlaceResult>;
1893
+ place(request: QueuePlaceRequest, options?: QueuePlaceOptions): Promise<QueuePlaceResponse>;
1894
+ }
1895
+
1896
+ /** Lo que una operación pide al transporte. La sesión agrega `CPAId`, `ConversationId` y el token. */
1897
+ type SessionRequest = Omit<SoapRequest, 'cpaId' | 'conversationId' | 'security'>;
1898
+ /**
1899
+ * Método interno por el que las operaciones de la sesión (cola, ping) llaman a Sabre. Va con un
1900
+ * símbolo que no se exporta del paquete para no sumar superficie pública.
1901
+ */
1902
+ declare const sessionSend: unique symbol;
1903
+ /** Opciones de `openSession`. */
1904
+ interface OpenSessionOptions extends RequestOptions {
1905
+ /**
1906
+ * Manda `OTA_PingRQ` cuando la sesión lleva 13 minutos inactiva, antes del vencimiento de los
1907
+ * 15. Apagado por defecto: en runtimes serverless o edge un timer no sobrevive entre
1908
+ * invocaciones. Ahí conviene `withSession` por recorrido, o un `ping()` antes de reutilizar.
1909
+ */
1910
+ keepAlive?: boolean;
1911
+ }
1912
+ /**
1913
+ * Una sesión SOAP abierta con `SessionCreateRQ`. Es exclusiva: Sabre no admite llamadas
1914
+ * concurrentes en la misma sesión (`USG_INVALID_SESSION`), así que una segunda llamada mientras
1915
+ * otra está en vuelo lanza `TypeError` sin llamar a la red. Se cierra con `close()`, o sola si
1916
+ * se abrió con `withSession`.
1917
+ */
1918
+ declare class SabreSession {
1919
+ #private;
1920
+ /** Queue Management: contar, recorrer y colocar en colas, dentro de esta sesión. */
1921
+ readonly queue: QueueManagement;
1922
+ /** @internal Se crea con `SabreLegacy.openSession()`. */
1923
+ constructor(internal: {
1924
+ transport: SoapTransport;
1925
+ pcc: string;
1926
+ conversationId: string;
1927
+ token: string;
1928
+ keepAlive: boolean;
1929
+ });
1930
+ /**
1931
+ * Milisegundos desde la última respuesta de Sabre en esta sesión; `0` mientras hay una llamada
1932
+ * en vuelo. Sabre cierra la sesión a los 15 minutos de inactividad.
1933
+ */
1934
+ get idleMs(): number;
1935
+ /**
1936
+ * Manda `OTA_PingRQ`, que reinicia el contador de inactividad sin tocar el AAA. Durante un
1937
+ * recorrido de cola no hace falta: cada operación ya lo reinicia.
1938
+ */
1939
+ ping(options?: RequestOptions): Promise<void>;
1940
+ /**
1941
+ * Cierra la sesión con `SessionCloseRQ`: Sabre descarta el AAA e invalida el token. Es
1942
+ * idempotente: las llamadas siguientes devuelven la misma promesa, sin volver a la red. Si el
1943
+ * cierre falla, la sesión queda cerrada igual del lado del SDK; la de Sabre vence sola a los
1944
+ * 15 minutos. Una sesión inutilizable (ver `SabreSessionError`) se cierra sin red: Sabre ya no
1945
+ * la reconoce.
1946
+ */
1947
+ close(options?: RequestOptions): Promise<void>;
1948
+ /** @internal Una llamada a Sabre dentro de la sesión, con uso exclusivo. */
1949
+ [sessionSend](request: SessionRequest): Promise<SoapResponse>;
1950
+ }
1951
+
1952
+ declare class SabreLegacy {
1953
+ #private;
1954
+ /**
1955
+ * Recibe la misma config que `Sabre`. Usuario, PCC y domain de la sesión salen de
1956
+ * `credentials.username` (`V1:<user>:<PCC>:<domain>` o `<user>-<PCC>-<domain>`), y la versión
1957
+ * de `SessionCreateRQ` de las credenciales: 2.0.0 con `clientId` y `clientSecret`, 1.0.0 sin
1958
+ * ellos. Una config inválida lanza `TypeError` aquí, sin llamar a la red.
1959
+ */
1960
+ constructor(config: SabreConfig);
1961
+ get environment(): SabreEnvironment;
1962
+ /** Endpoint SOAP del entorno. */
1963
+ get baseUrl(): string;
1964
+ /**
1965
+ * Abre una sesión SOAP. Quien la abre la cierra: `try { … } finally { await session.close() }`.
1966
+ * Para el caso común, `withSession` la cierra sola. Con `keepAlive: true`, manda un ping a los
1967
+ * 13 minutos de inactividad.
1968
+ */
1969
+ openSession(options?: OpenSessionOptions): Promise<SabreSession>;
1970
+ /**
1971
+ * Abre una sesión, se la presta al callback y la cierra en un `finally`. Devuelve lo mismo que
1972
+ * el callback y propaga su error. Si el cierre falla, emite `sabre.session.closeFailed` en
1973
+ * `warn` y no pisa el resultado ni el error del callback.
1974
+ */
1975
+ withSession<T>(callback: (session: SabreSession) => Promise<T>): Promise<T>;
1976
+ }
1977
+
1978
+ /**
1979
+ * Cómo se elige el año cuando el texto no lo trae:
1980
+ *
1981
+ * - `'past'`: la fecha más reciente que no sea posterior a `referenceDate` (el mismo día cuenta).
1982
+ * Es la regla de los hechos que ya pasaron: la línea de recibido, `placedAt` y `countedAt`.
1983
+ * - `'nearest'`: la fecha más cercana a `referenceDate`, hacia adelante o hacia atrás, dentro de
1984
+ * ±6 meses. Es la regla de los segmentos y del plazo de ticketing (`T-`, `TAW`). Con un empate
1985
+ * gana la fecha futura.
1986
+ */
1987
+ type HostDateDirection = 'past' | 'nearest';
1988
+ interface ResolveHostDateOptions {
1989
+ /** Regla del año. Por defecto `'past'`, la de `placedAt` y `countedAt`. */
1990
+ direction?: HostDateDirection;
1991
+ }
1992
+ /**
1993
+ * Convierte una fecha de host en un string ISO sin zona horaria: `'YYYY-MM-DD'`, o
1994
+ * `'YYYY-MM-DDTHH:mm'` si el texto trae hora.
1995
+ *
1996
+ * Formatos que reconoce (sin distinguir mayúsculas, sin espacios a los costados):
1997
+ *
1998
+ * - `06SEP` y `06SEP26`, como en los segmentos, el ticketing y la línea de recibido;
1999
+ * - `12-21` y `12-21T07:00`, como el `DateTime` de `QueueCountRS`;
2000
+ * - `2024-05-15` y `2024-05-15T13:24`, como el `DateTime` de una línea de cola real.
2001
+ *
2002
+ * Si el texto trae año, se usa ese (un año de dos dígitos es del 2000 en adelante). Si no, el año
2003
+ * se resuelve contra `referenceDate` con la regla de `options.direction`.
2004
+ *
2005
+ * `referenceDate` es un `'YYYY-MM-DD'` (puede seguir una hora, que no se usa) o un `Date`, del que
2006
+ * se toma el día en UTC. Conviene pasar el día en el calendario del PCC: la regla compara días, y
2007
+ * con zonas distintas la referencia puede quedar un día corrida.
2008
+ *
2009
+ * Devuelve `undefined` si el texto no tiene un formato reconocido, si la fecha no existe
2010
+ * (`2026-02-29`, `31APR`) o si no hay un año que cumpla la regla (un `29FEB` sin un año bisiesto a
2011
+ * menos de 6 meses, con `'nearest'`). Lanza `TypeError` si `referenceDate` no es válida.
2012
+ */
2013
+ declare function resolveHostDate(text: string, referenceDate: Date | string, options?: ResolveHostDateOptions): string | undefined;
2014
+
2015
+ interface QueueParagraphOptions {
2016
+ /**
2017
+ * Fecha contra la que se resuelve el año de las fechas sin año: un `'YYYY-MM-DD'` o un `Date`
2018
+ * (se toma el día en UTC). Es obligatoria. Ver `resolveHostDate`.
2019
+ */
2020
+ referenceDate: Date | string;
2021
+ }
2022
+ /** Aviso de cola del principio del párrafo: el código PIC y su descripción (`011 SEE REMARKS`). */
2023
+ interface QueueParagraphMessage {
2024
+ instructionCode: number;
2025
+ text: string;
2026
+ }
2027
+ /** Un nombre del PNR (`1.1TEST/SWS*FSG`). */
2028
+ interface QueueParagraphPassenger {
2029
+ /** Número de nombre, tal cual: `'1.1'`. */
2030
+ nameNumber: string;
2031
+ surname: string;
2032
+ givenName?: string;
2033
+ /** Lo que sigue al `*` del nombre. */
2034
+ nameRemark?: string;
2035
+ /** El nombre como llegó, sin el número: `'TEST/SWS*FSG'`. */
2036
+ text: string;
2037
+ }
2038
+ interface QueueParagraphSegmentBase {
2039
+ /** Número de segmento en el PNR. */
2040
+ number: number;
2041
+ /** Fecha ISO (`'2026-05-22'`), con el año resuelto con la regla `'nearest'`. */
2042
+ date?: string;
2043
+ /** Estado del segmento: `HK`, `HX`, `UN`, `GK`… */
2044
+ status: string;
2045
+ /** Cantidad que acompaña al estado (`HK1` → `1`). */
2046
+ quantity: number;
2047
+ /** La línea como llegó, sin espacios a los costados. */
2048
+ text: string;
2049
+ }
2050
+ /** Un segmento aéreo: ` 1 DL2151E 20MAR 5 MIALGA HK1 0700 1003 /DCDL*HTDHAT /E`. */
2051
+ interface QueueParagraphAirSegment extends QueueParagraphSegmentBase {
2052
+ kind: 'air';
2053
+ airlineCode: string;
2054
+ flightNumber: number;
2055
+ bookingClass: string;
2056
+ fromAirportCode: string;
2057
+ toAirportCode: string;
2058
+ /** Hora local de salida, en 24 horas (`'07:00'`). */
2059
+ departureTime?: string;
2060
+ /** Hora local de llegada, en 24 horas. Puede ser de otro día: el host no siempre lo marca. */
2061
+ arrivalTime?: string;
2062
+ }
2063
+ /** Un segmento no aéreo con fecha: `2 CAR ZE 22APR Q GK1 DFW/24APR/…`. */
2064
+ interface QueueParagraphOtherSegment extends QueueParagraphSegmentBase {
2065
+ kind: 'other';
2066
+ /** Tipo de segmento del host: `CAR`, `OTH`… */
2067
+ segmentType: string;
2068
+ vendorCode: string;
2069
+ }
2070
+ type QueueParagraphSegment = QueueParagraphAirSegment | QueueParagraphOtherSegment;
2071
+ /** Una entrada del campo de ticketing (`TKT/TIME LIMIT`). */
2072
+ interface QueueParagraphTicketingEntry {
2073
+ /** Número de la entrada: `1` en `1.T-13MAY-X6R3*N18`. */
2074
+ number: number;
2075
+ /** `'T-'`, `'TAW'` (o `TAC`, `TAM`, `TAT`, `TAX`), o `'TE'`/`'TK'` para una línea de boleto. */
2076
+ code: string;
2077
+ /** Fecha ISO de la entrada, con el año resuelto con la regla `'nearest'`. */
2078
+ date?: string;
2079
+ pseudoCityCode?: string;
2080
+ agentSine?: string;
2081
+ /** Número de boleto de una línea `TE` o `TK`. */
2082
+ ticketNumber?: string;
2083
+ /** La entrada como llegó, sin el número: `'T-13MAY-X6R3*N18'`. */
2084
+ text: string;
2085
+ }
2086
+ interface QueueParagraphTicketing {
2087
+ entries: QueueParagraphTicketingEntry[];
2088
+ /** `true` si alguna entrada es una línea de boleto (`TE` o `TK`, con número). */
2089
+ issued: boolean;
2090
+ }
2091
+ /**
2092
+ * La línea `RECEIVED FROM - …` y la línea de firma del PNR
2093
+ * (`<PCC>.<PCC>*<agente> HHMM/DDMMMYY <localizador> H`). La firma es la de la última modificación.
2094
+ */
2095
+ interface QueueParagraphReceivedFrom {
2096
+ /** Lo que sigue a `RECEIVED FROM - `. */
2097
+ name?: string;
2098
+ /** El primer PCC de la firma. */
2099
+ pseudoCityCode?: string;
2100
+ /** La firma del agente, lo que sigue al `*`. */
2101
+ agentSine?: string;
2102
+ /** Fecha y hora de la firma, `'YYYY-MM-DDTHH:mm'`. Sin año, se resuelve hacia atrás. */
2103
+ receivedAt?: string;
2104
+ locator?: string;
2105
+ }
2106
+ interface QueueParagraph {
2107
+ messages: QueueParagraphMessage[];
2108
+ passengers: QueueParagraphPassenger[];
2109
+ segments: QueueParagraphSegment[];
2110
+ /** El campo de ticketing, si el párrafo trae la sección `TKT/TIME LIMIT`. */
2111
+ ticketing?: QueueParagraphTicketing;
2112
+ /** La línea de recibido y la firma, si llega alguna de las dos. */
2113
+ receivedFrom?: QueueParagraphReceivedFrom;
2114
+ /** Las líneas que no se reconocieron, tal cual y en orden. Las líneas vacías no se incluyen. */
2115
+ unparsed: string[];
2116
+ }
2117
+ /**
2118
+ * Lee un párrafo de cola (`QueueItem.paragraph`) y extrae las secciones estándar de un PNR en
2119
+ * formato de host: los avisos de cola, los nombres, los segmentos con su estado, el campo de
2120
+ * ticketing y la línea de recibido con la firma.
2121
+ *
2122
+ * **Es best-effort**: el formato de host no tiene contrato. Una línea que no reconoce va a
2123
+ * `unparsed` y nunca lanza por el contenido del párrafo. Solo lanza `TypeError` si `lines` no es
2124
+ * un array o si `referenceDate` falta o no es válida.
2125
+ *
2126
+ * **No extrae** los plazos escritos en texto libre por la aerolínea (`ADTK BY`, `BEFORE` en
2127
+ * remarks, SSR u OSI): su formato lo pone cada aerolínea. Esas líneas van a `unparsed`.
2128
+ *
2129
+ * Las fechas salen como strings ISO sin zona horaria. Los segmentos y el ticketing toman la fecha
2130
+ * más cercana a `referenceDate` dentro de ±6 meses, y la firma se resuelve hacia atrás.
2131
+ *
2132
+ * **Versionado**: que una línea pase de `unparsed` a un campo nuevo es un cambio minor. Que cambie
2133
+ * la forma de un campo existente es major.
2134
+ */
2135
+ declare function parseQueueParagraph(lines: readonly string[], options: QueueParagraphOptions): QueueParagraph;
2136
+
2137
+ interface SeatAvailabilityRequestSource {
2138
+ /** Grupo del itinerario: aporta la fecha de cada tramo. */
2139
+ group: ItineraryGroup;
2140
+ /** Itinerario elegido, idealmente el devuelto por Revalidate Itinerary. */
2141
+ itinerary: Itinerary;
2142
+ /**
2143
+ * Números de los vuelos para los que se piden mapas, empezando en 1, igual que `segmentIndex`
2144
+ * de `buildBookingFlightDetails` (`1` es `S1`). Por defecto, todos.
2145
+ */
2146
+ segments?: number[];
2147
+ /** ISO 4217 para los precios de los asientos. Si falta, Sabre la elige. */
2148
+ currencyCode?: string;
2149
+ }
2150
+ /**
2151
+ * Arma el request de `sabre.air.getSeats` por payload para un itinerario ya revalidado.
2152
+ *
2153
+ * - `segments[]`: un segmento por vuelo, en el orden del itinerario, con `id` `S1`, `S2`, …
2154
+ * (`IdType` exige empezar por letra). Vuelo, fechas y clase con las mismas reglas que
2155
+ * `buildBookingFlightDetails`; horas en `HH:MM`. Si el operador o su número de vuelo difieren
2156
+ * del comercializador, van en `operatingAirlineCode` / `operatingFlightNumber`.
2157
+ * - `fareComponents[]`: uno por componente de tarifa (`FC` + su `id` en BFM), con `fareBasis`,
2158
+ * `governingCarrier` y `fareDetail`. `brandCode` no se manda: el itinerario no lo trae.
2159
+ * - `passengers[]`: `P1`, `P2`, … en el orden de `passengerInfoList`, repetidos según
2160
+ * `passengerNumber`. Coinciden con `travelerIndex` de Create Booking si `travelers[]` va en
2161
+ * el mismo orden. `fareSegmentAssociation` une cada segmento con su componente de tarifa.
2162
+ */
2163
+ declare function buildSeatAvailabilityRequest(source: SeatAvailabilityRequestSource): SeatAvailabilityByPayloadRq;
2164
+
2165
+ /** Asiento elegido para un vuelo del itinerario. */
2166
+ interface BookingSeatSelection {
2167
+ /**
2168
+ * Número del vuelo en el itinerario, empezando en 1 (`1` es `flights[0]`). Misma base que
2169
+ * `travelerIndex`, para no confundirlos.
2170
+ */
2171
+ segmentIndex: number;
2172
+ /** Número del viajero en `travelers[]` de Create Booking, empezando en 1 (lo fija el spec). */
2173
+ travelerIndex: number;
2174
+ /** Fila y columna, p. ej. `13A`. */
2175
+ number: string;
2176
+ }
2177
+ /** Asiento elegido que tiene precio en Get Seats. Sin datos del pasajero. */
2178
+ interface PricedSeat {
2179
+ /** Empieza en 1, como en `BookingSeatSelection`. */
2180
+ segmentIndex: number;
2181
+ /** Vuelo comercializador, p. ej. `AA1234`. */
2182
+ flight: string;
2183
+ seat: string;
2184
+ amount: string;
2185
+ currencyCode: string;
2186
+ }
1182
2187
  interface BookingFlightDetailsSource {
1183
2188
  /** Grupo del itinerario: aporta la fecha de cada tramo. */
1184
2189
  group: ItineraryGroup;
@@ -1189,6 +2194,16 @@ interface BookingFlightDetailsSource {
1189
2194
  * tiene campo de moneda: se supone la del pricing (la del PCC, salvo `currencyPricing`).
1190
2195
  */
1191
2196
  priceComparison?: Omit<PriceComparison, 'desiredAmount'>;
2197
+ /**
2198
+ * Asientos por número, para `flights[segmentIndex - 1].seats[]` (camino ATPCO; `seatOffers` es
2199
+ * solo NDC). Conviene elegir asientos sin cargo: no se sabe qué hace Sabre con uno cobrable.
2200
+ */
2201
+ seats?: BookingSeatSelection[];
2202
+ /**
2203
+ * Respuesta de `sabre.air.getSeats` para el mismo itinerario. Si un asiento elegido tiene
2204
+ * precio ahí, `booking.create` emite `sabre.booking.seat.priced` (`warn`) y reserva igual.
2205
+ */
2206
+ seatAvailability?: GetSeatsResponse;
1192
2207
  }
1193
2208
  /**
1194
2209
  * Arma `flightDetails` para reservar por el camino ATPCO un itinerario ya revalidado.
@@ -1198,9 +2213,12 @@ interface BookingFlightDetailsSource {
1198
2213
  * `isMarriageGroup` no se manda: no hay fuente para él.
1199
2214
  * - `flightPricing[0].qualifiers`: `passengersPricing` desde `passengerInfoList` y
1200
2215
  * `validatingAirlineCode` desde `validatingCarrierCode` de la primera cotización.
2216
+ * - `seats`: se validan sin llamar a Sabre (`number` con el patrón del spec, vuelo y viajero
2217
+ * existentes, los dos índices empiezan en 1) y se agregan a `flights[segmentIndex - 1].seats[]`.
2218
+ * Sin `seats`, nada cambia.
1201
2219
  */
1202
2220
  declare function buildBookingFlightDetails(source: BookingFlightDetailsSource): FlightDetails;
1203
2221
 
1204
2222
  declare const VERSION = "0.3.0";
1205
2223
 
1206
- export { Air, type BaggageAllowanceDesc, type BaggageInformation, type BargainFinderMaxRequest, type BargainFinderMaxResponse, type BookContactInformation, type BookGenericSeat, type BookSeat, type BookTraveler, type Booking, type BookingAgency, type BookingFlightDetailsSource, type BookingItemReference, BookingManagement, type BookingResponseError, type BookingSource, type BrandedFare, type CancelBookingErrorPolicy, type CancelBookingNotification, type CancelBookingOptions, type CancelBookingRequest, type CancelBookingResponse, type CancelSegmentReference, type CreateBookingErrorPolicy, type CreateBookingOptions, type CreateBookingRequest, type CreateBookingResponse, type CreateBookingResponseError, type CurrencyConversion, type Fare, type FareComponent, type FareComponentDesc, type FareComponentDescSegment, type FareComponentSegment, type FareComponentSegmentDetail, type FareMessage, type FlightDetails, type FlightStatusCode, type FlightTicketOperation, type FlightToBook, type GetBookingExtraFeatures, type GetBookingOptions, type GetBookingRequest, type GetBookingResponse, type GetBookingReturnOnly, type GroupedItineraryResponse, type Itinerary, type ItineraryGroup, type ItineraryMessage, type Leg, type LegDesc, type LegDescription, type LegSchedule, type LegScheduleRef, type LowFareSearchFlight, type LowFareSearchLocation, type LowFareSearchOriginDestination, type LowFareSearchPassengerTypeQuantity, type LowFareSearchRequestorId, type LowFareSearchSource, type LowFareSearchTpaExtensions, type LowFareSearchTravelPreferences, type LowFareSearchTravelerInfoSummary, type ObFeeDesc, type OtaAirLowFareSearchRq, type PassengerInfo, type PassengerPricing, type PassengerTotalFare, type PaymentMethod, type PriceComparison, type PriceComparisonType, type PricingDetails, type PricingInformation, type PricingQualifiers, type Ref, type RefundDocumentsType, type RequestOptions, type RetryOptions, type RevalidateItineraryRequest, type RevalidateItineraryRequestSource, type RevalidateItineraryResponse, Sabre, type SabreAuthVersion, SabreBusinessError, type SabreBusinessErrorOptions, type SabreConfig, type SabreConfigV2, type SabreConfigV3, type SabreCredentials, type SabreCredentialsV2, type SabreEnvironment, SabreError, type SabreErrorOptions, SabreGatewayError, type SabreGatewayErrorOptions, type SabreLogEvent, type SabreLogLevel, type SabreLogger, SabreOrchestrationError, type SabreOrchestrationErrorOptions, type SabreProtocol, type SabreRawResponse, type SabreRawResponseCallback, type SabreServiceErrorOptions, type SabreTokenStore, SabreWarning, type ScheduleCarrier, type ScheduleDesc, type ScheduleEndpoint, type ScheduleEquipment, type SeatAreaPreference, type SpecificFare, type StoredToken, type TaxDesc, type TaxSummaryDesc, type TicketingPolicy, type TotalFare, type TravelerPhone, type TravelerTitle, VERSION, type ValidatingCarrierDesc, buildBookingFlightDetails, buildRevalidateItineraryRequest };
2224
+ export { Air, type BaggageAllowanceDesc, type BaggageInformation, type BargainFinderMaxRequest, type BargainFinderMaxResponse, type BookContactInformation, type BookGenericSeat, type BookSeat, type BookTraveler, type Booking, type BookingAgency, type BookingFlightDetailsSource, type BookingItemReference, BookingManagement, type BookingResponseError, type BookingSeatSelection, type BookingSource, type BrandedFare, type CancelBookingErrorPolicy, type CancelBookingNotification, type CancelBookingOptions, type CancelBookingRequest, type CancelBookingResponse, type CancelSegmentReference, type CreateBookingErrorPolicy, type CreateBookingOptions, type CreateBookingRequest, type CreateBookingResponse, type CreateBookingResponseError, type CurrencyConversion, type Fare, type FareComponent, type FareComponentDesc, type FareComponentDescSegment, type FareComponentSegment, type FareComponentSegmentDetail, type FareMessage, type FlightDetails, type FlightStatusCode, type FlightTicketOperation, type FlightToBook, type GetBookingExtraFeatures, type GetBookingOptions, type GetBookingRequest, type GetBookingResponse, type GetBookingReturnOnly, type GetSeatsRequest, type GetSeatsResponse, type GroupedItineraryResponse, type HostDateDirection, type Itinerary, type ItineraryGroup, type ItineraryMessage, type Leg, type LegDesc, type LegDescription, type LegSchedule, type LegScheduleRef, type LowFareSearchFlight, type LowFareSearchLocation, type LowFareSearchOriginDestination, type LowFareSearchPassengerTypeQuantity, type LowFareSearchRequestorId, type LowFareSearchSource, type LowFareSearchTpaExtensions, type LowFareSearchTravelPreferences, type LowFareSearchTravelerInfoSummary, type ObFeeDesc, type OpenSessionOptions, type OtaAirLowFareSearchRq, type PassengerInfo, type PassengerPricing, type PassengerTotalFare, type PaymentMethod, type PriceComparison, type PriceComparisonType, type PricedSeat, type PricingDetails, type PricingInformation, type PricingQualifiers, type QueueAccessOptions, type QueueAccessRequest, type QueueCount, type QueueCountOptions, type QueueCountRequest, type QueueCountResponse, type QueueEndReason, type QueueItem, type QueueListEntry, type QueueListOptions, type QueueListRequest, type QueueListResponse, QueueManagement, type QueueNavigationOptions, type QueueParagraph, type QueueParagraphAirSegment, type QueueParagraphMessage, type QueueParagraphOptions, type QueueParagraphOtherSegment, type QueueParagraphPassenger, type QueueParagraphReceivedFrom, type QueueParagraphSegment, type QueueParagraphTicketing, type QueueParagraphTicketingEntry, type QueuePlaceOptions, type QueuePlaceRequest, type QueuePlaceResponse, type QueuePlaceResult, type QueuePlaceTarget, type QueuePlacement, type QueueProcessAction, type QueueProcessRequest, type QueueProcessResult, QueueRef, type QueueRemoveRequest, type QueueRemoveTarget, type QueueSelection, type QueueState, type QueueStep, type RawSeatAvailabilityRs, type Ref, type RefundDocumentsType, type RequestOptions, type ResolveHostDateOptions, type RetryOptions, type RevalidateItineraryRequest, type RevalidateItineraryRequestSource, type RevalidateItineraryResponse, Sabre, type SabreAuthVersion, SabreBusinessError, type SabreBusinessErrorOptions, type SabreConfig, type SabreConfigV2, type SabreConfigV3, type SabreCredentials, type SabreCredentialsV2, type SabreEnvironment, SabreError, type SabreErrorOptions, SabreGatewayError, type SabreGatewayErrorOptions, SabreLegacy, type SabreLogEvent, type SabreLogLevel, type SabreLogger, SabreOrchestrationError, type SabreOrchestrationErrorOptions, type SabreProtocol, type SabreRawResponse, type SabreRawResponseCallback, type SabreServiceErrorOptions, SabreSession, SabreSessionError, type SabreSessionErrorKind, type SabreSessionErrorOptions, type SabreTokenStore, SabreWarning, type ScheduleCarrier, type ScheduleDesc, type ScheduleEndpoint, type ScheduleEquipment, type Seat, type SeatAreaPreference, type SeatAvailabilityByPayloadRq, type SeatAvailabilityByPnrLocatorRq, type SeatAvailabilityIssue, type SeatAvailabilityRequestSource, type SeatAvailabilityResponse, type SeatCabinCompartment, type SeatCabinFacility, type SeatCabinLayout, type SeatCabinRowPosition, type SeatCharacteristic, type SeatDisplayOnlyItem, type SeatFareComponent, type SeatFareDetail, type SeatFareSegmentAssociation, type SeatFlightLeg, type SeatKeyValuePair, type SeatLoyaltyProgramAccount, type SeatMap, type SeatOfferItem, type SeatOfferItemDetails, type SeatPassenger, type SeatPassengerPayloadRq, type SeatPassengerRs, type SeatPriceBreakdown, type SeatPriceDefinition, type SeatRow, type SeatSegment, type SeatSegmentPayloadRq, type SeatSegmentRs, type SeatServiceDefinition, type SeatSpecialServiceRequest, type SeatTax, type SpecificFare, type StoredToken, type TaxDesc, type TaxSummaryDesc, type TicketingPolicy, type TotalFare, type TravelerPhone, type TravelerTitle, VERSION, type ValidatingCarrierDesc, buildBookingFlightDetails, buildRevalidateItineraryRequest, buildSeatAvailabilityRequest, parseQueueParagraph, resolveHostDate };