aves-sdk 1.0.2 → 1.1.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.js CHANGED
@@ -1,4 +1,4 @@
1
- var De=Object.defineProperty;var ht=(e,t,o)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var i=(e,t)=>De(e,"name",{value:t,configurable:!0});var u=(e,t,o)=>ht(e,typeof t!="symbol"?t+"":t,o);import"reflect-metadata";import{format as Ae,parseISO as Ce,isValid as be}from"date-fns";var T=i(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=Ce(e)}catch{throw new Error(`Invalid date string: ${e}`)}}else t=e;if(!be(t))throw new Error(`Invalid date value: ${e}`);return Ae(t,"yyyy-MM-dd")},"createDateString"),N=i(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=Ce(e)}catch{throw new Error(`Invalid datetime string: ${e}`)}}else t=e;if(!be(t))throw new Error(`Invalid datetime value: ${e}`);return Ae(t,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")},"createDateTimeString"),fn=i(e=>{if(!/^\d{2}:\d{2}:\d{2}$/.test(e))throw new Error(`Invalid time format. Expected HH:MM:SS, got: ${e}`);let[t,o,a]=e.split(":").map(Number);if(t<0||t>23||o<0||o>59||a<0||a>59)throw new Error(`Invalid time value: ${e}`);return e},"createTimeString");function _(e){return{home:"HOME",work:"WORK",billing:"BILLING",delivery:"DELIVERY"}[e]||"HOME"}i(_,"mapAddressTypeToXml");function M(e){return{HOME:"home",WORK:"work",BILLING:"billing",DELIVERY:"delivery"}[e]||"home"}i(M,"mapAddressTypeFromXml");function X(e){return{home:"HOME",work:"WORK",mobile:"MOBILE",fax:"FAX"}[e]||"HOME"}i(X,"mapContactTypeToXml");function L(e){return{HOME:"home",WORK:"work",MOBILE:"mobile",FAX:"fax"}[e]||"home"}i(L,"mapContactTypeFromXml");function x(e){return{home:"HOME",work:"WORK"}[e]||"HOME"}i(x,"mapEmailTypeToXml");function V(e){return{HOME:"home",WORK:"work"}[e]||"home"}i(V,"mapEmailTypeFromXml");function w(e){return{adult:"ADT",child:"CHD",infant:"INF"}[e]||"ADT"}i(w,"mapPassengerTypeToXml");function B(e){return{ADT:"adult",CHD:"child",INF:"infant"}[e]||"adult"}i(B,"mapPassengerTypeFromXml");function j(e){return{mr:"MR",mrs:"MRS",ms:"MS",dr:"DR",prof:"PROF"}[e]||"MR"}i(j,"mapTitleToXml");function k(e){return{MR:"mr",MRS:"mrs",MS:"ms",DR:"dr",PROF:"prof"}[e]||"mr"}i(k,"mapTitleFromXml");function q(e){return{flight:"FLIGHT",hotel:"HOTEL",car:"CAR",transfer:"TRANSFER",insurance:"INSURANCE"}[e]||"FLIGHT"}i(q,"mapServiceTypeToXml");function U(e){return{FLIGHT:"flight",HOTEL:"hotel",CAR:"car",TRANSFER:"transfer",INSURANCE:"insurance"}[e]||"flight"}i(U,"mapServiceTypeFromXml");function H(e){return{confirmed:"CONFIRMED",pending:"PENDING",cancelled:"CANCELLED"}[e]||"PENDING"}i(H,"mapServiceStatusToXml");function G(e){return{CONFIRMED:"confirmed",PENDING:"pending",CANCELLED:"cancelled"}[e]||"pending"}i(G,"mapServiceStatusFromXml");function K(e){return{credit_card:"CREDIT_CARD",debit_card:"DEBIT_CARD",bank_transfer:"BANK_TRANSFER",cash:"CASH"}[e]||"CASH"}i(K,"mapPaymentTypeToXml");function W(e){return{CREDIT_CARD:"credit_card",DEBIT_CARD:"debit_card",BANK_TRANSFER:"bank_transfer",CASH:"cash"}[e]||"cash"}i(W,"mapPaymentTypeFromXml");function Y(e){return{pending:"PENDING",confirmed:"CONFIRMED",failed:"FAILED"}[e]||"PENDING"}i(Y,"mapPaymentStatusToXml");function $(e){return{PENDING:"pending",CONFIRMED:"confirmed",FAILED:"failed"}[e]||"pending"}i($,"mapPaymentStatusFromXml");function D(e){return{customer:"CUSTOMER",agent:"AGENT",supplier:"SUPPLIER"}[e]||"CUSTOMER"}i(D,"mapCustomerTypeToXml");function Oe(e){return{CUSTOMER:"customer",AGENT:"agent",SUPPLIER:"supplier"}[e]||"customer"}i(Oe,"mapCustomerTypeFromXml");function Pe(e){return{active:"ACTIVE",inactive:"INACTIVE",suspended:"SUSPENDED"}[e]||"ACTIVE"}i(Pe,"mapCustomerStatusToXml");function Fe(e){return{ACTIVE:"active",INACTIVE:"inactive",SUSPENDED:"suspended"}[e]||"active"}i(Fe,"mapCustomerStatusFromXml");function ve(e){return{email:"EMAIL",sms:"SMS",phone:"PHONE"}[e]||"EMAIL"}i(ve,"mapCommunicationMethodToXml");function _e(e){return{EMAIL:"email",SMS:"sms",PHONE:"phone"}[e]||"email"}i(_e,"mapCommunicationMethodFromXml");function Q(e){return{individual:"INDIVIDUAL",group:"GROUP",corporate:"CORPORATE"}[e]||"INDIVIDUAL"}i(Q,"mapBookingTypeToXml");function Me(e){return{PENDING:"pending",CONFIRMED:"confirmed",CANCELLED:"cancelled",COMPLETED:"completed"}[e]||"pending"}i(Me,"mapBookingStatusFromXml");function z(e){return{low:"LOW",normal:"NORMAL",high:"HIGH",urgent:"URGENT"}[e]||"NORMAL"}i(z,"mapPriorityToXml");function Z(e){return{meal:"MEAL",seat:"SEAT",wheelchair:"WHEELCHAIR",other:"OTHER"}[e]||"OTHER"}i(Z,"mapSpecialRequestTypeToXml");function J(e){return{customer_request:"CUSTOMER_REQUEST",no_show:"NO_SHOW",operational:"OPERATIONAL",other:"OTHER"}[e]||"OTHER"}i(J,"mapCancelReasonToXml");function ee(e){return{original_payment:"ORIGINAL_PAYMENT",credit:"CREDIT",cash:"CASH"}[e]||"CASH"}i(ee,"mapRefundMethodToXml");function te(e){return{confirmation:"CONFIRMATION",invoice:"INVOICE",voucher:"VOUCHER",ticket:"TICKET",all:"ALL"}[e]||"ALL"}i(te,"mapDocumentTypeToXml");function ne(e){return{pdf:"PDF",html:"HTML",xml:"XML"}[e]||"PDF"}i(ne,"mapDocumentFormatToXml");function oe(e){return{email:"EMAIL",sms:"SMS",download:"DOWNLOAD"}[e]||"EMAIL"}i(oe,"mapDeliveryMethodToXml");function re(e){return{equals:"EQUALS",contains:"CONTAINS",starts_with:"STARTS_WITH",ends_with:"ENDS_WITH"}[e]||"EQUALS"}i(re,"mapSearchOperatorToXml");function Xe(e){return{SERVICE:"service",TAX:"tax",FEE:"fee",DISCOUNT:"discount"}[e]||"service"}i(Xe,"mapPricingItemTypeFromXml");function Le(e){return{SENT:"sent",PENDING:"pending",FAILED:"failed"}[e]||"pending"}i(Le,"mapDeliveryStatusFromXml");function ie(e){return{male:"M",female:"F"}[e]||"M"}i(ie,"mapGenderToXml");function xe(e){return{M:"male",F:"female"}[e]||"male"}i(xe,"mapGenderFromXml");function ae(e){return{"@Type":e.type?_(e.type):void 0,Street:e.street,City:e.city,State:e.state,PostalCode:e.postalCode,Country:e.country}}i(ae,"mapAddressToXml");function A(e){return{type:e["@Type"]?M(e["@Type"]):void 0,street:e.Street,city:e.City,state:e.State,postalCode:e.PostalCode,country:e.Country}}i(A,"mapAddressFromXml");function se(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?x(e.email.type):void 0,"@Address":e.email.address}:void 0}}i(se,"mapContactToXml");function C(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"]?V(e.Email["@Type"]):void 0,address:e.Email["@Address"]}:void 0}}i(C,"mapContactFromXml");function Ve(e){return{"@PassengerID":e.id,"@Type":w(e.type),"@Title":e.title?j(e.title):void 0,FirstName:e.firstName,LastName:e.lastName,MiddleName:e.middleName,DateOfBirth:e.dateOfBirth,Gender:e.gender?ie(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?ae(e.address):void 0,ContactInfo:e.contact?se(e.contact):void 0}}i(Ve,"mapPassengerToXml");function we(e){return{id:e["@PassengerID"],type:B(e["@Type"]),title:e["@Title"]?k(e["@Title"]):void 0,firstName:e.FirstName,lastName:e.LastName,middleName:e.MiddleName,dateOfBirth:e.DateOfBirth?T(e.DateOfBirth):void 0,gender:e.Gender?xe(e.Gender):void 0,nationality:e.Nationality,passport:e.Passport?{number:e.Passport["@Number"],expiryDate:T(e.Passport["@ExpiryDate"]),issuingCountry:e.Passport["@IssuingCountry"]}:void 0,address:e.Address?A(e.Address):void 0,contact:e.ContactInfo?C(e.ContactInfo):void 0}}i(we,"mapPassengerFromXml");function Be(e){return{"@ServiceID":e.id,"@Type":q(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}}}i(Be,"mapServiceToXml");function je(e){return{id:e["@ServiceID"],type:U(e["@Type"]),status:G(e["@Status"]),code:e.ServiceDetails.Code,name:e.ServiceDetails.Name,description:e.ServiceDetails.Description,startDate:e.ServiceDetails.StartDate?T(e.ServiceDetails.StartDate):void 0,endDate:e.ServiceDetails.EndDate?T(e.ServiceDetails.EndDate):void 0,price:e.ServiceDetails.Price?{currency:e.ServiceDetails.Price["@Currency"],amount:e.ServiceDetails.Price["@Amount"]}:void 0}}i(je,"mapServiceFromXml");function ke(e){return{"@PaymentID":e.id,"@Type":K(e.type),"@Status":Y(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}}i(ke,"mapPaymentToXml");function qe(e){return{id:e["@PaymentID"],type:W(e["@Type"]),status:$(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}}i(qe,"mapPaymentFromXml");function St(e){return{SearchCriteria:{MasterRecordType:D(e.type),SearchFields:{Field:e.fields.map(t=>({"@Name":t.name,"@Value":t.value,"@Operator":t.operator?re(t.operator):void 0}))},Pagination:e.pagination?{"@PageSize":e.pagination.pageSize,"@PageNumber":e.pagination.pageNumber}:void 0}}}i(St,"mapSearchCustomerToXml");function Ue(e){return{"@MasterRecordID":e.id,"@Type":D(e.type),"@Status":Pe(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?ie(e.personalInfo.gender):void 0,Nationality:e.personalInfo.nationality}:void 0,ContactInfo:e.contact?se(e.contact):void 0,Address:e.address?ae(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?ve(e.preferences.communicationMethod):void 0}:void 0}}i(Ue,"mapCustomerToXml");function Nt(e){return{BookingDetails:{"@BookingType":Q(e.type),"@Priority":z(e.priority),CustomerInfo:{"@CustomerID":e.customerId,CustomerDetails:e.customerDetails?Ue(e.customerDetails):void 0},PassengerList:{Passenger:e.passengers.map(Ve)},SelectedServiceList:{Service:e.services.map(Be)},SpecialRequests:e.specialRequests?{Request:e.specialRequests.map(t=>({"@Type":Z(t.type),"@Description":t.description}))}:void 0}}}i(Nt,"mapCreateBookingToXml");function Dt(e){return{"@BookingFileID":e.bookingId,CancellationDetails:{"@Reason":J(e.reason),"@Description":e.description,RefundRequest:e.refundRequest?{"@Amount":e.refundRequest.amount,"@Currency":e.refundRequest.currency,"@Method":ee(e.refundRequest.method)}:void 0}}}i(Dt,"mapCancelBookingToXml");function At(e){return{"@BookingFileID":e.bookingId,DocumentRequest:{"@DocumentType":te(e.documentType),"@Format":ne(e.format),"@Language":e.language,DeliveryMethod:e.deliveryMethod?{"@Type":oe(e.deliveryMethod.type),"@Address":e.deliveryMethod.address}:void 0}}}i(At,"mapPrintDocumentToXml");function Ct(e){return{"@BookingFileID":e.bookingId,PaymentList:{Payment:e.payments.map(ke)}}}i(Ct,"mapAddPaymentToXml");function He(e){return{id:e["@MasterRecordID"],type:Oe(e["@Type"]),status:Fe(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?T(e.PersonalInfo.DateOfBirth):void 0,gender:e.PersonalInfo.Gender==="M"?"male":"female",nationality:e.PersonalInfo.Nationality}:void 0,contact:e.ContactInfo?C(e.ContactInfo):void 0,address:e.Address?A(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?_e(e.Preferences.CommunicationMethod):void 0}:void 0}}i(He,"mapCustomerFromXml");function me(e){return{id:e["@BookingFileID"],status:Me(e["@Status"]),createdAt:N(e["@CreationDate"]),updatedAt:N(e["@LastModified"]),customer:He(e.CustomerInfo),passengers:e.PassengerList.Passenger.map(we),services:e.ServiceList.Service.map(je),pricing:{totalAmount:{currency:e.Pricing.TotalAmount["@Currency"],amount:e.Pricing.TotalAmount["@Amount"]},breakdowns:e.Pricing.Breakdown?.Item.map(t=>({type:Xe(t["@Type"]),description:t["@Description"],amount:t["@Amount"]}))}}}i(me,"mapBookingFromXml");function bt(e){let t=me(e.BookingFile);return{...t,success:e.OperationResult["@Status"]==="SUCCESS",message:e.OperationResult["@Message"],data:t}}i(bt,"mapBookingResponseFromXml");function Ot(e){return{results:e.SearchResults.MasterRecord.map(He),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}}i(Ot,"mapSearchResponseFromXml");function Pt(e){return{id:e.DocumentInfo["@DocumentID"],type:e.DocumentInfo["@DocumentType"],format:e.DocumentInfo["@Format"],size:e.DocumentInfo["@Size"],createdAt:N(e.DocumentInfo["@CreationDate"]),downloadUrl:e.DocumentInfo.DownloadURL,deliveryStatus:e.DocumentInfo.DeliveryStatus?{status:Le(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"]}}i(Pt,"mapDocumentResponseFromXml");function Ft(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}}}i(Ft,"mapCancelResponseFromXml");function vt(e){let t=me(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(qe)}}}}i(vt,"mapPaymentResponseFromXml");function _t(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?C(e.ContactInfo):void 0,address:e.Address?A(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}}i(_t,"mapMasterRecordFromXml");import{Module as zt,Global as Zt}from"@nestjs/common";import{ConfigModule as Qe}from"@nestjs/config";import{Inject as We,Injectable as Xt}from"@nestjs/common";var y=Symbol("AVES_SDK_CONFIG"),R=Symbol("XML_HTTP_CLIENT");var ue=class ue{constructor(t){u(this,"RqHeader");u(this,"Body");Object.assign(this,t)}};i(ue,"RequestPayload");var pe=ue,ce=class ce{constructor(t){u(this,"Request");this.Request=new pe(t)}};i(ce,"WrapRequestDto");var b=ce;function Mt(e,t,o,a){var p=arguments.length,m=p<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,o):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(e,t,o,a);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(m=(p<3?c(m):p>3?c(t,o,m):c(t,o))||m);return p>3&&m&&Object.defineProperty(t,o,m),m}i(Mt,"_ts_decorate");function Ge(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}i(Ge,"_ts_metadata");function Ke(e,t){return function(o,a){t(o,a,e)}}i(Ke,"_ts_param");var de=class de{constructor(t,o){u(this,"config");u(this,"http");this.config=t,this.http=o}buildHeader(){let{hostId:t,xtoken:o,languageCode:a}=this.config;return{"@HostID":t,"@Xtoken":o,"@Interface":"WEB","@UserName":"WEB","@LanguageCode":a}}wrapRequest(t){return new b({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))}};i(de,"AvesService");var g=de;g=Mt([Xt(),Ke(0,We(y)),Ke(1,We(R)),Ge("design:type",Function),Ge("design:paramtypes",[typeof AvesSdkConfig>"u"?Object:AvesSdkConfig,typeof IXmlHttpClient>"u"?Object:IXmlHttpClient])],g);import Vt from"axios";import{XMLBuilder as wt,XMLParser as Bt}from"fast-xml-parser";import{Inject as jt,Injectable as kt,Scope as qt}from"@nestjs/common";function Lt(e,t,o,a){var p=arguments.length,m=p<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,o):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(e,t,o,a);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(m=(p<3?c(m):p>3?c(t,o,m):c(t,o))||m);return p>3&&m&&Object.defineProperty(t,o,m),m}i(Lt,"_ts_decorate");function Ye(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}i(Ye,"_ts_metadata");function xt(e,t){return function(o,a){t(o,a,e)}}i(xt,"_ts_param");var le=class le{constructor(t){u(this,"config");u(this,"httpClient");u(this,"xmlBuilder");u(this,"xmlParser");this.config=t,this.httpClient=Vt.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:i(o=>o>=200&&o<300,"validateStatus")}),this.xmlBuilder=new wt({attributeNamePrefix:"@",ignoreAttributes:!1,suppressEmptyNode:!0,format:process.env.NODE_ENV?.toLowerCase()==="development"}),this.xmlParser=new Bt({attributeNamePrefix:"@",ignoreAttributes:!1,parseAttributeValue:!1,trimValues:!0,isArray:i(o=>["Field","Item","Service","Passenger","Payment","MasterRecord","Request","Notes","ServiceID"].includes(o),"isArray")})}async postXml(t,o,a,p){let m=this.xmlBuilder.build({[o]:a}),c=await this.httpClient.post(t,m,p);return this.xmlParser.parse(c.data)}};i(le,"XmlHttpClient");var I=le;I=Lt([kt({scope:qt.DEFAULT}),xt(0,jt(y)),Ye("design:type",Function),Ye("design:paramtypes",[typeof AvesSdkConfig>"u"?Object:AvesSdkConfig])],I);import{registerAs as Ut}from"@nestjs/config";var Ht="aves",fe=Ut(Ht,()=>({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 Gt=r.enum(["01","02"]),$e=r.object({baseUrl:r.url(),hostId:r.string().length(6),xtoken:r.string(),languageCode:Gt.optional(),timeout:r.number().optional()}),Kt=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()}),Wt=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()}),Yt=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:Kt.optional(),ContactInfo:Wt.optional()}),$t=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()})}),Qn=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()}),zn=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()})}),Zn=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(Yt)}),SelectedServiceList:r.object({Service:r.array($t)}),SpecialRequests:r.object({Request:r.array(r.object({"@Type":r.enum(["MEAL","SEAT","WHEELCHAIR","OTHER"]),"@Description":r.string()}))}).optional()})}),Jn=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()})}),eo=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 Qt(e,t,o,a){var p=arguments.length,m=p<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,o):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(e,t,o,a);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(m=(p<3?c(m):p>3?c(t,o,m):c(t,o))||m);return p>3&&m&&Object.defineProperty(t,o,m),m}i(Qt,"_ts_decorate");var E=class E{static forRoot(t){let o=this.validateConfig(t);return{module:E,imports:[Qe.forFeature(fe)],providers:[{provide:y,useValue:o},this.createXmlHttpClientProvider(),g],exports:[g,R]}}static forRootAsync(t){let o=this.createAsyncProviders(t);return{module:E,imports:[...t.imports??[],Qe.forFeature(fe)],providers:[...o,this.createXmlHttpClientProvider(),g],exports:[g,R]}}static createXmlHttpClientProvider(){return{provide:R,useClass:I}}static createAsyncProviders(t){if(t.useFactory)return[{provide:y,useFactory:i(async(...p)=>{try{let m=await t.useFactory(...p);return this.validateConfig(m)}catch(m){throw new Error(`Failed to create Aves configuration: ${m.message}`)}},"useFactory"),inject:t.inject??[]}];let o=t.useClass||t.useExisting;if(!o)throw new Error("Invalid AvesModule async options: provide useFactory, useClass, or useExisting");let a=[{provide:y,useFactory:i(async p=>{try{let m=await p.createAvesOptions();return this.validateConfig(m)}catch(m){throw new Error(`Failed to create Aves configuration: ${m.message}`)}},"useFactory"),inject:[o]}];return t.useClass&&a.push({provide:t.useClass,useClass:t.useClass}),a}static validateConfig(t){let o=$e.safeParse(t);if(!o.success)throw new Error(`Invalid AVES SDK configuration: ${o.error.issues.map(a=>a.message).join(", ")}`);return o.data}};i(E,"AvesModule"),u(E,"MODULE_NAME","AvesModule"),u(E,"VERSION","1.0.0");var O=E;O=Qt([Zt(),zt({})],O);var lo=(function(e){return e.OK="OK",e.ERROR="ERROR",e.WARNING="WARNING",e.TIMEOUT="TIMEOUT",e})({}),l=(function(e){return e.ERROR="ERROR",e.WARNING="WARNING",e.INFO="INFO",e})({}),s=(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 Jt}from"zod";var P=class P{constructor(t){u(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,o="; "){return t.issues.map(a=>`${a.path.length>0?`${a.path.join(".")}: `:""}${a.message}`).join(o)}createError({message:t,path:o}){return{success:!1,error:new Jt([{code:"custom",message:t,path:o}])}}static withSchema(t){return new P(t)}};i(P,"AvesValidator");var ge=P;function yo(e){return new ge(e)}i(yo,"createAvesValidator");import{z as n}from"zod";var ze=n.enum(["home","work","billing","delivery"]),Ze=n.enum(["home","work","mobile","fax"]),Je=n.enum(["home","work"]),et=n.enum(["adult","child","infant"]),tt=n.enum(["mr","mrs","ms","dr","prof"]),Te=n.enum(["male","female"]),nt=n.enum(["flight","hotel","car","transfer","insurance"]),ot=n.enum(["confirmed","pending","cancelled"]),rt=n.enum(["credit_card","debit_card","bank_transfer","cash"]),it=n.enum(["pending","confirmed","failed"]),Ee=n.enum(["customer","agent","supplier"]),at=n.enum(["equals","contains","starts_with","ends_with"]),st=n.enum(["individual","group","corporate"]),mt=n.enum(["low","normal","high","urgent"]),pt=n.enum(["meal","seat","wheelchair","other"]),ut=n.enum(["customer_request","no_show","operational","other"]),ct=n.enum(["original_payment","credit","cash"]),dt=n.enum(["confirmation","invoice","voucher","ticket","all"]),lt=n.enum(["pdf","html","xml"]),ft=n.enum(["email","sms","download"]),gt=n.enum(["pending","confirmed","cancelled","completed"]),yt=n.enum(["service","tax","fee","discount"]),Tt=n.enum(["sent","pending","failed"]),Et=n.enum(["active","inactive","suspended"]),Rt=n.enum(["email","sms","phone"]),S=n.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),Io=n.string().regex(/^\d{2}:\d{2}:\d{2}$/,"Time must be in HH:MM:SS format"),ye=n.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,"DateTime must be in ISO 8601 format"),Re=n.object({type:ze.optional(),street:n.string().optional(),city:n.string().optional(),state:n.string().optional(),postalCode:n.string().optional(),country:n.string().optional()}),Ie=n.object({phone:n.object({type:Ze.optional(),number:n.string().min(1,"Phone number is required")}).optional(),email:n.object({type:Je.optional(),address:n.string().email("Valid email address is required")}).optional()}),F=n.object({id:n.string().min(1,"Customer ID is required"),type:Ee,status:Et,personalInfo:n.object({title:n.string().optional(),firstName:n.string().min(1,"First name is required"),lastName:n.string().min(1,"Last name is required"),middleName:n.string().optional(),dateOfBirth:S.optional(),gender:Te.optional(),nationality:n.string().optional()}).optional(),contact:Ie.optional(),address:Re.optional(),businessInfo:n.object({companyName:n.string().optional(),taxId:n.string().optional(),licenseNumber:n.string().optional()}).optional(),preferences:n.object({language:n.string().optional(),currency:n.string().optional(),communicationMethod:Rt.optional()}).optional()}),he=n.object({id:n.string().min(1,"Passenger ID is required"),type:et,title:tt.optional(),firstName:n.string().min(1,"First name is required"),lastName:n.string().min(1,"Last name is required"),middleName:n.string().optional(),dateOfBirth:S.optional(),gender:Te.optional(),nationality:n.string().optional(),passport:n.object({number:n.string().min(1,"Passport number is required"),expiryDate:S,issuingCountry:n.string().min(1,"Issuing country is required")}).optional(),address:Re.optional(),contact:Ie.optional()}),Se=n.object({id:n.string().min(1,"Service ID is required"),type:nt,status:ot,code:n.string().optional(),name:n.string().optional(),description:n.string().optional(),startDate:S.optional(),endDate:S.optional(),price:n.object({currency:n.string().min(1,"Currency is required"),amount:n.number().positive("Amount must be positive")}).optional()}),It=n.object({id:n.string().min(1,"Payment ID is required"),type:rt,status:it,amount:n.object({currency:n.string().min(1,"Currency is required"),amount:n.number().positive("Amount must be positive")}),details:n.object({cardNumber:n.string().optional(),expiryDate:n.string().optional(),cardHolderName:n.string().optional()}).optional()}),en=n.object({type:Ee,fields:n.array(n.object({name:n.string().min(1,"Field name is required"),value:n.string().min(1,"Field value is required"),operator:at.optional()})).min(1,"At least one search field is required"),pagination:n.object({pageSize:n.number().int().positive("Page size must be a positive integer"),pageNumber:n.number().int().min(1,"Page number must be at least 1")}).optional()}),tn=n.object({type:st,priority:mt,customerId:n.string().optional(),customerDetails:F.optional(),passengers:n.array(he).min(1,"At least one passenger is required"),services:n.array(Se).min(1,"At least one service is required"),specialRequests:n.array(n.object({type:pt,description:n.string().min(1,"Special request description is required")})).optional()}),nn=n.object({bookingId:n.string().min(1,"Booking ID is required"),reason:ut,description:n.string().optional(),refundRequest:n.object({amount:n.number().positive("Refund amount must be positive"),currency:n.string().min(1,"Currency is required"),method:ct}).optional()}),on=n.object({bookingId:n.string().min(1,"Booking ID is required"),documentType:dt,format:lt,language:n.string().optional(),deliveryMethod:n.object({type:ft,address:n.string().optional()}).optional()}),rn=n.object({bookingId:n.string().min(1,"Booking ID is required"),payments:n.array(It).min(1,"At least one payment is required")}),an=n.object({id:n.string().min(1,"Booking ID is required"),status:gt,createdAt:ye,updatedAt:ye,customer:F,passengers:n.array(he),services:n.array(Se),pricing:n.object({totalAmount:n.object({currency:n.string().min(1,"Currency is required"),amount:n.number().positive("Amount must be positive")}),breakdowns:n.array(n.object({type:yt,description:n.string().min(1,"Description is required"),amount:n.number()})).optional()})}),sn=n.object({results:n.array(F),pagination:n.object({totalRecords:n.number().int().min(0),pageSize:n.number().int().positive(),pageNumber:n.number().int().min(1),totalPages:n.number().int().min(0)}).optional()}),mn=n.object({id:n.string().min(1,"Document ID is required"),type:n.string().min(1,"Document type is required"),format:n.string().min(1,"Document format is required"),size:n.number().int().positive("Document size must be positive"),createdAt:ye,downloadUrl:n.string().url("Download URL must be valid").optional(),deliveryStatus:n.object({status:Tt,method:n.string().min(1,"Delivery method is required"),address:n.string().optional()}).optional()}),pn=n.object({success:n.boolean(),message:n.string().optional(),data:n.any().optional()}),ho={addressType:ze,contactType:Ze,emailType:Je,passengerType:et,titleType:tt,genderType:Te,serviceType:nt,serviceStatusType:ot,paymentType:rt,paymentStatusType:it,customerType:Ee,searchOperatorType:at,bookingType:st,priorityType:mt,specialRequestType:pt,cancelReasonType:ut,refundMethodType:ct,documentType:dt,documentFormatType:lt,deliveryMethodType:ft,bookingStatusType:gt,pricingItemType:yt,deliveryStatusType:Tt,customerStatusType:Et,communicationMethodType:Rt,customerAddress:Re,customerContact:Ie,customer:F,bookingPassenger:he,bookingService:Se,bookingPayment:It,searchCustomerRequest:en,createBookingRequest:tn,cancelBookingRequest:nn,printDocumentRequest:on,addPaymentRequest:rn,bookingResponse:an,searchResponse:sn,documentResponse:mn,operationResponse:pn};import{Injectable as cn}from"@nestjs/common";var h=class h extends Error{constructor(o,a,p={}){super(a);u(this,"code");u(this,"severity");u(this,"timestamp");u(this,"requestId");u(this,"context");this.name="AvesException",this.code=o,this.severity=p.severity||l.ERROR,this.timestamp=new Date().toISOString(),this.context=p.context,this.requestId=p.requestId||this.generateRequestId(),Object.setPrototypeOf(this,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,h)}static fromAvesError(o){return new h(o.code,o.message,{severity:o.severity,context:o.context,requestId:o.requestId})}isRetryable(){return[s.TIMEOUT,s.SERVICE_UNAVAILABLE,s.INTERNAL_SERVER_ERROR,s.RATE_LIMIT_EXCEEDED].includes(this.code)}getUserFriendlyMessage(){return{[s.INVALID_TOKEN]:"Your session has expired. Please log in again.",[s.TOKEN_EXPIRED]:"Your session has expired. Please log in again.",[s.INSUFFICIENT_PERMISSIONS]:"You do not have permission to perform this action.",[s.BOOKING_NOT_FOUND]:"The requested booking could not be found.",[s.BOOKING_ALREADY_CANCELLED]:"This booking has already been cancelled.",[s.PAYMENT_FAILED]:"Payment processing failed. Please try again.",[s.INSUFFICIENT_INVENTORY]:"The requested service is no longer available.",[s.SERVICE_UNAVAILABLE]:"The service is temporarily unavailable. Please try again later.",[s.TIMEOUT]:"The request timed out. Please try again.",[s.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 s.INVALID_TOKEN:case s.TOKEN_EXPIRED:return 401;case s.INSUFFICIENT_PERMISSIONS:return 403;case s.BOOKING_NOT_FOUND:return 404;case s.INVALID_REQUEST_FORMAT:case s.MISSING_REQUIRED_FIELD:case s.INVALID_FIELD_VALUE:return 400;case s.RATE_LIMIT_EXCEEDED:return 429;case s.SERVICE_UNAVAILABLE:return 503;case s.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)}`}};i(h,"AvesException");var d=h;function un(e,t,o,a){var p=arguments.length,m=p<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,o):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(e,t,o,a);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(m=(p<3?c(m):p>3?c(t,o,m):c(t,o))||m);return p>3&&m&&Object.defineProperty(t,o,m),m}i(un,"_ts_decorate");var Ne=class Ne{parseError(t){return t instanceof d?t:this.isHttpError(t)?this.parseHttpError(t):this.isAvesXmlResponse(t)?this.parseAvesXmlError(t):t instanceof Error?new d(s.INTERNAL_SERVER_ERROR,t.message,{severity:l.ERROR,context:this.buildContext({type:"javascript_error",errorName:t.name,stack:t.stack||"No stack trace available"})}):new d(s.INTERNAL_SERVER_ERROR,"Unknown error occurred",{severity:l.ERROR,context:this.buildContext({type:"unknown_error",errorName:typeof t,errorValue:String(t)})})}parseHttpError(t){if(t.response){let o=t.response.status,a=t.response.statusText;switch(o){case 400:return new d(s.INVALID_REQUEST_FORMAT,`Bad Request: ${a}`,{severity:l.ERROR,context:this.buildContext({type:"http_error",errorName:o,statusText:a,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 401:return new d(s.INVALID_TOKEN,"Authentication failed",{severity:l.ERROR,context:this.buildContext({type:"http_error",status:o,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 403:return new d(s.INSUFFICIENT_PERMISSIONS,"Access forbidden",{severity:l.ERROR,context:this.buildContext({type:"http_error",status:o,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 404:return new d(s.BOOKING_NOT_FOUND,"Resource not found",{severity:l.ERROR,context:this.buildContext({type:"http_error",status:o,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 429:return new d(s.RATE_LIMIT_EXCEEDED,"Rate limit exceeded",{severity:l.ERROR,context:this.buildContext({type:"http_error",status:o,retryAfter:t.response.headers?.["retry-after"]})});case 500:return new d(s.INTERNAL_SERVER_ERROR,"Internal server error",{severity:l.ERROR,context:this.buildContext({type:"http_error",status:o,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 503:return new d(s.SERVICE_UNAVAILABLE,"Service unavailable",{severity:l.ERROR,context:this.buildContext({type:"http_error",status:o,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});default:return new d(s.INTERNAL_SERVER_ERROR,`HTTP ${o}: ${a}`,{severity:l.ERROR,context:this.buildContext({type:"http_error",status:o,statusText:a,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})})}}else return t.request?new d(s.TIMEOUT,"Request timeout - no response from AVES API",{severity:l.ERROR,context:this.buildContext({type:"http_error",timeout:!0,url:t.config?.url,method:t.config?.method,configuredTimeout:t.config?.timeout})}):new d(s.INTERNAL_SERVER_ERROR,`Request setup error: ${t.message}`,{severity:l.ERROR,context:this.buildContext({type:"http_error",setupError:!0})})}parseAvesXmlError(t){if(!t?.Response?.RsStatus)return new d(s.INVALID_REQUEST_FORMAT,"Invalid response format from AVES API",{severity:l.ERROR,context:this.buildContext({type:"aves_xml_error",missingRsStatus:!0})});let o=t.Response.RsStatus;if(o["@Status"]==="ERROR")return new d(o.ErrorCode||s.INTERNAL_SERVER_ERROR,o.ErrorDescription||"Unknown error from AVES API",{severity:l.ERROR,context:this.buildContext({type:"aves_xml_error",originalResponse:o})});if(o.Warnings?.Warning){let a=Array.isArray(o.Warnings.Warning)?o.Warnings.Warning:[o.Warnings.Warning];return new d(s.INVALID_FIELD_VALUE,a.join("; "),{severity:l.WARNING,context:this.buildContext({type:"aves_xml_warning",warnings:a})})}return new d(s.INTERNAL_SERVER_ERROR,"Unexpected response from AVES API",{severity:l.ERROR,context:this.buildContext({type:"aves_xml_error",unexpectedResponse:!0,status:o["@Status"]})})}isRetryable(t){return[s.TIMEOUT,s.SERVICE_UNAVAILABLE,s.INTERNAL_SERVER_ERROR,s.RATE_LIMIT_EXCEEDED].includes(t.code)}getUserFriendlyMessage(t){return{[s.INVALID_TOKEN]:"Your session has expired. Please log in again.",[s.TOKEN_EXPIRED]:"Your session has expired. Please log in again.",[s.INSUFFICIENT_PERMISSIONS]:"You do not have permission to perform this action.",[s.BOOKING_NOT_FOUND]:"The requested booking could not be found.",[s.BOOKING_ALREADY_CANCELLED]:"This booking has already been cancelled.",[s.PAYMENT_FAILED]:"Payment processing failed. Please try again.",[s.INSUFFICIENT_INVENTORY]:"The requested service is no longer available.",[s.SERVICE_UNAVAILABLE]:"The service is temporarily unavailable. Please try again later.",[s.TIMEOUT]:"The request timed out. Please try again.",[s.RATE_LIMIT_EXCEEDED]:"Too many requests. Please wait a moment and try again."}[t.code]||t.message}buildContext(t){let o={};return typeof t=="object"&&t!==null?Object.keys(t).forEach(a=>{let p=t[a];if(this.isSensitiveKey(a)){o[a]="********";return}this.isSerializableValue(p)?o[a]=p:typeof p=="function"?o[a]="[Function]":p instanceof Error?o[a]={name:p.name,message:p.message,stack:p.stack?.split(`
1
+ var Ue=Object.defineProperty;var St=(e,t,n)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var i=(e,t)=>Ue(e,"name",{value:t,configurable:!0});var p=(e,t,n)=>St(e,typeof t!="symbol"?t+"":t,n);import{z as o}from"zod";var C={ADULT:"adult",CHILD:"child",INFANT:"infant",SENIOR:"senior"},y={MALE:"male",FEMALE:"female"},O={FLIGHT:"flight",HOTEL:"hotel",CAR:"car",TRANSFER:"transfer",INSURANCE:"insurance"},P={CONFIRMED:"confirmed",PENDING:"pending",CANCELLED:"cancelled"},U={CREDIT_CARD:"credit_card",DEBIT_CARD:"debit_card",BANK_TRANSFER:"bank_transfer",CASH:"cash"},Y={PENDING:"pending",CONFIRMED:"confirmed",FAILED:"failed"},T={CUSTOMER:"customer",SUPPLIER:"supplier",VOUCHER:"voucher",SUPPLIER_VOUCHER:"supplier_voucher"},f={ENABLED:"enabled",WARNING:"warning",BLACKLISTED:"blacklisted",DISABLED:"disabled"},l={QUOTATION:"quotation",WORK_IN_PROGRESS:"work_in_progress",CONFIRMED:"confirmed",OPTIONED:"optioned",NULLIFIED:"nullified",CANCELED:"canceled"},S={VISA_REQUEST:"visa_request",TRAVEL_INFORMATION:"travel_information",VOUCHER:"voucher",BOOKING_CONTRACT:"booking_contract",BOOKING_CONFIRMATION:"booking_confirmation",SUPPLIER_SERVICE_LIST:"supplier_service_list",INVOICE:"invoice",PROFORMA_INVOICE:"proforma_invoice",ADEGUAMENTO:"adeguamento",RESERVATION_FORM:"reservation_form",OPEN_XML:"open_xml",SALES_INVOICE:"sales_invoice",TICKETING_TMASTER:"ticketing_tmaster",SUMMARY_FORM:"summary_form"},W={PDF:"pdf",HTML:"html",XML:"xml"},Q={EMAIL:"email",SMS:"sms",DOWNLOAD:"download"},k={CUSTOMER_REQUEST:"customer_request",NO_SHOW:"no_show",OPERATIONAL:"operational",OTHER:"other"},$={ORIGINAL_PAYMENT:"original_payment",CREDIT:"credit",CASH:"cash"},V={SERVICE:"service",TAX:"tax",FEE:"fee",DISCOUNT:"discount"},z={SENT:"sent",PENDING:"pending",FAILED:"failed"},Xe=o.enum(["home","work","billing","delivery"]),Z=o.enum(["home","work","mobile","fax"]),we=o.enum(["home","work"]),je=o.enum([C.ADULT,C.CHILD,C.INFANT,C.SENIOR]),Ge=o.enum(["mr","mrs","ms","dr","prof"]),te=o.enum([y.MALE,y.FEMALE]),qe=o.enum([O.FLIGHT,O.HOTEL,O.CAR,O.TRANSFER,O.INSURANCE]),He=o.enum([P.CONFIRMED,P.PENDING,P.CANCELLED]),Ke=o.enum([U.CREDIT_CARD,U.DEBIT_CARD,U.BANK_TRANSFER,U.CASH]),Ye=o.enum([Y.PENDING,Y.CONFIRMED,Y.FAILED]),We=o.enum([T.CUSTOMER,T.SUPPLIER,T.VOUCHER,T.SUPPLIER_VOUCHER]),Tt=o.enum(["equals","contains","starts_with","ends_with"]),ft=o.enum(["individual","group","corporate"]),Ct=o.enum(["low","normal","high","urgent"]),ht=o.enum(["meal","seat","wheelchair","other"]),Qe=o.enum([k.CUSTOMER_REQUEST,k.NO_SHOW,k.OPERATIONAL,k.OTHER]),$e=o.enum([$.ORIGINAL_PAYMENT,$.CREDIT,$.CASH]),ze=o.enum([S.VISA_REQUEST,S.TRAVEL_INFORMATION,S.VOUCHER,S.BOOKING_CONTRACT,S.BOOKING_CONFIRMATION,S.SUPPLIER_SERVICE_LIST,S.INVOICE,S.PROFORMA_INVOICE,S.ADEGUAMENTO,S.RESERVATION_FORM,S.OPEN_XML,S.SALES_INVOICE,S.TICKETING_TMASTER,S.SUMMARY_FORM]),Ze=o.enum([W.PDF,W.HTML,W.XML]),Je=o.enum([Q.EMAIL,Q.SMS,Q.DOWNLOAD]),oe=o.enum([l.QUOTATION,l.WORK_IN_PROGRESS,l.CONFIRMED,l.OPTIONED,l.NULLIFIED,l.CANCELED]),et=o.enum([V.SERVICE,V.TAX,V.FEE,V.DISCOUNT]),yt=o.enum([z.SENT,z.PENDING,z.FAILED]),tt=o.enum([f.ENABLED,f.WARNING,f.BLACKLISTED,f.DISABLED]),ot=o.enum(["email","sms","phone"]),A=o.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),ke=o.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/,"DateTime must be in ISO 8601 format"),ne=o.object({type:Xe.optional(),street:o.string().max(100,"Street must be 100 characters or less").optional(),city:o.string().max(50,"City must be 50 characters or less").optional(),state:o.string().max(50,"State must be 50 characters or less").optional(),postalCode:o.string().max(20,"Postal code must be 20 characters or less").optional(),country:o.string().max(50,"Country must be 50 characters or less").optional()}),re=o.object({phone:o.object({type:Z.optional(),number:o.string().min(1,"Phone number is required").max(30,"Phone number must be 30 characters or less")}).optional(),email:o.object({type:we.optional(),address:o.string().email("Valid email address is required").max(100,"Email must be 100 characters or less")}).optional(),mobile:o.object({type:Z.optional(),number:o.string().min(1,"Mobile number is required").max(30,"Mobile number must be 30 characters or less")}).optional()}),X=o.object({id:o.string().max(6,"Customer ID must be 6 characters or less"),type:We,status:tt,personalInfo:o.object({title:o.string().max(10,"Title must be 10 characters or less").optional(),firstName:o.string().min(1,"First name is required").max(50,"First name must be 50 characters or less"),lastName:o.string().min(1,"Last name is required").max(50,"Last name must be 50 characters or less"),dateOfBirth:A.optional(),gender:te.optional(),nationality:o.string().max(3,"Nationality code must be 3 characters or less").optional()}).optional(),contact:re.optional(),address:ne.optional(),businessInfo:o.object({companyName:o.string().max(100,"Company name must be 100 characters or less").optional(),taxId:o.string().max(30,"Tax ID must be 30 characters or less").optional(),vatCode:o.string().max(30,"VAT code must be 30 characters or less").optional(),fiscalCode:o.string().max(30,"Fiscal code must be 30 characters or less").optional(),licenseNumber:o.string().max(50,"License number must be 50 characters or less").optional()}).optional(),preferences:o.object({language:o.string().length(2,"Language code must be exactly 2 characters").optional(),currency:o.string().length(3,"Currency code must be exactly 3 characters").optional(),communicationMethod:ot.optional()}).optional()}),w=o.object({id:o.string().regex(/^\d{3}$/,"Passenger ID must be 3 digits (001, 002, etc.)"),type:je,title:Ge.optional(),firstName:o.string().min(1,"First name is required").max(50,"First name must be 50 characters or less"),lastName:o.string().min(1,"Last name is required").max(50,"Last name must be 50 characters or less"),dateOfBirth:A.optional(),gender:te.optional(),nationality:o.string().max(3,"Nationality code must be 3 characters or less").optional(),passport:o.object({number:o.string().min(1,"Passport number is required").max(20,"Passport number must be 20 characters or less"),expiryDate:A,issuingCountry:o.string().min(1,"Issuing country is required").max(3,"Country code must be 3 characters or less")}).optional(),address:ne.optional(),contact:re.optional()}),j=o.object({id:o.string().min(1,"Service ID is required"),type:qe,status:He,code:o.string().max(50,"Service code must be 50 characters or less").optional(),name:o.string().max(200,"Service name must be 200 characters or less").optional(),description:o.string().max(500,"Description must be 500 characters or less").optional(),startDate:A.optional(),endDate:A.optional(),price:o.object({currency:o.string().length(3,"Currency code must be exactly 3 characters"),amount:o.number().nonnegative("Amount must be non-negative")}).optional()}),J=o.object({id:o.string().min(1,"Payment ID is required"),type:Ke,status:Ye,amount:o.object({currency:o.string().length(3,"Currency code must be exactly 3 characters"),amount:o.number().positive("Amount must be positive")}),details:o.object({cardNumber:o.string().max(20,"Card number must be 20 characters or less").optional(),expiryDate:o.string().regex(/^\d{2}\/\d{2}$/,"Expiry date must be in MM/YY format").optional(),cardHolderName:o.string().max(100,"Cardholder name must be 100 characters or less").optional()}).optional()}),h=o.object({pages:o.number().int().positive("Pages must be positive").max(100,"Pages cannot exceed 100"),page:o.number().int().min(1,"Page must be at least 1")}).optional(),Nt=o.discriminatedUnion("type",[o.object({type:o.literal("code"),code:o.string().min(1,"Code is required").max(6,"Code must be 6 characters or less"),pagination:h}),o.object({type:o.literal("name"),name:o.string().min(1,"Name is required"),city:o.string().max(50,"City must be 50 characters or less").optional(),pagination:h}),o.object({type:o.literal("vat_code"),vatCode:o.string().min(1,"VAT code is required"),phoneNumber:o.string().max(30,"Phone number must be 30 characters or less").optional(),pagination:h}),o.object({type:o.literal("zone"),zipCode:o.string().min(1,"Zip code is required"),city:o.string().max(50,"City must be 50 characters or less").optional(),countyCode:o.string().max(10,"County code must be 10 characters or less").optional(),pagination:h}),o.object({type:o.literal("category"),categoryCode:o.string().min(1,"Category code is required"),pagination:h}),o.object({type:o.literal("email"),email:o.email("Valid email is required"),pagination:h}),o.object({type:o.literal("last_mod_date"),from:o.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),to:o.string().regex(/^\d{4}-\d{2}-\d{2}$/,"Date must be in YYYY-MM-DD format"),pagination:h}),o.object({type:o.literal("search_field"),searchField:o.string().min(1,"Search field is required"),pagination:h}),o.object({type:o.literal("external_ref_code"),externalRefCode:o.string().min(1,"External ref code is required"),pagination:h})]),Ve=o.object({description:o.string().max(200,"Description must be 200 characters or less").optional(),startDate:o.string().min(1,"Start date is required"),endDate:o.string().min(1,"End date is required"),currency:o.string().max(3,"Currency code must be 3 characters or less").optional(),passengers:o.array(w).min(1,"At least one passenger is required").max(99,"Maximum 99 passengers allowed"),services:o.array(j).min(1,"At least one service is required").max(50,"Maximum 50 services allowed"),statisticCodes:o.object({code1:o.string().max(4,"Statistic code must be 4 characters or less").optional(),code2:o.string().max(4,"Statistic code must be 4 characters or less").optional(),code3:o.string().max(4,"Statistic code must be 4 characters or less").optional(),code4:o.string().max(4,"Statistic code must be 4 characters or less").optional(),code5:o.string().max(4,"Statistic code must be 4 characters or less").optional(),code6:o.string().max(4,"Statistic code must be 4 characters or less").optional()}).optional(),destination:o.object({code:o.string().optional(),iataCode:o.string().optional(),nationCode:o.string().optional()}).optional(),deadlines:o.array(o.object({code:o.string().min(1,"Deadline code is required"),description:o.string().optional(),expireDate:o.string().optional()})).optional(),printDocument:o.boolean().optional(),sendDocumentViaEmail:o.boolean().optional()}),Dt=o.union([Ve.extend({customerId:o.string().max(6,"Customer ID must be 6 characters or less").min(1,"Customer ID is required"),customerDetails:o.never().optional()}),Ve.extend({customerId:o.never().optional(),customerDetails:X})]),Ot=o.object({bookingId:o.string().min(1,"Booking ID is required").max(20,"Booking ID must be 20 characters or less"),customerId:o.string().max(6,"Customer ID must be 6 characters or less").optional(),reason:Qe,description:o.string().max(500,"Description must be 500 characters or less").optional(),refundRequest:o.object({amount:o.number().positive("Refund amount must be positive"),currency:o.string().length(3,"Currency code must be exactly 3 characters"),method:$e}).optional()}),At=o.object({bookingId:o.string().min(1,"Booking ID is required").max(20,"Booking ID must be 20 characters or less"),customerId:o.string().max(6,"Customer ID must be 6 characters or less").optional(),documentType:ze,format:Ze.optional(),language:o.string().length(2,"Language code must be exactly 2 characters").optional(),deliveryMethod:o.object({type:Je,address:o.string().max(100,"Delivery address must be 100 characters or less").optional()}).optional()}),_t=o.union([o.object({bookingId:o.string().min(1,"Booking ID is required").max(20,"Booking ID must be 20 characters or less"),bookingRefCode:o.never().optional(),payments:o.array(J).min(1,"At least one payment is required").max(20,"Maximum 20 payments allowed"),enableMultiple:o.boolean().optional(),operationType:o.enum(["absolute","final","final_no_controls"]).optional()}),o.object({bookingId:o.never().optional(),bookingRefCode:o.string().min(1,"Booking reference code is required").max(20,"Booking reference code must be 20 characters or less"),payments:o.array(J).min(1,"At least one payment is required").max(20,"Maximum 20 payments allowed"),enableMultiple:o.boolean().optional(),operationType:o.enum(["absolute","final","final_no_controls"]).optional()})]),bt=o.object({bookingId:o.string().min(1,"Booking ID is required").max(20,"Booking ID must be 20 characters or less"),customerId:o.string().max(6,"Customer ID must be 6 characters or less"),startDate:A,passengers:o.array(w).optional(),notes:o.string().max(999,"Notes must be 999 characters or less").optional(),statisticCodes:o.object({code1:o.string().max(4,"Statistic code must be 4 characters or less").optional(),code2:o.string().max(4,"Statistic code must be 4 characters or less").optional(),code3:o.string().max(4,"Statistic code must be 4 characters or less").optional(),code4:o.string().max(4,"Statistic code must be 4 characters or less").optional(),code5:o.string().max(4,"Statistic code must be 4 characters or less").optional(),code6:o.string().max(4,"Statistic code must be 4 characters or less").optional()}).optional()}),xt=o.object({bookingId:o.string().min(1,"Booking ID is required").max(20,"Booking ID must be 20 characters or less"),customerId:o.string().max(6,"Customer ID must be 6 characters or less"),services:o.array(j).min(1,"At least one service is required").max(50,"Maximum 50 services allowed")}),Lt=o.object({bookingId:o.string().min(1,"Booking ID is required").max(20,"Booking ID must be 20 characters or less"),customerId:o.string().max(6,"Customer ID must be 6 characters or less"),status:oe,expireDate:A.optional()}),Mt=o.object({id:o.string().min(1,"Booking ID is required"),status:oe,createdAt:ke,updatedAt:ke,customer:X,passengers:o.array(w),services:o.array(j),pricing:o.object({totalAmount:o.object({currency:o.string().length(3,"Currency code must be exactly 3 characters"),amount:o.number().nonnegative("Amount must be non-negative")}),breakdowns:o.array(o.object({type:et,description:o.string().min(1,"Description is required"),amount:o.number()})).optional()})}),Ft=o.object({customers:o.array(X),pagination:o.object({page:o.number().int().min(1,"Page must be at least 1"),pages:o.number().int().min(1,"Pages must be at least 1"),totalItems:o.number().int().min(0,"Total items must be non-negative"),hasMore:o.boolean()})}),ee=o.object({fileName:o.string().min(1,"File name is required"),content:o.string().optional(),contentSize:o.number().int().min(0,"Content size must be non-negative")}),Pt=o.object({emailRecipient:o.email("Valid email address is required").optional(),documents:o.array(ee).min(0,"Documents array is required"),additionalDocuments:o.array(o.object({emailRecipient:o.string().email("Valid email address is required"),documents:o.array(ee)})).optional()}),vt=o.object({success:o.boolean(),message:o.string().optional(),data:o.any().optional()}),mo={addressType:Xe,contactType:Z,emailType:we,passengerType:je,titleType:Ge,genderType:te,serviceType:qe,serviceStatusType:He,paymentType:Ke,paymentStatusType:Ye,customerType:We,searchOperatorType:Tt,bookingType:ft,priorityType:Ct,specialRequestType:ht,cancelReasonType:Qe,refundMethodType:$e,documentType:ze,documentFormatType:Ze,deliveryMethodType:Je,bookingStatusType:oe,pricingItemType:et,deliveryStatusType:yt,customerStatusType:tt,communicationMethodType:ot,customerAddress:ne,customerContact:re,customer:X,bookingPassenger:w,bookingService:j,bookingPayment:J,searchCustomerRequest:Nt,createBookingRequest:Dt,cancelBookingRequest:Ot,printDocumentRequest:At,addPaymentRequest:_t,updateBookingHeader:bt,updateBookingServices:xt,setBookingStatus:Lt,bookingResponse:Mt,customerSearchResult:Ft,printedDocument:ee,documentPrintResult:Pt,operationResponse:vt};var _=i(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=new Date(e+"T00:00:00.000Z")}catch{throw new Error(`Invalid date string: ${e}`)}}else t=e;if(isNaN(t.getTime()))throw new Error(`Invalid date value: ${e}`);let n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),a=String(t.getUTCDate()).padStart(2,"0");return`${n}-${r}-${a}`},"createDateString"),se=i(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=new Date(e)}catch{throw new Error(`Invalid datetime string: ${e}`)}}else t=e;if(isNaN(t.getTime()))throw new Error(`Invalid datetime value: ${e}`);return t.toISOString()},"createDateTimeString"),po=i(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,r]=e.split(":").map(Number);if(t<0||t>23||n<0||n>59||r<0||r>59)throw new Error(`Invalid time value: ${e}`);return e},"createTimeString");function ie(e){return{[T.CUSTOMER]:"CUSTOMER",[T.SUPPLIER]:"SUPPLIER",[T.VOUCHER]:"VOUCHER",[T.SUPPLIER_VOUCHER]:"SUPPLIER_VOUCHER"}[e]||"CUSTOMER"}i(ie,"mapCustomerTypeToXml");function nt(e){return{CUSTOMER:T.CUSTOMER,SUPPLIER:T.SUPPLIER,VOUCHER:T.VOUCHER,SUPPLIER_VOUCHER:T.SUPPLIER_VOUCHER}[e]||T.CUSTOMER}i(nt,"mapCustomerTypeFromXml");function ae(e){return{[f.ENABLED]:"ENABLED",[f.WARNING]:"WARNING",[f.BLACKLISTED]:"BLACKLISTED",[f.DISABLED]:"DISABLED"}[e]||"ENABLED"}i(ae,"mapCustomerStatusToXml");function rt(e){return{ENABLED:f.ENABLED,WARNING:f.WARNING,BLACKLISTED:f.BLACKLISTED,DISABLED:f.DISABLED}[e]||f.ENABLED}i(rt,"mapCustomerStatusFromXml");function ce(e){return{[l.QUOTATION]:"QUOTATION",[l.WORK_IN_PROGRESS]:"WORK_IN_PROGRESS",[l.CONFIRMED]:"CONFIRMED",[l.OPTIONED]:"OPTIONED",[l.NULLIFIED]:"NULLIFIED",[l.CANCELED]:"CANCELED"}[e]||"QUOTATION"}i(ce,"mapBookingStatusToXml");function st(e){return{QUOTATION:l.QUOTATION,WORK_IN_PROGRESS:l.WORK_IN_PROGRESS,CONFIRMED:l.CONFIRMED,OPTIONED:l.OPTIONED,NULLIFIED:l.NULLIFIED,CANCELED:l.CANCELED}[e]||l.QUOTATION}i(st,"mapBookingStatusFromXml");function me(e){return{visa_request:"VISA_REQUEST",travel_information:"TRAVEL_INFORMATION",voucher:"VOUCHER",booking_contract:"BOOKING_CONTRACT",booking_confirmation:"BOOKING_CONFIRMATION",supplier_service_list:"SUPPLIER_SERVICE_LIST",invoice:"INVOICE",proforma_invoice:"PROFORMA_INVOICE",adeguamento:"ADEGUAMENTO",reservation_form:"RESERVATION_FORM",open_xml:"OPEN_XML",sales_invoice:"SALES_INVOICE",ticketing_tmaster:"TICKETING_TMASTER",summary_form:"SUMMARY_FORM"}[e]||"VOUCHER"}i(me,"mapDocumentTypeToXml");function ue(e){return{male:"M",female:"F"}[e]||"M"}i(ue,"mapGenderToXml");function it(e){let t=(e.Name||"").split(" "),n=t.pop()||"",r=t.join(" ")||e.Name,a={AD:C.ADULT,CH:C.CHILD,IN:C.INFANT,OV:C.SENIOR};return{id:e["@RPH"],type:a[e.CategoryCode]||C.ADULT,title:void 0,firstName:r,lastName:n,dateOfBirth:e.BirthDate?_(e.BirthDate):void 0,gender:e.Sex==="M"?y.MALE:e.Sex==="F"?y.FEMALE:void 0,nationality:e.NationCode||e.CitizenshipCode,passport:e.IDDocInfo?{number:e.IDDocInfo["@IDCode"]||"",expiryDate:_(e.IDDocInfo["@IDExpireDate"]||""),issuingCountry:""}:void 0,address:void 0,contact:e.eMail||e.PhoneNumber?{email:e.eMail?{address:e.eMail}:void 0,phone:e.PhoneNumber?{number:e.PhoneNumber}:void 0}:void 0}}i(it,"mapPassengerFromXml");function at(e){return{id:e["@ServiceCode"],type:O.HOTEL,status:P.PENDING,code:e["@ServiceCode"],name:e.FirstDescription,description:e.SecondDescription,startDate:e.StartDate?_(e.StartDate):void 0,endDate:e.EndDate?_(e.EndDate):void 0,price:e.ServiceTotalAmountDetail?.ServiceTotalPrice?{currency:"EUR",amount:parseFloat(e.ServiceTotalAmountDetail.ServiceTotalPrice)}:void 0}}i(at,"mapServiceFromXml");var Bt=i((e,t)=>{switch(e.type){case"code":t.RecordCode=e.code;break;case"name":t.Name=e.name,e.city&&(t.City=e.city);break;case"vat_code":t.VatCode=e.vatCode,e.phoneNumber&&(t.PhoneNumber=e.phoneNumber);break;case"zone":t.ZipCode=e.zipCode,e.city&&(t.City=e.city),e.countyCode&&(t.CountyCode=e.countyCode);break;case"category":t.CategoryCode=e.categoryCode;break;case"email":t.Email=e.email;break;case"last_mod_date":t.LastModificationDate={"@MinDate":e.from,"@MaxDate":e.to};break;case"search_field":t.SearchFieldValue=e.searchField;break;case"external_ref_code":t.SearchFieldValue=e.externalRefCode;break}return t},"buildSearchMasterRecordRQ");function pe(e){let t={SearchType:e.type.toUpperCase()};return Bt(e,t)}i(pe,"mapSearchCustomerToXml");function v(e){let t=e.personalInfo?`${e.personalInfo.firstName} ${e.personalInfo.lastName}`.trim():e.id;return{"@RecordCode":e.id,RecordType:ie(e.type),Name:t,LanguageCode:e.preferences?.language||"01",Moniker:e.personalInfo?.title,Gender:e.personalInfo?.gender?ue(e.personalInfo?.gender):void 0,BirthDate:e.personalInfo?.dateOfBirth,CitizenshipCode:e.personalInfo?.nationality,Email:e.contact?.email?.address,FirstPhoneNumber:e.contact?.phone?.number,MobilePhone:e.contact?.phone?.number,Address:e.address?.street,CityName:e.address?.city,StateCode:e.address?.country,ZipCode:e.address?.postalCode,FiscalCode:e.businessInfo?.taxId,VatCode:e.businessInfo?.taxId,RecordStatus:ae(e.status),FinancialDetail:e.preferences?.currency?{"@CurrencyCode":e.preferences.currency}:void 0}}i(v,"mapCustomerToXml");function le(e){return{CustomerDetail:e.customerDetails?v(e.customerDetails):{"@RecordCode":e.customerId||"",RecordType:"CUSTOMER",Name:"Customer",LanguageCode:"01"},CurrencyCode:e.currency,BookingFileStatus:{"@Value":"QUOTATION"},StatisticCodes:e.statisticCodes?{"@sCode1":e.statisticCodes.code1,"@sCode2":e.statisticCodes.code2,"@sCode3":e.statisticCodes.code3,"@sCode4":e.statisticCodes.code4,"@sCode5":e.statisticCodes.code5,"@sCode6":e.statisticCodes.code6}:void 0,Destination:e.destination?{"@Code":e.destination.code,"@IataCode":e.destination.iataCode,"@NationCode":e.destination.nationCode}:void 0,BookingFileDescription:e.description,StartDate:e.startDate,EndDate:e.endDate,BookingFileDocument:e.printDocument!==void 0||e.sendDocumentViaEmail!==void 0?{"@PrintDoc":e.printDocument||!1,"@SendDocViaEmail":e.sendDocumentViaEmail||!1}:void 0,DeadlineList:e.deadlines?{DeadlineDetail:e.deadlines.map(n=>({"@DeadlineCode":n.code,"@Description":n.description,"@ExpireDate":n.expireDate}))}:void 0,PassengerList:{PassengerDetail:e.passengers.map((n,r)=>ct(n,r+1))},SelectedServiceList:{SelectedServiceDetail:e.services.map((n,r)=>mt(n,r+1))}}}i(le,"mapCreateBookingToXml");function ct(e,t){return{"@RPH":String(t).padStart(3,"0"),Name:`${e.firstName} ${e.lastName}`,CategoryCode:e.type===C.ADULT?"AD":e.type===C.CHILD?"CH":e.type===C.INFANT?"IN":"OV",Sex:e.gender===y.MALE?"M":"F",BirthDate:e.dateOfBirth,eMail:e.contact?.email?.address,PhoneNumber:e.contact?.phone?.number}}i(ct,"mapPassengerToAvesXml");function mt(e,t){return{"@sCode":e.id,AvesServiceType:"TOP",StartDate:e.startDate||new Date().toISOString(),EndDate:e.endDate||new Date().toISOString(),Qty:1,Pax:1,AvesSession:t}}i(mt,"mapServiceToAvesXml");function de(e){return{BookingFileCode:e.bookingId,CustomerRecordCode:e.customerId||""}}i(de,"mapCancelBookingToXml");function Ee(e){return{RefMasterRecordCode:e.customerId||"",LanguageCode:e.language||"01",BookingFileCode:e.bookingId,InfoDocumentsToPrint:{InfoDocumentToPrint:[{DocumentType:me(e.documentType)}]},GetDocumentContent:e.deliveryMethod?.type==="download",SendDocumentViaEmail:e.deliveryMethod?.type==="email"}}i(Ee,"mapPrintDocumentToXml");function Re(e){let t="AbsoluteAmountsInsertion";return e.operationType==="final"?t="FinalAmountToAchieve":e.operationType==="final_no_controls"&&(t="FinalAmountToAchieveWithoutControls"),{BookingFileCode:e.bookingId,BookingFileRefCode:e.bookingRefCode,EnableMultiplePayments:e.enableMultiple??e.payments.length>1,OperationType:t,FilePaymentList:{FilePaymentDetail:e.payments.map(n=>({"@PaymentDate":new Date().toISOString(),"@Amount":String(n.amount?.amount||0),"@PaymentType":Ut(n.type)}))}}}i(Re,"mapAddPaymentToXml");function Ut(e){return{cash:"C",bank:"B",bank2:"D",bank3:"T",atm:"P",creditCard:"R",credit_card:"R",rebate:"A"}[e]||"C"}i(Ut,"mapPaymentTypeToAvesXml");function ge(e){let t=v(e);return t["@InsertCriteria"]="S",{MasterRecordDetail:t}}i(ge,"mapCreateCustomerToXml");function Ie(e){let t=v(e);return t["@InsertCriteria"]="T",{MasterRecordDetail:t}}i(Ie,"mapUpdateCustomerToXml");function Se(e){let t=v(e);return t["@InsertCriteria"]="M",{MasterRecordDetail:t}}i(Se,"mapUpsertCustomerToXml");function Te(e,t,n,r){return{BookingFileCode:t,BookingFileStartDate:n,CustomerRecordCode:e,NewCustomerRecordCode:r?.newCustomerRecordCode,BookingNote:r?.notes,PassengerList:r?.passengers?{PassengerDetail:r.passengers.map((a,c)=>ct(a,c+1))}:void 0}}i(Te,"mapUpdateBookingHeaderToXml");function fe(e,t,n){return{CustomerRecordCode:e,BookingFileCode:t,SelectedServiceList:{SelectedServiceDetail:n.map((r,a)=>mt(r,a+1))}}}i(fe,"mapUpdateBookingServicesToXml");function Ce(e,t,n,r){return{CustomerRecordCode:e,BookingFileCode:t,FileStatus:{"@Value":ce(n),...r?.expiredDate&&{"@ExpiredDate":r.expiredDate},...r?.optionedFileExpireDatePolicy&&{"@OptionedFileExpireDatePolicy":r.optionedFileExpireDatePolicy}},...r?.backOfficeRequest!==void 0&&{BackOfficeRequest:r.backOfficeRequest},...r?.printDoc!==void 0||r?.sendDocViaEmail!==void 0?{BookingFileDocument:{"@PrintDoc":r.printDoc||!1,"@SendDocViaEmail":r.sendDocViaEmail||!1}}:{},...r?.applyPenalty!==void 0&&{Penalty:{"@Apply":r.applyPenalty,...r.penaltyCode&&{"@SpecificCode":r.penaltyCode}}},...r?.simulateCancelAndGetPenalty!==void 0&&{SimulateCancelAndGetPenaltyAmount:r.simulateCancelAndGetPenalty}}}i(Ce,"mapSetBookingStatusToXml");function he(e,t,n,r){return{CustomerRecordCode:e,BookingFileCode:t,BookingServiceRef:n,BookingFileServiceStatus:"NULLIFIED",...r&&{BookingFileServiceStatusDate:r}}}i(he,"mapSetBookingServiceStatusToXml");function ye(e){let t=(e.Name??"").split(" "),n=t.pop()??"",r=t.join(" ")??e.Name;return{id:e["@RecordCode"],type:nt(e.RecordType),status:rt(e.RecordStatus??""),personalInfo:{title:e.Moniker,firstName:r,lastName:n,dateOfBirth:e.BirthDate?_(e.BirthDate):void 0,gender:e.Gender==="M"?y.MALE:e.Gender==="F"?y.FEMALE:void 0,nationality:e.CitizenshipCode},contact:{email:e.Email?{address:e.Email}:void 0,phone:e.FirstPhoneNumber?{number:e.FirstPhoneNumber}:void 0,mobile:e.MobilePhone?{number:e.MobilePhone}:void 0},address:e.Address?{street:e.Address,city:e.CityName,state:e.CountyCode,postalCode:e.ZipCode,country:e.StateCode}:void 0,businessInfo:e.VatCode||e.FiscalCode?{companyName:void 0,taxId:e.VatCode||e.FiscalCode,licenseNumber:void 0}:void 0,preferences:{language:e.LanguageCode,currency:e.FinancialDetail?.["@CurrencyCode"],communicationMethod:void 0}}}i(ye,"mapCustomerFromXml");function B(e){return e?e.MasterRecordDetail?{success:!0,message:"Operation successful",data:ye(e.MasterRecordDetail)}:{success:!1,message:"No master record in response",data:void 0}:{success:!1,message:"Invalid XML response",data:void 0}}i(B,"mapCustomerResponseFromXml");function ut(e){return{id:e.BookingFileCode,status:st(e.BookingFileStatus["@Value"]),createdAt:se(e.CreationDate),updatedAt:se(e.CreationDate),customer:ye({"@RecordCode":e.CustomerRecordCode,RecordType:"CUSTOMER",Name:e.CustomerName,LanguageCode:"01",Email:e.CustomerEmail}),passengers:e.PassengerList.PassengerDetail.map(it),services:e.BookedServiceList?.BookedServiceDetail.map(at)||[],pricing:{totalAmount:{currency:e.TotalAmountDetail?.CurrencyCode||"EUR",amount:parseFloat(e.TotalAmountDetail?.TotalAmountAfterDiscount||"0")},breakdowns:void 0}}}i(ut,"mapBookingFromXml");function x(e){if(!e)return{success:!1,message:"Invalid XML response",data:void 0};let t=e.OperationResult["@Status"]==="SUCCESS";if(!t||!e.BookingFile)return{success:t,message:e?.OperationResult["@Message"],data:void 0};let n=ut(e.BookingFile);return{success:t,message:e.OperationResult["@Message"],data:n}}i(x,"mapBookingResponseFromXml");function Ne(e,t){let a=t?.pages||50,c=t?.page||1;if(!e||!e.MasterRecordList)return{customers:[],pagination:{page:c,pages:1,totalItems:0,hasMore:!1}};let u=e.MasterRecordList.MasterRecordDetail.map(ye),E=u.length,Be=E===a,It=Be?c+1:c;return{customers:u,pagination:{page:c,pages:It,totalItems:E,hasMore:Be}}}i(Ne,"mapSearchResponseFromXml");function De(e){if(!e)return{success:!1,message:"Invalid XML response",data:void 0};let t=e.BaseDocumentAndAttachments?.SingleBaseDocumentOrAttachment.map(a=>({fileName:a.DocFileName,content:a.Base64DocContent,contentSize:a.Base64DocContent?.length||0}))||[],n=e.AdditionalDocuments?.AdditionalDocument.map(a=>({emailRecipient:a.EmailRecipient,documents:a.BaseDocumentAndAttachments?.SingleBaseDocumentOrAttachment.map(c=>({fileName:c.DocFileName,content:c.Base64DocContent,contentSize:c.Base64DocContent?.length||0}))||[]}));return{success:!0,message:"Documents generated successfully",data:{emailRecipient:e.EmailRecipient,documents:t,additionalDocuments:n}}}i(De,"mapDocumentResponseFromXml");function Oe(e){if(!e)return{success:!1,message:"Invalid XML response",data:void 0};let t=e.OperationResult["@Status"]==="SUCCESS";return t?{success:t,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}}:{success:t,message:e?.OperationResult["@Message"],data:void 0}}i(Oe,"mapCancelResponseFromXml");function Ae(e){return e?{success:!0,message:"Payment registered successfully",data:{booking:void 0,paymentSummary:{totalPaid:{currency:"EUR",amount:0},outstandingAmount:{currency:"EUR",amount:0},paymentHistory:[]}}}:{success:!1,message:"Invalid XML response",data:void 0}}i(Ae,"mapPaymentResponseFromXml");import{Module as oo,Global as no}from"@nestjs/common";import{ConfigModule as gt}from"@nestjs/config";import{Inject as dt,Injectable as Vt}from"@nestjs/common";var D=Symbol("AVES_SDK_CONFIG"),L=Symbol("XML_HTTP_CLIENT");var g={SEARCH_MASTER_RECORD:"SearchMasterRecordRQ",MANAGE_MASTER_RECORD:"ManageMasterRecordRQ",BOOK_FILE:"BookFileRQ",MODI_FILE_HEADER:"ModiFileHeaderRQ",MOD_FILE_SERVICES:"ModFileServicesRQ",SET_STATUS:"SetStatusRQ",SET_STATUS_SERVICE:"SetStatusServiceRQ",CANCEL_FILE:"CancelFileRQ",FILE_PAYMENT_LIST:"FilePaymentListRQ",PRINT_BOOKING_DOCUMENT:"PrintBookingDocumentRQ"};var I={SEARCH_MASTER_RECORDS:"/interop/masterRecords/v2/rest/Search",INSERT_OR_UPDATE_MASTER_RECORD:"/interop/masterRecords/v2/rest/InsertOrUpdate",CREATE_BOOKING_FILE:"/interop/booking/v2/rest/CreateBookingFile",MOD_BOOKING_FILE_HEADER:"/interop/booking/v2/rest/ModBookingFileHeader",MOD_BOOKING_FILE_SERVICES:"/interop/booking/v2/rest/ModBookingFileServices",SET_BOOKING_FILE_STATUS:"/interop/booking/v2/rest/SetBookingFileStatus",SET_BOOKING_FILE_SERVICE_STATUS:"/interop/booking/v2/rest/SetBookingFileServiceStatus",CANCEL_BOOKING_FILE:"/interop/booking/v2/rest/CancelBookingFile",INSERT_FILE_PAYMENT_LIST:"/interop/booking/v2/rest/InsertFilePaymentList",PRINT_BOOKING_DOCUMENT:"/interop/document/v2/rest/PrintBookingDocument"};var be=class be{constructor(t){p(this,"RqHeader");p(this,"Body");Object.assign(this,t)}};i(be,"RequestPayload");var _e=be,xe=class xe{constructor(t){p(this,"Request");this.Request=new _e(t)}};i(xe,"WrapRequestDto");var G=xe;function kt(e,t,n,r){var a=arguments.length,c=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,t,n,r);else for(var E=e.length-1;E>=0;E--)(u=e[E])&&(c=(a<3?u(c):a>3?u(t,n,c):u(t,n))||c);return a>3&&c&&Object.defineProperty(t,n,c),c}i(kt,"_ts_decorate");function pt(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}i(pt,"_ts_metadata");function lt(e,t){return function(n,r){t(n,r,e)}}i(lt,"_ts_param");var Le=class Le{constructor(t,n){p(this,"config");p(this,"http");this.config=t,this.http=n}buildHeader(){let{hostId:t,xtoken:n,languageCode:r}=this.config;return{"@HostID":t,"@Xtoken":n,"@Interface":"WEB","@UserName":"WEB","@LanguageCode":r}}wrapRequest(t){return new G({RqHeader:this.buildHeader(),Body:t})}async searchCustomers(t){let n=pe(t),r=await this.http.postXml(I.SEARCH_MASTER_RECORDS,g.SEARCH_MASTER_RECORD,this.wrapRequest(n));return Ne(r.Response.Body,t.pagination)}async createCustomer(t){let n=ge(t),r=await this.http.postXml(I.INSERT_OR_UPDATE_MASTER_RECORD,g.MANAGE_MASTER_RECORD,this.wrapRequest(n));return B(r.Response.Body)}async updateCustomer(t){let n=Ie(t),r=await this.http.postXml(I.INSERT_OR_UPDATE_MASTER_RECORD,g.MANAGE_MASTER_RECORD,this.wrapRequest(n));return B(r.Response.Body)}async upsertCustomer(t){let n=Se(t),r=await this.http.postXml(I.INSERT_OR_UPDATE_MASTER_RECORD,g.MANAGE_MASTER_RECORD,this.wrapRequest(n));return B(r.Response.Body)}async createBooking(t){let n=le(t),r=await this.http.postXml(I.CREATE_BOOKING_FILE,g.BOOK_FILE,this.wrapRequest(n));return x(r.Response.Body)}async updateBookingHeader(t,n,r,a){let c=Te(t,n,r,a),u=await this.http.postXml(I.MOD_BOOKING_FILE_HEADER,g.MODI_FILE_HEADER,this.wrapRequest(c));return{success:u.Response.RsStatus["@Status"]==="OK",message:u.Response.RsStatus.ErrorDescription}}async updateBookingServices(t,n,r){let a=fe(t,n,r),c=await this.http.postXml(I.MOD_BOOKING_FILE_SERVICES,g.MOD_FILE_SERVICES,this.wrapRequest(a));return x(c.Response.Body)}async setBookingStatus(t,n,r,a){let c=Ce(t,n,r,a),u=await this.http.postXml(I.SET_BOOKING_FILE_STATUS,g.SET_STATUS,this.wrapRequest(c));return x(u.Response.Body)}async setBookingServiceStatus(t,n,r,a){let c=he(t,n,r,a),u=await this.http.postXml(I.SET_BOOKING_FILE_SERVICE_STATUS,g.SET_STATUS_SERVICE,this.wrapRequest(c));return x(u.Response.Body)}async cancelBooking(t){let n=de(t),r=await this.http.postXml(I.CANCEL_BOOKING_FILE,g.CANCEL_FILE,this.wrapRequest(n));return Oe(r.Response.Body)}async addPayment(t){let n=Re(t),r=await this.http.postXml(I.INSERT_FILE_PAYMENT_LIST,g.FILE_PAYMENT_LIST,this.wrapRequest(n));return Ae(r.Response.Body)}async printDocument(t){let n=Ee(t),r=await this.http.postXml(I.PRINT_BOOKING_DOCUMENT,g.PRINT_BOOKING_DOCUMENT,this.wrapRequest(n));return De(r.Response.Body)}async searchMasterRecord(t){return this.http.postXml(I.SEARCH_MASTER_RECORDS,g.SEARCH_MASTER_RECORD,this.wrapRequest(t))}async insertOrUpdateMasterRecord(t){return this.http.postXml(I.INSERT_OR_UPDATE_MASTER_RECORD,g.MANAGE_MASTER_RECORD,this.wrapRequest(t))}async createBookingFile(t){return this.http.postXml(I.CREATE_BOOKING_FILE,g.BOOK_FILE,this.wrapRequest(t))}async cancelBookingFile(t){return this.http.postXml(I.CANCEL_BOOKING_FILE,g.CANCEL_FILE,this.wrapRequest(t))}async printBookingDocument(t){return this.http.postXml(I.PRINT_BOOKING_DOCUMENT,g.PRINT_BOOKING_DOCUMENT,this.wrapRequest(t))}};i(Le,"AvesService");var N=Le;N=kt([Vt(),lt(0,dt(D)),lt(1,dt(L)),pt("design:type",Function),pt("design:paramtypes",[typeof AvesSdkConfig>"u"?Object:AvesSdkConfig,typeof IXmlHttpClient>"u"?Object:IXmlHttpClient])],N);import jt from"axios";import{XMLBuilder as Gt,XMLParser as qt}from"fast-xml-parser";import{Inject as Ht,Injectable as Kt,Scope as Yt}from"@nestjs/common";function Xt(e,t,n,r){var a=arguments.length,c=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,t,n,r);else for(var E=e.length-1;E>=0;E--)(u=e[E])&&(c=(a<3?u(c):a>3?u(t,n,c):u(t,n))||c);return a>3&&c&&Object.defineProperty(t,n,c),c}i(Xt,"_ts_decorate");function Et(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}i(Et,"_ts_metadata");function wt(e,t){return function(n,r){t(n,r,e)}}i(wt,"_ts_param");var Me=class Me{constructor(t){p(this,"config");p(this,"httpClient");p(this,"xmlBuilder");p(this,"xmlParser");this.config=t,this.httpClient=jt.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:i(n=>n>=200&&n<300,"validateStatus")}),this.xmlBuilder=new Gt({attributeNamePrefix:"@",ignoreAttributes:!1,suppressEmptyNode:!0,format:process.env.NODE_ENV?.toLowerCase()==="development"}),this.xmlParser=new qt({attributeNamePrefix:"@",ignoreAttributes:!1,parseAttributeValue:!1,trimValues:!0,isArray:i(n=>["Field","Item","Service","Passenger","Payment","MasterRecord","Request","Notes","ServiceID"].includes(n),"isArray")})}async postXml(t,n,r,a){let c=this.xmlBuilder.build({[n]:r}),u=await this.httpClient.post(t,c,a);return this.xmlParser.parse(u.data)}};i(Me,"XmlHttpClient");var M=Me;M=Xt([Kt({scope:Yt.DEFAULT}),wt(0,Ht(D)),Et("design:type",Function),Et("design:paramtypes",[typeof AvesSdkConfig>"u"?Object:AvesSdkConfig])],M);import{registerAs as Wt}from"@nestjs/config";var Qt="aves",Fe=Wt(Qt,()=>({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 s}from"zod";var $t=s.enum(["01","02"]),Rt=s.object({baseUrl:s.url(),hostId:s.string().length(6),xtoken:s.string(),languageCode:$t.optional(),timeout:s.number().optional()}),zt=s.object({"@Type":s.enum(["HOME","WORK","BILLING","DELIVERY"]).optional(),Street:s.string().max(100).optional(),City:s.string().max(50).optional(),State:s.string().max(50).optional(),PostalCode:s.string().max(20).optional(),Country:s.string().max(50).optional()}),Zt=s.object({Phone:s.object({"@Type":s.enum(["HOME","WORK","MOBILE","FAX"]).optional(),"@Number":s.string()}).optional(),Email:s.object({"@Type":s.enum(["HOME","WORK"]).optional(),"@Address":s.string()}).optional()}),Jt=s.object({"@PassengerID":s.string().min(1),"@Type":s.enum(["ADT","CHD","INF"]),"@Title":s.enum(["MR","MRS","MS","DR","PROF"]).optional(),FirstName:s.string().min(1).max(50),LastName:s.string().min(1).max(50),DateOfBirth:s.date().optional(),Gender:s.enum(["M","F"]).optional(),Nationality:s.string().max(3).optional(),Address:zt.optional(),ContactInfo:Zt.optional()}),eo=s.object({"@ServiceID":s.string().min(1),"@Type":s.enum(["FLIGHT","HOTEL","CAR","TRANSFER","INSURANCE"]),"@Status":s.enum(["CONFIRMED","PENDING","CANCELLED"]),ServiceDetails:s.object({Code:s.string().optional(),Name:s.string().optional(),Description:s.string().optional(),StartDate:s.string().optional(),EndDate:s.string().optional(),Price:s.object({"@Currency":s.string(),"@Amount":s.number()}).optional()})}),nn=s.object({"@PaymentID":s.string().min(1),"@Type":s.enum(["CREDIT_CARD","DEBIT_CARD","BANK_TRANSFER","CASH"]),"@Status":s.enum(["PENDING","CONFIRMED","FAILED"]),Amount:s.object({"@Currency":s.string(),"@Amount":s.number()}),PaymentDetails:s.object({CardNumber:s.string().optional(),ExpiryDate:s.string().optional(),CardHolderName:s.string().optional()}).optional()}),rn=s.object({SearchCriteria:s.object({MasterRecordType:s.enum(["CUSTOMER","AGENT","SUPPLIER"]),SearchFields:s.object({Field:s.array(s.object({"@Name":s.string(),"@Value":s.string(),"@Operator":s.enum(["EQUALS","CONTAINS","STARTS_WITH","ENDS_WITH"]).optional()}))}),Pagination:s.object({"@PageSize":s.number(),"@PageNumber":s.number()}).optional()})}),sn=s.object({BookingDetails:s.object({"@BookingType":s.enum(["INDIVIDUAL","GROUP","CORPORATE"]),"@Priority":s.enum(["LOW","NORMAL","HIGH","URGENT"]),CustomerInfo:s.object({"@CustomerID":s.string().optional(),CustomerDetails:s.any().optional()}),PassengerList:s.object({Passenger:s.array(Jt)}),SelectedServiceList:s.object({Service:s.array(eo)}),SpecialRequests:s.object({Request:s.array(s.object({"@Type":s.enum(["MEAL","SEAT","WHEELCHAIR","OTHER"]),"@Description":s.string()}))}).optional()})}),an=s.object({"@BookingFileID":s.string().min(1),CancellationDetails:s.object({"@Reason":s.enum(["CUSTOMER_REQUEST","NO_SHOW","OPERATIONAL","OTHER"]),"@Description":s.string().optional(),RefundRequest:s.object({"@Amount":s.number(),"@Currency":s.string(),"@Method":s.enum(["ORIGINAL_PAYMENT","CREDIT","CASH"])}).optional()})}),cn=s.object({"@BookingFileID":s.string().min(1),DocumentRequest:s.object({"@DocumentType":s.enum(["CONFIRMATION","INVOICE","VOUCHER","TICKET","ALL"]),"@Format":s.enum(["PDF","HTML","XML"]),"@Language":s.string().optional(),DeliveryMethod:s.object({"@Type":s.enum(["EMAIL","SMS","DOWNLOAD"]),"@Address":s.string().optional()}).optional()})});function to(e,t,n,r){var a=arguments.length,c=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,t,n,r);else for(var E=e.length-1;E>=0;E--)(u=e[E])&&(c=(a<3?u(c):a>3?u(t,n,c):u(t,n))||c);return a>3&&c&&Object.defineProperty(t,n,c),c}i(to,"_ts_decorate");var b=class b{static forRoot(t){let n=this.validateConfig(t);return{module:b,imports:[gt.forFeature(Fe)],providers:[{provide:D,useValue:n},this.createXmlHttpClientProvider(),N],exports:[N,L]}}static forRootAsync(t){let n=this.createAsyncProviders(t);return{module:b,imports:[...t.imports??[],gt.forFeature(Fe)],providers:[...n,this.createXmlHttpClientProvider(),N],exports:[N,L]}}static createXmlHttpClientProvider(){return{provide:L,useClass:M}}static createAsyncProviders(t){if(t.useFactory)return[{provide:D,useFactory:i(async(...a)=>{try{let c=await t.useFactory(...a);return this.validateConfig(c)}catch(c){throw new Error(`Failed to create Aves configuration: ${c.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 r=[{provide:D,useFactory:i(async a=>{try{let c=await a.createAvesOptions();return this.validateConfig(c)}catch(c){throw new Error(`Failed to create Aves configuration: ${c.message}`)}},"useFactory"),inject:[n]}];return t.useClass&&r.push({provide:t.useClass,useClass:t.useClass}),r}static validateConfig(t){let n=Rt.safeParse(t);if(!n.success)throw new Error(`Invalid AVES SDK configuration: ${n.error.issues.map(r=>r.message).join(", ")}`);return n.data}};i(b,"AvesModule"),p(b,"MODULE_NAME","AvesModule"),p(b,"VERSION","1.0.0");var q=b;q=to([no(),oo({})],q);var fn=(function(e){return e.OK="OK",e.ERROR="ERROR",e.WARNING="WARNING",e.TIMEOUT="TIMEOUT",e})({}),R=(function(e){return e.ERROR="ERROR",e.WARNING="WARNING",e.INFO="INFO",e})({}),m=(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})({}),Cn=(function(e){return e.INSERT="INSERT",e.UPDATE="UPDATE",e.UPSERT="UPSERT",e})({});import{ZodError as ro}from"zod";var H=class H{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(r=>`${r.path.length>0?`${r.path.join(".")}: `:""}${r.message}`).join(n)}createError({message:t,path:n}){return{success:!1,error:new ro([{code:"custom",message:t,path:n}])}}static withSchema(t){return new H(t)}};i(H,"AvesValidator");var Pe=H;function Nn(e){return new Pe(e)}i(Nn,"createAvesValidator");import{Injectable as io}from"@nestjs/common";var F=class F extends Error{constructor(n,r,a={}){super(r);p(this,"code");p(this,"severity");p(this,"timestamp");p(this,"requestId");p(this,"context");this.name="AvesException",this.code=n,this.severity=a.severity||R.ERROR,this.timestamp=new Date().toISOString(),this.context=a.context,this.requestId=a.requestId||this.generateRequestId(),Object.setPrototypeOf(this,F.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,F)}static fromAvesError(n){return new F(n.code,n.message,{severity:n.severity,context:n.context,requestId:n.requestId})}isRetryable(){return[m.TIMEOUT,m.SERVICE_UNAVAILABLE,m.INTERNAL_SERVER_ERROR,m.RATE_LIMIT_EXCEEDED].includes(this.code)}getUserFriendlyMessage(){return{[m.INVALID_TOKEN]:"Your session has expired. Please log in again.",[m.TOKEN_EXPIRED]:"Your session has expired. Please log in again.",[m.INSUFFICIENT_PERMISSIONS]:"You do not have permission to perform this action.",[m.BOOKING_NOT_FOUND]:"The requested booking could not be found.",[m.BOOKING_ALREADY_CANCELLED]:"This booking has already been cancelled.",[m.PAYMENT_FAILED]:"Payment processing failed. Please try again.",[m.INSUFFICIENT_INVENTORY]:"The requested service is no longer available.",[m.SERVICE_UNAVAILABLE]:"The service is temporarily unavailable. Please try again later.",[m.TIMEOUT]:"The request timed out. Please try again.",[m.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 m.INVALID_TOKEN:case m.TOKEN_EXPIRED:return 401;case m.INSUFFICIENT_PERMISSIONS:return 403;case m.BOOKING_NOT_FOUND:return 404;case m.INVALID_REQUEST_FORMAT:case m.MISSING_REQUIRED_FIELD:case m.INVALID_FIELD_VALUE:return 400;case m.RATE_LIMIT_EXCEEDED:return 429;case m.SERVICE_UNAVAILABLE:return 503;case m.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)}`}};i(F,"AvesException");var d=F;function so(e,t,n,r){var a=arguments.length,c=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(e,t,n,r);else for(var E=e.length-1;E>=0;E--)(u=e[E])&&(c=(a<3?u(c):a>3?u(t,n,c):u(t,n))||c);return a>3&&c&&Object.defineProperty(t,n,c),c}i(so,"_ts_decorate");var ve=class ve{parseError(t){return t instanceof d?t:this.isHttpError(t)?this.parseHttpError(t):this.isAvesXmlResponse(t)?this.parseAvesXmlError(t):t instanceof Error?new d(m.INTERNAL_SERVER_ERROR,t.message,{severity:R.ERROR,context:this.buildContext({type:"javascript_error",errorName:t.name,stack:t.stack||"No stack trace available"})}):new d(m.INTERNAL_SERVER_ERROR,"Unknown error occurred",{severity:R.ERROR,context:this.buildContext({type:"unknown_error",errorName:typeof t,errorValue:String(t)})})}parseHttpError(t){if(t.response){let n=t.response.status,r=t.response.statusText;switch(n){case 400:return new d(m.INVALID_REQUEST_FORMAT,`Bad Request: ${r}`,{severity:R.ERROR,context:this.buildContext({type:"http_error",errorName:n,statusText:r,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});case 401:return new d(m.INVALID_TOKEN,"Authentication failed",{severity:R.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 d(m.INSUFFICIENT_PERMISSIONS,"Access forbidden",{severity:R.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 d(m.BOOKING_NOT_FOUND,"Resource not found",{severity:R.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 d(m.RATE_LIMIT_EXCEEDED,"Rate limit exceeded",{severity:R.ERROR,context:this.buildContext({type:"http_error",status:n,retryAfter:t.response.headers?.["retry-after"]})});case 500:return new d(m.INTERNAL_SERVER_ERROR,"Internal server error",{severity:R.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 d(m.SERVICE_UNAVAILABLE,"Service unavailable",{severity:R.ERROR,context:this.buildContext({type:"http_error",status:n,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})});default:return new d(m.INTERNAL_SERVER_ERROR,`HTTP ${n}: ${r}`,{severity:R.ERROR,context:this.buildContext({type:"http_error",status:n,statusText:r,url:t.config?.url,method:t.config?.method,timeout:t.config?.timeout})})}}else return t.request?new d(m.TIMEOUT,"Request timeout - no response from AVES API",{severity:R.ERROR,context:this.buildContext({type:"http_error",timeout:!0,url:t.config?.url,method:t.config?.method,configuredTimeout:t.config?.timeout})}):new d(m.INTERNAL_SERVER_ERROR,`Request setup error: ${t.message}`,{severity:R.ERROR,context:this.buildContext({type:"http_error",setupError:!0})})}parseAvesXmlError(t){if(!t?.Response?.RsStatus)return new d(m.INVALID_REQUEST_FORMAT,"Invalid response format from AVES API",{severity:R.ERROR,context:this.buildContext({type:"aves_xml_error",missingRsStatus:!0})});let n=t.Response.RsStatus;if(n["@Status"]==="ERROR")return new d(n.ErrorCode||m.INTERNAL_SERVER_ERROR,n.ErrorDescription||"Unknown error from AVES API",{severity:R.ERROR,context:this.buildContext({type:"aves_xml_error",originalResponse:n})});if(n.Warnings?.Warning){let r=Array.isArray(n.Warnings.Warning)?n.Warnings.Warning:[n.Warnings.Warning];return new d(m.INVALID_FIELD_VALUE,r.join("; "),{severity:R.WARNING,context:this.buildContext({type:"aves_xml_warning",warnings:r})})}return new d(m.INTERNAL_SERVER_ERROR,"Unexpected response from AVES API",{severity:R.ERROR,context:this.buildContext({type:"aves_xml_error",unexpectedResponse:!0,status:n["@Status"]})})}isRetryable(t){return[m.TIMEOUT,m.SERVICE_UNAVAILABLE,m.INTERNAL_SERVER_ERROR,m.RATE_LIMIT_EXCEEDED].includes(t.code)}getUserFriendlyMessage(t){return{[m.INVALID_TOKEN]:"Your session has expired. Please log in again.",[m.TOKEN_EXPIRED]:"Your session has expired. Please log in again.",[m.INSUFFICIENT_PERMISSIONS]:"You do not have permission to perform this action.",[m.BOOKING_NOT_FOUND]:"The requested booking could not be found.",[m.BOOKING_ALREADY_CANCELLED]:"This booking has already been cancelled.",[m.PAYMENT_FAILED]:"Payment processing failed. Please try again.",[m.INSUFFICIENT_INVENTORY]:"The requested service is no longer available.",[m.SERVICE_UNAVAILABLE]:"The service is temporarily unavailable. Please try again later.",[m.TIMEOUT]:"The request timed out. Please try again.",[m.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(r=>{let a=t[r];if(this.isSensitiveKey(r)){n[r]="********";return}this.isSerializableValue(a)?n[r]=a:typeof a=="function"?n[r]="[Function]":a instanceof Error?n[r]={name:a.name,message:a.message,stack:a.stack?.split(`
2
2
  `).slice(0,3).join(`
3
- `)}:o[a]=String(p)}):typeof t=="string"?o.message=t:typeof t=="number"||typeof t=="boolean"?o.value=t:o.input=String(t),o.timestamp=new Date().toISOString(),o.contextType=typeof t,o}isSensitiveKey(t){let o=["password","token","secret","key","auth","credential","xtoken","authorization","cookie","session","private"],a=t.toLowerCase();return o.some(p=>a.includes(p))}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}};i(Ne,"AvesErrorHandler");var v=Ne;v=un([cn()],v);export{Ht as AVES_CONFIG_NAMESPACE,y as AVES_SDK_CONFIG,Kt as AddressValidation,s as AvesErrorCodes,v as AvesErrorHandler,d as AvesException,O as AvesModule,g as AvesService,l as AvesSeverity,lo as AvesStatus,ge as AvesValidator,Zn as BookFileRQValidation,Jn as CancelFileRQValidation,Wt as ContactInfoValidation,Gt as LanguageCodeValidation,Yt as PassengerValidation,Qn as PaymentValidation,eo as PrintBookingDocumentRQValidation,zn as SearchMasterRecordRQValidation,$t as ServiceValidation,R as XML_HTTP_CLIENT,I as XmlHttpClient,rn as addPaymentRequestSchema,ze as addressTypeSchema,ho as apiSchemas,fe as avesConfig,he as bookingPassengerSchema,It as bookingPaymentSchema,an as bookingResponseSchema,Se as bookingServiceSchema,gt as bookingStatusTypeSchema,st as bookingTypeSchema,nn as cancelBookingRequestSchema,ut as cancelReasonTypeSchema,Rt as communicationMethodTypeSchema,$e as configValidationSchema,Ze as contactTypeSchema,yo as createAvesValidator,tn as createBookingRequestSchema,T as createDateString,N as createDateTimeString,fn as createTimeString,Re as customerAddressSchema,Ie as customerContactSchema,F as customerSchema,Et as customerStatusTypeSchema,Ee as customerTypeSchema,ft as deliveryMethodTypeSchema,Tt as deliveryStatusTypeSchema,lt as documentFormatTypeSchema,mn as documentResponseSchema,dt as documentTypeSchema,Je as emailTypeSchema,Te as genderTypeSchema,Ct as mapAddPaymentToXml,ae as mapAddressToXml,M as mapAddressTypeFromXml,_ as mapAddressTypeToXml,me as mapBookingFromXml,bt as mapBookingResponseFromXml,Q as mapBookingTypeToXml,Dt as mapCancelBookingToXml,J as mapCancelReasonToXml,Ft as mapCancelResponseFromXml,se as mapContactToXml,L as mapContactTypeFromXml,X as mapContactTypeToXml,Nt as mapCreateBookingToXml,Ue as mapCustomerToXml,D as mapCustomerTypeToXml,oe as mapDeliveryMethodToXml,ne as mapDocumentFormatToXml,Pt as mapDocumentResponseFromXml,te as mapDocumentTypeToXml,V as mapEmailTypeFromXml,x as mapEmailTypeToXml,_t as mapMasterRecordFromXml,Ve as mapPassengerToXml,B as mapPassengerTypeFromXml,w as mapPassengerTypeToXml,vt as mapPaymentResponseFromXml,$ as mapPaymentStatusFromXml,Y as mapPaymentStatusToXml,ke as mapPaymentToXml,W as mapPaymentTypeFromXml,K as mapPaymentTypeToXml,At as mapPrintDocumentToXml,z as mapPriorityToXml,ee as mapRefundMethodToXml,St as mapSearchCustomerToXml,re as mapSearchOperatorToXml,Ot as mapSearchResponseFromXml,G as mapServiceStatusFromXml,H as mapServiceStatusToXml,Be as mapServiceToXml,U as mapServiceTypeFromXml,q as mapServiceTypeToXml,Z as mapSpecialRequestTypeToXml,k as mapTitleFromXml,j as mapTitleToXml,pn as operationResponseSchema,et as passengerTypeSchema,it as paymentStatusTypeSchema,rt as paymentTypeSchema,yt as pricingItemTypeSchema,on as printDocumentRequestSchema,mt as priorityTypeSchema,ct as refundMethodTypeSchema,en as searchCustomerRequestSchema,at as searchOperatorTypeSchema,sn as searchResponseSchema,ot as serviceStatusTypeSchema,nt as serviceTypeSchema,pt as specialRequestTypeSchema,tt as titleTypeSchema};
3
+ `)}:n[r]=String(a)}):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"],r=t.toLowerCase();return n.some(a=>r.includes(a))}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}};i(ve,"AvesErrorHandler");var K=ve;K=so([io()],K);export{Qt as AVES_CONFIG_NAMESPACE,D as AVES_SDK_CONFIG,zt as AddressValidation,I as AvesEndpoints,m as AvesErrorCodes,K as AvesErrorHandler,d as AvesException,q as AvesModule,N as AvesService,R as AvesSeverity,fn as AvesStatus,Pe as AvesValidator,sn as BookFileRQValidation,l as BookingStatusType,an as CancelFileRQValidation,k as CancelReasonType,Zt as ContactInfoValidation,f as CustomerStatusType,T as CustomerType,Q as DeliveryMethodType,z as DeliveryStatusType,W as DocumentFormatType,S as DocumentType,y as GenderType,Cn as InsertCriteria,$t as LanguageCodeValidation,C as PassengerType,Jt as PassengerValidation,Y as PaymentStatusType,U as PaymentType,nn as PaymentValidation,V as PricingItemType,cn as PrintBookingDocumentRQValidation,$ as RefundMethodType,g as RootElementNames,rn as SearchMasterRecordRQValidation,P as ServiceStatusType,O as ServiceType,eo as ServiceValidation,L as XML_HTTP_CLIENT,M as XmlHttpClient,_t as addPaymentRequestSchema,Xe as addressTypeSchema,mo as apiSchemas,Fe as avesConfig,w as bookingPassengerSchema,J as bookingPaymentSchema,Mt as bookingResponseSchema,j as bookingServiceSchema,oe as bookingStatusTypeSchema,ft as bookingTypeSchema,Ot as cancelBookingRequestSchema,Qe as cancelReasonTypeSchema,ot as communicationMethodTypeSchema,Rt as configValidationSchema,Z as contactTypeSchema,Nn as createAvesValidator,Dt as createBookingRequestSchema,_ as createDateString,se as createDateTimeString,po as createTimeString,ne as customerAddressSchema,re as customerContactSchema,X as customerSchema,Ft as customerSearchResultSchema,tt as customerStatusTypeSchema,We as customerTypeSchema,Je as deliveryMethodTypeSchema,yt as deliveryStatusTypeSchema,Ze as documentFormatTypeSchema,Pt as documentPrintResultSchema,ze as documentTypeSchema,we as emailTypeSchema,te as genderTypeSchema,Re as mapAddPaymentToXml,ut as mapBookingFromXml,x as mapBookingResponseFromXml,ce as mapBookingStatusToXml,de as mapCancelBookingToXml,Oe as mapCancelResponseFromXml,le as mapCreateBookingToXml,ge as mapCreateCustomerToXml,B as mapCustomerResponseFromXml,ae as mapCustomerStatusToXml,v as mapCustomerToXml,ie as mapCustomerTypeToXml,De as mapDocumentResponseFromXml,me as mapDocumentTypeToXml,ue as mapGenderToXml,Ae as mapPaymentResponseFromXml,Ee as mapPrintDocumentToXml,pe as mapSearchCustomerToXml,Ne as mapSearchResponseFromXml,he as mapSetBookingServiceStatusToXml,Ce as mapSetBookingStatusToXml,Te as mapUpdateBookingHeaderToXml,fe as mapUpdateBookingServicesToXml,Ie as mapUpdateCustomerToXml,Se as mapUpsertCustomerToXml,vt as operationResponseSchema,je as passengerTypeSchema,Ye as paymentStatusTypeSchema,Ke as paymentTypeSchema,et as pricingItemTypeSchema,At as printDocumentRequestSchema,ee as printedDocumentSchema,Ct as priorityTypeSchema,$e as refundMethodTypeSchema,Nt as searchCustomerRequestSchema,Tt as searchOperatorTypeSchema,He as serviceStatusTypeSchema,qe as serviceTypeSchema,Lt as setBookingStatusSchema,ht as specialRequestTypeSchema,Ge as titleTypeSchema,bt as updateBookingHeaderSchema,xt as updateBookingServicesSchema};
4
4
  //# sourceMappingURL=index.js.map