sabre-legacy-client 0.1.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.
Files changed (210) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/build/index.d.ts +9 -0
  4. package/build/index.js +8 -0
  5. package/build/package.json +44 -0
  6. package/build/src/authentication/authentication..d.ts +21 -0
  7. package/build/src/authentication/authentication..js +28 -0
  8. package/build/src/authentication/helpers/index.d.ts +1 -0
  9. package/build/src/authentication/helpers/index.js +1 -0
  10. package/build/src/authentication/helpers/username-token.helper.d.ts +15 -0
  11. package/build/src/authentication/helpers/username-token.helper.js +17 -0
  12. package/build/src/authentication/requests/index.d.ts +4 -0
  13. package/build/src/authentication/requests/index.js +4 -0
  14. package/build/src/authentication/requests/interfaces/ping-options.interface.d.ts +3 -0
  15. package/build/src/authentication/requests/interfaces/ping-options.interface.js +1 -0
  16. package/build/src/authentication/requests/interfaces/session-close-options.interface.d.ts +3 -0
  17. package/build/src/authentication/requests/interfaces/session-close-options.interface.js +1 -0
  18. package/build/src/authentication/requests/interfaces/session-create-options.interface.d.ts +5 -0
  19. package/build/src/authentication/requests/interfaces/session-create-options.interface.js +1 -0
  20. package/build/src/authentication/requests/interfaces/token-create-options.interface.d.ts +3 -0
  21. package/build/src/authentication/requests/interfaces/token-create-options.interface.js +1 -0
  22. package/build/src/authentication/requests/interfaces/username-token-options.interface.d.ts +8 -0
  23. package/build/src/authentication/requests/interfaces/username-token-options.interface.js +1 -0
  24. package/build/src/authentication/requests/ping.request.d.ts +12 -0
  25. package/build/src/authentication/requests/ping.request.js +16 -0
  26. package/build/src/authentication/requests/session-close.request.d.ts +12 -0
  27. package/build/src/authentication/requests/session-close.request.js +16 -0
  28. package/build/src/authentication/requests/session-create.request.d.ts +12 -0
  29. package/build/src/authentication/requests/session-create.request.js +26 -0
  30. package/build/src/authentication/requests/token-create.request.d.ts +12 -0
  31. package/build/src/authentication/requests/token-create.request.js +26 -0
  32. package/build/src/common/config/xml-parser.config.d.ts +1 -0
  33. package/build/src/common/config/xml-parser.config.js +17 -0
  34. package/build/src/common/helpers/header.helper.d.ts +10 -0
  35. package/build/src/common/helpers/header.helper.js +14 -0
  36. package/build/src/common/helpers/message-header.helper.d.ts +17 -0
  37. package/build/src/common/helpers/message-header.helper.js +19 -0
  38. package/build/src/common/helpers/request.helper.d.ts +12 -0
  39. package/build/src/common/helpers/request.helper.js +19 -0
  40. package/build/src/common/helpers/security.helper.d.ts +9 -0
  41. package/build/src/common/helpers/security.helper.js +11 -0
  42. package/build/src/common/helpers/soap-env.helper.d.ts +15 -0
  43. package/build/src/common/helpers/soap-env.helper.js +17 -0
  44. package/build/src/common/interfaces/actions.interface.d.ts +16 -0
  45. package/build/src/common/interfaces/actions.interface.js +18 -0
  46. package/build/src/common/interfaces/application-results.interface.d.ts +12 -0
  47. package/build/src/common/interfaces/application-results.interface.js +1 -0
  48. package/build/src/common/interfaces/header-options.interface.d.ts +5 -0
  49. package/build/src/common/interfaces/header-options.interface.js +1 -0
  50. package/build/src/common/interfaces/headers-request-options.interface.d.ts +4 -0
  51. package/build/src/common/interfaces/headers-request-options.interface.js +1 -0
  52. package/build/src/common/interfaces/index.d.ts +8 -0
  53. package/build/src/common/interfaces/index.js +8 -0
  54. package/build/src/common/interfaces/message-header-options.interface.d.ts +7 -0
  55. package/build/src/common/interfaces/message-header-options.interface.js +1 -0
  56. package/build/src/common/interfaces/post-options.interface.d.ts +5 -0
  57. package/build/src/common/interfaces/post-options.interface.js +1 -0
  58. package/build/src/common/interfaces/request-options.interface.d.ts +4 -0
  59. package/build/src/common/interfaces/request-options.interface.js +1 -0
  60. package/build/src/common/interfaces/soap-env-options.interface.d.ts +4 -0
  61. package/build/src/common/interfaces/soap-env-options.interface.js +1 -0
  62. package/build/src/common/utils/get-sub-string.d.ts +1 -0
  63. package/build/src/common/utils/get-sub-string.js +11 -0
  64. package/build/src/config.d.ts +5 -0
  65. package/build/src/config.js +18 -0
  66. package/build/src/daily-sales/common/interfaces/cupon-type.enum.d.ts +7 -0
  67. package/build/src/daily-sales/common/interfaces/cupon-type.enum.js +6 -0
  68. package/build/src/daily-sales/common/interfaces/document-type.enum.d.ts +9 -0
  69. package/build/src/daily-sales/common/interfaces/document-type.enum.js +8 -0
  70. package/build/src/daily-sales/common/interfaces/index.d.ts +5 -0
  71. package/build/src/daily-sales/common/interfaces/index.js +5 -0
  72. package/build/src/daily-sales/common/interfaces/selection-criteria.interface.d.ts +13 -0
  73. package/build/src/daily-sales/common/interfaces/selection-criteria.interface.js +1 -0
  74. package/build/src/daily-sales/common/interfaces/settlement-type.enum.d.ts +7 -0
  75. package/build/src/daily-sales/common/interfaces/settlement-type.enum.js +6 -0
  76. package/build/src/daily-sales/common/interfaces/transaction-type.enum.d.ts +8 -0
  77. package/build/src/daily-sales/common/interfaces/transaction-type.enum.js +7 -0
  78. package/build/src/daily-sales/common/requests/interfaces/report-options.interface.d.ts +7 -0
  79. package/build/src/daily-sales/common/requests/interfaces/report-options.interface.js +1 -0
  80. package/build/src/daily-sales/common/requests/interfaces/summary-options.interface.d.ts +15 -0
  81. package/build/src/daily-sales/common/requests/interfaces/summary-options.interface.js +1 -0
  82. package/build/src/daily-sales/common/requests/report.request.d.ts +10 -0
  83. package/build/src/daily-sales/common/requests/report.request.js +17 -0
  84. package/build/src/daily-sales/common/requests/summary.request.d.ts +15 -0
  85. package/build/src/daily-sales/common/requests/summary.request.js +24 -0
  86. package/build/src/daily-sales/common/utils/parse-summary-options-to-selection-criteria.d.ts +4 -0
  87. package/build/src/daily-sales/common/utils/parse-summary-options-to-selection-criteria.js +16 -0
  88. package/build/src/daily-sales/common/utils/parse-summary-options-to-xml.d.ts +3 -0
  89. package/build/src/daily-sales/common/utils/parse-summary-options-to-xml.js +8 -0
  90. package/build/src/daily-sales/common/utils/parse-summary-options-to-xml.spec.d.ts +1 -0
  91. package/build/src/daily-sales/common/utils/parse-summary-options-to-xml.spec.js +30 -0
  92. package/build/src/daily-sales/common/utils/parse-xml-to-daily-sales-report.d.ts +2 -0
  93. package/build/src/daily-sales/common/utils/parse-xml-to-daily-sales-report.js +5 -0
  94. package/build/src/daily-sales/common/utils/parse-xml-to-daily-sales-report.spec.d.ts +1 -0
  95. package/build/src/daily-sales/common/utils/parse-xml-to-daily-sales-report.spec.js +56 -0
  96. package/build/src/daily-sales/common/utils/parse-xml-to-daily-sales-summary.d.ts +2 -0
  97. package/build/src/daily-sales/common/utils/parse-xml-to-daily-sales-summary.js +5 -0
  98. package/build/src/daily-sales/common/utils/parse-xml-to-daily-sales-summary.spec.d.ts +1 -0
  99. package/build/src/daily-sales/common/utils/parse-xml-to-daily-sales-summary.spec.js +61 -0
  100. package/build/src/daily-sales/daily-sales.d.ts +9 -0
  101. package/build/src/daily-sales/daily-sales.js +41 -0
  102. package/build/src/daily-sales/interfaces/daily-sales-report-options.interface.d.ts +63 -0
  103. package/build/src/daily-sales/interfaces/daily-sales-report-options.interface.js +1 -0
  104. package/build/src/daily-sales/interfaces/daily-sales-summary-options.interface.d.ts +107 -0
  105. package/build/src/daily-sales/interfaces/daily-sales-summary-options.interface.js +1 -0
  106. package/build/src/interfaces.d.ts +24 -0
  107. package/build/src/interfaces.js +17 -0
  108. package/build/src/queue/common/helpers/interfaces/navigation-actions.interface.d.ts +5 -0
  109. package/build/src/queue/common/helpers/interfaces/navigation-actions.interface.js +6 -0
  110. package/build/src/queue/common/helpers/interfaces/queue-identifier-options.interface.d.ts +6 -0
  111. package/build/src/queue/common/helpers/interfaces/queue-identifier-options.interface.js +1 -0
  112. package/build/src/queue/common/helpers/navigation-action.helper.d.ts +3 -0
  113. package/build/src/queue/common/helpers/navigation-action.helper.js +7 -0
  114. package/build/src/queue/common/helpers/queue-access.helper.d.ts +9 -0
  115. package/build/src/queue/common/helpers/queue-access.helper.js +11 -0
  116. package/build/src/queue/common/helpers/queue-count.helper.d.ts +10 -0
  117. package/build/src/queue/common/helpers/queue-count.helper.js +12 -0
  118. package/build/src/queue/common/helpers/queue-identifier.helper.d.ts +18 -0
  119. package/build/src/queue/common/helpers/queue-identifier.helper.js +23 -0
  120. package/build/src/queue/common/helpers/queue-place.helper.d.ts +10 -0
  121. package/build/src/queue/common/helpers/queue-place.helper.js +12 -0
  122. package/build/src/queue/common/interfaces/index.d.ts +2 -0
  123. package/build/src/queue/common/interfaces/index.js +2 -0
  124. package/build/src/queue/common/interfaces/notification.interface.d.ts +5 -0
  125. package/build/src/queue/common/interfaces/notification.interface.js +1 -0
  126. package/build/src/queue/common/interfaces/warning.interface.d.ts +4 -0
  127. package/build/src/queue/common/interfaces/warning.interface.js +1 -0
  128. package/build/src/queue/common/requests/access-list.request.d.ts +12 -0
  129. package/build/src/queue/common/requests/access-list.request.js +22 -0
  130. package/build/src/queue/common/requests/access.request.d.ts +12 -0
  131. package/build/src/queue/common/requests/access.request.js +22 -0
  132. package/build/src/queue/common/requests/count.request.d.ts +12 -0
  133. package/build/src/queue/common/requests/count.request.js +25 -0
  134. package/build/src/queue/common/requests/exit.request.d.ts +12 -0
  135. package/build/src/queue/common/requests/exit.request.js +19 -0
  136. package/build/src/queue/common/requests/ignore.request.d.ts +12 -0
  137. package/build/src/queue/common/requests/ignore.request.js +19 -0
  138. package/build/src/queue/common/requests/index.d.ts +7 -0
  139. package/build/src/queue/common/requests/index.js +7 -0
  140. package/build/src/queue/common/requests/interfaces/access-options.interface.d.ts +5 -0
  141. package/build/src/queue/common/requests/interfaces/access-options.interface.js +1 -0
  142. package/build/src/queue/common/requests/interfaces/count-options.interface.d.ts +4 -0
  143. package/build/src/queue/common/requests/interfaces/count-options.interface.js +1 -0
  144. package/build/src/queue/common/requests/interfaces/exit-options.interface.d.ts +3 -0
  145. package/build/src/queue/common/requests/interfaces/exit-options.interface.js +1 -0
  146. package/build/src/queue/common/requests/interfaces/ignore-options.interface.d.ts +3 -0
  147. package/build/src/queue/common/requests/interfaces/ignore-options.interface.js +1 -0
  148. package/build/src/queue/common/requests/interfaces/place-options.inferface.d.ts +3 -0
  149. package/build/src/queue/common/requests/interfaces/place-options.inferface.js +1 -0
  150. package/build/src/queue/common/requests/interfaces/remove-options.interface.d.ts +3 -0
  151. package/build/src/queue/common/requests/interfaces/remove-options.interface.js +1 -0
  152. package/build/src/queue/common/requests/place.request.d.ts +12 -0
  153. package/build/src/queue/common/requests/place.request.js +20 -0
  154. package/build/src/queue/common/requests/remove.request.d.ts +12 -0
  155. package/build/src/queue/common/requests/remove.request.js +19 -0
  156. package/build/src/queue/common/utils/find-booking-id.d.ts +2 -0
  157. package/build/src/queue/common/utils/find-booking-id.js +10 -0
  158. package/build/src/queue/common/utils/find-booking-id.spec.d.ts +1 -0
  159. package/build/src/queue/common/utils/find-booking-id.spec.js +9 -0
  160. package/build/src/queue/common/utils/format-queue-response.d.ts +3 -0
  161. package/build/src/queue/common/utils/format-queue-response.js +12 -0
  162. package/build/src/queue/common/utils/index.d.ts +5 -0
  163. package/build/src/queue/common/utils/index.js +5 -0
  164. package/build/src/queue/common/utils/interfaces/booking-text.interface.d.ts +3 -0
  165. package/build/src/queue/common/utils/interfaces/booking-text.interface.js +1 -0
  166. package/build/src/queue/common/utils/interfaces/format-queue-options.interface.d.ts +11 -0
  167. package/build/src/queue/common/utils/interfaces/format-queue-options.interface.js +1 -0
  168. package/build/src/queue/common/utils/interfaces/index.d.ts +6 -0
  169. package/build/src/queue/common/utils/interfaces/index.js +6 -0
  170. package/build/src/queue/common/utils/interfaces/queue-access.interface.d.ts +21 -0
  171. package/build/src/queue/common/utils/interfaces/queue-access.interface.js +1 -0
  172. package/build/src/queue/common/utils/interfaces/queue-count.interface.d.ts +23 -0
  173. package/build/src/queue/common/utils/interfaces/queue-count.interface.js +1 -0
  174. package/build/src/queue/common/utils/interfaces/queue-place.interface.d.ts +8 -0
  175. package/build/src/queue/common/utils/interfaces/queue-place.interface.js +1 -0
  176. package/build/src/queue/common/utils/interfaces/warnings-notifications-options.interface.d.ts +5 -0
  177. package/build/src/queue/common/utils/interfaces/warnings-notifications-options.interface.js +1 -0
  178. package/build/src/queue/common/utils/parse-paragraph-to-warnings.d.ts +4 -0
  179. package/build/src/queue/common/utils/parse-paragraph-to-warnings.js +12 -0
  180. package/build/src/queue/common/utils/parse-warnings-to-notifications.d.ts +6 -0
  181. package/build/src/queue/common/utils/parse-warnings-to-notifications.js +4 -0
  182. package/build/src/queue/common/utils/parse-xml-to-queue-access.d.ts +2 -0
  183. package/build/src/queue/common/utils/parse-xml-to-queue-access.js +6 -0
  184. package/build/src/queue/common/utils/parse-xml-to-queue-access.spec.d.ts +1 -0
  185. package/build/src/queue/common/utils/parse-xml-to-queue-access.spec.js +135 -0
  186. package/build/src/queue/common/utils/parse-xml-to-queue-count.d.ts +2 -0
  187. package/build/src/queue/common/utils/parse-xml-to-queue-count.js +6 -0
  188. package/build/src/queue/common/utils/parse-xml-to-queue-count.spec.d.ts +1 -0
  189. package/build/src/queue/common/utils/parse-xml-to-queue-count.spec.js +67 -0
  190. package/build/src/queue/common/utils/parse-xml-to-queue-place.d.ts +2 -0
  191. package/build/src/queue/common/utils/parse-xml-to-queue-place.js +5 -0
  192. package/build/src/queue/common/utils/parse-xml-to-queue-place.spec.d.ts +1 -0
  193. package/build/src/queue/common/utils/parse-xml-to-queue-place.spec.js +88 -0
  194. package/build/src/queue/interfaces/index.d.ts +5 -0
  195. package/build/src/queue/interfaces/index.js +5 -0
  196. package/build/src/queue/interfaces/queue-access-options.interface.d.ts +7 -0
  197. package/build/src/queue/interfaces/queue-access-options.interface.js +1 -0
  198. package/build/src/queue/interfaces/queue-count.interface.d.ts +3 -0
  199. package/build/src/queue/interfaces/queue-count.interface.js +1 -0
  200. package/build/src/queue/interfaces/queue-ignore.interface.d.ts +3 -0
  201. package/build/src/queue/interfaces/queue-ignore.interface.js +1 -0
  202. package/build/src/queue/interfaces/queue-place-options.interface.d.ts +6 -0
  203. package/build/src/queue/interfaces/queue-place-options.interface.js +1 -0
  204. package/build/src/queue/interfaces/queue-remove.interface.d.ts +3 -0
  205. package/build/src/queue/interfaces/queue-remove.interface.js +1 -0
  206. package/build/src/queue/queue.d.ts +13 -0
  207. package/build/src/queue/queue.js +101 -0
  208. package/build/src/sabre.d.ts +31 -0
  209. package/build/src/sabre.js +141 -0
  210. package/package.json +44 -0
@@ -0,0 +1,88 @@
1
+ import { parseXMLToQueuePlace } from "./parse-xml-to-queue-place";
2
+ describe('Parse XML Queue Access', () => {
3
+ it('should handle response body', () => {
4
+ const bodyPayload = '<QueuePlaceRS xmlns="http://webservices.sabre.com/sabreXML/2011/10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:stl="http://services.sabre.com/STL/v01" Version="2.0.4"><stl:ApplicationResults status="Complete"><stl:Success timeStamp="2025-02-18T17:46:56Z"><stl:SystemSpecificResults><stl:HostCommand LNIATA="52D656">QP/H8GI100/11</stl:HostCommand></stl:SystemSpecificResults></stl:Success></stl:ApplicationResults><Text>011 SEE REMARKS</Text><Text>1.1ALONSO VEGA/FERNANDO 2.1SALUM RODRIGUEZ/ANA ISABEL</Text><Text>TKT/TIME LIMIT</Text><Text>1.T-02JAN-8AYC*ATS</Text><Text>PHONES</Text><Text>1.MEX871 178 6111</Text><Text>PASSENGER EMAIL DATA EXISTS *PE TO DISPLAY ALL</Text><Text>CUSTOMER NUMBER - 421029</Text><Text>INVOICED</Text><Text>PRICE QUOTE RECORD EXISTS - SYSTEM/MANUAL</Text><Text>SECURITY INFO EXISTS *P3D OR *P4D TO DISPLAY</Text><Text>AA FACTS</Text><Text>1.SSR ADTK 1S KK01 AA WILL CANCEL IF NO TKT BY 2359 05JUN CST</Text><Text>2.OSI 1S *** PREV TIME FOR AA4005O 28JAN TRCDFW 644A 844A</Text><Text>3.OSI 1S *** PREV TIME FOR AA 420O 28JAN DFWDEN 1219P 131P</Text><Text>4.OSI 1S *** PREV TIME FOR AA2359O 06FEB DENDFW 1254P 355P</Text><Text>5.OSI 1S *** PREV TIME FOR AA4004O 06FEB DFWTRC 636P 831P</Text><Text>6.OSI 1S *** PREV TIME FOR AA4005O 28JAN TRCDFW 613A 808A</Text><Text>7.OSI 1S *** PREV TIME FOR AA4004O 06FEB DFWTRC 840P 1050P</Text><Text>8.OSI 1S *** PREV TIME FOR AA 420O 28JAN DFWDEN 1241P 156P</Text><Text>9.OSI 1S *** PREV TIME FOR AA2359O 06FEB DENDFW 1235P 334P</Text><Text>GENERAL FACTS</Text><Text>7.SSR OTHS 1S ATTN AGY TKT REVALIDATED PER SCHD CHNG 30SEP24</Text><Text>8.SSR OTHS 1S ATTN AGY TKT REVALIDATED PER SCHD CHNG 28OCT24</Text><Text>9.SSR OTHS 1S ATTN AGY TKT REVALIDATED PER SCHD CHNG 11NOV24</Text><Text>REMARKS</Text><Text>1..AC06PATY GALES</Text><Text>2..MP-PUE</Text><Text>3..UCFDI-S01</Text><Text>4..REGFISREC-616</Text><Text>5.H-AUTH-AMEX/AX6012/05JUN/01521717625460153238</Text><Text>6.H- AUTH-APV/140480/000/MXN12890</Text><Text>7.H- AUTH-CSC NOT SUPPLIED/</Text><Text>8.H- AUTH-AVS NOT SUPPORTED/</Text><Text>9.XXTAW/</Text><Text>10..CS01-CXSAX-517.24-6012</Text><Text>11.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN</Text><Text>12.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN</Text><Text>13.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN</Text><Text>14.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN</Text><Text>15.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN</Text><Text>16.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN</Text><Text>17.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN</Text><Text>18.H-AUTH-AMEX/AX6012/02JAN/01301735856535295564</Text><Text>19.H- AUTH-APV/184822/000/MXN53</Text><Text>20.H- AUTH-CSC NOT SUPPLIED/</Text><Text>21.H- AUTH-AVS NOT SUPPORTED/</Text><Text>23.H-AEBT/0013489329919/8AYC*ATS/8AYC*ATS</Text><Text>24.H-AUTH-AMEX/AX6012/02JAN/01131735856729229551</Text><Text>25.H- AUTH-APV/119708/000/MXN53</Text><Text>26.H- AUTH-CSC NOT SUPPLIED/</Text><Text>27.H- AUTH-AVS NOT SUPPORTED/</Text><Text>29.H-AEBT/0013489329920/8AYC*ATS/8AYC*ATS</Text><Text>30..AG-29</Text><Text>31.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN</Text><Text>32.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN</Text><Text>ACCOUNTING DATA</Text><Text>1. AA‡3709124848/ 37/ 3744/ 1516/D150/D1035/ONE/</Text><Text>CCAX376666929056012 1.1ALONSO VEGA FERNANDO/1/F/E</Text><Text>2. AA‡3709124849/ 37/ 3744/ 1516/D150/D1035/ONE/</Text><Text>CCAX376666929056012 2.1SALUM RODRIGUEZ ANA ISABEL/1/F/E</Text><Text>3. AA‡3489329919/ 0/ 0/ 47/D6/D0/ONE/CCAX3</Text><Text>76666929056012 1.1ALONSO VEGA FERNANDO/1/F/E-00137091248</Text><Text>48/1234</Text><Text>4. AA‡3489329920/ 0/ 0/ 47/D6/D0/ONE/CCAX3</Text><Text>76666929056012 2.1SALUM RODRIGUEZ ANA I/1/F/E-0013709124</Text><Text>849/1234</Text><Text>RECEIVED FROM - PATYGALES</Text><Text>8AYC.8AYC*AEH 1829/04JUN24 FXIDVU H</Text></QueuePlaceRS>';
5
+ const response = parseXMLToQueuePlace(bodyPayload);
6
+ // console.dir(response, { depth: null })
7
+ expect(response).toEqual({
8
+ applicationResults: {
9
+ success: {
10
+ systemSpecificResults: { hostCommand: { content: 'QP/H8GI100/11', lNIATA: '52D656' } },
11
+ timeStamp: '2025-02-18T17:46:56Z'
12
+ },
13
+ status: 'Complete'
14
+ },
15
+ text: [
16
+ '011 SEE REMARKS',
17
+ '1.1ALONSO VEGA/FERNANDO 2.1SALUM RODRIGUEZ/ANA ISABEL',
18
+ 'TKT/TIME LIMIT',
19
+ '1.T-02JAN-8AYC*ATS',
20
+ 'PHONES',
21
+ '1.MEX871 178 6111',
22
+ 'PASSENGER EMAIL DATA EXISTS *PE TO DISPLAY ALL',
23
+ 'CUSTOMER NUMBER - 421029',
24
+ 'INVOICED',
25
+ 'PRICE QUOTE RECORD EXISTS - SYSTEM/MANUAL',
26
+ 'SECURITY INFO EXISTS *P3D OR *P4D TO DISPLAY',
27
+ 'AA FACTS',
28
+ '1.SSR ADTK 1S KK01 AA WILL CANCEL IF NO TKT BY 2359 05JUN CST',
29
+ '2.OSI 1S *** PREV TIME FOR AA4005O 28JAN TRCDFW 644A 844A',
30
+ '3.OSI 1S *** PREV TIME FOR AA 420O 28JAN DFWDEN 1219P 131P',
31
+ '4.OSI 1S *** PREV TIME FOR AA2359O 06FEB DENDFW 1254P 355P',
32
+ '5.OSI 1S *** PREV TIME FOR AA4004O 06FEB DFWTRC 636P 831P',
33
+ '6.OSI 1S *** PREV TIME FOR AA4005O 28JAN TRCDFW 613A 808A',
34
+ '7.OSI 1S *** PREV TIME FOR AA4004O 06FEB DFWTRC 840P 1050P',
35
+ '8.OSI 1S *** PREV TIME FOR AA 420O 28JAN DFWDEN 1241P 156P',
36
+ '9.OSI 1S *** PREV TIME FOR AA2359O 06FEB DENDFW 1235P 334P',
37
+ 'GENERAL FACTS',
38
+ '7.SSR OTHS 1S ATTN AGY TKT REVALIDATED PER SCHD CHNG 30SEP24',
39
+ '8.SSR OTHS 1S ATTN AGY TKT REVALIDATED PER SCHD CHNG 28OCT24',
40
+ '9.SSR OTHS 1S ATTN AGY TKT REVALIDATED PER SCHD CHNG 11NOV24',
41
+ 'REMARKS',
42
+ '1..AC06PATY GALES',
43
+ '2..MP-PUE',
44
+ '3..UCFDI-S01',
45
+ '4..REGFISREC-616',
46
+ '5.H-AUTH-AMEX/AX6012/05JUN/01521717625460153238',
47
+ '6.H- AUTH-APV/140480/000/MXN12890',
48
+ '7.H- AUTH-CSC NOT SUPPLIED/',
49
+ '8.H- AUTH-AVS NOT SUPPORTED/',
50
+ '9.XXTAW/',
51
+ '10..CS01-CXSAX-517.24-6012',
52
+ '11.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN',
53
+ '12.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN',
54
+ '13.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN',
55
+ '14.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN',
56
+ '15.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN',
57
+ '16.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN',
58
+ '17.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN',
59
+ '18.H-AUTH-AMEX/AX6012/02JAN/01301735856535295564',
60
+ '19.H- AUTH-APV/184822/000/MXN53',
61
+ '20.H- AUTH-CSC NOT SUPPLIED/',
62
+ '21.H- AUTH-AVS NOT SUPPORTED/',
63
+ '23.H-AEBT/0013489329919/8AYC*ATS/8AYC*ATS',
64
+ '24.H-AUTH-AMEX/AX6012/02JAN/01131735856729229551',
65
+ '25.H- AUTH-APV/119708/000/MXN53',
66
+ '26.H- AUTH-CSC NOT SUPPLIED/',
67
+ '27.H- AUTH-AVS NOT SUPPORTED/',
68
+ '29.H-AEBT/0013489329920/8AYC*ATS/8AYC*ATS',
69
+ '30..AG-29',
70
+ '31.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN',
71
+ '32.H-POSSIBLE DUPE BOOKING. SEE PNR JCNCRN',
72
+ 'ACCOUNTING DATA',
73
+ '1. AA\x873709124848/ 37/ 3744/ 1516/D150/D1035/ONE/',
74
+ 'CCAX376666929056012 1.1ALONSO VEGA FERNANDO/1/F/E',
75
+ '2. AA\x873709124849/ 37/ 3744/ 1516/D150/D1035/ONE/',
76
+ 'CCAX376666929056012 2.1SALUM RODRIGUEZ ANA ISABEL/1/F/E',
77
+ '3. AA\x873489329919/ 0/ 0/ 47/D6/D0/ONE/CCAX3',
78
+ '76666929056012 1.1ALONSO VEGA FERNANDO/1/F/E-00137091248',
79
+ '48/1234',
80
+ '4. AA\x873489329920/ 0/ 0/ 47/D6/D0/ONE/CCAX3',
81
+ '76666929056012 2.1SALUM RODRIGUEZ ANA I/1/F/E-0013709124',
82
+ '849/1234',
83
+ 'RECEIVED FROM - PATYGALES',
84
+ '8AYC.8AYC*AEH 1829/04JUN24 FXIDVU H'
85
+ ]
86
+ });
87
+ });
88
+ });
@@ -0,0 +1,5 @@
1
+ export * from './queue-access-options.interface';
2
+ export * from './queue-count.interface';
3
+ export * from './queue-ignore.interface';
4
+ export * from './queue-place-options.interface';
5
+ export * from './queue-remove.interface';
@@ -0,0 +1,5 @@
1
+ export * from './queue-access-options.interface';
2
+ export * from './queue-count.interface';
3
+ export * from './queue-ignore.interface';
4
+ export * from './queue-place-options.interface';
5
+ export * from './queue-remove.interface';
@@ -0,0 +1,7 @@
1
+ import { FormatQueueResponse } from "../common/utils/interfaces";
2
+ export interface QueueAccessOptions {
3
+ number: string;
4
+ pcc?: string;
5
+ }
6
+ export interface QueueAccessResponse extends FormatQueueResponse {
7
+ }
@@ -0,0 +1,3 @@
1
+ import { QueueCountRS } from "../common/utils/interfaces";
2
+ export interface QueueCountResponse extends QueueCountRS {
3
+ }
@@ -0,0 +1,3 @@
1
+ import { QueueAccessResponse } from "./queue-access-options.interface";
2
+ export interface QueueIgnoreResponse extends QueueAccessResponse {
3
+ }
@@ -0,0 +1,6 @@
1
+ import { QueueAccessOptions } from "./queue-access-options.interface";
2
+ import { QueueAccessResponse } from "./queue-access-options.interface";
3
+ export interface QueuePlaceOptions extends QueueAccessOptions {
4
+ }
5
+ export interface QueuePlaceResponse extends QueueAccessResponse {
6
+ }
@@ -0,0 +1,3 @@
1
+ import { QueueAccessResponse } from "./queue-access-options.interface";
2
+ export interface QueueRemoveResponse extends QueueAccessResponse {
3
+ }
@@ -0,0 +1,13 @@
1
+ import { Sabre } from "../sabre";
2
+ import { QueueAccessOptions, QueueAccessResponse, QueueCountResponse, QueueIgnoreResponse, QueuePlaceOptions, QueuePlaceResponse, QueueRemoveResponse } from "./interfaces";
3
+ export declare class Queue {
4
+ private readonly sabre;
5
+ private readonly meta;
6
+ constructor(sabre: Sabre);
7
+ count(pcc?: string): Promise<QueueCountResponse>;
8
+ access(payload: QueueAccessOptions): Promise<QueueAccessResponse>;
9
+ ignore(): Promise<QueueIgnoreResponse>;
10
+ remove(): Promise<QueueRemoveResponse>;
11
+ exit(): Promise<void>;
12
+ place(payload: QueuePlaceOptions): Promise<QueuePlaceResponse>;
13
+ }
@@ -0,0 +1,101 @@
1
+ import { parseXMLToQueueCount, parseXMLToQueueAccess, formatQueueResponse, parseXMLToQueuePlace, findBookingId } from "./common/utils";
2
+ import { countRequest, accessRequest, ignoreRequest, removeRequest, exitRequest, placeRequest } from "./common/requests";
3
+ import { ActionsRQ, ActionsRS } from "../common/interfaces/actions.interface";
4
+ export class Queue {
5
+ sabre;
6
+ meta = {
7
+ queue: '',
8
+ };
9
+ constructor(sabre) {
10
+ this.sabre = sabre;
11
+ }
12
+ async count(pcc) {
13
+ if (!pcc) {
14
+ if (typeof process !== 'undefined' && process.env) {
15
+ pcc = process.env.SABRE_ORGANIZATION;
16
+ }
17
+ }
18
+ if (!pcc)
19
+ throw new Error('Missing pcc. Set it in count("PCC")');
20
+ this.sabre.setAction(ActionsRQ.QUEUE_COUNT);
21
+ const response = await this.sabre.post((opts) => countRequest({
22
+ pcc, ...opts
23
+ }));
24
+ if (!response.data)
25
+ throw new Error(`Response error ${response.error}`);
26
+ return parseXMLToQueueCount(response.data);
27
+ }
28
+ async access(payload) {
29
+ if (!payload.pcc) {
30
+ if (typeof process !== 'undefined' && process.env) {
31
+ payload.pcc = process.env.SABRE_ORGANIZATION;
32
+ }
33
+ }
34
+ if (!payload.pcc)
35
+ throw new Error('Missing pcc. Set it in access({ pcc, number })');
36
+ const { number, pcc } = payload;
37
+ this.sabre.setAction(ActionsRS.QUEUE_ACCESS);
38
+ const response = await this.sabre.post((opts) => accessRequest({
39
+ number, pcc, ...opts
40
+ }));
41
+ if (!response.data)
42
+ throw new Error(`Response error ${response.error}`);
43
+ this.meta.queue = number;
44
+ const queueAccess = parseXMLToQueueAccess(response.data);
45
+ return formatQueueResponse({
46
+ bookingId: queueAccess.line.uniqueID.iD,
47
+ paragraph: queueAccess.paragraph,
48
+ queue: this.meta.queue
49
+ });
50
+ }
51
+ async ignore() {
52
+ this.sabre.setAction(ActionsRS.QUEUE_ACCESS);
53
+ const response = await this.sabre.post(ignoreRequest);
54
+ if (!response.data)
55
+ throw new Error(`Response error ${response.error}`);
56
+ const queueAccess = parseXMLToQueueAccess(response.data);
57
+ return formatQueueResponse({
58
+ bookingId: queueAccess.line.uniqueID.iD,
59
+ paragraph: queueAccess.paragraph,
60
+ queue: this.meta.queue
61
+ });
62
+ }
63
+ async remove() {
64
+ this.sabre.setAction(ActionsRS.QUEUE_ACCESS);
65
+ const response = await this.sabre.post(removeRequest);
66
+ if (!response.data)
67
+ throw new Error(`Response error ${response.error}`);
68
+ const queueAccess = parseXMLToQueueAccess(response.data);
69
+ return formatQueueResponse({
70
+ bookingId: queueAccess.line.uniqueID.iD,
71
+ paragraph: queueAccess.paragraph,
72
+ queue: this.meta.queue
73
+ });
74
+ }
75
+ async exit() {
76
+ this.sabre.setAction(ActionsRS.QUEUE_ACCESS);
77
+ await this.sabre.post(exitRequest);
78
+ }
79
+ async place(payload) {
80
+ if (!payload.pcc) {
81
+ if (typeof process !== 'undefined' && process.env) {
82
+ payload.pcc = process.env.SABRE_ORGANIZATION;
83
+ }
84
+ }
85
+ if (!payload.pcc)
86
+ throw new Error('Missing pcc. Set it in place({ pcc, number })');
87
+ const { number, pcc } = payload;
88
+ this.sabre.setAction(ActionsRQ.QUEUE_PLACE);
89
+ const response = await this.sabre.post((opts) => placeRequest({
90
+ number, pcc, ...opts
91
+ }));
92
+ if (!response.data)
93
+ throw new Error(`Response error ${response.error}`);
94
+ const queuePlace = parseXMLToQueuePlace(response.data);
95
+ return formatQueueResponse({
96
+ bookingId: findBookingId(queuePlace.text.pop()),
97
+ paragraph: { text: queuePlace.text },
98
+ queue: this.meta.queue
99
+ });
100
+ }
101
+ }
@@ -0,0 +1,31 @@
1
+ import type { ErrorResponse, Actions } from "./interfaces";
2
+ import type { PostOptions } from "./common/interfaces/post-options.interface";
3
+ import type { HeadersRequestOptions } from "./common/interfaces/headers-request-options.interface";
4
+ import { Authentication } from "./authentication/authentication.";
5
+ import { Queue } from "./queue/queue";
6
+ import { DailySales } from "./daily-sales/daily-sales";
7
+ import type { SessionCreateOptions } from "./authentication/requests/interfaces/session-create-options.interface";
8
+ export declare class Sabre {
9
+ private readonly username?;
10
+ private readonly password?;
11
+ private readonly organization?;
12
+ private readonly headers;
13
+ private readonly headersRequest;
14
+ readonly authentication: Authentication;
15
+ readonly queue: Queue;
16
+ readonly dailySales: DailySales;
17
+ constructor(username?: string | undefined, password?: string | undefined, organization?: string | undefined);
18
+ setAction(action: Actions): void;
19
+ fetchRequest<T>(options?: {}): Promise<{
20
+ data: T | null;
21
+ error: ErrorResponse | null;
22
+ }>;
23
+ post<T>(handlerRequest: (payload: HeadersRequestOptions) => string, options?: PostOptions): Promise<{
24
+ data: T | null;
25
+ error: ErrorResponse | null;
26
+ }>;
27
+ auth<T>(handlerRequest: (payload: SessionCreateOptions) => string, options?: PostOptions): Promise<{
28
+ data: T | null;
29
+ error: ErrorResponse | null;
30
+ }>;
31
+ }
@@ -0,0 +1,141 @@
1
+ import { getSubString } from "./common/utils/get-sub-string";
2
+ import { baseUrl, conversationId, domain, userAgent } from "./config";
3
+ import { Authentication } from "./authentication/authentication.";
4
+ import { Queue } from "./queue/queue";
5
+ import { DailySales } from "./daily-sales/daily-sales";
6
+ import { ActionsRQ } from "./common/interfaces/actions.interface";
7
+ export class Sabre {
8
+ username;
9
+ password;
10
+ organization;
11
+ headers;
12
+ headersRequest;
13
+ authentication = new Authentication(this);
14
+ queue = new Queue(this);
15
+ dailySales = new DailySales(this);
16
+ constructor(username, password, organization) {
17
+ this.username = username;
18
+ this.password = password;
19
+ this.organization = organization;
20
+ const processEnv = typeof process !== 'undefined' && process.env;
21
+ if (!username && processEnv)
22
+ this.username = processEnv.SABRE_USERNAME;
23
+ if (!password && processEnv)
24
+ this.password = processEnv.SABRE_PASSWORD;
25
+ if (!organization && processEnv)
26
+ this.organization = processEnv.SABRE_ORGANIZATION;
27
+ if (!this.username || !this.password || !this.organization) {
28
+ throw new Error('Missing LegacySabre authorization. Pass it to the constructor `new LegacySabre("USERNAME", "PASSWORD", "ORGANIZATION")');
29
+ }
30
+ this.headers = new Headers({
31
+ 'User-Agent': userAgent,
32
+ 'Content-Type': 'text/xml; charset="utf-8"',
33
+ 'Content-Encoding': 'deflate'
34
+ });
35
+ this.headersRequest = {
36
+ conversationId, authorization: ''
37
+ };
38
+ }
39
+ setAction(action) {
40
+ this.headers.set('SOAPAction', action);
41
+ }
42
+ async fetchRequest(options = {}) {
43
+ try {
44
+ const response = await fetch(baseUrl, options);
45
+ const xml = await response.text();
46
+ if (!response.ok) {
47
+ try {
48
+ const fault = getSubString(xml, '<faultstring>', '</faultstring>', false);
49
+ return {
50
+ data: null,
51
+ error: {
52
+ name: 'fault_error',
53
+ message: fault
54
+ }
55
+ };
56
+ }
57
+ catch (err) {
58
+ if (err instanceof SyntaxError) {
59
+ return {
60
+ data: null,
61
+ error: {
62
+ name: 'application_error',
63
+ message: 'Internal server error. We are unable to process your request right now, please try again later.',
64
+ },
65
+ };
66
+ }
67
+ const error = {
68
+ message: response.statusText,
69
+ name: 'application_error',
70
+ };
71
+ if (err instanceof Error) {
72
+ return { data: null, error: { ...error, message: err.message } };
73
+ }
74
+ return { data: null, error };
75
+ }
76
+ }
77
+ const body = getSubString(xml, '<soap-env:Body>', '</soap-env:Body>', false);
78
+ const error = getSubString(body, '<stl:Error>', '</stl:Error>', false);
79
+ if (error) {
80
+ return {
81
+ data: null,
82
+ error: {
83
+ name: 'error_in_response',
84
+ message: getSubString(error, '<stl:Message>', '</stl:Message>', false)
85
+ }
86
+ };
87
+ }
88
+ const action = this.headers.get('SOAPAction');
89
+ // AUTHORIZATION INTERNAL MANAGEMENT
90
+ if (action === ActionsRQ.SESSION_CREATE || action === ActionsRQ.TOKEN_CREATE) {
91
+ const token = getSubString(xml, '<wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">', '</wsse:BinarySecurityToken>', false);
92
+ this.headersRequest.authorization = token;
93
+ this.headers.set('Authorization', `Bearer ${token}`);
94
+ }
95
+ else if (action === ActionsRQ.SESSION_CLOSE) {
96
+ this.headersRequest.authorization = '';
97
+ this.headers.delete('Authorization');
98
+ }
99
+ return { data: body, error: null };
100
+ }
101
+ catch (error) {
102
+ return {
103
+ data: null,
104
+ error: {
105
+ name: 'application_error',
106
+ message: 'Unable to fetch data. The request could not be resolved.',
107
+ },
108
+ };
109
+ }
110
+ }
111
+ async post(handlerRequest, options = {}) {
112
+ if (!this.headersRequest.authorization)
113
+ throw new Error('Missing authorization. Set it in setToken("TOKEN")');
114
+ const requestOptions = {
115
+ method: 'POST',
116
+ headers: this.headers,
117
+ body: handlerRequest(this.headersRequest),
118
+ ...options,
119
+ };
120
+ return this.fetchRequest(requestOptions);
121
+ }
122
+ async auth(handlerRequest, options = {}) {
123
+ if (!this.username || !this.password || !this.organization)
124
+ throw new Error('Missing authorization. Pass it to the constructor `new LegacySabre("USERNAME", "PASSWORD", "ORGANIZATION")');
125
+ const requestOptions = {
126
+ method: 'POST',
127
+ headers: this.headers,
128
+ body: handlerRequest({
129
+ conversationId: conversationId,
130
+ authorization: {
131
+ username: this.username,
132
+ password: this.password,
133
+ pcc: this.organization,
134
+ domain: domain
135
+ }
136
+ }),
137
+ ...options,
138
+ };
139
+ return this.fetchRequest(requestOptions);
140
+ }
141
+ }
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "sabre-legacy-client",
3
+ "version": "0.1.0",
4
+ "description": "Sabre Node.js SDK",
5
+ "keywords": [
6
+ "sabre",
7
+ "legacy",
8
+ "client",
9
+ "soap"
10
+ ],
11
+ "homepage": "https://github.com/CarlosIvanSoto/sabre-legacy-client#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/CarlosIvanSoto/sabre-legacy-client/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/CarlosIvanSoto/sabre-legacy-client.git"
18
+ },
19
+ "license": "MIT",
20
+ "author": "Carlos Ivan Soto <csoto_99@outlook.com>",
21
+ "type": "module",
22
+ "main": "./build/index.js",
23
+ "types": "./build/index.d.ts",
24
+ "files": [
25
+ "build/**",
26
+ "README.md"
27
+ ],
28
+ "scripts": {
29
+ "build": "npx tsc",
30
+ "test": "jest",
31
+ "test:watch": "jest --watch"
32
+ },
33
+ "devDependencies": {
34
+ "@types/jest": "^29.5.14",
35
+ "@types/node": "^22.13.3",
36
+ "jest": "^29.7.0",
37
+ "ts-jest": "^29.2.5",
38
+ "ts-node": "^10.9.2",
39
+ "typescript": "^5.7.3"
40
+ },
41
+ "dependencies": {
42
+ "fast-xml-parser": "^4.5.1"
43
+ }
44
+ }