sabre-client 0.3.0-next.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.es.md CHANGED
@@ -12,16 +12,16 @@ SDK de TypeScript para las APIs de Sabre.
12
12
 
13
13
  ## Estado
14
14
 
15
- `0.3.0` **todavía no está publicada**. Se publica cuando estén terminados el Tier 1 y el
16
- Tier 2 del flujo de Air Booking, y el Tier 3 (sesiones SOAP y colas). Mientras tanto, `npm install sabre-client` instala `0.2.4`.
17
-
18
- Las prereleases de la reescritura se publican con el tag `next`:
15
+ `0.4.0` es la versión actual de la reescritura. Cubre el Tier 1 y el Tier 2 del flujo de Air
16
+ Booking por REST, y el Tier 3 (sesiones SOAP y colas). Sobre la `0.3.0` agrega `buildCredentials`
17
+ y los comandos de host (`session.command`), sin cambios incompatibles.
19
18
 
20
19
  ```sh
21
- npm install sabre-client@next
20
+ npm install sabre-client
22
21
  ```
23
22
 
24
- La API todavía puede cambiar antes de `0.3.0`.
23
+ El paquete sigue en `0.x`: una versión minor puede traer cambios incompatibles, y el
24
+ [CHANGELOG](./CHANGELOG.md) los marca.
25
25
 
26
26
  El Tier 1 cubre el flujo básico de Air Booking por REST:
27
27
 
@@ -47,8 +47,9 @@ El Tier 3 agrega el cliente SOAP `SabreLegacy`, con una sesión stateful y Queue
47
47
  | Sesión | `SessionCreateRQ` 2.0.0 / 1.0.0, `OTA_PingRQ`, `SessionCloseRQ` | `legacy.withSession`, `legacy.openSession` |
48
48
  | Colas | Get Queue Count, Access Queue, Place Queue Message | `session.queue.count`, `list`, `access`, `ignore`, `remove`, `place`, `exit`, `process` |
49
49
  | Párrafo de cola | — (función pura) | `parseQueueParagraph`, `resolveHostDate` |
50
+ | Comandos de host | `SabreCommandLLSRQ` 2.0.0 | `session.command` |
50
51
 
51
- Planeado después de `0.3.0`: Get Ancillaries (solo NDC).
52
+ Planeado después de `0.4.0`: Get Ancillaries (solo NDC).
52
53
 
53
54
  ## Requisitos
54
55
 
@@ -71,8 +72,8 @@ const sabre = new Sabre({
71
72
  credentials: {
72
73
  clientId: process.env.SABRE_CLIENT_ID!,
73
74
  clientSecret: process.env.SABRE_CLIENT_SECRET!,
74
- username: process.env.SABRE_EPR_USERNAME!, // usuario EPR, p. ej. `<user>-<PCC>-AA`
75
- password: process.env.SABRE_EPR_PASSWORD!,
75
+ username: '<user>-<PCC>-AA', // usuario EPR ya armado (ver Credenciales abajo)
76
+ password: process.env.SABRE_PASSWORD!,
76
77
  },
77
78
  });
78
79
  ```
@@ -87,6 +88,37 @@ const sabre = new Sabre({
87
88
  | `fetch` | `fetch` global | `fetch` propio (proxies, tests, otros runtimes) |
88
89
  | `tokenStore` | solo en memoria | Comparte el token entre procesos (ver [Reutilizar el token](#reutilizar-el-token)) |
89
90
 
91
+ ### Credenciales
92
+
93
+ Hay **un solo juego de credenciales** para REST y SOAP: el mismo objeto `credentials` sirve para
94
+ `Sabre` y para `SabreLegacy`. Trae el usuario EPR, su PCC y su domain, el password del EPR y, de
95
+ forma opcional, el `clientId`/`clientSecret` de la app. La versión de OAuth solo cambia cómo se
96
+ escribe el `username` del EPR: `<user>-<PCC>-<domain>` (v3) o `V1:<user>:<PCC>:<domain>` (v2).
97
+
98
+ `buildCredentials` arma ese objeto a partir de las partes, así que no necesitas conocer ninguno de
99
+ los dos formatos. No lee variables de entorno y lanza un `TypeError` si algo no es válido:
100
+
101
+ ```ts
102
+ import { Sabre, SabreLegacy, buildCredentials } from 'sabre-client';
103
+
104
+ const credentials = buildCredentials({
105
+ authVersion: 'v3', // por defecto; 'v2' → `V1:<user>:<PCC>:<domain>`
106
+ user: process.env.SABRE_USERNAME!, // solo el usuario EPR
107
+ pcc: process.env.SABRE_PCC!, // el PCC al que pertenece el EPR
108
+ domain: process.env.SABRE_DOMAIN || undefined, // 'AA' por defecto
109
+ password: process.env.SABRE_PASSWORD!,
110
+ clientId: process.env.SABRE_CLIENT_ID!, // obligatorio con v3; con v2, los dos o ninguno
111
+ clientSecret: process.env.SABRE_CLIENT_SECRET!,
112
+ });
113
+
114
+ const sabre = new Sabre({ environment: 'sandbox', credentials });
115
+ const legacy = new SabreLegacy({ environment: 'sandbox', credentials });
116
+ ```
117
+
118
+ El PCC de las credenciales es con el que te autenticas. Trabajar en otro PCC no requiere otro
119
+ juego de credenciales: se pasa en cada operación, como `targetPcc` en `booking.create`, `get` y
120
+ `cancel`, o como `pcc` en las operaciones de colas.
121
+
90
122
  ### Autenticación
91
123
 
92
124
  Nunca pides el token tú. El cliente lo obtiene en la primera llamada, lo cachea, lo renueva
@@ -257,9 +289,12 @@ A tener en cuenta:
257
289
  que llega como `SabreGatewayError`.
258
290
  - **Qué está comprobado.** `byReservationPayload` se probó en producción, en solo lectura, con
259
291
  un vuelo directo y una conexión. La reserva con asiento se probó en sandbox: el asiento llega
260
- al PNR y `sabre.booking.get` lo devuelve en `flights[].seats[]`. `byPnrLocator` todavía no se
261
- probó contra Sabre, porque las únicas reservas posibles en sandbox viven en otro PCC. Los
262
- precios llegan como número aunque el spec diga string, así que los tipos aceptan los dos.
292
+ al PNR y `sabre.booking.get` lo devuelve en `flights[].seats[]`. `byPnrLocator` se probó en
293
+ sandbox con una reserva hecha en el PCC con el que te autenticas: devuelve el mapa de los
294
+ segmentos del PNR, con ids propios de Sabre para pasajero y segmento (`pnr_pax_1`,
295
+ `segment_ancs_1`) en lugar de `P1` y `S1`. En sandbox ninguno de los dos endpoints refleja la
296
+ ocupación: todos los asientos vienen en `F`, también el que tiene el PNR. Los precios llegan
297
+ como número aunque el spec diga string, así que los tipos aceptan los dos.
263
298
 
264
299
  ## Sesiones SOAP y colas (`SabreLegacy`)
265
300
 
@@ -276,7 +311,7 @@ import { SabreLegacy } from 'sabre-client';
276
311
  const legacy = new SabreLegacy({
277
312
  environment: 'production',
278
313
  authVersion: 'v2',
279
- credentials: { username: 'V1:<user>:<PCC>:AA', password: process.env.SABRE_EPR_PASSWORD! },
314
+ credentials: { username: 'V1:<user>:<PCC>:AA', password: process.env.SABRE_PASSWORD! },
280
315
  });
281
316
 
282
317
  const counts = await legacy.withSession((session) => session.queue.count());
@@ -303,6 +338,45 @@ const counts = await legacy.withSession((session) => session.queue.count());
303
338
  `session unusable` sin red, y `close()` resuelve sin red. El SDK no la reabre, porque el cursor
304
339
  de la cola ya se perdió. Volver a empezar es decisión tuya.
305
340
 
341
+ ### Comandos de host
342
+
343
+ `session.command(command, options?)` manda un comando de host de Sabre (`SabreCommandLLSRQ` 2.0.0)
344
+ dentro de la sesión y devuelve la pantalla como texto. **Es una vía de escape**, sin tipos ni
345
+ garantías: el SDK no interpreta la pantalla, y un comando puede cambiar la configuración del PCC o
346
+ emitir boletos. El SDK no tiene una lista de comandos permitidos o bloqueados.
347
+
348
+ ```ts
349
+ const screen = await legacy.withSession((session) => session.command('W/PT¥*', { idempotent: true }));
350
+ // screen.text → 'PSGR TYPE - ON' (como lo manda Sabre, sin recortar)
351
+ // screen.warnings → los stl:Warning, si los hay
352
+ // screen.messageId → eb:MessageId, para soporte de Sabre
353
+ ```
354
+
355
+ - **El comando va tal cual.** En este servicio, el separador `‡` de Sabre se escribe `¥`
356
+ (`W/PT‡*` en Sabre Red es `W/PT¥*` aquí); el SDK no lo convierte.
357
+ - **La pantalla no se recorta.** Las pantallas del host van alineadas por columna y pueden empezar
358
+ con un espacio (` 17MAR WED…`), así que `text` es el contenido de `Response` tal cual. Si
359
+ necesitas recortarla, hazlo tú.
360
+ - **Hasta 1023 caracteres, contados como Sabre:** `!`, `%`, `$`, `&`, `¥` y `§` cuentan 2. Un
361
+ comando más largo lanza un `TypeError` sin llamar a la red (Sabre respondería
362
+ `REQUEST EXCEEDED MAXIMUM LENGTH`).
363
+ - **Sabre bloquea algunos comandos por su cuenta** (`SO`, `/@`, `¤¤`, según su whitelist), aunque
364
+ el SDK no tenga una lista propia.
365
+ - **Algunos comandos cuestan más.** `JR` y `WPNI` cuentan como búsquedas "Worldfare".
366
+ - **Las máscaras del host** se responden con los dos primeros caracteres de la máscara.
367
+ - **Prefiere una API estructurada.** Sabre pide no usar este servicio para lo que ya tiene una:
368
+ si el SDK tiene una operación para eso, úsala.
369
+ - **Sin reintentos por defecto**, porque el SDK no distingue una lectura de un cambio. Pasa
370
+ `{ idempotent: true }` en los comandos de solo lectura y siguen la
371
+ [política de reintentos](#reintentos).
372
+ - **Un mensaje del host no es un error.** `DUTY CODE 9 REQUIRED` o `FORMAT` llegan en `text`. Un
373
+ SOAP fault o un `stl:Error` lanzan, como en cualquier otra llamada de la sesión.
374
+ - Los comandos que dependen de la misma firma (`SI9` y luego `W/PT¥ON`) tienen que ir en la misma
375
+ sesión.
376
+ - El log de debug (`sabre.session.command`) lleva solo el primer token del comando, cortado a 4
377
+ caracteres (`W/PT`, `DC`, `*IM`), nunca el comando entero ni la pantalla. La respuesta completa
378
+ está disponible en `onRawResponse`.
379
+
306
380
  ### Colas
307
381
 
308
382
  Las operaciones de cola están en `session.queue`. `pcc` es opcional en cada llamada, y por defecto
@@ -491,7 +565,7 @@ const booking = await sabre.booking.get({ confirmationId }, { onRawResponse: (r)
491
565
  conserva el valor y escríbelo cuando la llamada vuelva.
492
566
 
493
567
  En `SabreLegacy`, `protocol` es `'soap'`, `body` es el sobre SOAP completo, y `operation` es
494
- `'openSession'`, `'close'`, `'ping'` o `'queue.<método>'`. El token de la sesión
568
+ `'openSession'`, `'close'`, `'ping'`, `'command'` o `'queue.<método>'`. El token de la sesión
495
569
  (`BinarySecurityToken`) se reemplaza por `[REDACTED]` donde aparezca. No se cambia nada más.
496
570
 
497
571
  > [!WARNING]
@@ -556,7 +630,7 @@ El SDK registra eventos estructurados (`sabre.request.start`, `sabre.request.end
556
630
  `sabre.request.retry`, `sabre.request.rawResponseHookFailed`, `sabre.auth.token.refresh`,
557
631
  `sabre.auth.token.store`, `sabre.booking.seat.priced`, `sabre.session.open`,
558
632
  `sabre.session.close`, `sabre.session.closeFailed`, `sabre.session.keepAliveFailed`,
559
- `sabre.queue.exitTolerated`, `sabre.queue.exitFailed`) y nunca los bodies
633
+ `sabre.session.command`, `sabre.queue.exitTolerated`, `sabre.queue.exitFailed`) y nunca los bodies
560
634
  crudos de request o response. Los secretos, el header `Authorization` y los datos de pasajeros
561
635
  se redactan siempre antes de llegar a tu logger.
562
636
 
package/README.md CHANGED
@@ -12,16 +12,16 @@ TypeScript SDK for the Sabre APIs.
12
12
 
13
13
  ## Status
14
14
 
15
- `0.3.0` is **not released yet**. It will be released once Tier 1 and Tier 2 of the Air Booking
16
- flow and Tier 3 (SOAP sessions and queues) are done. Until then, `npm install sabre-client` installs `0.2.4`.
17
-
18
- Prereleases of the rewrite are published under the `next` tag:
15
+ `0.4.0` is the current release of the rewrite. It covers Tier 1 and Tier 2 of the Air Booking
16
+ flow over REST, and Tier 3 (SOAP sessions and queues). It adds `buildCredentials` and host
17
+ commands (`session.command`) to `0.3.0`, with no breaking changes.
19
18
 
20
19
  ```sh
21
- npm install sabre-client@next
20
+ npm install sabre-client
22
21
  ```
23
22
 
24
- The API may still change before `0.3.0`.
23
+ The package is still `0.x`: a minor version may include breaking changes, and the
24
+ [CHANGELOG](./CHANGELOG.md) marks them.
25
25
 
26
26
  Tier 1 covers the core Air Booking flow over REST:
27
27
 
@@ -47,8 +47,9 @@ Tier 3 adds the `SabreLegacy` SOAP client, with a stateful session and Queue Man
47
47
  | Session | `SessionCreateRQ` 2.0.0 / 1.0.0, `OTA_PingRQ`, `SessionCloseRQ` | `legacy.withSession`, `legacy.openSession` |
48
48
  | Queues | Get Queue Count, Access Queue, Place Queue Message | `session.queue.count`, `list`, `access`, `ignore`, `remove`, `place`, `exit`, `process` |
49
49
  | Queue paragraph | — (pure function) | `parseQueueParagraph`, `resolveHostDate` |
50
+ | Host commands | `SabreCommandLLSRQ` 2.0.0 | `session.command` |
50
51
 
51
- Planned after `0.3.0`: Get Ancillaries (NDC only).
52
+ Planned after `0.4.0`: Get Ancillaries (NDC only).
52
53
 
53
54
  ## Requirements
54
55
 
@@ -71,8 +72,8 @@ const sabre = new Sabre({
71
72
  credentials: {
72
73
  clientId: process.env.SABRE_CLIENT_ID!,
73
74
  clientSecret: process.env.SABRE_CLIENT_SECRET!,
74
- username: process.env.SABRE_EPR_USERNAME!, // EPR user, e.g. `<user>-<PCC>-AA`
75
- password: process.env.SABRE_EPR_PASSWORD!,
75
+ username: '<user>-<PCC>-AA', // EPR username, already built (see Credentials below)
76
+ password: process.env.SABRE_PASSWORD!,
76
77
  },
77
78
  });
78
79
  ```
@@ -87,6 +88,37 @@ const sabre = new Sabre({
87
88
  | `fetch` | global `fetch` | Custom `fetch` (proxies, tests, other runtimes) |
88
89
  | `tokenStore` | in-memory only | Shares the token between processes (see [Token reuse](#token-reuse)) |
89
90
 
91
+ ### Credentials
92
+
93
+ There is **one set of credentials** for REST and SOAP: the same `credentials` object works for
94
+ `Sabre` and for `SabreLegacy`. It holds the EPR user, its PCC and domain, the EPR password and,
95
+ optionally, the app's `clientId`/`clientSecret`. The OAuth version only changes how the EPR
96
+ `username` is written: `<user>-<PCC>-<domain>` (v3) or `V1:<user>:<PCC>:<domain>` (v2).
97
+
98
+ `buildCredentials` builds that object from the parts, so you don't have to know either format.
99
+ It does not read environment variables and throws a `TypeError` on invalid input:
100
+
101
+ ```ts
102
+ import { Sabre, SabreLegacy, buildCredentials } from 'sabre-client';
103
+
104
+ const credentials = buildCredentials({
105
+ authVersion: 'v3', // default; 'v2' → `V1:<user>:<PCC>:<domain>`
106
+ user: process.env.SABRE_USERNAME!, // the EPR user alone
107
+ pcc: process.env.SABRE_PCC!, // the PCC the EPR belongs to
108
+ domain: process.env.SABRE_DOMAIN || undefined, // 'AA' by default
109
+ password: process.env.SABRE_PASSWORD!,
110
+ clientId: process.env.SABRE_CLIENT_ID!, // required with v3; with v2, both or neither
111
+ clientSecret: process.env.SABRE_CLIENT_SECRET!,
112
+ });
113
+
114
+ const sabre = new Sabre({ environment: 'sandbox', credentials });
115
+ const legacy = new SabreLegacy({ environment: 'sandbox', credentials });
116
+ ```
117
+
118
+ The PCC in the credentials is the one you authenticate with. Working in another PCC is not a
119
+ second set of credentials: pass it per operation, as `targetPcc` in `booking.create`, `get` and
120
+ `cancel`, or as `pcc` in the queue operations.
121
+
90
122
  ### Authentication
91
123
 
92
124
  You never request a token yourself. The client gets one on the first call, caches it, renews
@@ -256,9 +288,12 @@ Things to know:
256
288
  which surfaces as a `SabreGatewayError`.
257
289
  - **What has been checked.** `byReservationPayload` was checked read-only in production, for
258
290
  a nonstop and a connection. Booking with a seat was checked in sandbox: the seat reaches the
259
- PNR and `sabre.booking.get` returns it in `flights[].seats[]`. `byPnrLocator` has not been
260
- checked against Sabre yet, because the only sandbox bookings available live in another PCC.
261
- Prices arrive as numbers even though the spec says strings, so the types accept both.
291
+ PNR and `sabre.booking.get` returns it in `flights[].seats[]`. `byPnrLocator` was checked in
292
+ sandbox with a booking made in the PCC you authenticate with: it returns the map for the PNR's
293
+ segments, with Sabre's own passenger and segment ids (`pnr_pax_1`, `segment_ancs_1`) instead
294
+ of `P1` and `S1`. In sandbox neither endpoint reflects occupancy: every seat comes back as
295
+ `F`, including the one the PNR holds. Prices arrive as numbers even though the spec says
296
+ strings, so the types accept both.
262
297
 
263
298
  ## SOAP sessions and queues (`SabreLegacy`)
264
299
 
@@ -274,7 +309,7 @@ import { SabreLegacy } from 'sabre-client';
274
309
  const legacy = new SabreLegacy({
275
310
  environment: 'production',
276
311
  authVersion: 'v2',
277
- credentials: { username: 'V1:<user>:<PCC>:AA', password: process.env.SABRE_EPR_PASSWORD! },
312
+ credentials: { username: 'V1:<user>:<PCC>:AA', password: process.env.SABRE_PASSWORD! },
278
313
  });
279
314
 
280
315
  const counts = await legacy.withSession((session) => session.queue.count());
@@ -302,6 +337,42 @@ const counts = await legacy.withSession((session) => session.queue.count());
302
337
  calling the network, and `close()` resolves without calling it. The SDK does not reopen the
303
338
  session, because the queue cursor is already lost. Starting over is your decision.
304
339
 
340
+ ### Host commands
341
+
342
+ `session.command(command, options?)` sends a Sabre host command (`SabreCommandLLSRQ` 2.0.0)
343
+ inside the session and returns the screen as text. **It is an escape hatch**, with no types and
344
+ no guarantees: the SDK does not parse the screen, and a command can change the PCC configuration
345
+ or issue tickets. There is no list of allowed or blocked commands.
346
+
347
+ ```ts
348
+ const screen = await legacy.withSession((session) => session.command('W/PT¥*', { idempotent: true }));
349
+ // screen.text → 'PSGR TYPE - ON' (as Sabre sends it, not trimmed)
350
+ // screen.warnings → the stl:Warning entries, if any
351
+ // screen.messageId → eb:MessageId, for Sabre support
352
+ ```
353
+
354
+ - **The command is sent as is.** In this service Sabre's `‡` separator is written `¥`
355
+ (`W/PT‡*` in Sabre Red is `W/PT¥*` here); the SDK does not convert it.
356
+ - **The screen is not trimmed.** Host screens are aligned by column and can start with a space
357
+ (` 17MAR WED…`), so `text` is the content of `Response` as is. Trim it yourself if you need to.
358
+ - **Up to 1023 characters, counted as Sabre does:** `!`, `%`, `$`, `&`, `¥` and `§` count 2. A
359
+ longer command throws a `TypeError` without calling the network (Sabre would answer
360
+ `REQUEST EXCEEDED MAXIMUM LENGTH`).
361
+ - **Sabre blocks some commands on its own** (`SO`, `/@`, `¤¤`, per its whitelist), even though
362
+ the SDK has no list of its own.
363
+ - **Some commands cost more.** `JR` and `WPNI` count as "Worldfare" searches.
364
+ - **Host masks** are answered with the first two characters of the mask.
365
+ - **Prefer a structured API.** Sabre asks not to use this service for what already has one: when
366
+ the SDK has an operation for it, use that.
367
+ - **No retries by default**, because the SDK cannot tell a read from a change. Pass
368
+ `{ idempotent: true }` for read-only commands and they follow the [retry policy](#retries).
369
+ - **A host message is not an error.** `DUTY CODE 9 REQUIRED` or `FORMAT` come back in `text`. A
370
+ SOAP fault or an `stl:Error` throws, like any other session call.
371
+ - Commands that need the same sign-in (`SI9` followed by `W/PT¥ON`) must run in the same session.
372
+ - The debug log (`sabre.session.command`) carries only the first token of the command, cut to 4
373
+ characters (`W/PT`, `DC`, `*IM`), never the whole command or the screen. The full response is
374
+ available through `onRawResponse`.
375
+
305
376
  ### Queues
306
377
 
307
378
  The queue operations live in `session.queue`. `pcc` is optional in every call and defaults to the
@@ -487,7 +558,7 @@ const booking = await sabre.booking.get({ confirmationId }, { onRawResponse: (r)
487
558
  asynchronously, keep the value and write it after the call returns.
488
559
 
489
560
  In `SabreLegacy`, `protocol` is `'soap'`, `body` is the whole SOAP envelope, and `operation` is
490
- `'openSession'`, `'close'`, `'ping'` or `'queue.<method>'`. The session token
561
+ `'openSession'`, `'close'`, `'ping'`, `'command'` or `'queue.<method>'`. The session token
491
562
  (`BinarySecurityToken`) is replaced by `[REDACTED]` wherever it appears. Nothing else is changed.
492
563
 
493
564
  > [!WARNING]
@@ -553,7 +624,7 @@ The SDK logs structured events (`sabre.request.start`, `sabre.request.end`,
553
624
  `sabre.request.retry`, `sabre.request.rawResponseHookFailed`, `sabre.auth.token.refresh`,
554
625
  `sabre.auth.token.store`, `sabre.booking.seat.priced`, `sabre.session.open`,
555
626
  `sabre.session.close`, `sabre.session.closeFailed`, `sabre.session.keepAliveFailed`,
556
- `sabre.queue.exitTolerated`, `sabre.queue.exitFailed`), never raw
627
+ `sabre.session.command`, `sabre.queue.exitTolerated`, `sabre.queue.exitFailed`), never raw
557
628
  request or response bodies. Secrets, the `Authorization` header and passenger data are always
558
629
  redacted before they reach your logger.
559
630
 
package/dist/index.d.ts CHANGED
@@ -41,7 +41,7 @@ interface SabreLogger {
41
41
  }
42
42
  type SabreLogLevel = keyof SabreLogger;
43
43
  /** Eventos estables que emite el SDK como `message`. */
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';
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.session.command' | 'sabre.queue.exitTolerated' | 'sabre.queue.exitFailed';
45
45
  /** Logger interno: redacta siempre el contexto y no hace nada si no hay logger. */
46
46
  declare class EventLogger {
47
47
  #private;
@@ -1893,6 +1893,27 @@ declare class QueueManagement {
1893
1893
  place(request: QueuePlaceRequest, options?: QueuePlaceOptions): Promise<QueuePlaceResponse>;
1894
1894
  }
1895
1895
 
1896
+ interface SabreCommandOptions extends RequestOptions {
1897
+ /**
1898
+ * `true` solo si el comando es una lectura (`W/PT¥*`, `DC¥…`): entra en la política de
1899
+ * reintentos. Por defecto `false`, porque el SDK no sabe si un comando cambia algo.
1900
+ */
1901
+ idempotent?: boolean;
1902
+ }
1903
+ interface SabreCommandResponse {
1904
+ /**
1905
+ * La pantalla tal como la devuelve Sabre (`Response`), sin interpretar y sin recortar: las
1906
+ * pantallas van alineadas por columna y pueden empezar con un espacio (` 17MAR WED…`). Recortar
1907
+ * es decisión de quien la lee. Un mensaje de host (`DUTY CODE 9 REQUIRED`, `FORMAT`) llega aquí:
1908
+ * no lanza.
1909
+ */
1910
+ text: string;
1911
+ /** Los `stl:Warning` de la respuesta. No lanzan. */
1912
+ warnings: SabreWarning[];
1913
+ /** `eb:MessageId` de la respuesta, el dato que pide soporte de Sabre. */
1914
+ messageId: string | undefined;
1915
+ }
1916
+
1896
1917
  /** Lo que una operación pide al transporte. La sesión agrega `CPAId`, `ConversationId` y el token. */
1897
1918
  type SessionRequest = Omit<SoapRequest, 'cpaId' | 'conversationId' | 'security'>;
1898
1919
  /**
@@ -1937,6 +1958,14 @@ declare class SabreSession {
1937
1958
  * recorrido de cola no hace falta: cada operación ya lo reinicia.
1938
1959
  */
1939
1960
  ping(options?: RequestOptions): Promise<void>;
1961
+ /**
1962
+ * Manda un comando de host (`SabreCommandLLSRQ` 2.0.0) y devuelve la pantalla como texto, sin
1963
+ * interpretarla. Es una vía de escape: sin tipos ni garantías, y un comando puede cambiar la
1964
+ * configuración del PCC o emitir. El comando va tal cual; el separador de Sabre Red (`‡`) se
1965
+ * escribe `¥`. Sin reintento salvo `{ idempotent: true }`, para comandos de solo lectura. La
1966
+ * pantalla llega sin recortar, y más de 1023 caracteres (contados como Sabre) lanza sin red.
1967
+ */
1968
+ command(command: string, options?: SabreCommandOptions): Promise<SabreCommandResponse>;
1940
1969
  /**
1941
1970
  * Cierra la sesión con `SessionCloseRQ`: Sabre descarta el AAA e invalida el token. Es
1942
1971
  * idempotente: las llamadas siguientes devuelven la misma promesa, sin volver a la red. Si el
@@ -1975,6 +2004,42 @@ declare class SabreLegacy {
1975
2004
  withSession<T>(callback: (session: SabreSession) => Promise<T>): Promise<T>;
1976
2005
  }
1977
2006
 
2007
+ interface BuildCredentialsBase {
2008
+ /** Usuario EPR, sin PCC ni domain. */
2009
+ user: string;
2010
+ /** PCC del EPR (el *group*): 3 o 4 caracteres alfanuméricos. */
2011
+ pcc: string;
2012
+ /** Domain del EPR. Default `'AA'`. */
2013
+ domain?: string;
2014
+ /** Contraseña EPR. */
2015
+ password: string;
2016
+ }
2017
+ /** Partes para OAuth Token Create v3 (default): `clientId` y `clientSecret` son obligatorios. */
2018
+ interface BuildCredentialsOptionsV3 extends BuildCredentialsBase {
2019
+ authVersion?: 'v3';
2020
+ clientId: string;
2021
+ clientSecret: string;
2022
+ }
2023
+ /**
2024
+ * Partes para OAuth Token Create v2: `clientId`/`clientSecret` son opcionales. REST los ignora,
2025
+ * pero si vienen los dos, `SabreLegacy` abre la sesión con `SessionCreateRQ` 2.0.0.
2026
+ */
2027
+ interface BuildCredentialsOptionsV2 extends BuildCredentialsBase {
2028
+ authVersion: 'v2';
2029
+ clientId?: string;
2030
+ clientSecret?: string;
2031
+ }
2032
+ type BuildCredentialsOptions = BuildCredentialsOptionsV3 | BuildCredentialsOptionsV2;
2033
+ /**
2034
+ * Arma el `credentials` para `Sabre` y `SabreLegacy` a partir del usuario, el PCC, el domain y
2035
+ * la contraseña del EPR, más `clientId`/`clientSecret` cuando los hay. El username queda como
2036
+ * `<user>-<PCC>-<domain>` (v3) o `V1:<user>:<PCC>:<domain>` (v2). No lee variables de entorno
2037
+ * ni toca la red; un dato inválido lanza `TypeError` sin repetir secretos.
2038
+ */
2039
+ declare function buildCredentials(options: BuildCredentialsOptionsV3): SabreCredentials;
2040
+ declare function buildCredentials(options: BuildCredentialsOptionsV2): SabreCredentialsV2;
2041
+ declare function buildCredentials(options: BuildCredentialsOptions): SabreCredentials | SabreCredentialsV2;
2042
+
1978
2043
  /**
1979
2044
  * Cómo se elige el año cuando el texto no lo trae:
1980
2045
  *
@@ -2219,6 +2284,6 @@ interface BookingFlightDetailsSource {
2219
2284
  */
2220
2285
  declare function buildBookingFlightDetails(source: BookingFlightDetailsSource): FlightDetails;
2221
2286
 
2222
- declare const VERSION = "0.3.0";
2287
+ declare const VERSION = "0.4.0";
2223
2288
 
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 };
2289
+ 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 BuildCredentialsOptions, type BuildCredentialsOptionsV2, type BuildCredentialsOptionsV3, 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 SabreCommandOptions, type SabreCommandResponse, 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, buildCredentials, buildRevalidateItineraryRequest, buildSeatAvailabilityRequest, parseQueueParagraph, resolveHostDate };