aves-sdk 1.0.0 → 1.0.1

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.cts CHANGED
@@ -3,15 +3,6 @@ import { AxiosRequestConfig } from 'axios';
3
3
  import * as _nestjs_config from '@nestjs/config';
4
4
  import { z, ZodSchema, ZodError } from 'zod';
5
5
 
6
- type DateString = string & {
7
- readonly __brand: 'DateString';
8
- };
9
- type DateTimeString = string & {
10
- readonly __brand: 'DateTimeString';
11
- };
12
- type TimeString = string & {
13
- readonly __brand: 'TimeString';
14
- };
15
6
  type AddressType = 'home' | 'work' | 'billing' | 'delivery';
16
7
  type ContactType = 'home' | 'work' | 'mobile' | 'fax';
17
8
  type EmailType = 'home' | 'work';
@@ -64,7 +55,7 @@ interface Customer {
64
55
  firstName: string;
65
56
  lastName: string;
66
57
  middleName?: string;
67
- dateOfBirth?: DateString;
58
+ dateOfBirth?: string;
68
59
  gender?: GenderType;
69
60
  nationality?: string;
70
61
  };
@@ -88,12 +79,12 @@ interface BookingPassenger {
88
79
  firstName: string;
89
80
  lastName: string;
90
81
  middleName?: string;
91
- dateOfBirth?: DateString;
82
+ dateOfBirth?: string;
92
83
  gender?: GenderType;
93
84
  nationality?: string;
94
85
  passport?: {
95
86
  number: string;
96
- expiryDate: DateString;
87
+ expiryDate: string;
97
88
  issuingCountry: string;
98
89
  };
99
90
  address?: CustomerAddress;
@@ -106,8 +97,8 @@ interface BookingService {
106
97
  code?: string;
107
98
  name?: string;
108
99
  description?: string;
109
- startDate?: DateString;
110
- endDate?: DateString;
100
+ startDate?: string;
101
+ endDate?: string;
111
102
  price?: {
112
103
  currency: string;
113
104
  amount: number;
@@ -178,8 +169,8 @@ interface AddPaymentRequest {
178
169
  interface BookingResponse {
179
170
  id: string;
180
171
  status: BookingStatusType;
181
- createdAt: DateTimeString;
182
- updatedAt: DateTimeString;
172
+ createdAt: string;
173
+ updatedAt: string;
183
174
  customer: Customer;
184
175
  passengers: BookingPassenger[];
185
176
  services: BookingService[];
@@ -209,7 +200,7 @@ interface DocumentResponse {
209
200
  type: string;
210
201
  format: string;
211
202
  size: number;
212
- createdAt: DateTimeString;
203
+ createdAt: string;
213
204
  downloadUrl?: string;
214
205
  deliveryStatus?: {
215
206
  status: DeliveryStatusType;
@@ -595,14 +586,9 @@ declare function mapDocumentFormatToXml(format: string): 'PDF' | 'HTML' | 'XML';
595
586
  declare function mapDeliveryMethodToXml(method: string): 'EMAIL' | 'SMS' | 'DOWNLOAD';
596
587
  declare function mapSearchOperatorToXml(operator: string): 'EQUALS' | 'CONTAINS' | 'STARTS_WITH' | 'ENDS_WITH';
597
588
 
598
- declare const createDateString: (date: string) => DateString;
599
- declare const createDateTimeString: (dateTime: string) => DateTimeString;
600
- declare const createTimeString: (time: string) => TimeString;
601
- declare const getCurrentDateString: () => DateString;
602
- declare const getCurrentDateTimeString: () => DateTimeString;
603
- declare const isValidDateString: (date: string) => date is DateString;
604
- declare const isValidDateTimeString: (dateTime: string) => dateTime is DateTimeString;
605
- declare const isValidTimeString: (time: string) => time is TimeString;
589
+ declare const createDateString: (date: string | Date) => string;
590
+ declare const createDateTimeString: (dateTime: string | Date) => string;
591
+ declare const createTimeString: (time: string) => string;
606
592
 
607
593
  interface RqHeader {
608
594
  '@HostID': string;
@@ -1196,4 +1182,4 @@ declare class AvesErrorHandler {
1196
1182
  private isAvesXmlResponse;
1197
1183
  }
1198
1184
 
1199
- export { AVES_CONFIG_NAMESPACE, AVES_SDK_CONFIG, type AddPaymentRequest, type Address, type AddressType, AddressValidation, type AddressValidationType, type AvesEnvConfig, type AvesError, AvesErrorCodes, AvesErrorHandler, AvesException, AvesModule, type AvesModuleAsyncOptions, type AvesOptionsFactory, type AvesRegisteredConfig, type AvesRequestRoot, type AvesResponseRoot, type AvesSdkConfig, AvesService, AvesSeverity, AvesStatus, AvesValidator, type AvesXmlResponse, type BookFileRQ, BookFileRQValidation, type BookFileRQValidationType, type BookingFile, type BookingFileRS, type BookingPassenger, type BookingPayment, type BookingResponse, type BookingService, type BookingStatusType, type BookingType, type CancelBookingRequest, type CancelFileRQ, CancelFileRQValidation, type CancelFileRQValidationType, type CancelFileRS, type CancelReasonType, type CommunicationMethodType, type ContactInfo, ContactInfoValidation, type ContactInfoValidationType, type ContactType, type CreateBookingRequest, type Customer, type CustomerAddress, type CustomerContact, type CustomerRecordRS, type CustomerStatusType, type CustomerType, type DateString, type DateTimeString, type DeliveryMethodType, type DeliveryStatusType, type DocumentFormatType, type DocumentResponse, type DocumentType, type EmailType, type FilePaymentListRQ, type FilePaymentListRS, type GenderType, type HttpError, type IXmlHttpClient, type LanguageCode, LanguageCodeValidation, type ManageMasterRecordRQ, type MasterRecord, type ModFileServicesRQ, type ModiFileHeaderRQ, type ModiFileHeaderRS, type OperationResponse, type Passenger, type PassengerType, PassengerValidation, type PassengerValidationType, type Payment, type PaymentStatusType, type PaymentType, PaymentValidation, type PaymentValidationType, type PricingItemType, type PrintBookingDocumentRQ, PrintBookingDocumentRQValidation, type PrintBookingDocumentRQValidationType, type PrintBookingDocumentRS, type PrintDocumentRequest, type PriorityType, type RefundMethodType, type RqHeader, type RsStatus, type SearchCustomerRequest, type SearchMasterRecordRQ, SearchMasterRecordRQValidation, type SearchMasterRecordRQValidationType, type SearchMasterRecordRS, type SearchOperatorType, type SearchResponse, type Service, type ServiceStatusType, type ServiceType, ServiceValidation, type ServiceValidationType, type SetStatusRQ, type SetStatusServiceRS, type SpecialRequestType, type TimeString, type TitleType, XML_HTTP_CLIENT, XmlHttpClient, avesConfig, configValidationSchema, createAvesValidator, createDateString, createDateTimeString, createTimeString, getCurrentDateString, getCurrentDateTimeString, isValidDateString, isValidDateTimeString, isValidTimeString, mapAddPaymentToXml, mapAddressToXml, mapAddressTypeFromXml, mapAddressTypeToXml, mapBookingFromXml, mapBookingResponseFromXml, mapBookingTypeToXml, mapCancelBookingToXml, mapCancelReasonToXml, mapCancelResponseFromXml, mapContactToXml, mapContactTypeFromXml, mapContactTypeToXml, mapCreateBookingToXml, mapCustomerToXml, mapCustomerTypeToXml, mapDeliveryMethodToXml, mapDocumentFormatToXml, mapDocumentResponseFromXml, mapDocumentTypeToXml, mapEmailTypeFromXml, mapEmailTypeToXml, mapMasterRecordFromXml, mapPassengerToXml, mapPassengerTypeFromXml, mapPassengerTypeToXml, mapPaymentResponseFromXml, mapPaymentStatusFromXml, mapPaymentStatusToXml, mapPaymentToXml, mapPaymentTypeFromXml, mapPaymentTypeToXml, mapPrintDocumentToXml, mapPriorityToXml, mapRefundMethodToXml, mapSearchCustomerToXml, mapSearchOperatorToXml, mapSearchResponseFromXml, mapServiceStatusFromXml, mapServiceStatusToXml, mapServiceToXml, mapServiceTypeFromXml, mapServiceTypeToXml, mapSpecialRequestTypeToXml, mapTitleFromXml, mapTitleToXml };
1185
+ export { AVES_CONFIG_NAMESPACE, AVES_SDK_CONFIG, type AddPaymentRequest, type Address, type AddressType, AddressValidation, type AddressValidationType, type AvesEnvConfig, type AvesError, AvesErrorCodes, AvesErrorHandler, AvesException, AvesModule, type AvesModuleAsyncOptions, type AvesOptionsFactory, type AvesRegisteredConfig, type AvesRequestRoot, type AvesResponseRoot, type AvesSdkConfig, AvesService, AvesSeverity, AvesStatus, AvesValidator, type AvesXmlResponse, type BookFileRQ, BookFileRQValidation, type BookFileRQValidationType, type BookingFile, type BookingFileRS, type BookingPassenger, type BookingPayment, type BookingResponse, type BookingService, type BookingStatusType, type BookingType, type CancelBookingRequest, type CancelFileRQ, CancelFileRQValidation, type CancelFileRQValidationType, type CancelFileRS, type CancelReasonType, type CommunicationMethodType, type ContactInfo, ContactInfoValidation, type ContactInfoValidationType, type ContactType, type CreateBookingRequest, type Customer, type CustomerAddress, type CustomerContact, type CustomerRecordRS, type CustomerStatusType, type CustomerType, type DeliveryMethodType, type DeliveryStatusType, type DocumentFormatType, type DocumentResponse, type DocumentType, type EmailType, type FilePaymentListRQ, type FilePaymentListRS, type GenderType, type HttpError, type IXmlHttpClient, type LanguageCode, LanguageCodeValidation, type ManageMasterRecordRQ, type MasterRecord, type ModFileServicesRQ, type ModiFileHeaderRQ, type ModiFileHeaderRS, type OperationResponse, type Passenger, type PassengerType, PassengerValidation, type PassengerValidationType, type Payment, type PaymentStatusType, type PaymentType, PaymentValidation, type PaymentValidationType, type PricingItemType, type PrintBookingDocumentRQ, PrintBookingDocumentRQValidation, type PrintBookingDocumentRQValidationType, type PrintBookingDocumentRS, type PrintDocumentRequest, type PriorityType, type RefundMethodType, type RqHeader, type RsStatus, type SearchCustomerRequest, type SearchMasterRecordRQ, SearchMasterRecordRQValidation, type SearchMasterRecordRQValidationType, type SearchMasterRecordRS, type SearchOperatorType, type SearchResponse, type Service, type ServiceStatusType, type ServiceType, ServiceValidation, type ServiceValidationType, type SetStatusRQ, type SetStatusServiceRS, type SpecialRequestType, type TitleType, XML_HTTP_CLIENT, XmlHttpClient, avesConfig, configValidationSchema, createAvesValidator, createDateString, createDateTimeString, createTimeString, mapAddPaymentToXml, mapAddressToXml, mapAddressTypeFromXml, mapAddressTypeToXml, mapBookingFromXml, mapBookingResponseFromXml, mapBookingTypeToXml, mapCancelBookingToXml, mapCancelReasonToXml, mapCancelResponseFromXml, mapContactToXml, mapContactTypeFromXml, mapContactTypeToXml, mapCreateBookingToXml, mapCustomerToXml, mapCustomerTypeToXml, mapDeliveryMethodToXml, mapDocumentFormatToXml, mapDocumentResponseFromXml, mapDocumentTypeToXml, mapEmailTypeFromXml, mapEmailTypeToXml, mapMasterRecordFromXml, mapPassengerToXml, mapPassengerTypeFromXml, mapPassengerTypeToXml, mapPaymentResponseFromXml, mapPaymentStatusFromXml, mapPaymentStatusToXml, mapPaymentToXml, mapPaymentTypeFromXml, mapPaymentTypeToXml, mapPrintDocumentToXml, mapPriorityToXml, mapRefundMethodToXml, mapSearchCustomerToXml, mapSearchOperatorToXml, mapSearchResponseFromXml, mapServiceStatusFromXml, mapServiceStatusToXml, mapServiceToXml, mapServiceTypeFromXml, mapServiceTypeToXml, mapSpecialRequestTypeToXml, mapTitleFromXml, mapTitleToXml };
package/dist/index.d.ts CHANGED
@@ -3,15 +3,6 @@ import { AxiosRequestConfig } from 'axios';
3
3
  import * as _nestjs_config from '@nestjs/config';
4
4
  import { z, ZodSchema, ZodError } from 'zod';
5
5
 
6
- type DateString = string & {
7
- readonly __brand: 'DateString';
8
- };
9
- type DateTimeString = string & {
10
- readonly __brand: 'DateTimeString';
11
- };
12
- type TimeString = string & {
13
- readonly __brand: 'TimeString';
14
- };
15
6
  type AddressType = 'home' | 'work' | 'billing' | 'delivery';
16
7
  type ContactType = 'home' | 'work' | 'mobile' | 'fax';
17
8
  type EmailType = 'home' | 'work';
@@ -64,7 +55,7 @@ interface Customer {
64
55
  firstName: string;
65
56
  lastName: string;
66
57
  middleName?: string;
67
- dateOfBirth?: DateString;
58
+ dateOfBirth?: string;
68
59
  gender?: GenderType;
69
60
  nationality?: string;
70
61
  };
@@ -88,12 +79,12 @@ interface BookingPassenger {
88
79
  firstName: string;
89
80
  lastName: string;
90
81
  middleName?: string;
91
- dateOfBirth?: DateString;
82
+ dateOfBirth?: string;
92
83
  gender?: GenderType;
93
84
  nationality?: string;
94
85
  passport?: {
95
86
  number: string;
96
- expiryDate: DateString;
87
+ expiryDate: string;
97
88
  issuingCountry: string;
98
89
  };
99
90
  address?: CustomerAddress;
@@ -106,8 +97,8 @@ interface BookingService {
106
97
  code?: string;
107
98
  name?: string;
108
99
  description?: string;
109
- startDate?: DateString;
110
- endDate?: DateString;
100
+ startDate?: string;
101
+ endDate?: string;
111
102
  price?: {
112
103
  currency: string;
113
104
  amount: number;
@@ -178,8 +169,8 @@ interface AddPaymentRequest {
178
169
  interface BookingResponse {
179
170
  id: string;
180
171
  status: BookingStatusType;
181
- createdAt: DateTimeString;
182
- updatedAt: DateTimeString;
172
+ createdAt: string;
173
+ updatedAt: string;
183
174
  customer: Customer;
184
175
  passengers: BookingPassenger[];
185
176
  services: BookingService[];
@@ -209,7 +200,7 @@ interface DocumentResponse {
209
200
  type: string;
210
201
  format: string;
211
202
  size: number;
212
- createdAt: DateTimeString;
203
+ createdAt: string;
213
204
  downloadUrl?: string;
214
205
  deliveryStatus?: {
215
206
  status: DeliveryStatusType;
@@ -595,14 +586,9 @@ declare function mapDocumentFormatToXml(format: string): 'PDF' | 'HTML' | 'XML';
595
586
  declare function mapDeliveryMethodToXml(method: string): 'EMAIL' | 'SMS' | 'DOWNLOAD';
596
587
  declare function mapSearchOperatorToXml(operator: string): 'EQUALS' | 'CONTAINS' | 'STARTS_WITH' | 'ENDS_WITH';
597
588
 
598
- declare const createDateString: (date: string) => DateString;
599
- declare const createDateTimeString: (dateTime: string) => DateTimeString;
600
- declare const createTimeString: (time: string) => TimeString;
601
- declare const getCurrentDateString: () => DateString;
602
- declare const getCurrentDateTimeString: () => DateTimeString;
603
- declare const isValidDateString: (date: string) => date is DateString;
604
- declare const isValidDateTimeString: (dateTime: string) => dateTime is DateTimeString;
605
- declare const isValidTimeString: (time: string) => time is TimeString;
589
+ declare const createDateString: (date: string | Date) => string;
590
+ declare const createDateTimeString: (dateTime: string | Date) => string;
591
+ declare const createTimeString: (time: string) => string;
606
592
 
607
593
  interface RqHeader {
608
594
  '@HostID': string;
@@ -1196,4 +1182,4 @@ declare class AvesErrorHandler {
1196
1182
  private isAvesXmlResponse;
1197
1183
  }
1198
1184
 
1199
- export { AVES_CONFIG_NAMESPACE, AVES_SDK_CONFIG, type AddPaymentRequest, type Address, type AddressType, AddressValidation, type AddressValidationType, type AvesEnvConfig, type AvesError, AvesErrorCodes, AvesErrorHandler, AvesException, AvesModule, type AvesModuleAsyncOptions, type AvesOptionsFactory, type AvesRegisteredConfig, type AvesRequestRoot, type AvesResponseRoot, type AvesSdkConfig, AvesService, AvesSeverity, AvesStatus, AvesValidator, type AvesXmlResponse, type BookFileRQ, BookFileRQValidation, type BookFileRQValidationType, type BookingFile, type BookingFileRS, type BookingPassenger, type BookingPayment, type BookingResponse, type BookingService, type BookingStatusType, type BookingType, type CancelBookingRequest, type CancelFileRQ, CancelFileRQValidation, type CancelFileRQValidationType, type CancelFileRS, type CancelReasonType, type CommunicationMethodType, type ContactInfo, ContactInfoValidation, type ContactInfoValidationType, type ContactType, type CreateBookingRequest, type Customer, type CustomerAddress, type CustomerContact, type CustomerRecordRS, type CustomerStatusType, type CustomerType, type DateString, type DateTimeString, type DeliveryMethodType, type DeliveryStatusType, type DocumentFormatType, type DocumentResponse, type DocumentType, type EmailType, type FilePaymentListRQ, type FilePaymentListRS, type GenderType, type HttpError, type IXmlHttpClient, type LanguageCode, LanguageCodeValidation, type ManageMasterRecordRQ, type MasterRecord, type ModFileServicesRQ, type ModiFileHeaderRQ, type ModiFileHeaderRS, type OperationResponse, type Passenger, type PassengerType, PassengerValidation, type PassengerValidationType, type Payment, type PaymentStatusType, type PaymentType, PaymentValidation, type PaymentValidationType, type PricingItemType, type PrintBookingDocumentRQ, PrintBookingDocumentRQValidation, type PrintBookingDocumentRQValidationType, type PrintBookingDocumentRS, type PrintDocumentRequest, type PriorityType, type RefundMethodType, type RqHeader, type RsStatus, type SearchCustomerRequest, type SearchMasterRecordRQ, SearchMasterRecordRQValidation, type SearchMasterRecordRQValidationType, type SearchMasterRecordRS, type SearchOperatorType, type SearchResponse, type Service, type ServiceStatusType, type ServiceType, ServiceValidation, type ServiceValidationType, type SetStatusRQ, type SetStatusServiceRS, type SpecialRequestType, type TimeString, type TitleType, XML_HTTP_CLIENT, XmlHttpClient, avesConfig, configValidationSchema, createAvesValidator, createDateString, createDateTimeString, createTimeString, getCurrentDateString, getCurrentDateTimeString, isValidDateString, isValidDateTimeString, isValidTimeString, mapAddPaymentToXml, mapAddressToXml, mapAddressTypeFromXml, mapAddressTypeToXml, mapBookingFromXml, mapBookingResponseFromXml, mapBookingTypeToXml, mapCancelBookingToXml, mapCancelReasonToXml, mapCancelResponseFromXml, mapContactToXml, mapContactTypeFromXml, mapContactTypeToXml, mapCreateBookingToXml, mapCustomerToXml, mapCustomerTypeToXml, mapDeliveryMethodToXml, mapDocumentFormatToXml, mapDocumentResponseFromXml, mapDocumentTypeToXml, mapEmailTypeFromXml, mapEmailTypeToXml, mapMasterRecordFromXml, mapPassengerToXml, mapPassengerTypeFromXml, mapPassengerTypeToXml, mapPaymentResponseFromXml, mapPaymentStatusFromXml, mapPaymentStatusToXml, mapPaymentToXml, mapPaymentTypeFromXml, mapPaymentTypeToXml, mapPrintDocumentToXml, mapPriorityToXml, mapRefundMethodToXml, mapSearchCustomerToXml, mapSearchOperatorToXml, mapSearchResponseFromXml, mapServiceStatusFromXml, mapServiceStatusToXml, mapServiceToXml, mapServiceTypeFromXml, mapServiceTypeToXml, mapSpecialRequestTypeToXml, mapTitleFromXml, mapTitleToXml };
1185
+ export { AVES_CONFIG_NAMESPACE, AVES_SDK_CONFIG, type AddPaymentRequest, type Address, type AddressType, AddressValidation, type AddressValidationType, type AvesEnvConfig, type AvesError, AvesErrorCodes, AvesErrorHandler, AvesException, AvesModule, type AvesModuleAsyncOptions, type AvesOptionsFactory, type AvesRegisteredConfig, type AvesRequestRoot, type AvesResponseRoot, type AvesSdkConfig, AvesService, AvesSeverity, AvesStatus, AvesValidator, type AvesXmlResponse, type BookFileRQ, BookFileRQValidation, type BookFileRQValidationType, type BookingFile, type BookingFileRS, type BookingPassenger, type BookingPayment, type BookingResponse, type BookingService, type BookingStatusType, type BookingType, type CancelBookingRequest, type CancelFileRQ, CancelFileRQValidation, type CancelFileRQValidationType, type CancelFileRS, type CancelReasonType, type CommunicationMethodType, type ContactInfo, ContactInfoValidation, type ContactInfoValidationType, type ContactType, type CreateBookingRequest, type Customer, type CustomerAddress, type CustomerContact, type CustomerRecordRS, type CustomerStatusType, type CustomerType, type DeliveryMethodType, type DeliveryStatusType, type DocumentFormatType, type DocumentResponse, type DocumentType, type EmailType, type FilePaymentListRQ, type FilePaymentListRS, type GenderType, type HttpError, type IXmlHttpClient, type LanguageCode, LanguageCodeValidation, type ManageMasterRecordRQ, type MasterRecord, type ModFileServicesRQ, type ModiFileHeaderRQ, type ModiFileHeaderRS, type OperationResponse, type Passenger, type PassengerType, PassengerValidation, type PassengerValidationType, type Payment, type PaymentStatusType, type PaymentType, PaymentValidation, type PaymentValidationType, type PricingItemType, type PrintBookingDocumentRQ, PrintBookingDocumentRQValidation, type PrintBookingDocumentRQValidationType, type PrintBookingDocumentRS, type PrintDocumentRequest, type PriorityType, type RefundMethodType, type RqHeader, type RsStatus, type SearchCustomerRequest, type SearchMasterRecordRQ, SearchMasterRecordRQValidation, type SearchMasterRecordRQValidationType, type SearchMasterRecordRS, type SearchOperatorType, type SearchResponse, type Service, type ServiceStatusType, type ServiceType, ServiceValidation, type ServiceValidationType, type SetStatusRQ, type SetStatusServiceRS, type SpecialRequestType, type TitleType, XML_HTTP_CLIENT, XmlHttpClient, avesConfig, configValidationSchema, createAvesValidator, createDateString, createDateTimeString, createTimeString, mapAddPaymentToXml, mapAddressToXml, mapAddressTypeFromXml, mapAddressTypeToXml, mapBookingFromXml, mapBookingResponseFromXml, mapBookingTypeToXml, mapCancelBookingToXml, mapCancelReasonToXml, mapCancelResponseFromXml, mapContactToXml, mapContactTypeFromXml, mapContactTypeToXml, mapCreateBookingToXml, mapCustomerToXml, mapCustomerTypeToXml, mapDeliveryMethodToXml, mapDocumentFormatToXml, mapDocumentResponseFromXml, mapDocumentTypeToXml, mapEmailTypeFromXml, mapEmailTypeToXml, mapMasterRecordFromXml, mapPassengerToXml, mapPassengerTypeFromXml, mapPassengerTypeToXml, mapPaymentResponseFromXml, mapPaymentStatusFromXml, mapPaymentStatusToXml, mapPaymentToXml, mapPaymentTypeFromXml, mapPaymentTypeToXml, mapPrintDocumentToXml, mapPriorityToXml, mapRefundMethodToXml, mapSearchCustomerToXml, mapSearchOperatorToXml, mapSearchResponseFromXml, mapServiceStatusFromXml, mapServiceStatusToXml, mapServiceToXml, mapServiceTypeFromXml, mapServiceTypeToXml, mapSpecialRequestTypeToXml, mapTitleFromXml, mapTitleToXml };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var le=Object.defineProperty;var Be=(e,t,n)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var o=(e,t)=>le(e,"name",{value:t,configurable:!0});var p=(e,t,n)=>Be(e,typeof t!="symbol"?t+"":t,n);import"reflect-metadata";var l=o(e=>{if(!/^\d{4}-\d{2}-\d{2}$/.test(e))throw new Error(`Invalid date format. Expected YYYY-MM-DD, got: ${e}`);let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid date value: ${e}`);return e},"createDateString"),R=o(e=>{if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/.test(e))throw new Error(`Invalid datetime format. Expected ISO 8601, got: ${e}`);let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid datetime value: ${e}`);return e},"createDateTimeString"),Ue=o(e=>{if(!/^\d{2}:\d{2}:\d{2}$/.test(e))throw new Error(`Invalid time format. Expected HH:MM:SS, got: ${e}`);let[t,n,i]=e.split(":").map(Number);if(t<0||t>23||n<0||n>59||i<0||i>59)throw new Error(`Invalid time value: ${e}`);return e},"createTimeString"),St=o(()=>l(new Date().toISOString().split("T")[0]),"getCurrentDateString"),ht=o(()=>R(new Date().toISOString()),"getCurrentDateTimeString"),Nt=o(e=>{try{return l(e),!0}catch{return!1}},"isValidDateString"),Dt=o(e=>{try{return R(e),!0}catch{return!1}},"isValidDateTimeString"),At=o(e=>{try{return Ue(e),!0}catch{return!1}},"isValidTimeString");function F(e){return{home:"HOME",work:"WORK",billing:"BILLING",delivery:"DELIVERY"}[e]||"HOME"}o(F,"mapAddressTypeToXml");function _(e){return{HOME:"home",WORK:"work",BILLING:"billing",DELIVERY:"delivery"}[e]||"home"}o(_,"mapAddressTypeFromXml");function X(e){return{home:"HOME",work:"WORK",mobile:"MOBILE",fax:"FAX"}[e]||"HOME"}o(X,"mapContactTypeToXml");function L(e){return{HOME:"home",WORK:"work",MOBILE:"mobile",FAX:"fax"}[e]||"home"}o(L,"mapContactTypeFromXml");function M(e){return{home:"HOME",work:"WORK"}[e]||"HOME"}o(M,"mapEmailTypeToXml");function b(e){return{HOME:"home",WORK:"work"}[e]||"home"}o(b,"mapEmailTypeFromXml");function v(e){return{adult:"ADT",child:"CHD",infant:"INF"}[e]||"ADT"}o(v,"mapPassengerTypeToXml");function V(e){return{ADT:"adult",CHD:"child",INF:"infant"}[e]||"adult"}o(V,"mapPassengerTypeFromXml");function w(e){return{mr:"MR",mrs:"MRS",ms:"MS",dr:"DR",prof:"PROF"}[e]||"MR"}o(w,"mapTitleToXml");function B(e){return{MR:"mr",MRS:"mrs",MS:"ms",DR:"dr",PROF:"prof"}[e]||"mr"}o(B,"mapTitleFromXml");function U(e){return{flight:"FLIGHT",hotel:"HOTEL",car:"CAR",transfer:"TRANSFER",insurance:"INSURANCE"}[e]||"FLIGHT"}o(U,"mapServiceTypeToXml");function x(e){return{FLIGHT:"flight",HOTEL:"hotel",CAR:"car",TRANSFER:"transfer",INSURANCE:"insurance"}[e]||"flight"}o(x,"mapServiceTypeFromXml");function H(e){return{confirmed:"CONFIRMED",pending:"PENDING",cancelled:"CANCELLED"}[e]||"PENDING"}o(H,"mapServiceStatusToXml");function k(e){return{CONFIRMED:"confirmed",PENDING:"pending",CANCELLED:"cancelled"}[e]||"pending"}o(k,"mapServiceStatusFromXml");function j(e){return{credit_card:"CREDIT_CARD",debit_card:"DEBIT_CARD",bank_transfer:"BANK_TRANSFER",cash:"CASH"}[e]||"CASH"}o(j,"mapPaymentTypeToXml");function G(e){return{CREDIT_CARD:"credit_card",DEBIT_CARD:"debit_card",BANK_TRANSFER:"bank_transfer",CASH:"cash"}[e]||"cash"}o(G,"mapPaymentTypeFromXml");function q(e){return{pending:"PENDING",confirmed:"CONFIRMED",failed:"FAILED"}[e]||"PENDING"}o(q,"mapPaymentStatusToXml");function K(e){return{PENDING:"pending",CONFIRMED:"confirmed",FAILED:"failed"}[e]||"pending"}o(K,"mapPaymentStatusFromXml");function h(e){return{customer:"CUSTOMER",agent:"AGENT",supplier:"SUPPLIER"}[e]||"CUSTOMER"}o(h,"mapCustomerTypeToXml");function Ee(e){return{CUSTOMER:"customer",AGENT:"agent",SUPPLIER:"supplier"}[e]||"customer"}o(Ee,"mapCustomerTypeFromXml");function ge(e){return{active:"ACTIVE",inactive:"INACTIVE",suspended:"SUSPENDED"}[e]||"ACTIVE"}o(ge,"mapCustomerStatusToXml");function Ie(e){return{ACTIVE:"active",INACTIVE:"inactive",SUSPENDED:"suspended"}[e]||"active"}o(Ie,"mapCustomerStatusFromXml");function Re(e){return{email:"EMAIL",sms:"SMS",phone:"PHONE"}[e]||"EMAIL"}o(Re,"mapCommunicationMethodToXml");function ye(e){return{EMAIL:"email",SMS:"sms",PHONE:"phone"}[e]||"email"}o(ye,"mapCommunicationMethodFromXml");function W(e){return{individual:"INDIVIDUAL",group:"GROUP",corporate:"CORPORATE"}[e]||"INDIVIDUAL"}o(W,"mapBookingTypeToXml");function Te(e){return{PENDING:"pending",CONFIRMED:"confirmed",CANCELLED:"cancelled",COMPLETED:"completed"}[e]||"pending"}o(Te,"mapBookingStatusFromXml");function Q(e){return{low:"LOW",normal:"NORMAL",high:"HIGH",urgent:"URGENT"}[e]||"NORMAL"}o(Q,"mapPriorityToXml");function Y(e){return{meal:"MEAL",seat:"SEAT",wheelchair:"WHEELCHAIR",other:"OTHER"}[e]||"OTHER"}o(Y,"mapSpecialRequestTypeToXml");function $(e){return{customer_request:"CUSTOMER_REQUEST",no_show:"NO_SHOW",operational:"OPERATIONAL",other:"OTHER"}[e]||"OTHER"}o($,"mapCancelReasonToXml");function z(e){return{original_payment:"ORIGINAL_PAYMENT",credit:"CREDIT",cash:"CASH"}[e]||"CASH"}o(z,"mapRefundMethodToXml");function Z(e){return{confirmation:"CONFIRMATION",invoice:"INVOICE",voucher:"VOUCHER",ticket:"TICKET",all:"ALL"}[e]||"ALL"}o(Z,"mapDocumentTypeToXml");function J(e){return{pdf:"PDF",html:"HTML",xml:"XML"}[e]||"PDF"}o(J,"mapDocumentFormatToXml");function ee(e){return{email:"EMAIL",sms:"SMS",download:"DOWNLOAD"}[e]||"EMAIL"}o(ee,"mapDeliveryMethodToXml");function te(e){return{equals:"EQUALS",contains:"CONTAINS",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH"}[e]||"EQUALS"}o(te,"mapSearchOperatorToXml");function Se(e){return{SERVICE:"service",TAX:"tax",FEE:"fee",DISCOUNT:"discount"}[e]||"service"}o(Se,"mapPricingItemTypeFromXml");function he(e){return{SENT:"sent",PENDING:"pending",FAILED:"failed"}[e]||"pending"}o(he,"mapDeliveryStatusFromXml");function ne(e){return{male:"M",female:"F"}[e]||"M"}o(ne,"mapGenderToXml");function Ne(e){return{M:"male",F:"female"}[e]||"male"}o(Ne,"mapGenderFromXml");function oe(e){return{"@Type":e.type?F(e.type):void 0,Street:e.street,City:e.city,State:e.state,PostalCode:e.postalCode,Country:e.country}}o(oe,"mapAddressToXml");function N(e){return{type:e["@Type"]?_(e["@Type"]):void 0,street:e.Street,city:e.City,state:e.State,postalCode:e.PostalCode,country:e.Country}}o(N,"mapAddressFromXml");function re(e){return{Phone:e.phone?{"@Type":e.phone.type?X(e.phone.type):void 0,"@Number":e.phone.number}:void 0,Email:e.email?{"@Type":e.email.type?M(e.email.type):void 0,"@Address":e.email.address}:void 0}}o(re,"mapContactToXml");function D(e){return{phone:e.Phone?{type:e.Phone["@Type"]?L(e.Phone["@Type"]):void 0,number:e.Phone["@Number"]}:void 0,email:e.Email?{type:e.Email["@Type"]?b(e.Email["@Type"]):void 0,address:e.Email["@Address"]}:void 0}}o(D,"mapContactFromXml");function De(e){return{"@PassengerID":e.id,"@Type":v(e.type),"@Title":e.title?w(e.title):void 0,FirstName:e.firstName,LastName:e.lastName,MiddleName:e.middleName,DateOfBirth:e.dateOfBirth,Gender:e.gender?ne(e.gender):void 0,Nationality:e.nationality,Passport:e.passport?{"@Number":e.passport.number,"@ExpiryDate":e.passport.expiryDate,"@IssuingCountry":e.passport.issuingCountry}:void 0,Address:e.address?oe(e.address):void 0,ContactInfo:e.contact?re(e.contact):void 0}}o(De,"mapPassengerToXml");function Ae(e){return{id:e["@PassengerID"],type:V(e["@Type"]),title:e["@Title"]?B(e["@Title"]):void 0,firstName:e.FirstName,lastName:e.LastName,middleName:e.MiddleName,dateOfBirth:e.DateOfBirth?l(e.DateOfBirth):void 0,gender:e.Gender?Ne(e.Gender):void 0,nationality:e.Nationality,passport:e.Passport?{number:e.Passport["@Number"],expiryDate:l(e.Passport["@ExpiryDate"]),issuingCountry:e.Passport["@IssuingCountry"]}:void 0,address:e.Address?N(e.Address):void 0,contact:e.ContactInfo?D(e.ContactInfo):void 0}}o(Ae,"mapPassengerFromXml");function Ce(e){return{"@ServiceID":e.id,"@Type":U(e.type),"@Status":H(e.status),ServiceDetails:{Code:e.code,Name:e.name,Description:e.description,StartDate:e.startDate,EndDate:e.endDate,Price:e.price?{"@Currency":e.price.currency,"@Amount":e.price.amount}:void 0}}}o(Ce,"mapServiceToXml");function Oe(e){return{id:e["@ServiceID"],type:x(e["@Type"]),status:k(e["@Status"]),code:e.ServiceDetails.Code,name:e.ServiceDetails.Name,description:e.ServiceDetails.Description,startDate:e.ServiceDetails.StartDate?l(e.ServiceDetails.StartDate):void 0,endDate:e.ServiceDetails.EndDate?l(e.ServiceDetails.EndDate):void 0,price:e.ServiceDetails.Price?{currency:e.ServiceDetails.Price["@Currency"],amount:e.ServiceDetails.Price["@Amount"]}:void 0}}o(Oe,"mapServiceFromXml");function Pe(e){return{"@PaymentID":e.id,"@Type":j(e.type),"@Status":q(e.status),Amount:{"@Currency":e.amount.currency,"@Amount":e.amount.amount},PaymentDetails:e.details?{CardNumber:e.details.cardNumber,ExpiryDate:e.details.expiryDate,CardHolderName:e.details.cardHolderName}:void 0}}o(Pe,"mapPaymentToXml");function Fe(e){return{id:e["@PaymentID"],type:G(e["@Type"]),status:K(e["@Status"]),amount:{currency:e.Amount["@Currency"],amount:e.Amount["@Amount"]},details:e.PaymentDetails?{cardNumber:e.PaymentDetails.CardNumber,expiryDate:e.PaymentDetails.ExpiryDate,cardHolderName:e.PaymentDetails.CardHolderName}:void 0}}o(Fe,"mapPaymentFromXml");function xe(e){return{SearchCriteria:{MasterRecordType:h(e.type),SearchFields:{Field:e.fields.map(t=>({"@Name":t.name,"@Value":t.value,"@Operator":t.operator?te(t.operator):void 0}))},Pagination:e.pagination?{"@PageSize":e.pagination.pageSize,"@PageNumber":e.pagination.pageNumber}:void 0}}}o(xe,"mapSearchCustomerToXml");function _e(e){return{"@MasterRecordID":e.id,"@Type":h(e.type),"@Status":ge(e.status),PersonalInfo:e.personalInfo?{Title:e.personalInfo.title,FirstName:e.personalInfo.firstName,LastName:e.personalInfo.lastName,MiddleName:e.personalInfo.middleName,DateOfBirth:e.personalInfo.dateOfBirth,Gender:e.personalInfo.gender?ne(e.personalInfo.gender):void 0,Nationality:e.personalInfo.nationality}:void 0,ContactInfo:e.contact?re(e.contact):void 0,Address:e.address?oe(e.address):void 0,BusinessInfo:e.businessInfo?{CompanyName:e.businessInfo.companyName,TaxID:e.businessInfo.taxId,LicenseNumber:e.businessInfo.licenseNumber}:void 0,Preferences:e.preferences?{Language:e.preferences.language,Currency:e.preferences.currency,CommunicationMethod:e.preferences.communicationMethod?Re(e.preferences.communicationMethod):void 0}:void 0}}o(_e,"mapCustomerToXml");function He(e){return{BookingDetails:{"@BookingType":W(e.type),"@Priority":Q(e.priority),CustomerInfo:{"@CustomerID":e.customerId,CustomerDetails:e.customerDetails?_e(e.customerDetails):void 0},PassengerList:{Passenger:e.passengers.map(De)},SelectedServiceList:{Service:e.services.map(Ce)},SpecialRequests:e.specialRequests?{Request:e.specialRequests.map(t=>({"@Type":Y(t.type),"@Description":t.description}))}:void 0}}}o(He,"mapCreateBookingToXml");function ke(e){return{"@BookingFileID":e.bookingId,CancellationDetails:{"@Reason":$(e.reason),"@Description":e.description,RefundRequest:e.refundRequest?{"@Amount":e.refundRequest.amount,"@Currency":e.refundRequest.currency,"@Method":z(e.refundRequest.method)}:void 0}}}o(ke,"mapCancelBookingToXml");function je(e){return{"@BookingFileID":e.bookingId,DocumentRequest:{"@DocumentType":Z(e.documentType),"@Format":J(e.format),"@Language":e.language,DeliveryMethod:e.deliveryMethod?{"@Type":ee(e.deliveryMethod.type),"@Address":e.deliveryMethod.address}:void 0}}}o(je,"mapPrintDocumentToXml");function Ge(e){return{"@BookingFileID":e.bookingId,PaymentList:{Payment:e.payments.map(Pe)}}}o(Ge,"mapAddPaymentToXml");function Xe(e){return{id:e["@MasterRecordID"],type:Ee(e["@Type"]),status:Ie(e["@Status"]),personalInfo:e.PersonalInfo?{title:e.PersonalInfo.Title,firstName:e.PersonalInfo.FirstName,lastName:e.PersonalInfo.LastName,middleName:e.PersonalInfo.MiddleName,dateOfBirth:e.PersonalInfo.DateOfBirth?l(e.PersonalInfo.DateOfBirth):void 0,gender:e.PersonalInfo.Gender==="M"?"male":"female",nationality:e.PersonalInfo.Nationality}:void 0,contact:e.ContactInfo?D(e.ContactInfo):void 0,address:e.Address?N(e.Address):void 0,businessInfo:e.BusinessInfo?{companyName:e.BusinessInfo.CompanyName,taxId:e.BusinessInfo.TaxID,licenseNumber:e.BusinessInfo.LicenseNumber}:void 0,preferences:e.Preferences?{language:e.Preferences.Language,currency:e.Preferences.Currency,communicationMethod:e.Preferences.CommunicationMethod?ye(e.Preferences.CommunicationMethod):void 0}:void 0}}o(Xe,"mapCustomerFromXml");function ie(e){return{id:e["@BookingFileID"],status:Te(e["@Status"]),createdAt:R(e["@CreationDate"]),updatedAt:R(e["@LastModified"]),customer:Xe(e.CustomerInfo),passengers:e.PassengerList.Passenger.map(Ae),services:e.ServiceList.Service.map(Oe),pricing:{totalAmount:{currency:e.Pricing.TotalAmount["@Currency"],amount:e.Pricing.TotalAmount["@Amount"]},breakdowns:e.Pricing.Breakdown?.Item.map(t=>({type:Se(t["@Type"]),description:t["@Description"],amount:t["@Amount"]}))}}}o(ie,"mapBookingFromXml");function qe(e){let t=ie(e.BookingFile);return{...t,success:e.OperationResult["@Status"]==="SUCCESS",message:e.OperationResult["@Message"],data:t}}o(qe,"mapBookingResponseFromXml");function Ke(e){return{results:e.SearchResults.MasterRecord.map(Xe),pagination:e.SearchResults.PaginationInfo?{totalRecords:e.SearchResults.PaginationInfo["@TotalRecords"],pageSize:e.SearchResults.PaginationInfo["@PageSize"],pageNumber:e.SearchResults.PaginationInfo["@PageNumber"],totalPages:e.SearchResults.PaginationInfo["@TotalPages"]}:void 0}}o(Ke,"mapSearchResponseFromXml");function We(e){return{id:e.DocumentInfo["@DocumentID"],type:e.DocumentInfo["@DocumentType"],format:e.DocumentInfo["@Format"],size:e.DocumentInfo["@Size"],createdAt:R(e.DocumentInfo["@CreationDate"]),downloadUrl:e.DocumentInfo.DownloadURL,deliveryStatus:e.DocumentInfo.DeliveryStatus?{status:he(e.DocumentInfo.DeliveryStatus["@Status"]),method:e.DocumentInfo.DeliveryStatus["@Method"],address:e.DocumentInfo.DeliveryStatus["@Address"]}:void 0,success:e.OperationResult["@Status"]==="SUCCESS",message:e.OperationResult["@Message"]}}o(We,"mapDocumentResponseFromXml");function Qe(e){return{success:e.OperationResult["@Status"]==="SUCCESS",message:e.OperationResult["@Message"],data:{refundInfo:e.OperationResult.RefundInfo?{refundAmount:e.OperationResult.RefundInfo["@RefundAmount"],currency:e.OperationResult.RefundInfo["@Currency"],refundMethod:e.OperationResult.RefundInfo["@RefundMethod"],processingTime:e.OperationResult.RefundInfo["@ProcessingTime"]}:void 0}}}o(Qe,"mapCancelResponseFromXml");function Ye(e){let t=ie(e.BookingFile);return{success:e.OperationResult["@Status"]==="SUCCESS",message:e.OperationResult["@Message"],data:{booking:t,paymentSummary:{totalPaid:{currency:e.PaymentSummary.TotalPaid["@Currency"],amount:e.PaymentSummary.TotalPaid["@Amount"]},outstandingAmount:{currency:e.PaymentSummary.OutstandingAmount["@Currency"],amount:e.PaymentSummary.OutstandingAmount["@Amount"]},paymentHistory:e.PaymentSummary.PaymentHistory.Payment.map(Fe)}}}}o(Ye,"mapPaymentResponseFromXml");function $e(e){return{id:e["@MasterRecordID"],type:e["@Type"].toLowerCase(),status:e["@Status"].toLowerCase(),personalInfo:e.PersonalInfo?{title:e.PersonalInfo.Title,firstName:e.PersonalInfo.FirstName,lastName:e.PersonalInfo.LastName,middleName:e.PersonalInfo.MiddleName,dateOfBirth:e.PersonalInfo.DateOfBirth,gender:e.PersonalInfo.Gender?.toLowerCase(),nationality:e.PersonalInfo.Nationality}:void 0,contact:e.ContactInfo?D(e.ContactInfo):void 0,address:e.Address?N(e.Address):void 0,businessInfo:e.BusinessInfo?{companyName:e.BusinessInfo.CompanyName,taxId:e.BusinessInfo.TaxID,licenseNumber:e.BusinessInfo.LicenseNumber}:void 0,preferences:e.Preferences?{language:e.Preferences.Language,currency:e.Preferences.Currency,communicationMethod:e.Preferences.CommunicationMethod?.toLowerCase()}:void 0}}o($e,"mapMasterRecordFromXml");import{Module as Et,Global as gt}from"@nestjs/common";import{ConfigModule as we}from"@nestjs/config";import{Inject as be,Injectable as Ze}from"@nestjs/common";var g=Symbol("AVES_SDK_CONFIG"),y=Symbol("XML_HTTP_CLIENT");var se=class se{constructor(t){p(this,"RqHeader");p(this,"Body");Object.assign(this,t)}};o(se,"RequestPayload");var ae=se,me=class me{constructor(t){p(this,"Request");this.Request=new ae(t)}};o(me,"WrapRequestDto");var A=me;function ze(e,t,n,i){var m=arguments.length,s=m<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,i);else for(var f=e.length-1;f>=0;f--)(u=e[f])&&(s=(m<3?u(s):m>3?u(t,n,s):u(t,n))||s);return m>3&&s&&Object.defineProperty(t,n,s),s}o(ze,"_ts_decorate");function Le(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}o(Le,"_ts_metadata");function Me(e,t){return function(n,i){t(n,i,e)}}o(Me,"_ts_param");var pe=class pe{constructor(t,n){p(this,"config");p(this,"http");this.config=t,this.http=n}buildHeader(){let{hostId:t,xtoken:n,languageCode:i}=this.config;return{"@HostID":t,"@Xtoken":n,"@Interface":"WEB","@UserName":"WEB","@LanguageCode":i}}wrapRequest(t){return new A({RqHeader:this.buildHeader(),Body:t})}async searchMasterRecord(t){return this.http.postXml("/interop/masterRecords/v2/rest/Search","SearchMasterRecordRQ",this.wrapRequest(t))}async insertOrUpdateMasterRecord(t){return this.http.postXml("/interop/masterRecords/v2/rest/InsertOrUpdate","ManageMasterRecordRQ",this.wrapRequest(t))}async createBookingFile(t){return this.http.postXml("/interop/booking/v2/rest/CreateBookingFile","BookFileRQ",this.wrapRequest(t))}async modBookingFileHeader(t){return this.http.postXml("/interop/booking/v2/rest/ModBookingFileHeader","ModiFileHeaderRQ",this.wrapRequest(t))}async modBookingFileServices(t){return this.http.postXml("/interop/booking/v2/rest/ModBookingFileServices","ModFileServicesRQ",this.wrapRequest(t))}async setBookingFileStatus(t){return this.http.postXml("/interop/booking/v2/rest/SetBookingFileStatus","SetStatusRQ",this.wrapRequest(t))}async cancelBookingFile(t){return this.http.postXml("/interop/booking/v2/rest/CancelBookingFile","CancelFileRQ",this.wrapRequest(t))}async insertFilePaymentList(t){return this.http.postXml("/interop/booking/v2/rest/InsertFilePaymentList","FilePaymentListRQ",this.wrapRequest(t))}async printBookingDocument(t){return this.http.postXml("/interop/document/v2/rest/PrintBookingDocument","PrintBookingDocumentRQ",this.wrapRequest(t))}};o(pe,"AvesService");var E=pe;E=ze([Ze(),Me(0,be(g)),Me(1,be(y)),Le("design:type",Function),Le("design:paramtypes",[typeof AvesSdkConfig>"u"?Object:AvesSdkConfig,typeof IXmlHttpClient>"u"?Object:IXmlHttpClient])],E);import tt from"axios";import{XMLBuilder as nt,XMLParser as ot}from"fast-xml-parser";import{Inject as rt,Injectable as it,Scope as at}from"@nestjs/common";function Je(e,t,n,i){var m=arguments.length,s=m<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,i);else for(var f=e.length-1;f>=0;f--)(u=e[f])&&(s=(m<3?u(s):m>3?u(t,n,s):u(t,n))||s);return m>3&&s&&Object.defineProperty(t,n,s),s}o(Je,"_ts_decorate");function ve(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}o(ve,"_ts_metadata");function et(e,t){return function(n,i){t(n,i,e)}}o(et,"_ts_param");var ue=class ue{constructor(t){p(this,"config");p(this,"httpClient");p(this,"xmlBuilder");p(this,"xmlParser");this.config=t,this.httpClient=tt.create({baseURL:t.baseUrl,timeout:typeof t.timeout=="number"?t.timeout:3e4,headers:{"Content-Type":"application/xml",Accept:"application/xml, text/xml, */*;q=0.1"},transitional:{clarifyTimeoutError:!0},validateStatus:o(n=>n>=200&&n<300,"validateStatus")}),this.xmlBuilder=new nt({attributeNamePrefix:"@",ignoreAttributes:!1,suppressEmptyNode:!0,format:process.env.NODE_ENV?.toLowerCase()==="development"}),this.xmlParser=new ot({attributeNamePrefix:"@",ignoreAttributes:!1,parseAttributeValue:!1,trimValues:!0,isArray:o(n=>["Field","Item","Service","Passenger","Payment","MasterRecord","Request","Notes","ServiceID"].includes(n),"isArray")})}async postXml(t,n,i,m){let s=this.xmlBuilder.build({[n]:i}),u=await this.httpClient.post(t,s,m);return this.xmlParser.parse(u.data)}};o(ue,"XmlHttpClient");var T=ue;T=Je([it({scope:at.DEFAULT}),et(0,rt(g)),ve("design:type",Function),ve("design:paramtypes",[typeof AvesSdkConfig>"u"?Object:AvesSdkConfig])],T);import{registerAs as st}from"@nestjs/config";var mt="aves",ce=st(mt,()=>({baseUrl:process.env.AVES_BASE_URL??"",hostId:process.env.AVES_HOST_ID??"",xtoken:process.env.AVES_XTOKEN??"",languageCode:process.env.AVES_LANGUAGE_CODE,timeout:process.env.AVES_TIMEOUT?Number(process.env.AVES_TIMEOUT):void 0}));import{z as r}from"zod";var pt=r.enum(["01","02"]),Ve=r.object({baseUrl:r.url(),hostId:r.string().length(6),xtoken:r.string(),languageCode:pt.optional(),timeout:r.number().optional()}),ut=r.object({"@Type":r.enum(["HOME","WORK","BILLING","DELIVERY"]).optional(),Street:r.string().max(100).optional(),City:r.string().max(50).optional(),State:r.string().max(50).optional(),PostalCode:r.string().max(20).optional(),Country:r.string().max(50).optional()}),ct=r.object({Phone:r.object({"@Type":r.enum(["HOME","WORK","MOBILE","FAX"]).optional(),"@Number":r.string()}).optional(),Email:r.object({"@Type":r.enum(["HOME","WORK"]).optional(),"@Address":r.string()}).optional()}),dt=r.object({"@PassengerID":r.string().min(1),"@Type":r.enum(["ADT","CHD","INF"]),"@Title":r.enum(["MR","MRS","MS","DR","PROF"]).optional(),FirstName:r.string().min(1).max(50),LastName:r.string().min(1).max(50),MiddleName:r.string().max(50).optional(),DateOfBirth:r.string().datetime().optional(),Gender:r.enum(["M","F"]).optional(),Nationality:r.string().max(3).optional(),Address:ut.optional(),ContactInfo:ct.optional()}),ft=r.object({"@ServiceID":r.string().min(1),"@Type":r.enum(["FLIGHT","HOTEL","CAR","TRANSFER","INSURANCE"]),"@Status":r.enum(["CONFIRMED","PENDING","CANCELLED"]),ServiceDetails:r.object({Code:r.string().optional(),Name:r.string().optional(),Description:r.string().optional(),StartDate:r.string().optional(),EndDate:r.string().optional(),Price:r.object({"@Currency":r.string(),"@Amount":r.number()}).optional()})}),mn=r.object({"@PaymentID":r.string().min(1),"@Type":r.enum(["CREDIT_CARD","DEBIT_CARD","BANK_TRANSFER","CASH"]),"@Status":r.enum(["PENDING","CONFIRMED","FAILED"]),Amount:r.object({"@Currency":r.string(),"@Amount":r.number()}),PaymentDetails:r.object({CardNumber:r.string().optional(),ExpiryDate:r.string().optional(),CardHolderName:r.string().optional()}).optional()}),pn=r.object({SearchCriteria:r.object({MasterRecordType:r.enum(["CUSTOMER","AGENT","SUPPLIER"]),SearchFields:r.object({Field:r.array(r.object({"@Name":r.string(),"@Value":r.string(),"@Operator":r.enum(["EQUALS","CONTAINS","STARTS_WITH","ENDS_WITH"]).optional()}))}),Pagination:r.object({"@PageSize":r.number(),"@PageNumber":r.number()}).optional()})}),un=r.object({BookingDetails:r.object({"@BookingType":r.enum(["INDIVIDUAL","GROUP","CORPORATE"]),"@Priority":r.enum(["LOW","NORMAL","HIGH","URGENT"]),CustomerInfo:r.object({"@CustomerID":r.string().optional(),CustomerDetails:r.any().optional()}),PassengerList:r.object({Passenger:r.array(dt)}),SelectedServiceList:r.object({Service:r.array(ft)}),SpecialRequests:r.object({Request:r.array(r.object({"@Type":r.enum(["MEAL","SEAT","WHEELCHAIR","OTHER"]),"@Description":r.string()}))}).optional()})}),cn=r.object({"@BookingFileID":r.string().min(1),CancellationDetails:r.object({"@Reason":r.enum(["CUSTOMER_REQUEST","NO_SHOW","OPERATIONAL","OTHER"]),"@Description":r.string().optional(),RefundRequest:r.object({"@Amount":r.number(),"@Currency":r.string(),"@Method":r.enum(["ORIGINAL_PAYMENT","CREDIT","CASH"])}).optional()})}),dn=r.object({"@BookingFileID":r.string().min(1),DocumentRequest:r.object({"@DocumentType":r.enum(["CONFIRMATION","INVOICE","VOUCHER","TICKET","ALL"]),"@Format":r.enum(["PDF","HTML","XML"]),"@Language":r.string().optional(),DeliveryMethod:r.object({"@Type":r.enum(["EMAIL","SMS","DOWNLOAD"]),"@Address":r.string().optional()}).optional()})});function lt(e,t,n,i){var m=arguments.length,s=m<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,i);else for(var f=e.length-1;f>=0;f--)(u=e[f])&&(s=(m<3?u(s):m>3?u(t,n,s):u(t,n))||s);return m>3&&s&&Object.defineProperty(t,n,s),s}o(lt,"_ts_decorate");var I=class I{static forRoot(t){let n=this.validateConfig(t);return{module:I,imports:[we.forFeature(ce)],providers:[{provide:g,useValue:n},this.createXmlHttpClientProvider(),E],exports:[E,y]}}static forRootAsync(t){let n=this.createAsyncProviders(t);return{module:I,imports:[...t.imports??[],we.forFeature(ce)],providers:[...n,this.createXmlHttpClientProvider(),E],exports:[E,y]}}static createXmlHttpClientProvider(){return{provide:y,useClass:T}}static createAsyncProviders(t){if(t.useFactory)return[{provide:g,useFactory:o(async(...m)=>{try{let s=await t.useFactory(...m);return this.validateConfig(s)}catch(s){throw new Error(`Failed to create Aves configuration: ${s.message}`)}},"useFactory"),inject:t.inject??[]}];let n=t.useClass||t.useExisting;if(!n)throw new Error("Invalid AvesModule async options: provide useFactory, useClass, or useExisting");let i=[{provide:g,useFactory:o(async m=>{try{let s=await m.createAvesOptions();return this.validateConfig(s)}catch(s){throw new Error(`Failed to create Aves configuration: ${s.message}`)}},"useFactory"),inject:[n]}];return t.useClass&&i.push({provide:t.useClass,useClass:t.useClass}),i}static validateConfig(t){let n=Ve.safeParse(t);if(!n.success)throw new Error(`Invalid AVES SDK configuration: ${n.error.issues.map(i=>i.message).join(", ")}`);return n.data}};o(I,"AvesModule"),p(I,"MODULE_NAME","AvesModule"),p(I,"VERSION","1.0.0");var C=I;C=lt([gt(),Et({})],C);var Dn=(function(e){return e.OK="OK",e.ERROR="ERROR",e.WARNING="WARNING",e.TIMEOUT="TIMEOUT",e})({}),d=(function(e){return e.ERROR="ERROR",e.WARNING="WARNING",e.INFO="INFO",e})({}),a=(function(e){return e.INVALID_TOKEN="AVES_001",e.TOKEN_EXPIRED="AVES_002",e.INSUFFICIENT_PERMISSIONS="AVES_003",e.INVALID_REQUEST_FORMAT="AVES_100",e.MISSING_REQUIRED_FIELD="AVES_101",e.INVALID_FIELD_VALUE="AVES_102",e.INVALID_DATE_FORMAT="AVES_103",e.BOOKING_NOT_FOUND="AVES_200",e.BOOKING_ALREADY_CANCELLED="AVES_201",e.INVALID_BOOKING_STATUS="AVES_202",e.PAYMENT_FAILED="AVES_203",e.INSUFFICIENT_INVENTORY="AVES_204",e.INTERNAL_SERVER_ERROR="AVES_500",e.SERVICE_UNAVAILABLE="AVES_501",e.TIMEOUT="AVES_502",e.RATE_LIMIT_EXCEEDED="AVES_503",e})({});import{ZodError as It}from"zod";var O=class O{constructor(t){p(this,"schema");this.schema=t}validate(t){if(!this.schema)throw new Error("No schema provided. Either pass schema to constructor or as method parameter.");return this.schema.parse(t)}async asyncValidate(t){if(!this.schema)throw new Error("No schema provided. Either pass schema to constructor or as method parameter.");return this.schema.parseAsync(t)}safeValidateAndParse(t){return this.schema?this.schema.safeParse(t):this.createError({message:"No schema provided. Either pass schema to constructor or as method parameter.",path:[]})}async safeAsyncValidateAndParse(t){return this.schema?this.schema.safeParseAsync(t):this.createError({message:"No schema provided. Either pass schema to constructor or as method parameter.",path:[]})}getErrorMessage(t,n="; "){return t.issues.map(i=>`${i.path.length>0?`${i.path.join(".")}: `:""}${i.message}`).join(n)}createError({message:t,path:n}){return{success:!1,error:new It([{code:"custom",message:t,path:n}])}}static withSchema(t){return new O(t)}};o(O,"AvesValidator");var de=O;function On(e){return new de(e)}o(On,"createAvesValidator");import{Injectable as yt}from"@nestjs/common";var S=class S extends Error{constructor(n,i,m={}){super(i);p(this,"code");p(this,"severity");p(this,"timestamp");p(this,"requestId");p(this,"context");this.name="AvesException",this.code=n,this.severity=m.severity||d.ERROR,this.timestamp=new Date().toISOString(),this.context=m.context,this.requestId=m.requestId||this.generateRequestId(),Object.setPrototypeOf(this,S.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,S)}static fromAvesError(n){return new S(n.code,n.message,{severity:n.severity,context:n.context,requestId:n.requestId})}isRetryable(){return[a.TIMEOUT,a.SERVICE_UNAVAILABLE,a.INTERNAL_SERVER_ERROR,a.RATE_LIMIT_EXCEEDED].includes(this.code)}getUserFriendlyMessage(){return{[a.INVALID_TOKEN]:"Your session has expired. Please log in again.",[a.TOKEN_EXPIRED]:"Your session has expired. Please log in again.",[a.INSUFFICIENT_PERMISSIONS]:"You do not have permission to perform this action.",[a.BOOKING_NOT_FOUND]:"The requested booking could not be found.",[a.BOOKING_ALREADY_CANCELLED]:"This booking has already been cancelled.",[a.PAYMENT_FAILED]:"Payment processing failed. Please try again.",[a.INSUFFICIENT_INVENTORY]:"The requested service is no longer available.",[a.SERVICE_UNAVAILABLE]:"The service is temporarily unavailable. Please try again later.",[a.TIMEOUT]:"The request timed out. Please try again.",[a.RATE_LIMIT_EXCEEDED]:"Too many requests. Please wait a moment and try again."}[this.code]||this.message}toJSON(){return{name:this.name,code:this.code,message:this.message,severity:this.severity,timestamp:this.timestamp,requestId:this.requestId,context:this.context,stack:this.stack,isRetryable:this.isRetryable(),userFriendlyMessage:this.getUserFriendlyMessage()}}toAvesError(){return{code:this.code,message:this.message,severity:this.severity,timestamp:this.timestamp,requestId:this.requestId,context:this.context}}getHttpStatusCode(){switch(this.code){case a.INVALID_TOKEN:case a.TOKEN_EXPIRED:return 401;case a.INSUFFICIENT_PERMISSIONS:return 403;case a.BOOKING_NOT_FOUND:return 404;case a.INVALID_REQUEST_FORMAT:case a.MISSING_REQUIRED_FIELD:case a.INVALID_FIELD_VALUE:return 400;case a.RATE_LIMIT_EXCEEDED:return 429;case a.SERVICE_UNAVAILABLE:return 503;case a.TIMEOUT:return 408;default:return 500}}getCategory(){return this.code.startsWith("AVES_1")?"Authentication":this.code.startsWith("AVES_2")?"Business Logic":this.code.startsWith("AVES_5")?"System":"Unknown"}generateRequestId(){return`aves_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}};o(S,"AvesException");var c=S;function Rt(e,t,n,i){var m=arguments.length,s=m<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,i);else for(var f=e.length-1;f>=0;f--)(u=e[f])&&(s=(m<3?u(s):m>3?u(t,n,s):u(t,n))||s);return m>3&&s&&Object.defineProperty(t,n,s),s}o(Rt,"_ts_decorate");var fe=class fe{parseError(t){return t instanceof c?t:this.isHttpError(t)?this.parseHttpError(t):this.isAvesXmlResponse(t)?this.parseAvesXmlError(t):t instanceof Error?new c(a.INTERNAL_SERVER_ERROR,t.message,{severity:d.ERROR,context:this.buildContext({type:"javascript_error",errorName:t.name,stack:t.stack||"No stack trace available"})}):new c(a.INTERNAL_SERVER_ERROR,"Unknown error occurred",{severity:d.ERROR,context:this.buildContext({type:"unknown_error",errorName:typeof t,errorValue:String(t)})})}parseHttpError(t){if(t.response){let n=t.response.status,i=t.response.statusText;switch(n){case 400:return new c(a.INVALID_REQUEST_FORMAT,`Bad Request: ${i}`,{severity:d.ERROR,context:this.buildContext({type:"http_error",errorName:n,statusText:i,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 401:return new c(a.INVALID_TOKEN,"Authentication failed",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 403:return new c(a.INSUFFICIENT_PERMISSIONS,"Access forbidden",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 404:return new c(a.BOOKING_NOT_FOUND,"Resource not found",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 429:return new c(a.RATE_LIMIT_EXCEEDED,"Rate limit exceeded",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,retryAfter:t.response.headers?.["retry-after"]})});case 500:return new c(a.INTERNAL_SERVER_ERROR,"Internal server error",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 503:return new c(a.SERVICE_UNAVAILABLE,"Service unavailable",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});default:return new c(a.INTERNAL_SERVER_ERROR,`HTTP ${n}: ${i}`,{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,statusText:i,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})})}}else return t.request?new c(a.TIMEOUT,"Request timeout - no response from AVES API",{severity:d.ERROR,context:this.buildContext({type:"http_error",timeout:!0,url:t.config?.url,method:t.config?.method,configuredTimeout:t.config?.timeout})}):new c(a.INTERNAL_SERVER_ERROR,`Request setup error: ${t.message}`,{severity:d.ERROR,context:this.buildContext({type:"http_error",setupError:!0})})}parseAvesXmlError(t){if(!t?.Response?.RsStatus)return new c(a.INVALID_REQUEST_FORMAT,"Invalid response format from AVES API",{severity:d.ERROR,context:this.buildContext({type:"aves_xml_error",missingRsStatus:!0})});let n=t.Response.RsStatus;if(n["@Status"]==="ERROR")return new c(n.ErrorCode||a.INTERNAL_SERVER_ERROR,n.ErrorDescription||"Unknown error from AVES API",{severity:d.ERROR,context:this.buildContext({type:"aves_xml_error",originalResponse:n})});if(n.Warnings?.Warning){let i=Array.isArray(n.Warnings.Warning)?n.Warnings.Warning:[n.Warnings.Warning];return new c(a.INVALID_FIELD_VALUE,i.join("; "),{severity:d.WARNING,context:this.buildContext({type:"aves_xml_warning",warnings:i})})}return new c(a.INTERNAL_SERVER_ERROR,"Unexpected response from AVES API",{severity:d.ERROR,context:this.buildContext({type:"aves_xml_error",unexpectedResponse:!0,status:n["@Status"]})})}isRetryable(t){return[a.TIMEOUT,a.SERVICE_UNAVAILABLE,a.INTERNAL_SERVER_ERROR,a.RATE_LIMIT_EXCEEDED].includes(t.code)}getUserFriendlyMessage(t){return{[a.INVALID_TOKEN]:"Your session has expired. Please log in again.",[a.TOKEN_EXPIRED]:"Your session has expired. Please log in again.",[a.INSUFFICIENT_PERMISSIONS]:"You do not have permission to perform this action.",[a.BOOKING_NOT_FOUND]:"The requested booking could not be found.",[a.BOOKING_ALREADY_CANCELLED]:"This booking has already been cancelled.",[a.PAYMENT_FAILED]:"Payment processing failed. Please try again.",[a.INSUFFICIENT_INVENTORY]:"The requested service is no longer available.",[a.SERVICE_UNAVAILABLE]:"The service is temporarily unavailable. Please try again later.",[a.TIMEOUT]:"The request timed out. Please try again.",[a.RATE_LIMIT_EXCEEDED]:"Too many requests. Please wait a moment and try again."}[t.code]||t.message}buildContext(t){let n={};return typeof t=="object"&&t!==null?Object.keys(t).forEach(i=>{let m=t[i];if(this.isSensitiveKey(i)){n[i]="********";return}this.isSerializableValue(m)?n[i]=m:typeof m=="function"?n[i]="[Function]":m instanceof Error?n[i]={name:m.name,message:m.message,stack:m.stack?.split(`
1
+ var le=Object.defineProperty;var xe=(e,t,n)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var r=(e,t)=>le(e,"name",{value:t,configurable:!0});var p=(e,t,n)=>xe(e,typeof t!="symbol"?t+"":t,n);import"reflect-metadata";import{format as Ee,parseISO as ge,isValid as Ie}from"date-fns";var g=r(e=>{let t;if(typeof e=="string"){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))throw new Error(`Invalid date format. Expected YYYY-MM-DD, got: ${e}`);try{t=ge(e)}catch{throw new Error(`Invalid date string: ${e}`)}}else t=e;if(!Ie(t))throw new Error(`Invalid date value: ${e}`);return Ee(t,"yyyy-MM-dd")},"createDateString"),h=r(e=>{let t;if(typeof e=="string"){if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/.test(e))throw new Error(`Invalid datetime format. Expected ISO 8601, got: ${e}`);try{t=ge(e)}catch{throw new Error(`Invalid datetime string: ${e}`)}}else t=e;if(!Ie(t))throw new Error(`Invalid datetime value: ${e}`);return Ee(t,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")},"createDateTimeString"),Dt=r(e=>{if(!/^\d{2}:\d{2}:\d{2}$/.test(e))throw new Error(`Invalid time format. Expected HH:MM:SS, got: ${e}`);let[t,n,i]=e.split(":").map(Number);if(t<0||t>23||n<0||n>59||i<0||i>59)throw new Error(`Invalid time value: ${e}`);return e},"createTimeString");function F(e){return{home:"HOME",work:"WORK",billing:"BILLING",delivery:"DELIVERY"}[e]||"HOME"}r(F,"mapAddressTypeToXml");function _(e){return{HOME:"home",WORK:"work",BILLING:"billing",DELIVERY:"delivery"}[e]||"home"}r(_,"mapAddressTypeFromXml");function X(e){return{home:"HOME",work:"WORK",mobile:"MOBILE",fax:"FAX"}[e]||"HOME"}r(X,"mapContactTypeToXml");function L(e){return{HOME:"home",WORK:"work",MOBILE:"mobile",FAX:"fax"}[e]||"home"}r(L,"mapContactTypeFromXml");function M(e){return{home:"HOME",work:"WORK"}[e]||"HOME"}r(M,"mapEmailTypeToXml");function b(e){return{HOME:"home",WORK:"work"}[e]||"home"}r(b,"mapEmailTypeFromXml");function v(e){return{adult:"ADT",child:"CHD",infant:"INF"}[e]||"ADT"}r(v,"mapPassengerTypeToXml");function V(e){return{ADT:"adult",CHD:"child",INF:"infant"}[e]||"adult"}r(V,"mapPassengerTypeFromXml");function w(e){return{mr:"MR",mrs:"MRS",ms:"MS",dr:"DR",prof:"PROF"}[e]||"MR"}r(w,"mapTitleToXml");function B(e){return{MR:"mr",MRS:"mrs",MS:"ms",DR:"dr",PROF:"prof"}[e]||"mr"}r(B,"mapTitleFromXml");function U(e){return{flight:"FLIGHT",hotel:"HOTEL",car:"CAR",transfer:"TRANSFER",insurance:"INSURANCE"}[e]||"FLIGHT"}r(U,"mapServiceTypeToXml");function H(e){return{FLIGHT:"flight",HOTEL:"hotel",CAR:"car",TRANSFER:"transfer",INSURANCE:"insurance"}[e]||"flight"}r(H,"mapServiceTypeFromXml");function x(e){return{confirmed:"CONFIRMED",pending:"PENDING",cancelled:"CANCELLED"}[e]||"PENDING"}r(x,"mapServiceStatusToXml");function k(e){return{CONFIRMED:"confirmed",PENDING:"pending",CANCELLED:"cancelled"}[e]||"pending"}r(k,"mapServiceStatusFromXml");function j(e){return{credit_card:"CREDIT_CARD",debit_card:"DEBIT_CARD",bank_transfer:"BANK_TRANSFER",cash:"CASH"}[e]||"CASH"}r(j,"mapPaymentTypeToXml");function G(e){return{CREDIT_CARD:"credit_card",DEBIT_CARD:"debit_card",BANK_TRANSFER:"bank_transfer",CASH:"cash"}[e]||"cash"}r(G,"mapPaymentTypeFromXml");function q(e){return{pending:"PENDING",confirmed:"CONFIRMED",failed:"FAILED"}[e]||"PENDING"}r(q,"mapPaymentStatusToXml");function K(e){return{PENDING:"pending",CONFIRMED:"confirmed",FAILED:"failed"}[e]||"pending"}r(K,"mapPaymentStatusFromXml");function S(e){return{customer:"CUSTOMER",agent:"AGENT",supplier:"SUPPLIER"}[e]||"CUSTOMER"}r(S,"mapCustomerTypeToXml");function Re(e){return{CUSTOMER:"customer",AGENT:"agent",SUPPLIER:"supplier"}[e]||"customer"}r(Re,"mapCustomerTypeFromXml");function ye(e){return{active:"ACTIVE",inactive:"INACTIVE",suspended:"SUSPENDED"}[e]||"ACTIVE"}r(ye,"mapCustomerStatusToXml");function Te(e){return{ACTIVE:"active",INACTIVE:"inactive",SUSPENDED:"suspended"}[e]||"active"}r(Te,"mapCustomerStatusFromXml");function he(e){return{email:"EMAIL",sms:"SMS",phone:"PHONE"}[e]||"EMAIL"}r(he,"mapCommunicationMethodToXml");function Se(e){return{EMAIL:"email",SMS:"sms",PHONE:"phone"}[e]||"email"}r(Se,"mapCommunicationMethodFromXml");function W(e){return{individual:"INDIVIDUAL",group:"GROUP",corporate:"CORPORATE"}[e]||"INDIVIDUAL"}r(W,"mapBookingTypeToXml");function Ne(e){return{PENDING:"pending",CONFIRMED:"confirmed",CANCELLED:"cancelled",COMPLETED:"completed"}[e]||"pending"}r(Ne,"mapBookingStatusFromXml");function Q(e){return{low:"LOW",normal:"NORMAL",high:"HIGH",urgent:"URGENT"}[e]||"NORMAL"}r(Q,"mapPriorityToXml");function Y(e){return{meal:"MEAL",seat:"SEAT",wheelchair:"WHEELCHAIR",other:"OTHER"}[e]||"OTHER"}r(Y,"mapSpecialRequestTypeToXml");function $(e){return{customer_request:"CUSTOMER_REQUEST",no_show:"NO_SHOW",operational:"OPERATIONAL",other:"OTHER"}[e]||"OTHER"}r($,"mapCancelReasonToXml");function z(e){return{original_payment:"ORIGINAL_PAYMENT",credit:"CREDIT",cash:"CASH"}[e]||"CASH"}r(z,"mapRefundMethodToXml");function Z(e){return{confirmation:"CONFIRMATION",invoice:"INVOICE",voucher:"VOUCHER",ticket:"TICKET",all:"ALL"}[e]||"ALL"}r(Z,"mapDocumentTypeToXml");function J(e){return{pdf:"PDF",html:"HTML",xml:"XML"}[e]||"PDF"}r(J,"mapDocumentFormatToXml");function ee(e){return{email:"EMAIL",sms:"SMS",download:"DOWNLOAD"}[e]||"EMAIL"}r(ee,"mapDeliveryMethodToXml");function te(e){return{equals:"EQUALS",contains:"CONTAINS",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH"}[e]||"EQUALS"}r(te,"mapSearchOperatorToXml");function De(e){return{SERVICE:"service",TAX:"tax",FEE:"fee",DISCOUNT:"discount"}[e]||"service"}r(De,"mapPricingItemTypeFromXml");function Ae(e){return{SENT:"sent",PENDING:"pending",FAILED:"failed"}[e]||"pending"}r(Ae,"mapDeliveryStatusFromXml");function ne(e){return{male:"M",female:"F"}[e]||"M"}r(ne,"mapGenderToXml");function Ce(e){return{M:"male",F:"female"}[e]||"male"}r(Ce,"mapGenderFromXml");function oe(e){return{"@Type":e.type?F(e.type):void 0,Street:e.street,City:e.city,State:e.state,PostalCode:e.postalCode,Country:e.country}}r(oe,"mapAddressToXml");function N(e){return{type:e["@Type"]?_(e["@Type"]):void 0,street:e.Street,city:e.City,state:e.State,postalCode:e.PostalCode,country:e.Country}}r(N,"mapAddressFromXml");function re(e){return{Phone:e.phone?{"@Type":e.phone.type?X(e.phone.type):void 0,"@Number":e.phone.number}:void 0,Email:e.email?{"@Type":e.email.type?M(e.email.type):void 0,"@Address":e.email.address}:void 0}}r(re,"mapContactToXml");function D(e){return{phone:e.Phone?{type:e.Phone["@Type"]?L(e.Phone["@Type"]):void 0,number:e.Phone["@Number"]}:void 0,email:e.Email?{type:e.Email["@Type"]?b(e.Email["@Type"]):void 0,address:e.Email["@Address"]}:void 0}}r(D,"mapContactFromXml");function Oe(e){return{"@PassengerID":e.id,"@Type":v(e.type),"@Title":e.title?w(e.title):void 0,FirstName:e.firstName,LastName:e.lastName,MiddleName:e.middleName,DateOfBirth:e.dateOfBirth,Gender:e.gender?ne(e.gender):void 0,Nationality:e.nationality,Passport:e.passport?{"@Number":e.passport.number,"@ExpiryDate":e.passport.expiryDate,"@IssuingCountry":e.passport.issuingCountry}:void 0,Address:e.address?oe(e.address):void 0,ContactInfo:e.contact?re(e.contact):void 0}}r(Oe,"mapPassengerToXml");function Pe(e){return{id:e["@PassengerID"],type:V(e["@Type"]),title:e["@Title"]?B(e["@Title"]):void 0,firstName:e.FirstName,lastName:e.LastName,middleName:e.MiddleName,dateOfBirth:e.DateOfBirth?g(e.DateOfBirth):void 0,gender:e.Gender?Ce(e.Gender):void 0,nationality:e.Nationality,passport:e.Passport?{number:e.Passport["@Number"],expiryDate:g(e.Passport["@ExpiryDate"]),issuingCountry:e.Passport["@IssuingCountry"]}:void 0,address:e.Address?N(e.Address):void 0,contact:e.ContactInfo?D(e.ContactInfo):void 0}}r(Pe,"mapPassengerFromXml");function Fe(e){return{"@ServiceID":e.id,"@Type":U(e.type),"@Status":x(e.status),ServiceDetails:{Code:e.code,Name:e.name,Description:e.description,StartDate:e.startDate,EndDate:e.endDate,Price:e.price?{"@Currency":e.price.currency,"@Amount":e.price.amount}:void 0}}}r(Fe,"mapServiceToXml");function _e(e){return{id:e["@ServiceID"],type:H(e["@Type"]),status:k(e["@Status"]),code:e.ServiceDetails.Code,name:e.ServiceDetails.Name,description:e.ServiceDetails.Description,startDate:e.ServiceDetails.StartDate?g(e.ServiceDetails.StartDate):void 0,endDate:e.ServiceDetails.EndDate?g(e.ServiceDetails.EndDate):void 0,price:e.ServiceDetails.Price?{currency:e.ServiceDetails.Price["@Currency"],amount:e.ServiceDetails.Price["@Amount"]}:void 0}}r(_e,"mapServiceFromXml");function Xe(e){return{"@PaymentID":e.id,"@Type":j(e.type),"@Status":q(e.status),Amount:{"@Currency":e.amount.currency,"@Amount":e.amount.amount},PaymentDetails:e.details?{CardNumber:e.details.cardNumber,ExpiryDate:e.details.expiryDate,CardHolderName:e.details.cardHolderName}:void 0}}r(Xe,"mapPaymentToXml");function Le(e){return{id:e["@PaymentID"],type:G(e["@Type"]),status:K(e["@Status"]),amount:{currency:e.Amount["@Currency"],amount:e.Amount["@Amount"]},details:e.PaymentDetails?{cardNumber:e.PaymentDetails.CardNumber,expiryDate:e.PaymentDetails.ExpiryDate,cardHolderName:e.PaymentDetails.CardHolderName}:void 0}}r(Le,"mapPaymentFromXml");function ke(e){return{SearchCriteria:{MasterRecordType:S(e.type),SearchFields:{Field:e.fields.map(t=>({"@Name":t.name,"@Value":t.value,"@Operator":t.operator?te(t.operator):void 0}))},Pagination:e.pagination?{"@PageSize":e.pagination.pageSize,"@PageNumber":e.pagination.pageNumber}:void 0}}}r(ke,"mapSearchCustomerToXml");function Me(e){return{"@MasterRecordID":e.id,"@Type":S(e.type),"@Status":ye(e.status),PersonalInfo:e.personalInfo?{Title:e.personalInfo.title,FirstName:e.personalInfo.firstName,LastName:e.personalInfo.lastName,MiddleName:e.personalInfo.middleName,DateOfBirth:e.personalInfo.dateOfBirth,Gender:e.personalInfo.gender?ne(e.personalInfo.gender):void 0,Nationality:e.personalInfo.nationality}:void 0,ContactInfo:e.contact?re(e.contact):void 0,Address:e.address?oe(e.address):void 0,BusinessInfo:e.businessInfo?{CompanyName:e.businessInfo.companyName,TaxID:e.businessInfo.taxId,LicenseNumber:e.businessInfo.licenseNumber}:void 0,Preferences:e.preferences?{Language:e.preferences.language,Currency:e.preferences.currency,CommunicationMethod:e.preferences.communicationMethod?he(e.preferences.communicationMethod):void 0}:void 0}}r(Me,"mapCustomerToXml");function je(e){return{BookingDetails:{"@BookingType":W(e.type),"@Priority":Q(e.priority),CustomerInfo:{"@CustomerID":e.customerId,CustomerDetails:e.customerDetails?Me(e.customerDetails):void 0},PassengerList:{Passenger:e.passengers.map(Oe)},SelectedServiceList:{Service:e.services.map(Fe)},SpecialRequests:e.specialRequests?{Request:e.specialRequests.map(t=>({"@Type":Y(t.type),"@Description":t.description}))}:void 0}}}r(je,"mapCreateBookingToXml");function Ge(e){return{"@BookingFileID":e.bookingId,CancellationDetails:{"@Reason":$(e.reason),"@Description":e.description,RefundRequest:e.refundRequest?{"@Amount":e.refundRequest.amount,"@Currency":e.refundRequest.currency,"@Method":z(e.refundRequest.method)}:void 0}}}r(Ge,"mapCancelBookingToXml");function qe(e){return{"@BookingFileID":e.bookingId,DocumentRequest:{"@DocumentType":Z(e.documentType),"@Format":J(e.format),"@Language":e.language,DeliveryMethod:e.deliveryMethod?{"@Type":ee(e.deliveryMethod.type),"@Address":e.deliveryMethod.address}:void 0}}}r(qe,"mapPrintDocumentToXml");function Ke(e){return{"@BookingFileID":e.bookingId,PaymentList:{Payment:e.payments.map(Xe)}}}r(Ke,"mapAddPaymentToXml");function be(e){return{id:e["@MasterRecordID"],type:Re(e["@Type"]),status:Te(e["@Status"]),personalInfo:e.PersonalInfo?{title:e.PersonalInfo.Title,firstName:e.PersonalInfo.FirstName,lastName:e.PersonalInfo.LastName,middleName:e.PersonalInfo.MiddleName,dateOfBirth:e.PersonalInfo.DateOfBirth?g(e.PersonalInfo.DateOfBirth):void 0,gender:e.PersonalInfo.Gender==="M"?"male":"female",nationality:e.PersonalInfo.Nationality}:void 0,contact:e.ContactInfo?D(e.ContactInfo):void 0,address:e.Address?N(e.Address):void 0,businessInfo:e.BusinessInfo?{companyName:e.BusinessInfo.CompanyName,taxId:e.BusinessInfo.TaxID,licenseNumber:e.BusinessInfo.LicenseNumber}:void 0,preferences:e.Preferences?{language:e.Preferences.Language,currency:e.Preferences.Currency,communicationMethod:e.Preferences.CommunicationMethod?Se(e.Preferences.CommunicationMethod):void 0}:void 0}}r(be,"mapCustomerFromXml");function ie(e){return{id:e["@BookingFileID"],status:Ne(e["@Status"]),createdAt:h(e["@CreationDate"]),updatedAt:h(e["@LastModified"]),customer:be(e.CustomerInfo),passengers:e.PassengerList.Passenger.map(Pe),services:e.ServiceList.Service.map(_e),pricing:{totalAmount:{currency:e.Pricing.TotalAmount["@Currency"],amount:e.Pricing.TotalAmount["@Amount"]},breakdowns:e.Pricing.Breakdown?.Item.map(t=>({type:De(t["@Type"]),description:t["@Description"],amount:t["@Amount"]}))}}}r(ie,"mapBookingFromXml");function We(e){let t=ie(e.BookingFile);return{...t,success:e.OperationResult["@Status"]==="SUCCESS",message:e.OperationResult["@Message"],data:t}}r(We,"mapBookingResponseFromXml");function Qe(e){return{results:e.SearchResults.MasterRecord.map(be),pagination:e.SearchResults.PaginationInfo?{totalRecords:e.SearchResults.PaginationInfo["@TotalRecords"],pageSize:e.SearchResults.PaginationInfo["@PageSize"],pageNumber:e.SearchResults.PaginationInfo["@PageNumber"],totalPages:e.SearchResults.PaginationInfo["@TotalPages"]}:void 0}}r(Qe,"mapSearchResponseFromXml");function Ye(e){return{id:e.DocumentInfo["@DocumentID"],type:e.DocumentInfo["@DocumentType"],format:e.DocumentInfo["@Format"],size:e.DocumentInfo["@Size"],createdAt:h(e.DocumentInfo["@CreationDate"]),downloadUrl:e.DocumentInfo.DownloadURL,deliveryStatus:e.DocumentInfo.DeliveryStatus?{status:Ae(e.DocumentInfo.DeliveryStatus["@Status"]),method:e.DocumentInfo.DeliveryStatus["@Method"],address:e.DocumentInfo.DeliveryStatus["@Address"]}:void 0,success:e.OperationResult["@Status"]==="SUCCESS",message:e.OperationResult["@Message"]}}r(Ye,"mapDocumentResponseFromXml");function $e(e){return{success:e.OperationResult["@Status"]==="SUCCESS",message:e.OperationResult["@Message"],data:{refundInfo:e.OperationResult.RefundInfo?{refundAmount:e.OperationResult.RefundInfo["@RefundAmount"],currency:e.OperationResult.RefundInfo["@Currency"],refundMethod:e.OperationResult.RefundInfo["@RefundMethod"],processingTime:e.OperationResult.RefundInfo["@ProcessingTime"]}:void 0}}}r($e,"mapCancelResponseFromXml");function ze(e){let t=ie(e.BookingFile);return{success:e.OperationResult["@Status"]==="SUCCESS",message:e.OperationResult["@Message"],data:{booking:t,paymentSummary:{totalPaid:{currency:e.PaymentSummary.TotalPaid["@Currency"],amount:e.PaymentSummary.TotalPaid["@Amount"]},outstandingAmount:{currency:e.PaymentSummary.OutstandingAmount["@Currency"],amount:e.PaymentSummary.OutstandingAmount["@Amount"]},paymentHistory:e.PaymentSummary.PaymentHistory.Payment.map(Le)}}}}r(ze,"mapPaymentResponseFromXml");function Ze(e){return{id:e["@MasterRecordID"],type:e["@Type"].toLowerCase(),status:e["@Status"].toLowerCase(),personalInfo:e.PersonalInfo?{title:e.PersonalInfo.Title,firstName:e.PersonalInfo.FirstName,lastName:e.PersonalInfo.LastName,middleName:e.PersonalInfo.MiddleName,dateOfBirth:e.PersonalInfo.DateOfBirth,gender:e.PersonalInfo.Gender?.toLowerCase(),nationality:e.PersonalInfo.Nationality}:void 0,contact:e.ContactInfo?D(e.ContactInfo):void 0,address:e.Address?N(e.Address):void 0,businessInfo:e.BusinessInfo?{companyName:e.BusinessInfo.CompanyName,taxId:e.BusinessInfo.TaxID,licenseNumber:e.BusinessInfo.LicenseNumber}:void 0,preferences:e.Preferences?{language:e.Preferences.Language,currency:e.Preferences.Currency,communicationMethod:e.Preferences.CommunicationMethod?.toLowerCase()}:void 0}}r(Ze,"mapMasterRecordFromXml");import{Module as It,Global as Rt}from"@nestjs/common";import{ConfigModule as He}from"@nestjs/config";import{Inject as we,Injectable as et}from"@nestjs/common";var E=Symbol("AVES_SDK_CONFIG"),R=Symbol("XML_HTTP_CLIENT");var se=class se{constructor(t){p(this,"RqHeader");p(this,"Body");Object.assign(this,t)}};r(se,"RequestPayload");var ae=se,me=class me{constructor(t){p(this,"Request");this.Request=new ae(t)}};r(me,"WrapRequestDto");var A=me;function Je(e,t,n,i){var m=arguments.length,s=m<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,i);else for(var f=e.length-1;f>=0;f--)(u=e[f])&&(s=(m<3?u(s):m>3?u(t,n,s):u(t,n))||s);return m>3&&s&&Object.defineProperty(t,n,s),s}r(Je,"_ts_decorate");function ve(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}r(ve,"_ts_metadata");function Ve(e,t){return function(n,i){t(n,i,e)}}r(Ve,"_ts_param");var pe=class pe{constructor(t,n){p(this,"config");p(this,"http");this.config=t,this.http=n}buildHeader(){let{hostId:t,xtoken:n,languageCode:i}=this.config;return{"@HostID":t,"@Xtoken":n,"@Interface":"WEB","@UserName":"WEB","@LanguageCode":i}}wrapRequest(t){return new A({RqHeader:this.buildHeader(),Body:t})}async searchMasterRecord(t){return this.http.postXml("/interop/masterRecords/v2/rest/Search","SearchMasterRecordRQ",this.wrapRequest(t))}async insertOrUpdateMasterRecord(t){return this.http.postXml("/interop/masterRecords/v2/rest/InsertOrUpdate","ManageMasterRecordRQ",this.wrapRequest(t))}async createBookingFile(t){return this.http.postXml("/interop/booking/v2/rest/CreateBookingFile","BookFileRQ",this.wrapRequest(t))}async modBookingFileHeader(t){return this.http.postXml("/interop/booking/v2/rest/ModBookingFileHeader","ModiFileHeaderRQ",this.wrapRequest(t))}async modBookingFileServices(t){return this.http.postXml("/interop/booking/v2/rest/ModBookingFileServices","ModFileServicesRQ",this.wrapRequest(t))}async setBookingFileStatus(t){return this.http.postXml("/interop/booking/v2/rest/SetBookingFileStatus","SetStatusRQ",this.wrapRequest(t))}async cancelBookingFile(t){return this.http.postXml("/interop/booking/v2/rest/CancelBookingFile","CancelFileRQ",this.wrapRequest(t))}async insertFilePaymentList(t){return this.http.postXml("/interop/booking/v2/rest/InsertFilePaymentList","FilePaymentListRQ",this.wrapRequest(t))}async printBookingDocument(t){return this.http.postXml("/interop/document/v2/rest/PrintBookingDocument","PrintBookingDocumentRQ",this.wrapRequest(t))}};r(pe,"AvesService");var l=pe;l=Je([et(),Ve(0,we(E)),Ve(1,we(R)),ve("design:type",Function),ve("design:paramtypes",[typeof AvesSdkConfig>"u"?Object:AvesSdkConfig,typeof IXmlHttpClient>"u"?Object:IXmlHttpClient])],l);import ot from"axios";import{XMLBuilder as rt,XMLParser as it}from"fast-xml-parser";import{Inject as at,Injectable as st,Scope as mt}from"@nestjs/common";function tt(e,t,n,i){var m=arguments.length,s=m<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,i);else for(var f=e.length-1;f>=0;f--)(u=e[f])&&(s=(m<3?u(s):m>3?u(t,n,s):u(t,n))||s);return m>3&&s&&Object.defineProperty(t,n,s),s}r(tt,"_ts_decorate");function Be(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}r(Be,"_ts_metadata");function nt(e,t){return function(n,i){t(n,i,e)}}r(nt,"_ts_param");var ue=class ue{constructor(t){p(this,"config");p(this,"httpClient");p(this,"xmlBuilder");p(this,"xmlParser");this.config=t,this.httpClient=ot.create({baseURL:t.baseUrl,timeout:typeof t.timeout=="number"?t.timeout:3e4,headers:{"Content-Type":"application/xml",Accept:"application/xml, text/xml, */*;q=0.1"},transitional:{clarifyTimeoutError:!0},validateStatus:r(n=>n>=200&&n<300,"validateStatus")}),this.xmlBuilder=new rt({attributeNamePrefix:"@",ignoreAttributes:!1,suppressEmptyNode:!0,format:process.env.NODE_ENV?.toLowerCase()==="development"}),this.xmlParser=new it({attributeNamePrefix:"@",ignoreAttributes:!1,parseAttributeValue:!1,trimValues:!0,isArray:r(n=>["Field","Item","Service","Passenger","Payment","MasterRecord","Request","Notes","ServiceID"].includes(n),"isArray")})}async postXml(t,n,i,m){let s=this.xmlBuilder.build({[n]:i}),u=await this.httpClient.post(t,s,m);return this.xmlParser.parse(u.data)}};r(ue,"XmlHttpClient");var y=ue;y=tt([st({scope:mt.DEFAULT}),nt(0,at(E)),Be("design:type",Function),Be("design:paramtypes",[typeof AvesSdkConfig>"u"?Object:AvesSdkConfig])],y);import{registerAs as pt}from"@nestjs/config";var ut="aves",ce=pt(ut,()=>({baseUrl:process.env.AVES_BASE_URL??"",hostId:process.env.AVES_HOST_ID??"",xtoken:process.env.AVES_XTOKEN??"",languageCode:process.env.AVES_LANGUAGE_CODE,timeout:process.env.AVES_TIMEOUT?Number(process.env.AVES_TIMEOUT):void 0}));import{z as o}from"zod";var ct=o.enum(["01","02"]),Ue=o.object({baseUrl:o.url(),hostId:o.string().length(6),xtoken:o.string(),languageCode:ct.optional(),timeout:o.number().optional()}),dt=o.object({"@Type":o.enum(["HOME","WORK","BILLING","DELIVERY"]).optional(),Street:o.string().max(100).optional(),City:o.string().max(50).optional(),State:o.string().max(50).optional(),PostalCode:o.string().max(20).optional(),Country:o.string().max(50).optional()}),ft=o.object({Phone:o.object({"@Type":o.enum(["HOME","WORK","MOBILE","FAX"]).optional(),"@Number":o.string()}).optional(),Email:o.object({"@Type":o.enum(["HOME","WORK"]).optional(),"@Address":o.string()}).optional()}),lt=o.object({"@PassengerID":o.string().min(1),"@Type":o.enum(["ADT","CHD","INF"]),"@Title":o.enum(["MR","MRS","MS","DR","PROF"]).optional(),FirstName:o.string().min(1).max(50),LastName:o.string().min(1).max(50),MiddleName:o.string().max(50).optional(),DateOfBirth:o.string().datetime().optional(),Gender:o.enum(["M","F"]).optional(),Nationality:o.string().max(3).optional(),Address:dt.optional(),ContactInfo:ft.optional()}),Et=o.object({"@ServiceID":o.string().min(1),"@Type":o.enum(["FLIGHT","HOTEL","CAR","TRANSFER","INSURANCE"]),"@Status":o.enum(["CONFIRMED","PENDING","CANCELLED"]),ServiceDetails:o.object({Code:o.string().optional(),Name:o.string().optional(),Description:o.string().optional(),StartDate:o.string().optional(),EndDate:o.string().optional(),Price:o.object({"@Currency":o.string(),"@Amount":o.number()}).optional()})}),sn=o.object({"@PaymentID":o.string().min(1),"@Type":o.enum(["CREDIT_CARD","DEBIT_CARD","BANK_TRANSFER","CASH"]),"@Status":o.enum(["PENDING","CONFIRMED","FAILED"]),Amount:o.object({"@Currency":o.string(),"@Amount":o.number()}),PaymentDetails:o.object({CardNumber:o.string().optional(),ExpiryDate:o.string().optional(),CardHolderName:o.string().optional()}).optional()}),mn=o.object({SearchCriteria:o.object({MasterRecordType:o.enum(["CUSTOMER","AGENT","SUPPLIER"]),SearchFields:o.object({Field:o.array(o.object({"@Name":o.string(),"@Value":o.string(),"@Operator":o.enum(["EQUALS","CONTAINS","STARTS_WITH","ENDS_WITH"]).optional()}))}),Pagination:o.object({"@PageSize":o.number(),"@PageNumber":o.number()}).optional()})}),pn=o.object({BookingDetails:o.object({"@BookingType":o.enum(["INDIVIDUAL","GROUP","CORPORATE"]),"@Priority":o.enum(["LOW","NORMAL","HIGH","URGENT"]),CustomerInfo:o.object({"@CustomerID":o.string().optional(),CustomerDetails:o.any().optional()}),PassengerList:o.object({Passenger:o.array(lt)}),SelectedServiceList:o.object({Service:o.array(Et)}),SpecialRequests:o.object({Request:o.array(o.object({"@Type":o.enum(["MEAL","SEAT","WHEELCHAIR","OTHER"]),"@Description":o.string()}))}).optional()})}),un=o.object({"@BookingFileID":o.string().min(1),CancellationDetails:o.object({"@Reason":o.enum(["CUSTOMER_REQUEST","NO_SHOW","OPERATIONAL","OTHER"]),"@Description":o.string().optional(),RefundRequest:o.object({"@Amount":o.number(),"@Currency":o.string(),"@Method":o.enum(["ORIGINAL_PAYMENT","CREDIT","CASH"])}).optional()})}),cn=o.object({"@BookingFileID":o.string().min(1),DocumentRequest:o.object({"@DocumentType":o.enum(["CONFIRMATION","INVOICE","VOUCHER","TICKET","ALL"]),"@Format":o.enum(["PDF","HTML","XML"]),"@Language":o.string().optional(),DeliveryMethod:o.object({"@Type":o.enum(["EMAIL","SMS","DOWNLOAD"]),"@Address":o.string().optional()}).optional()})});function gt(e,t,n,i){var m=arguments.length,s=m<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,i);else for(var f=e.length-1;f>=0;f--)(u=e[f])&&(s=(m<3?u(s):m>3?u(t,n,s):u(t,n))||s);return m>3&&s&&Object.defineProperty(t,n,s),s}r(gt,"_ts_decorate");var I=class I{static forRoot(t){let n=this.validateConfig(t);return{module:I,imports:[He.forFeature(ce)],providers:[{provide:E,useValue:n},this.createXmlHttpClientProvider(),l],exports:[l,R]}}static forRootAsync(t){let n=this.createAsyncProviders(t);return{module:I,imports:[...t.imports??[],He.forFeature(ce)],providers:[...n,this.createXmlHttpClientProvider(),l],exports:[l,R]}}static createXmlHttpClientProvider(){return{provide:R,useClass:y}}static createAsyncProviders(t){if(t.useFactory)return[{provide:E,useFactory:r(async(...m)=>{try{let s=await t.useFactory(...m);return this.validateConfig(s)}catch(s){throw new Error(`Failed to create Aves configuration: ${s.message}`)}},"useFactory"),inject:t.inject??[]}];let n=t.useClass||t.useExisting;if(!n)throw new Error("Invalid AvesModule async options: provide useFactory, useClass, or useExisting");let i=[{provide:E,useFactory:r(async m=>{try{let s=await m.createAvesOptions();return this.validateConfig(s)}catch(s){throw new Error(`Failed to create Aves configuration: ${s.message}`)}},"useFactory"),inject:[n]}];return t.useClass&&i.push({provide:t.useClass,useClass:t.useClass}),i}static validateConfig(t){let n=Ue.safeParse(t);if(!n.success)throw new Error(`Invalid AVES SDK configuration: ${n.error.issues.map(i=>i.message).join(", ")}`);return n.data}};r(I,"AvesModule"),p(I,"MODULE_NAME","AvesModule"),p(I,"VERSION","1.0.0");var C=I;C=gt([Rt(),It({})],C);var Nn=(function(e){return e.OK="OK",e.ERROR="ERROR",e.WARNING="WARNING",e.TIMEOUT="TIMEOUT",e})({}),d=(function(e){return e.ERROR="ERROR",e.WARNING="WARNING",e.INFO="INFO",e})({}),a=(function(e){return e.INVALID_TOKEN="AVES_001",e.TOKEN_EXPIRED="AVES_002",e.INSUFFICIENT_PERMISSIONS="AVES_003",e.INVALID_REQUEST_FORMAT="AVES_100",e.MISSING_REQUIRED_FIELD="AVES_101",e.INVALID_FIELD_VALUE="AVES_102",e.INVALID_DATE_FORMAT="AVES_103",e.BOOKING_NOT_FOUND="AVES_200",e.BOOKING_ALREADY_CANCELLED="AVES_201",e.INVALID_BOOKING_STATUS="AVES_202",e.PAYMENT_FAILED="AVES_203",e.INSUFFICIENT_INVENTORY="AVES_204",e.INTERNAL_SERVER_ERROR="AVES_500",e.SERVICE_UNAVAILABLE="AVES_501",e.TIMEOUT="AVES_502",e.RATE_LIMIT_EXCEEDED="AVES_503",e})({});import{ZodError as yt}from"zod";var O=class O{constructor(t){p(this,"schema");this.schema=t}validate(t){if(!this.schema)throw new Error("No schema provided. Either pass schema to constructor or as method parameter.");return this.schema.parse(t)}async asyncValidate(t){if(!this.schema)throw new Error("No schema provided. Either pass schema to constructor or as method parameter.");return this.schema.parseAsync(t)}safeValidateAndParse(t){return this.schema?this.schema.safeParse(t):this.createError({message:"No schema provided. Either pass schema to constructor or as method parameter.",path:[]})}async safeAsyncValidateAndParse(t){return this.schema?this.schema.safeParseAsync(t):this.createError({message:"No schema provided. Either pass schema to constructor or as method parameter.",path:[]})}getErrorMessage(t,n="; "){return t.issues.map(i=>`${i.path.length>0?`${i.path.join(".")}: `:""}${i.message}`).join(n)}createError({message:t,path:n}){return{success:!1,error:new yt([{code:"custom",message:t,path:n}])}}static withSchema(t){return new O(t)}};r(O,"AvesValidator");var de=O;function Cn(e){return new de(e)}r(Cn,"createAvesValidator");import{Injectable as ht}from"@nestjs/common";var T=class T extends Error{constructor(n,i,m={}){super(i);p(this,"code");p(this,"severity");p(this,"timestamp");p(this,"requestId");p(this,"context");this.name="AvesException",this.code=n,this.severity=m.severity||d.ERROR,this.timestamp=new Date().toISOString(),this.context=m.context,this.requestId=m.requestId||this.generateRequestId(),Object.setPrototypeOf(this,T.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,T)}static fromAvesError(n){return new T(n.code,n.message,{severity:n.severity,context:n.context,requestId:n.requestId})}isRetryable(){return[a.TIMEOUT,a.SERVICE_UNAVAILABLE,a.INTERNAL_SERVER_ERROR,a.RATE_LIMIT_EXCEEDED].includes(this.code)}getUserFriendlyMessage(){return{[a.INVALID_TOKEN]:"Your session has expired. Please log in again.",[a.TOKEN_EXPIRED]:"Your session has expired. Please log in again.",[a.INSUFFICIENT_PERMISSIONS]:"You do not have permission to perform this action.",[a.BOOKING_NOT_FOUND]:"The requested booking could not be found.",[a.BOOKING_ALREADY_CANCELLED]:"This booking has already been cancelled.",[a.PAYMENT_FAILED]:"Payment processing failed. Please try again.",[a.INSUFFICIENT_INVENTORY]:"The requested service is no longer available.",[a.SERVICE_UNAVAILABLE]:"The service is temporarily unavailable. Please try again later.",[a.TIMEOUT]:"The request timed out. Please try again.",[a.RATE_LIMIT_EXCEEDED]:"Too many requests. Please wait a moment and try again."}[this.code]||this.message}toJSON(){return{name:this.name,code:this.code,message:this.message,severity:this.severity,timestamp:this.timestamp,requestId:this.requestId,context:this.context,stack:this.stack,isRetryable:this.isRetryable(),userFriendlyMessage:this.getUserFriendlyMessage()}}toAvesError(){return{code:this.code,message:this.message,severity:this.severity,timestamp:this.timestamp,requestId:this.requestId,context:this.context}}getHttpStatusCode(){switch(this.code){case a.INVALID_TOKEN:case a.TOKEN_EXPIRED:return 401;case a.INSUFFICIENT_PERMISSIONS:return 403;case a.BOOKING_NOT_FOUND:return 404;case a.INVALID_REQUEST_FORMAT:case a.MISSING_REQUIRED_FIELD:case a.INVALID_FIELD_VALUE:return 400;case a.RATE_LIMIT_EXCEEDED:return 429;case a.SERVICE_UNAVAILABLE:return 503;case a.TIMEOUT:return 408;default:return 500}}getCategory(){return this.code.startsWith("AVES_1")?"Authentication":this.code.startsWith("AVES_2")?"Business Logic":this.code.startsWith("AVES_5")?"System":"Unknown"}generateRequestId(){return`aves_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}};r(T,"AvesException");var c=T;function Tt(e,t,n,i){var m=arguments.length,s=m<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,n,i);else for(var f=e.length-1;f>=0;f--)(u=e[f])&&(s=(m<3?u(s):m>3?u(t,n,s):u(t,n))||s);return m>3&&s&&Object.defineProperty(t,n,s),s}r(Tt,"_ts_decorate");var fe=class fe{parseError(t){return t instanceof c?t:this.isHttpError(t)?this.parseHttpError(t):this.isAvesXmlResponse(t)?this.parseAvesXmlError(t):t instanceof Error?new c(a.INTERNAL_SERVER_ERROR,t.message,{severity:d.ERROR,context:this.buildContext({type:"javascript_error",errorName:t.name,stack:t.stack||"No stack trace available"})}):new c(a.INTERNAL_SERVER_ERROR,"Unknown error occurred",{severity:d.ERROR,context:this.buildContext({type:"unknown_error",errorName:typeof t,errorValue:String(t)})})}parseHttpError(t){if(t.response){let n=t.response.status,i=t.response.statusText;switch(n){case 400:return new c(a.INVALID_REQUEST_FORMAT,`Bad Request: ${i}`,{severity:d.ERROR,context:this.buildContext({type:"http_error",errorName:n,statusText:i,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 401:return new c(a.INVALID_TOKEN,"Authentication failed",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 403:return new c(a.INSUFFICIENT_PERMISSIONS,"Access forbidden",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 404:return new c(a.BOOKING_NOT_FOUND,"Resource not found",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 429:return new c(a.RATE_LIMIT_EXCEEDED,"Rate limit exceeded",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,retryAfter:t.response.headers?.["retry-after"]})});case 500:return new c(a.INTERNAL_SERVER_ERROR,"Internal server error",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 503:return new c(a.SERVICE_UNAVAILABLE,"Service unavailable",{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});default:return new c(a.INTERNAL_SERVER_ERROR,`HTTP ${n}: ${i}`,{severity:d.ERROR,context:this.buildContext({type:"http_error",status:n,statusText:i,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})})}}else return t.request?new c(a.TIMEOUT,"Request timeout - no response from AVES API",{severity:d.ERROR,context:this.buildContext({type:"http_error",timeout:!0,url:t.config?.url,method:t.config?.method,configuredTimeout:t.config?.timeout})}):new c(a.INTERNAL_SERVER_ERROR,`Request setup error: ${t.message}`,{severity:d.ERROR,context:this.buildContext({type:"http_error",setupError:!0})})}parseAvesXmlError(t){if(!t?.Response?.RsStatus)return new c(a.INVALID_REQUEST_FORMAT,"Invalid response format from AVES API",{severity:d.ERROR,context:this.buildContext({type:"aves_xml_error",missingRsStatus:!0})});let n=t.Response.RsStatus;if(n["@Status"]==="ERROR")return new c(n.ErrorCode||a.INTERNAL_SERVER_ERROR,n.ErrorDescription||"Unknown error from AVES API",{severity:d.ERROR,context:this.buildContext({type:"aves_xml_error",originalResponse:n})});if(n.Warnings?.Warning){let i=Array.isArray(n.Warnings.Warning)?n.Warnings.Warning:[n.Warnings.Warning];return new c(a.INVALID_FIELD_VALUE,i.join("; "),{severity:d.WARNING,context:this.buildContext({type:"aves_xml_warning",warnings:i})})}return new c(a.INTERNAL_SERVER_ERROR,"Unexpected response from AVES API",{severity:d.ERROR,context:this.buildContext({type:"aves_xml_error",unexpectedResponse:!0,status:n["@Status"]})})}isRetryable(t){return[a.TIMEOUT,a.SERVICE_UNAVAILABLE,a.INTERNAL_SERVER_ERROR,a.RATE_LIMIT_EXCEEDED].includes(t.code)}getUserFriendlyMessage(t){return{[a.INVALID_TOKEN]:"Your session has expired. Please log in again.",[a.TOKEN_EXPIRED]:"Your session has expired. Please log in again.",[a.INSUFFICIENT_PERMISSIONS]:"You do not have permission to perform this action.",[a.BOOKING_NOT_FOUND]:"The requested booking could not be found.",[a.BOOKING_ALREADY_CANCELLED]:"This booking has already been cancelled.",[a.PAYMENT_FAILED]:"Payment processing failed. Please try again.",[a.INSUFFICIENT_INVENTORY]:"The requested service is no longer available.",[a.SERVICE_UNAVAILABLE]:"The service is temporarily unavailable. Please try again later.",[a.TIMEOUT]:"The request timed out. Please try again.",[a.RATE_LIMIT_EXCEEDED]:"Too many requests. Please wait a moment and try again."}[t.code]||t.message}buildContext(t){let n={};return typeof t=="object"&&t!==null?Object.keys(t).forEach(i=>{let m=t[i];if(this.isSensitiveKey(i)){n[i]="********";return}this.isSerializableValue(m)?n[i]=m:typeof m=="function"?n[i]="[Function]":m instanceof Error?n[i]={name:m.name,message:m.message,stack:m.stack?.split(`
2
2
  `).slice(0,3).join(`
3
- `)}:n[i]=String(m)}):typeof t=="string"?n.message=t:typeof t=="number"||typeof t=="boolean"?n.value=t:n.input=String(t),n.timestamp=new Date().toISOString(),n.contextType=typeof t,n}isSensitiveKey(t){let n=["password","token","secret","key","auth","credential","xtoken","authorization","cookie","session","private"],i=t.toLowerCase();return n.some(m=>i.includes(m))}isSerializableValue(t){return t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"?!0:Array.isArray(t)?t.length<=10:typeof t=="object"&&t.constructor===Object?Object.keys(t).length<=20:!1}isHttpError(t){return t&&(t.response||t.request||t.config)}isAvesXmlResponse(t){return t&&t.Response&&t.Response.RsStatus}};o(fe,"AvesErrorHandler");var P=fe;P=Rt([yt()],P);export{mt as AVES_CONFIG_NAMESPACE,g as AVES_SDK_CONFIG,ut as AddressValidation,a as AvesErrorCodes,P as AvesErrorHandler,c as AvesException,C as AvesModule,E as AvesService,d as AvesSeverity,Dn as AvesStatus,de as AvesValidator,un as BookFileRQValidation,cn as CancelFileRQValidation,ct as ContactInfoValidation,pt as LanguageCodeValidation,dt as PassengerValidation,mn as PaymentValidation,dn as PrintBookingDocumentRQValidation,pn as SearchMasterRecordRQValidation,ft as ServiceValidation,y as XML_HTTP_CLIENT,T as XmlHttpClient,ce as avesConfig,Ve as configValidationSchema,On as createAvesValidator,l as createDateString,R as createDateTimeString,Ue as createTimeString,St as getCurrentDateString,ht as getCurrentDateTimeString,Nt as isValidDateString,Dt as isValidDateTimeString,At as isValidTimeString,Ge as mapAddPaymentToXml,oe as mapAddressToXml,_ as mapAddressTypeFromXml,F as mapAddressTypeToXml,ie as mapBookingFromXml,qe as mapBookingResponseFromXml,W as mapBookingTypeToXml,ke as mapCancelBookingToXml,$ as mapCancelReasonToXml,Qe as mapCancelResponseFromXml,re as mapContactToXml,L as mapContactTypeFromXml,X as mapContactTypeToXml,He as mapCreateBookingToXml,_e as mapCustomerToXml,h as mapCustomerTypeToXml,ee as mapDeliveryMethodToXml,J as mapDocumentFormatToXml,We as mapDocumentResponseFromXml,Z as mapDocumentTypeToXml,b as mapEmailTypeFromXml,M as mapEmailTypeToXml,$e as mapMasterRecordFromXml,De as mapPassengerToXml,V as mapPassengerTypeFromXml,v as mapPassengerTypeToXml,Ye as mapPaymentResponseFromXml,K as mapPaymentStatusFromXml,q as mapPaymentStatusToXml,Pe as mapPaymentToXml,G as mapPaymentTypeFromXml,j as mapPaymentTypeToXml,je as mapPrintDocumentToXml,Q as mapPriorityToXml,z as mapRefundMethodToXml,xe as mapSearchCustomerToXml,te as mapSearchOperatorToXml,Ke as mapSearchResponseFromXml,k as mapServiceStatusFromXml,H as mapServiceStatusToXml,Ce as mapServiceToXml,x as mapServiceTypeFromXml,U as mapServiceTypeToXml,Y as mapSpecialRequestTypeToXml,B as mapTitleFromXml,w as mapTitleToXml};
3
+ `)}:n[i]=String(m)}):typeof t=="string"?n.message=t:typeof t=="number"||typeof t=="boolean"?n.value=t:n.input=String(t),n.timestamp=new Date().toISOString(),n.contextType=typeof t,n}isSensitiveKey(t){let n=["password","token","secret","key","auth","credential","xtoken","authorization","cookie","session","private"],i=t.toLowerCase();return n.some(m=>i.includes(m))}isSerializableValue(t){return t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"?!0:Array.isArray(t)?t.length<=10:typeof t=="object"&&t.constructor===Object?Object.keys(t).length<=20:!1}isHttpError(t){return t&&(t.response||t.request||t.config)}isAvesXmlResponse(t){return t&&t.Response&&t.Response.RsStatus}};r(fe,"AvesErrorHandler");var P=fe;P=Tt([ht()],P);export{ut as AVES_CONFIG_NAMESPACE,E as AVES_SDK_CONFIG,dt as AddressValidation,a as AvesErrorCodes,P as AvesErrorHandler,c as AvesException,C as AvesModule,l as AvesService,d as AvesSeverity,Nn as AvesStatus,de as AvesValidator,pn as BookFileRQValidation,un as CancelFileRQValidation,ft as ContactInfoValidation,ct as LanguageCodeValidation,lt as PassengerValidation,sn as PaymentValidation,cn as PrintBookingDocumentRQValidation,mn as SearchMasterRecordRQValidation,Et as ServiceValidation,R as XML_HTTP_CLIENT,y as XmlHttpClient,ce as avesConfig,Ue as configValidationSchema,Cn as createAvesValidator,g as createDateString,h as createDateTimeString,Dt as createTimeString,Ke as mapAddPaymentToXml,oe as mapAddressToXml,_ as mapAddressTypeFromXml,F as mapAddressTypeToXml,ie as mapBookingFromXml,We as mapBookingResponseFromXml,W as mapBookingTypeToXml,Ge as mapCancelBookingToXml,$ as mapCancelReasonToXml,$e as mapCancelResponseFromXml,re as mapContactToXml,L as mapContactTypeFromXml,X as mapContactTypeToXml,je as mapCreateBookingToXml,Me as mapCustomerToXml,S as mapCustomerTypeToXml,ee as mapDeliveryMethodToXml,J as mapDocumentFormatToXml,Ye as mapDocumentResponseFromXml,Z as mapDocumentTypeToXml,b as mapEmailTypeFromXml,M as mapEmailTypeToXml,Ze as mapMasterRecordFromXml,Oe as mapPassengerToXml,V as mapPassengerTypeFromXml,v as mapPassengerTypeToXml,ze as mapPaymentResponseFromXml,K as mapPaymentStatusFromXml,q as mapPaymentStatusToXml,Xe as mapPaymentToXml,G as mapPaymentTypeFromXml,j as mapPaymentTypeToXml,qe as mapPrintDocumentToXml,Q as mapPriorityToXml,z as mapRefundMethodToXml,ke as mapSearchCustomerToXml,te as mapSearchOperatorToXml,Qe as mapSearchResponseFromXml,k as mapServiceStatusFromXml,x as mapServiceStatusToXml,Fe as mapServiceToXml,H as mapServiceTypeFromXml,U as mapServiceTypeToXml,Y as mapSpecialRequestTypeToXml,B as mapTitleFromXml,w as mapTitleToXml};
4
4
  //# sourceMappingURL=index.js.map