aves-sdk 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +46 -49
- package/dist/index.d.mts +6564 -3145
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"valibot";import{ValiError as t,parse as n,safeParse as r}from"valibot";import{request as i}from"undici";import a from"fast-xml-builder";import{XMLParser as o}from"fast-xml-parser";function s(e){return e.charAt(0).toUpperCase()+e.slice(1)}function c(e){return e.charAt(0).toLowerCase()+e.slice(1)}function l(e){return e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error}const u=new Map([[`toServiceType`,`TOServiceType`],[`rph`,`RPH`]]),ee=new Map([[`TOServiceType`,`toServiceType`],[`RPH`,`rph`]]);function te(e,t,n){return n?`@${t}`:`@${e}`}function d(e,t){if(!e||typeof e!=`object`||l(e))return e;if(Array.isArray(e))return e.map(e=>d(e,t));let n=t?.attrs,r=t?.preserveCamel,i={};for(let[a,o]of Object.entries(e)){let e=u.get(a)??s(a),c=n?.includes(a)?te(e,a,!!r?.includes(a)):e,l=t?.children?.[a];i[c]=p(o,e=>d(e,l))}return i}function f(e){if(typeof e!=`object`||!e||l(e))return e;if(Array.isArray(e))return e.map(e=>f(e));let t={};for(let[n,r]of Object.entries(e)){let e=n.startsWith(`@`)?n.slice(1):n,i=ee.get(e)??c(e);t[i]=p(r,f)}return t}function p(e,t){return!e||typeof e!=`object`||l(e)?e:Array.isArray(e)?e.map(e=>p(e,t)):t(e)}const ne={financialDeadlineList:`deadlineDetail`};function re(e){return ne[e]??e.replace(/List$/,`Detail`)}function ie(e,{listKeys:t,arrayOfOne:n}){let r={...e},i=n??new Set;for(let e of t){let t=r[e];if(!Array.isArray(t))continue;let n=re(e);r[e]=i.has(e)?t.map(e=>({[n]:e})):{[n]:t}}return r}const ae=[`selectedServiceList`,`passengerList`,`selectedPackageList`,`extraQuoteServiceList`,`deadlineList`,`financialDeadlineList`,`paymentList`,`noteList`],oe=new Set([`selectedServiceList`,`passengerList`]),se=[`selectedServiceList`,`passengerList`,`cancellableBookedServiceList`,`deadlineList`],ce=[`passengerList`,`financialDeadlineList`],le=[`filePaymentList`];function ue(e){let t=e=>{if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(t);let n={};for(let[r,i]of Object.entries(e)){if(r===`paxAssociated`&&Array.isArray(i)&&!i.length){n[r]=``;continue}n[r]=t(i)}return n};return t(e)}function m(e,t,n){return d(ue(n?ie(e,n):e),t)}function h(t,n,r){return e.pipe(t,e.transform(e=>m(e,n,r)))}function g(t){return e.pipe(e.union([e.array(t),t]),e.transform(e=>Array.isArray(e)?e:[e]))}function _(t){return e.pipe(t,e.transform(e=>f(e)))}function v(t,n={}){let r={},i=n.attrs??[],a=n.preserveCamel??[];for(let e in t.entries){let n=e.charAt(0).toUpperCase()+e.slice(1),o=i.includes(e)?a.includes(e)?`@${e}`:`@${n}`:n;r[o]=t.entries[e]}return e.object(r)}const y={attrs:[`currencyCode`,`creditLimit`,`c_PaymentType`,`c_SpecPaymentTypeCode`,`s_PaymentType`,`s_SpecPaymentTypeCode`,`enableElectronicInvoicing`,`electronicInvoicingType`]},b={attrs:[`idType`,`idCode`,`idIssueLocation`,`idIssueCounty`,`idIssueDate`,`idExpireDate`]},x={attrs:[`acceptProfilingPolicies`,`acceptPrivacyPolicies`,`acceptNewsletterPolicies`]},S={attrs:[`key`,`value`]},de={attrs:[`supplierRefCode`,`companyMainBusinessType`,`carrierType`]},fe={attrs:[`recordCode`,`insertCriteria`],children:{financialDetail:y,idDocumentDetail:b,accountPolicies:x,dynamicFields:S,supplierRefMasterRecords:de}},pe={children:{lastModificationDate:{attrs:[`minDate`,`maxDate`]}}},C={attrs:[`sCode1`,`sCode2`,`sCode3`,`sCode4`,`sCode5`,`sCode6`],preserveCamel:[`sCode1`,`sCode2`,`sCode3`,`sCode4`,`sCode5`,`sCode6`]},me={attrs:[`code`,`iataCode`,`nationCode`,`type`]},w={attrs:[`nType`,`title`]},he={attrs:[`rph`,`roomRph`,`billingHolder`],children:{notes:{children:{noteDetail:w}},idDocInfo:b}},ge={attrs:[`currencyCode`,`exchangeRate`,`cost`,`costTax`,`costType`,`vatCostCurrencyCode`,`price`,`priceTax`,`priceType`]},_e={attrs:[`pCode`,`startDate`,`endDate`,`getServicesFromPackage`],preserveCamel:[`pCode`]},ve={children:{selectedServiceDetail:{attrs:[`sCode`,`ssCode`,`supplierMasterCode`,`supplierName`,`supplierMasterSearchField`,`supplierFiscalCode`],preserveCamel:[`sCode`,`ssCode`],children:{serviceFare:ge,avesServiceInfo:{children:{serviceFare:ge}},noteList:{children:{noteDetail:w}}}}}},T={children:{passengerDetail:he}},ye={children:{selectedPackageDetail:_e}},be={children:{deadlineDetail:{attrs:[`deadlineCode`,`description`,`expireDate`,`reschedulingCode`]}}},xe={children:{deadlineDetail:{attrs:[`reschedulingCode`,`expireDate`,`totalAmount`]}}},Se={children:{paymentDetail:{attrs:[`paymentDate`,`paumentNote`,`amount`,`paymentUser`,`paymentType`]}}},Ce={children:{filePaymentDetail:{attrs:[`paymentDate`,`paymentNote`,`payerMasterCode`,`payerName`,`amount`,`paymentType`]}}},we={children:{cancellableBookedServiceDetail:{attrs:[`cancelOperationType`,`serviceRefType`,`serviceRefValue`]}}},Te={children:{noteDetail:w}},Ee={attrs:[`printDoc`,`sendDocViaEmail`],children:{infoDocumentsToPrint:{children:{infoDocumentToPrint:{children:{documentCustomizablePrintParameters:{attrs:[`makeDocumentTo`,`fillInCode`]}}}}}}},De={attrs:[`value`,`expiredDate`]},Oe={attrs:[`recordCode`]},ke={attrs:[`customer_PaymentType`,`customer_SpecPaymentTypeCode`]},Ae={attrs:[`getAllDeptDate`,`getFlightPlan`,`getAllAccomodation`,`getRealAvailability`]},je={attrs:[`compatibleAccomodation`,`alternativeAccomodation`]},Me={children:{featureDetail:{attrs:[`code`,`name`]}}},Ne={attrs:[`value`,`expiredDate`,`optionedFileExpireDatePolicy`]},Pe={attrs:[`apply`,`specificCode`]},E={children:{customerDetail:Oe,bookingFileStatus:De,statisticCodes:C,destination:me,bookingFileDocument:Ee,bookingFinancialInfo:ke,selectedPackageDetail:_e,selectedPackageList:ye,selectedServiceList:ve,extraQuoteServiceList:ve,passengerList:T,deadlineList:be,financialDeadlineList:xe,paymentList:Se,cancellableBookedServiceList:we,noteList:Te}},Fe={attrs:[`paymentUser`],children:{filePaymentList:Ce}},Ie={children:{fileStatus:{attrs:[`value`,`expireDate`]},startDate:{attrs:[`minDate`,`maxDate`]},createdDate:{attrs:[`minDate`,`maxDate`]},lastModificationDate:{attrs:[`minDate`,`maxDate`]},insurance:{attrs:[`code`,`number`]}}},Le={children:{statisticCodes:C,selectedServiceList:{children:{selectedServiceDetail:{attrs:[`serviceCode`,`packageRow`]}}},passengerList:T}},Re={children:{passengerList:T}},ze={children:{destination:me,statisticCodes:C,packageParams:Ae,topServiceParams:je,featureList:Me}},Be={children:{fileStatus:Ne,penalty:Pe,bookingFileDocument:Ee}},D={},O=e.union([e.literal(`true`),e.literal(`false`),e.boolean()]),Ve=e.union([e.literal(`QUOTATION`),e.literal(`WORK_IN_PROGRESS`),e.literal(`CONFIRMED`),e.literal(`OPTIONED`),e.literal(`CANCELED`)]),He=e.union([e.literal(`QUOTATION`),e.literal(`WORK_IN_PROGRESS`),e.literal(`CONFIRMED`),e.literal(`OPTIONED`),e.literal(`NULLIFIED`),e.literal(`CANCELED`)]),Ue=e.union([e.literal(`QUOTATION`),e.literal(`WORK_IN_PROGRESS`),e.literal(`CONFIRM`),e.literal(`CONFIRMED`),e.literal(`OPTION`),e.literal(`OPTIONED`),e.literal(`REQUEST`),e.literal(`REQUESTED`),e.literal(`NULLIFIED`),e.literal(`CANCELED`)]),We={CONFIRM:`CONFIRMED`,OPTION:`OPTIONED`,REQUESTED:`REQUEST`};function Ge(e){return e in We?We[e]:e}const Ke=e.union([e.literal(`TOP`),e.literal(`TOP_SS`),e.literal(`ADV`),e.literal(`GRP`),e.literal(`OTHER`)]),qe=e.union([e.literal(`ACCOMODATION`),e.literal(`TRANSPORT`),e.literal(`CHARTER`),e.literal(`TRANSFER`),e.literal(`PULLMAN`),e.literal(`FERRY`),e.literal(`CRUISE`),e.literal(`INSURANCE`),e.literal(`EXTRAFEE`),e.literal(`PENALTY`),e.literal(`PROMO`),e.literal(`OTHER`),e.literal(`NOT_SET`),e.literal(`RESIDENCE`)]),Je=e.union([e.literal(`REQUEST`),e.literal(`ALLOTMENT_REQUEST`),e.literal(`CONFIRMED_REQUEST`),e.literal(`CONFIRMED_EXTRA_ALLOTMENT`),e.literal(`WAITLISTED`),e.literal(`ALLOTMENT`),e.literal(`REFUSED`),e.literal(`NULLIFIED`),e.literal(`CANCELED`),e.literal(`MESSAGE`)]),Ye=e.union([e.literal(`C`),e.literal(`B`),e.literal(`D`),e.literal(`T`),e.literal(`P`),e.literal(`R`),e.literal(`A`),e.literal(`H`),e.literal(`I`),e.literal(`J`),e.literal(`K`),e.literal(`L`),e.literal(`M`),e.literal(`N`),e.literal(`O`),e.literal(`Q`),e.literal(`S`),e.literal(`U`),e.literal(`V`)]),k=e.union([e.string(),e.number()]),Xe=e.pipe(e.object({"@Value":Ue,"@ExpiredDate":e.optional(e.string()),"@ExpireDate":e.optional(e.string())}),e.transform(e=>({"@Value":Ge(e[`@Value`]),"@ExpiredDate":e[`@ExpiredDate`]??e[`@ExpireDate`]}))),Ze=e.object({"@PaxRef":e.string(),"@Price":k}),Qe=e.object({PricePerPaxDetail:e.optional(g(Ze))}),$e=e.object({"@CommissionCode":e.optional(e.string()),"@CommissionPercentage":e.optional(k),"@CommissionAmount":e.optional(k),"@PriceListCode":e.optional(e.string()),"@CostListCode":e.optional(e.string()),"@ServiceTotalPrice":e.optional(k),PaxPriceList:e.optional(Qe)}),et=e.object({"@Code":e.optional(e.string()),"@Name":e.optional(e.string()),"@Email":e.optional(e.string()),"@LanguageCode":e.optional(e.string())}),tt=e.object({"@Code":e.optional(e.string()),"@Description":e.optional(e.string())}),nt=e.object({"@RPH":e.string(),"@ServiceCode":e.optional(e.string()),"@FromExternalProvider":e.optional(k),"@isFromExternalProvider":e.optional(k),AvesServiceType:e.optional(Ke),TOServiceType:e.optional(qe),FirstDescription:e.optional(e.string()),SecondDescription:e.optional(e.string()),ThirdDescription:e.optional(e.string()),FourthDescription:e.optional(e.string()),ServiceStatus:e.optional(Je),StartDate:e.optional(e.string()),EndDate:e.optional(e.string()),Qty:e.optional(k),Pax:e.optional(k),PeriodType:e.optional(e.string()),PaxMultiplier:e.optional(e.string()),ExternalProviderCode:e.optional(e.string()),WebStatisticCode:e.optional(e.string()),WebStatisticDescription:e.optional(e.string()),WebStatistic:e.optional(tt),SupplierInfo:e.optional(et),ServiceTotalAmountDetail:e.optional($e)}),rt=e.pipe(nt,e.transform(e=>({"@RPH":e[`@RPH`],"@ServiceCode":e[`@ServiceCode`],"@FromExternalProvider":e[`@FromExternalProvider`]??e[`@isFromExternalProvider`],AvesServiceType:e.AvesServiceType,TOServiceType:e.TOServiceType,FirstDescription:e.FirstDescription,SecondDescription:e.SecondDescription,ThirdDescription:e.ThirdDescription,FourthDescription:e.FourthDescription,ServiceStatus:e.ServiceStatus,StartDate:e.StartDate,EndDate:e.EndDate,Qty:e.Qty,Pax:e.Pax,PeriodType:e.PeriodType,PaxMultiplier:e.PaxMultiplier,ExternalProviderCode:e.ExternalProviderCode,WebStatisticCode:e.WebStatisticCode,WebStatisticDescription:e.WebStatisticDescription,WebStatistic:e.WebStatistic,SupplierInfo:e.SupplierInfo,ServiceTotalAmountDetail:e.ServiceTotalAmountDetail}))),it=e.object({BookedServiceDetail:e.optional(g(rt))}),at=e.object({"@CurrencyCode":e.optional(e.string()),"@TotalAmountBeforeDiscount":e.optional(k),"@TotalAmountAfterDiscount":e.optional(k),"@TotalDiscount":e.optional(k),"@TotalAmountWithoutVat":e.optional(k),"@DueAmount":e.optional(k),"@PaiedAmount":e.optional(k),"@Balance":e.optional(k)}),ot=e.object({"@RPH":e.string(),"@RoomRPH":e.optional(e.string()),"@BillingHolder":e.optional(k),Name:e.optional(e.string()),CategoryCode:e.optional(e.string()),Sex:e.optional(e.string()),BirthDate:e.optional(e.string()),BirthPlace:e.optional(e.string()),NationCode:e.optional(e.string()),CitizenshipCode:e.optional(e.string()),FiscalCode:e.optional(e.string()),PhoneNumber:e.optional(e.string()),EMail:e.optional(e.string()),MasterRecordCode:e.optional(e.string())}),st=e.object({PassengerDetail:e.optional(g(ot))}),ct=e.object({"@ReschedulingCode":e.optional(e.string()),"@ExpireDate":e.optional(e.string()),"@TotalAmount":e.optional(k),ReschedulingCode:e.optional(e.string()),ExpireDate:e.optional(e.string()),TotalAmount:e.optional(k)}),lt=e.pipe(ct,e.transform(e=>({"@ReschedulingCode":e[`@ReschedulingCode`]??e.ReschedulingCode,"@ExpireDate":e[`@ExpireDate`]??e.ExpireDate,"@TotalAmount":e[`@TotalAmount`]??e.TotalAmount}))),ut=e.object({DeadlineDetail:e.optional(g(lt))}),dt=e.object({DocumentRefCode:e.optional(e.string()),DocumentType:e.optional(e.string()),DocumentName:e.optional(e.string()),ArchiviationDescription:e.optional(e.string())}),ft=e.object({StoredDocumentDetail:e.optional(g(dt))}),pt=e.object({DocumentType:e.optional(e.string()),DocumentName:e.optional(e.string()),Enabled:e.optional(k)}),mt=e.object({PrintableDocumentDetail:e.optional(g(pt))}),ht=e.object({"@BookingFileCode":e.optional(e.string()),BookingFileCode:e.optional(e.string()),CustomerRecordCode:e.optional(e.string()),CustomerName:e.optional(e.string()),CustomerEmail:e.optional(e.string()),TravelAgencyName:e.optional(e.string()),TravelAgencyEmail:e.optional(e.string()),BookingFileStatus:e.optional(Xe),Description:e.optional(e.string()),Nation:e.optional(e.string()),Destination:e.optional(e.string()),CreationDate:e.optional(e.string()),FirstConfirmationDate:e.optional(e.string()),StartDate:e.optional(e.string()),EndDate:e.optional(e.string()),PackageCode:e.optional(e.string()),BookedServiceList:e.optional(it),TotalAmountDetail:e.optional(at),PaxNumber:e.optional(k),PassengerList:e.optional(st),Reference:e.optional(e.string()),ClerkName:e.optional(e.string()),StoredDocumentsList:e.optional(ft),PrintableDocumentsList:e.optional(mt),FinancialDeadlineList:e.optional(ut)}),gt=e.pipe(ht,e.transform(e=>({"@BookingFileCode":e[`@BookingFileCode`]??e.BookingFileCode,CustomerRecordCode:e.CustomerRecordCode,CustomerName:e.CustomerName,CustomerEmail:e.CustomerEmail,TravelAgencyName:e.TravelAgencyName,TravelAgencyEmail:e.TravelAgencyEmail,BookingFileStatus:e.BookingFileStatus,Description:e.Description,Nation:e.Nation,Destination:e.Destination,CreationDate:e.CreationDate,FirstConfirmationDate:e.FirstConfirmationDate,StartDate:e.StartDate,EndDate:e.EndDate,PackageCode:e.PackageCode,BookedServiceList:e.BookedServiceList,TotalAmountDetail:e.TotalAmountDetail,PaxNumber:e.PaxNumber,PassengerList:e.PassengerList,Reference:e.Reference,ClerkName:e.ClerkName,StoredDocumentsList:e.StoredDocumentsList,PrintableDocumentsList:e.PrintableDocumentsList,FinancialDeadlineList:e.FinancialDeadlineList}))),_t=e.object({"@HostID":e.pipe(e.string(),e.minLength(6),e.maxLength(6)),"@Xtoken":e.string(),"@Interface":e.literal(`WEB`),"@UserName":e.literal(`WEB`),"@LanguageCode":e.optional(e.pipe(e.string(),e.minLength(2),e.maxLength(2)))}),vt=e.optional(e.pipe(e.string(),e.transform(e=>e.split(`,`)))),A=e.pipe(e.object({"@Status":e.union([e.literal(`OK`),e.literal(`ERROR`),e.literal(`WARNING`),e.literal(`TIMEOUT`)]),ErrorCode:e.optional(e.pipe(e.union([e.string(),e.number()]),e.transform(e=>Number(e)))),ErrorDescription:e.optional(e.string()),Warnings:vt}),e.transform(e=>({status:e[`@Status`],errorCode:e.ErrorCode,errorDescription:e.ErrorDescription,warnings:e.Warnings}))),yt=e.object({value:Ve,expiredDate:e.optional(e.string())}),j=e.object({sCode1:e.optional(e.pipe(e.string(),e.maxLength(4))),sCode2:e.optional(e.pipe(e.string(),e.maxLength(4))),sCode3:e.optional(e.pipe(e.string(),e.maxLength(4))),sCode4:e.optional(e.pipe(e.string(),e.maxLength(4))),sCode5:e.optional(e.pipe(e.string(),e.maxLength(4))),sCode6:e.optional(e.pipe(e.string(),e.maxLength(4)))}),bt=e.object({code:e.optional(e.string()),iataCode:e.optional(e.string()),nationCode:e.optional(e.string())}),xt=e.object({recordCode:e.optional(e.string())}),St=e.union([e.literal(`VISA_REQUEST`),e.literal(`TRAVEL_INFORMATION`),e.literal(`VOUCHER`),e.literal(`BOOKING_CONTRACT`),e.literal(`BOOKING_CONFIRMATION`),e.literal(`SUPPLIER_SERVICE_LIST`),e.literal(`INVOICE`),e.literal(`PROFORMA_INVOICE`),e.literal(`ADEGUAMENTO`),e.literal(`RESERVATION_FORM`),e.literal(`OPEN_XML`),e.literal(`SALES_INVOICE`),e.literal(`TICKETING_TMASTER`),e.literal(`SUMMARY_FORM`)]),Ct=e.object({makeDocumentTo:e.optional(e.union([e.literal(`BOOKING_CUSTOMER`),e.literal(`FIRST_PASSENGER`)]))}),wt=e.object({fillInCode:e.optional(e.string())}),Tt=e.union([Ct,wt]),Et=e.object({documentType:St,documentCustomizablePrintParameters:e.optional(Tt)}),Dt=e.object({printDoc:e.optional(O),sendDocViaEmail:e.optional(O),infoDocumentsToPrint:e.optional(e.array(Et))}),Ot=e.object({reschedulingCode:e.optional(e.string()),expireDate:e.optional(e.string()),totalAmount:e.optional(e.string())}),kt=e.object({deadlineCode:e.optional(e.string()),description:e.optional(e.string()),expireDate:e.optional(e.string())}),At=e.object({paymentDate:e.optional(e.string()),paumentNote:e.optional(e.string()),amount:e.optional(e.string()),paymentUser:e.optional(e.string()),paymentType:e.optional(Ye)}),jt=e.union([e.literal(`PAX_QTY_DAY`),e.literal(`PAX_QTY_NIGHT`),e.literal(`PAX_QTY_WEEK`),e.literal(`PAX_QTY`),e.literal(`PAX_DAY`),e.literal(`PAX_NIGHT`),e.literal(`PAX_WEEK`),e.literal(`PAX`),e.literal(`QTY_DAY`),e.literal(`QTY_NIGHT`),e.literal(`QTY_WEE`),e.literal(`QTY`),e.literal(`DAY`),e.literal(`NIGHT`),e.literal(`WEEK`),e.literal(`FORFAIT`)]),Mt=e.object({currencyCode:e.optional(e.string()),exchangeRate:e.optional(e.string()),cost:e.optional(e.string()),costTax:e.optional(e.string()),costType:e.optional(jt),vatCostCurrencyCode:e.optional(e.string()),price:e.optional(e.string()),priceTax:e.optional(e.string()),priceType:e.optional(jt)}),Nt=e.object({packageCode:e.optional(e.string()),packageReference:e.optional(e.string()),suballotmentCode:e.optional(e.string()),priceListCode:e.optional(e.string()),costListCode:e.optional(e.string()),externalFileCode:e.optional(e.string()),externalReference:e.optional(e.string()),serviceStatus:e.optional(e.string()),serviceStatisticCode:e.optional(e.string()),serviceFare:e.optional(Mt)}),Pt=e.object({pax:e.string()}),M=e.object({sCode:e.string(),ssCode:e.optional(e.string()),avesServiceType:Ke,toServiceType:e.optional(qe),subServiceDesc:e.optional(e.string()),startDate:e.string(),endDate:e.string(),qty:e.string(),pax:e.string(),paxAssociated:e.optional(e.array(Pt)),avesSession:e.string(),avesServiceInfo:e.optional(Nt),serviceFare:e.optional(Mt),bookedServiceRef:e.optional(e.string()),supplierMasterCode:e.optional(e.string()),voucherMasterCode:e.optional(e.string()),hotelServiceInfo:e.optional(e.string()),carRentalServiceInfo:e.optional(e.string()),flightServiceInfo:e.optional(e.string()),shipServiceInfo:e.optional(e.string()),ticketServiceInfo:e.optional(e.string()),commission:e.optional(e.string()),noteList:e.optional(e.string()),voucherInfo:e.optional(e.string()),firstDescription:e.optional(e.string()),secondDescription:e.optional(e.string())}),Ft=e.object({pCode:e.string(),startDate:e.string(),endDate:e.string(),getServicesFromPackage:e.optional(O)}),It=e.object({nType:e.optional(e.string()),title:e.optional(e.string()),text:e.optional(e.string())}),Lt=e.union([e.literal(`AD`),e.literal(`CH`),e.literal(`IN`),e.literal(`OV`)]),Rt={rph:e.string(),roomRph:e.optional(e.string()),billingHolder:e.optional(O),masterRecordCode:e.optional(e.string()),name:e.string(),sex:e.union([e.literal(`M`),e.literal(`F`)]),birthDate:e.optional(e.string()),birthPlace:e.optional(e.string()),nationCode:e.optional(e.string()),citizenshipCode:e.optional(e.string()),fiscalCode:e.optional(e.string()),phoneNumber:e.optional(e.string()),eMail:e.optional(e.string()),notes:e.optional(e.array(It)),flagStatus:e.optional(e.string()),offerCode:e.optional(e.string()),idDocInfo:e.optional(e.object({idType:e.optional(e.string()),idCode:e.optional(e.string()),idIssueLocation:e.optional(e.string()),idIssueCounty:e.optional(e.string()),idIssueDate:e.optional(e.string()),idExpireDate:e.optional(e.string())}))},N=e.object({...Rt,categoryCode:Lt}),zt=e.object({...Rt,categoryCode:e.optional(Lt)}),Bt=e.union([e.literal(`CASH`),e.literal(`BANK`),e.literal(`RID`),e.literal(`RIBA`),e.literal(`SPECIFIC_CODE`),e.literal(`NOT_SET`)]),Vt=e.object({customer_PaymentType:e.optional(Bt),customer_SpecPaymentTypeCode:e.optional(e.string())}),Ht=e.union([e.literal(`GROUPED_PAX`),e.literal(`NOT_GROUPED_PAX`),e.literal(`ONE_PAX_ONLY`)]),Ut=e.union([e.literal(`AVES2AVES`),e.literal(`AVES2AVESVIA`),e.literal(`AVES2AVESITA`)]),Wt=h(e.object({createDate:e.optional(e.string()),bookingFileRefCode:e.optional(e.string()),travelAgentCode:e.optional(e.string()),clerkName:e.optional(e.string()),customerDetail:xt,currencyCode:e.optional(e.string()),markupCode:e.optional(e.string()),bookingFileStatus:yt,statisticCodes:e.optional(j),destination:e.optional(bt),bookingFileDescription:e.optional(e.string()),startDate:e.string(),endDate:e.string(),earlyBookingDate:e.optional(e.string()),cupCode:e.optional(e.string()),cigCode:e.optional(e.string()),customerPromoterCode:e.optional(e.string()),billingReferenceCode:e.optional(e.string()),paymentReferenceCode:e.optional(e.string()),bookingFileDocument:e.optional(Dt),financialDeadlineList:e.optional(e.array(Ot)),deadlineList:e.optional(e.array(kt)),paymentList:e.optional(e.array(At)),selectedPackageList:e.optional(e.array(Ft)),selectedServiceList:e.array(M),extraQuotaRefCode:e.optional(e.string()),extraQuoteServiceList:e.optional(e.array(M)),getExtraQuoteFromSystem:e.optional(O),passengerList:e.array(N),noteList:e.optional(e.array(It)),bookingFinancialInfo:e.optional(Vt),bookingFileCode:e.optional(e.string()),groupingPaxPolicy:e.optional(Ht),groupBookingFile:e.optional(O),typeDownloadFile:e.optional(Ut),setBookingFileCodeFromStartDate:e.optional(O)}),E,{listKeys:ae,arrayOfOne:oe}),Gt=_(e.object({RsStatus:A,BookingFileDetail:e.optional(gt),PrintableDocumentsList:e.optional(mt),TotalAmountDetailAfterCancellation:e.optional(at),Base64DocContent:e.optional(e.string())})),P=_(e.object({RsStatus:A})),F=Gt,Kt=e.object({reschedulingCode:e.string(),description:e.optional(e.string()),expireDate:e.optional(e.string())}),qt=e.object({cancelOperationType:e.union([e.literal(`NULLIFY`),e.literal(`DELETE`)]),serviceRefType:e.union([e.literal(`RPH`),e.literal(`FILE`)]),serviceRefValue:e.string()}),Jt=h(e.object({customerRecordCode:e.string(),bookingFileCode:e.string(),currencyCode:e.optional(e.string()),deadlineList:e.optional(e.array(Kt)),selectedPackageDetail:e.optional(Ft),selectedServiceList:e.pipe(e.array(M),e.minLength(1)),cancellableBookedServiceList:e.optional(e.array(qt)),passengerList:e.optional(e.array(zt))}),E,{listKeys:se}),Yt=h(e.object({bookingFileCode:e.string(),bookingFileStartDate:e.string(),customerRecordCode:e.string(),newCustomerRecordCode:e.optional(e.string()),bookingFileReferenceName:e.optional(e.string()),travelAgentCode:e.optional(e.string()),billingReferenceCode:e.optional(e.string()),paymentReferenceCode:e.optional(e.string()),cupCode:e.optional(e.string()),cigCode:e.optional(e.string()),customerPromoterCode:e.optional(e.string()),bookingNote:e.optional(e.string()),passengerList:e.optional(e.array(zt)),statisticCodes:e.optional(j),bookingFinancialInfo:e.optional(Vt),financialDeadlineList:e.optional(e.array(e.object({reschedulingCode:e.string(),expireDate:e.string(),totalAmount:e.string()})))}),E,{listKeys:ce}),Xt=h(e.object({bookingFileCode:e.string(),customerRecordCode:e.string()}),D),Zt=e.union([e.literal(`NOT_SET`),e.literal(`CONSIDER_HOLIDAY`),e.literal(`CONSIDER_HOLIDAY_AND_SATURDAY`)]),Qt=h(e.object({customerRecordCode:e.string(),bookingFileCode:e.string(),fileStatus:e.object({value:He,expiredDate:e.optional(e.string()),optionedFileExpireDatePolicy:e.optional(Zt)}),backOfficeRequest:e.optional(O),bookingFileDocument:e.optional(Dt),penalty:e.optional(e.object({apply:e.optional(O),specificCode:e.optional(e.string())})),simulateCancelAndGetPenaltyAmount:e.optional(O)}),Be),$t=h(e.object({customerRecordCode:e.string(),bookingFileCode:e.string(),bookingServiceRef:e.string(),bookingFileServiceStatus:e.literal(`NULLIFIED`),bookingFileServiceStatusDate:e.optional(e.string())}),D),en=e.union([e.literal(`AbsoluteAmountsInsertion`),e.literal(`FinalAmountToAchieve`),e.literal(`FinalAmountToAchieveWithoutControls`)]),tn=e.object({paymentDate:e.string(),paymentNote:e.optional(e.string()),payerMasterCode:e.optional(e.string()),payerName:e.optional(e.string()),amount:e.string(),paymentType:Ye}),nn=h(e.pipe(e.object({bookingFileCode:e.optional(e.string()),bookingFileRefCode:e.optional(e.string()),paymentUser:e.optional(e.string()),enableMultiplePayments:O,operationType:en,filePaymentList:e.pipe(e.array(tn),e.minLength(1))}),e.check(e=>!!(e.bookingFileCode||e.bookingFileRefCode),`bookingFileCode or bookingFileRefCode is required`)),Fe,{listKeys:le}),I=e.object({minDate:e.string(),maxDate:e.string()}),rn=e.object({value:Ue,expireDate:e.optional(e.string())}),an=e.object({code:e.optional(e.string()),number:e.optional(e.string())}),L={customerRecordCode:e.string(),customerPromoterCode:e.optional(e.string()),getSupplierInfo:e.optional(O),user:e.optional(e.string()),officeCode:e.optional(e.string())},on=e.object({...L,searchType:e.literal(`FILE_CODE`),bookingFileCode:e.string()}),sn=e.object({...L,searchType:e.literal(`PAX_NAME`),firstPaxName:e.string()}),cn=e.object({...L,searchType:e.literal(`PACKAGE_CODE`),packageCode:e.string()}),ln=e.object({...L,searchType:e.literal(`OTHER`),fileStatus:e.optional(rn),startDate:e.optional(I),createdDate:e.optional(I),lastModificationDate:e.optional(I),insurance:e.optional(an),isSearchForB2C:e.optional(O)}),un=e.union([on,sn,cn,ln]),dn=e.pipe(un,e.transform(e=>m(e,Ie))),fn=_(e.object({RsStatus:A,BookingFileList:e.optional(e.object({BookingFileDetail:e.optional(g(gt))}))})),R={SEARCH_REQUEST:`SearchMasterRecordRQ`,SEARCH_RESPONSE:`SearchMasterRecordRS`,UPSERT_REQUEST:`ManageMasterRecordRQ`,UPSERT_RESPONSE:`ManageMasterRecordRS`,BOOKING_REQUEST:`BookFileRQ`,BOOKING_RESPONSE:`BookingFileRS`,MOD_FILE_SERVICES_REQUEST:`ModFileServicesRQ`,MOD_FILE_HEADER_REQUEST:`ModFileHeaderRQ`,MOD_FILE_HEADER_RESPONSE:`ModFileHeaderRS`,CANCEL_FILE_REQUEST:`CancelFileRQ`,CANCEL_FILE_RESPONSE:`CancelFileRS`,SET_STATUS_REQUEST:`SetStatusRQ`,SET_STATUS_RESPONSE:`SetStatusRS`,SET_STATUS_SERVICE_REQUEST:`SetStatusServiceRQ`,SET_STATUS_SERVICE_RESPONSE:`SetStatusServiceRS`,FILE_PAYMENT_LIST_REQUEST:`FilePaymentListRQ`,FILE_PAYMENT_LIST_RESPONSE:`FilePaymentListRS`,AVES_SEARCH_REQUEST:`AvesSearchRQ`,SEARCH_PACKAGE_RESPONSE:`SearchPackageRS`,SEARCH_SERVICES_RESPONSE:`SearchServicesRS`,PACKAGE_DETAIL_REQUEST:`PackageDetailRQ`,PACKAGE_DETAIL_RESPONSE:`PackageDetailRS`,COMMIT_PACKAGE_REQUEST:`CommitPackRQ`,COMMIT_PACKAGE_RESPONSE:`CommitPackRS`,SEARCH_BOOKING_FILE_REQUEST:`SearchFileRQ`,SEARCH_BOOKING_FILE_RESPONSE:`SearchFileRS`};function pn(e,t){return{[e]:t}}const z={search:`/interop/masterRecords/v2/rest/Search`,upsert:`/interop/masterRecords/v2/rest/InsertOrUpdate`,createBooking:`/interop/booking/v2/rest/CreateBookingFile`,modBookingServices:`/interop/booking/v2/rest/ModBookingFileServices`,modBookingHeader:`/interop/booking/v2/rest/ModBookingFileHeader`,cancelBooking:`/interop/booking/v2/rest/CancelBookingFile`,setBookingStatus:`/interop/booking/v2/rest/SetBookingFileStatus`,setBookingServiceStatus:`/interop/booking/v2/rest/SetBookingFileServiceStatus`,insertFilePaymentList:`/interop/booking/v2/rest/InsertFilePaymentList`,searchAvesPackages:`/interop/booking/v2/rest/SearchAvesPackages`,searchTopServices:`/interop/booking/v2/rest/SearchTopServices`,getPackageDetail:`/interop/booking/v2/rest/GetPackageDetail`,commitPackage:`/interop/booking/v2/rest/CommitPackage`,searchBookingFile:`/interop/booking/v2/rest/SearchBookingFile`};var mn=class{transport;constructor(e){this.transport=e}createBooking(e){return this.transport.invokeOp({op:`createBooking`,params:e,apiSchema:Wt,endpoint:z.createBooking,requestRoot:R.BOOKING_REQUEST,responseRoot:R.BOOKING_RESPONSE,responseSchema:Gt})}modBookingServices(e){return this.transport.invokeOp({op:`modBookingServices`,params:e,apiSchema:Jt,endpoint:z.modBookingServices,requestRoot:R.MOD_FILE_SERVICES_REQUEST,responseRoot:R.BOOKING_RESPONSE,responseSchema:F})}modBookingHeader(e){return this.transport.invokeOp({op:`modBookingHeader`,params:e,apiSchema:Yt,endpoint:z.modBookingHeader,requestRoot:R.MOD_FILE_HEADER_REQUEST,responseRoot:R.MOD_FILE_HEADER_RESPONSE,responseSchema:P})}cancelBooking(e){return this.transport.invokeOp({op:`cancelBooking`,params:e,apiSchema:Xt,endpoint:z.cancelBooking,requestRoot:R.CANCEL_FILE_REQUEST,responseRoot:R.CANCEL_FILE_RESPONSE,responseSchema:P})}setBookingStatus(e){return this.transport.invokeOp({op:`setBookingStatus`,params:e,apiSchema:Qt,endpoint:z.setBookingStatus,requestRoot:R.SET_STATUS_REQUEST,responseRoot:R.SET_STATUS_RESPONSE,responseSchema:F})}setBookingServiceStatus(e){return this.transport.invokeOp({op:`setBookingServiceStatus`,params:e,apiSchema:$t,endpoint:z.setBookingServiceStatus,requestRoot:R.SET_STATUS_SERVICE_REQUEST,responseRoot:R.SET_STATUS_SERVICE_RESPONSE,responseSchema:F})}insertFilePaymentList(e){return this.transport.invokeOp({op:`insertFilePaymentList`,params:e,apiSchema:nn,endpoint:z.insertFilePaymentList,requestRoot:R.FILE_PAYMENT_LIST_REQUEST,responseRoot:R.FILE_PAYMENT_LIST_RESPONSE,responseSchema:P})}searchBookingFiles(e){return this.transport.invokeOp({op:`searchBookingFiles`,params:e,apiSchema:dn,endpoint:z.searchBookingFile,requestRoot:R.SEARCH_BOOKING_FILE_REQUEST,responseRoot:R.SEARCH_BOOKING_FILE_RESPONSE,responseSchema:fn})}};const hn=e.union([e.literal(`CASH`),e.literal(`BANK`),e.literal(`RID`),e.literal(`RIBA`),e.literal(`SPECIFIC_CODE`)]),B=e.object({currencyCode:e.optional(e.string()),creditLimit:e.optional(e.string()),c_PaymentType:e.optional(hn),c_SpecPaymentTypeCode:e.optional(e.string()),s_PaymentType:e.optional(hn),s_SpecPaymentTypeCode:e.optional(e.string()),enableElectronicInvoicing:e.optional(e.union([e.literal(`true`),e.literal(`false`),e.boolean()])),electronicInvoicingType:e.optional(e.string())});h(B,y);const gn=v(B,y),V=e.object({idType:e.optional(e.string()),idCode:e.optional(e.string()),idIssueLocation:e.optional(e.string()),idIssueCounty:e.optional(e.string()),idIssueDate:e.optional(e.string()),idExpireDate:e.optional(e.string())});h(V,b);const _n=v(V,b),H=e.object({key:e.string(),value:e.string()});h(e.array(H),S);const vn=v(H,S),yn=e.union([e.literal(`NOT_SET`),e.literal(`FLIGHT`),e.literal(`SHIP`),e.literal(`TRAIN`),e.literal(`RENTCAR`),e.literal(`BUS`),e.literal(`DP_HOTEL`),e.literal(`TO_HOTEL`),e.literal(`TO_TOUR`),e.literal(`TO_HOTEL_AND_TOUR`),e.literal(`DP_AUTO`),e.literal(`DP_GDS_NAVI`),e.literal(`DP_GDS_VOLI`),e.literal(`TOUR_OPERATOR`),e.literal(`TICKETING_EV`),e.literal(`OTHER`)]),U=e.object({supplierRefCode:e.optional(e.string()),companyMainBusinessType:e.optional(e.string()),carrierType:e.optional(yn)});h(U,de);const bn=v(U,de),W=e.union([e.literal(0),e.literal(1)]),xn=e.union([e.literal(`ENABLED`),e.literal(`DISABLED`),e.literal(`WARNING`),e.literal(`BLACKLISTED`)]),Sn=e.union([e.literal(`CUSTOMER`),e.literal(`SUPPLIER`),e.literal(`GENERAL`)]),Cn=e.union([e.literal(`S`),e.literal(`N`),e.literal(`T`),e.literal(`M`)]),G=e.object({acceptProfilingPolicies:e.optional(W),acceptPrivacyPolicies:e.optional(W),acceptNewsletterPolicies:e.optional(W)});h(G,x);const wn=v(G,x),Tn=h(e.object({recordCode:e.optional(e.pipe(e.string(),e.minLength(6),e.maxLength(6))),insertCriteria:e.optional(Cn),createdDate:e.optional(e.string()),recordType:e.optional(e.union([Sn],`CUSTOMER`)),recordStatus:e.optional(e.union([xn],`ENABLED`)),moniker:e.optional(e.string()),name:e.optional(e.string()),extraInfo:e.optional(e.string()),languageCode:e.pipe(e.string(),e.minLength(2),e.maxLength(2)),address:e.optional(e.string()),zipCode:e.optional(e.string()),cityName:e.optional(e.string()),countyCode:e.optional(e.string()),stateCode:e.optional(e.string()),categoryCode:e.optional(e.string()),firstPhoneNumber:e.optional(e.string()),mobilePhoneNumber:e.optional(e.string()),email:e.optional(e.string()),gender:e.optional(e.union([e.literal(`M`),e.literal(`F`)])),birthDate:e.optional(e.string()),birthCity:e.optional(e.string()),birthCounty:e.optional(e.string()),fiscalCode:e.optional(e.string()),vatCode:e.optional(e.string()),thirdPartRecordCode:e.optional(e.string()),idDocumentDetail:e.optional(V),accountPolicies:e.optional(G),financialDetail:e.optional(B),dynamicFields:e.optional(H),supplierRefMasterRecords:e.optional(U)}),fe);_(Tn);const K=e.object({"@RecordCode":e.optional(e.pipe(e.string(),e.minLength(6),e.maxLength(6))),"@InsertCriteria":e.optional(Cn),CreatedDate:e.optional(e.string()),ModifiedDate:e.optional(e.string()),RecordType:e.optional(e.union([e.literal(`CUSTOMER`),e.literal(`SUPPLIER`),e.literal(`GENERAL`)])),LoginType:e.optional(e.string()),RecordStatus:e.optional(xn),Moniker:e.optional(e.string()),Name:e.optional(e.string()),ExtraInfo:e.optional(e.string()),LanguageCode:e.optional(e.pipe(e.string(),e.minLength(1),e.maxLength(2))),Address:e.optional(e.string()),ZipCode:e.optional(e.string()),CityName:e.optional(e.string()),CountyCode:e.optional(e.string()),StateCode:e.optional(e.string()),CategoryCode:e.optional(e.string()),PromoterCode:e.optional(e.string()),FirstPhoneNumber:e.optional(e.string()),MobilePhoneNumber:e.optional(e.string()),Email:e.optional(e.string()),Gender:e.optional(e.union([e.literal(`M`),e.literal(`F`)])),BirthDate:e.optional(e.string()),BirthCity:e.optional(e.string()),BirthCounty:e.optional(e.string()),EncryptedPassword:e.optional(e.union([e.literal(`true`),e.literal(`false`),e.boolean()])),FiscalCode:e.optional(e.string()),VatCode:e.optional(e.string()),ThirdPartRecordCode:e.optional(e.string()),IdDocumentDetail:e.optional(_n),NewsletterDisabled:e.optional(e.union([e.literal(`true`),e.literal(`false`),e.boolean()])),SupplierRefMasterRecords:e.optional(bn),AccountPolicies:e.optional(wn),FinancialDetail:e.optional(gn),DynamicFields:e.optional(vn)}),En=e.object({minDate:e.string(),maxDate:e.string()}),q=e.optional(e.pipe(e.string(),e.minLength(2),e.maxLength(2))),Dn=e.object({searchType:e.literal(`CODE`),recordCode:e.pipe(e.string(),e.minLength(5),e.maxLength(6)),languageCode:q}),On=e.object({searchType:e.literal(`NAME`),name:e.string(),city:e.optional(e.string()),languageCode:q}),kn=e.object({searchType:e.literal(`VATCODE`),vatCode:e.string(),phoneNumber:e.optional(e.string()),languageCode:q}),An=e.object({searchType:e.literal(`ZONE`),zipCode:e.string(),countyCode:e.string(),city:e.optional(e.string()),languageCode:q}),jn=e.object({searchType:e.literal(`CATEGORY`),categoryCode:e.string(),languageCode:q}),Mn=e.object({searchType:e.literal(`EMAIL`),email:e.string(),languageCode:q}),Nn=e.object({searchType:e.literal(`LASTMODDATE`),lastModificationDate:En,languageCode:q}),Pn=e.object({searchType:e.literal(`SEARCH_FIELD`),searchFieldValue:e.string(),languageCode:q}),Fn=e.object({searchType:e.literal(`EXTERNAL_REF_CODE`),searchFieldValue:e.string(),languageCode:q}),In=h(e.union([Dn,On,kn,An,jn,Mn,Nn,Pn,Fn]),pe);e.pipe(e.object({RqHeader:_t,SearchMasterRecord:In}),e.transform(e=>{let{SearchMasterRecord:t,RqHeader:n,...r}=e;return{RqHeader:n,...t,...r}}));const Ln=e.object({MasterRecordDetail:e.optional(e.pipe(e.union([e.array(K),K]),e.transform(e=>{if(e)return Array.isArray(e)?e:[e]})))}),Rn=_(e.object({RsStatus:A,MasterRecordList:e.optional(Ln)}));e.object({RqHeader:_t,MasterRecordDetail:K});const zn=_(e.object({RsStatus:A,MasterRecordDetail:e.optional(K)}));var Bn=class{transport;constructor(e){this.transport=e}search(e){return this.transport.invokeOp({op:`search`,params:e,apiSchema:In,endpoint:z.search,requestRoot:R.SEARCH_REQUEST,responseRoot:R.SEARCH_RESPONSE,responseSchema:Rn})}upsertRecord(e){return this.transport.invokeOp({op:`upsertRecord`,params:e,apiSchema:Tn,bodyKey:`MasterRecordDetail`,endpoint:z.upsert,requestRoot:R.UPSERT_REQUEST,responseRoot:R.UPSERT_RESPONSE,responseSchema:zn})}};const J=e.union([e.string(),e.number(),e.boolean()]),Vn=e.object({"@Code":e.optional(e.string()),"@Name":e.optional(e.string()),ValueCode:e.optional(e.string()),ValueName:e.optional(e.string())}),Hn=e.object({FeatureDetail:e.optional(g(Vn))}),Un=e.object({"@PackageCode":e.optional(e.string()),"@PackageReference":e.optional(e.string()),"@PackageServiceType":e.optional(e.string()),"@ServiceCodeForPackageDetail":e.optional(e.string())}),Wn=e.object({"@ssCode":e.optional(e.string()),FirstDescription:e.optional(e.string()),SubServiceType:e.optional(e.string()),SubServiceLevel:e.optional(J),StartDate:e.optional(e.string()),EndDate:e.optional(e.string())}),Gn=e.object({SubServiceDetail:e.optional(g(Wn))}),Kn=e.object({"@sCode":e.optional(e.string()),FirstDescription:e.optional(e.string()),SecondDescription:e.optional(e.string()),AvesServiceType:e.optional(e.string()),TOServiceType:e.optional(e.string()),StartDate:e.optional(e.string()),EndDate:e.optional(e.string()),RefPackageInfo:e.optional(Un),SubServiceList:e.optional(Gn)}),qn=e.object({ServiceDetail:e.optional(g(Kn))}),Jn=e.object({"@pCode":e.optional(e.string()),FirstDescription:e.optional(e.string()),SecondDescription:e.optional(e.string()),FrequencyType:e.optional(e.string()),ProgramType:e.optional(e.string()),StartValidation:e.optional(e.string()),EndValidation:e.optional(e.string()),StartDate:e.optional(e.string()),EndDate:e.optional(e.string()),BasePrice:e.optional(J),BasePax:e.optional(J),CanCommitPack:e.optional(J),FeatureList:e.optional(Hn),ServiceList:e.optional(qn)}),Yn=e.object({PackageDetail:e.optional(g(Jn))}),Xn=e.union([e.literal(`GREATER_THAN`),e.literal(`GREATER_OR_EQUAL`),e.literal(`EQUAL_TO`),e.literal(`LESS_OR_EQUAL`),e.literal(`LESS_THAN`)]),Zn=e.union([e.literal(`SERVICE`),e.literal(`PROGRAM`),e.literal(`PACKAGE`)]),Qn=e.object({code:e.optional(e.string()),type:e.optional(e.union([e.literal(`CODE`),e.literal(`SUB_LOCALITY`),e.literal(`LOCALITY`),e.literal(`SUB_SUB_ISLAND`),e.literal(`SUB_ISLAND`),e.literal(`ISLAND_COUNTY`),e.literal(`SUB_ARCHIPELAGO`),e.literal(`ARCHIPELAGO`),e.literal(`REGION_STATE`),e.literal(`SUB_SUB_NATION`),e.literal(`SUB_NATION`),e.literal(`NATION`),e.literal(`SUB_SUB_CONTINENT`),e.literal(`SUB_CONTINENT`),e.literal(`CONTINENT`)]))}),$n=e.object({code:e.string(),name:e.optional(e.string())}),er=e.object({getAllDeptDate:e.optional(O),getFlightPlan:e.optional(O),getAllAccomodation:e.optional(O),getRealAvailability:e.optional(O),minStay:e.optional(e.union([e.string(),e.number()])),maxStay:e.optional(e.union([e.string(),e.number()]))}),tr=e.object({compatibleAccomodation:e.optional(O),alternativeAccomodation:e.optional(O)}),nr=e.object({customerRecordCode:e.string(),languageCode:e.string(),currencyCode:e.optional(e.string()),startDate:e.string(),endDate:e.string(),earlyBookingDate:e.optional(e.string()),passengerList:e.pipe(e.array(N),e.minLength(1))}),rr=e.object({baseSearch:nr,avesSearchType:Zn,paxQty:e.union([e.string(),e.number()]),paxQtyCriteria:Xn,discartNotAvailables:e.optional(O),discartNotAvailablesMinSales:e.optional(O),discartNotAvailablesDaysInOut:e.optional(O),discardPriceZero:e.optional(O),discardZeroPriceDays:e.optional(O),destination:e.optional(Qn),objectTypeCode:e.optional(e.string()),featureList:e.optional(e.array($n)),servOrPackCode:e.optional(e.string()),servOrPackDesc:e.optional(e.string()),priceListCode:e.optional(e.string()),costListCode:e.optional(e.string()),suballotmentCode:e.optional(e.string()),markupCode:e.optional(e.string()),statisticCodes:e.optional(j),mergeBoardAndAccomodation:e.optional(O),packageParams:e.optional(er),topServiceParams:e.optional(tr),getDocumentation:e.optional(O)});function ir(e){let{baseSearch:t,...n}=e,{passengerList:r,...i}=t;return{BaseSearch:m({...i,passengerList:ie({passengerList:r},{listKeys:[`passengerList`]}).passengerList},Re),...m(n,ze,{listKeys:[`featureList`]})}}const ar=e.pipe(rr,e.transform(ir)),or=_(e.object({RsStatus:A,PackageList:e.optional(Yn)})),sr=_(e.object({RsStatus:A,ServiceList:e.optional(qn)})),cr=e.object({serviceCode:e.string(),packageRow:e.string()}),lr=e.object({customerRecordCode:e.string(),languageCode:e.optional(e.string()),currencyCode:e.optional(e.string()),packageCode:e.string(),startDate:e.string(),endDate:e.string(),priceListCode:e.optional(e.string()),costListCode:e.optional(e.string()),markupCode:e.optional(e.string()),statisticCodes:e.optional(j),selectedServiceList:e.pipe(e.array(cr),e.minLength(1)),passengerList:e.optional(e.array(N))}),ur=[`selectedServiceList`,`passengerList`],dr=e.pipe(lr,e.transform(e=>m(e,Le,{listKeys:ur}))),fr=_(e.object({RsStatus:A,PackageDetail:e.optional(Jn)})),pr=h(e.object({packageCode:e.string()}),D),mr=_(e.object({RsStatus:A}));var hr=class{transport;constructor(e){this.transport=e}searchPackages(e){return this.transport.invokeOp({op:`searchPackages`,params:e,apiSchema:ar,endpoint:z.searchAvesPackages,requestRoot:R.AVES_SEARCH_REQUEST,responseRoot:R.SEARCH_PACKAGE_RESPONSE,responseSchema:or})}searchTopServices(e){return this.transport.invokeOp({op:`searchTopServices`,params:e,apiSchema:ar,endpoint:z.searchTopServices,requestRoot:R.AVES_SEARCH_REQUEST,responseRoot:R.SEARCH_SERVICES_RESPONSE,responseSchema:sr})}getPackageDetail(e){return this.transport.invokeOp({op:`getPackageDetail`,params:e,apiSchema:dr,endpoint:z.getPackageDetail,requestRoot:R.PACKAGE_DETAIL_REQUEST,responseRoot:R.PACKAGE_DETAIL_RESPONSE,responseSchema:fr})}commitPackage(e){return this.transport.invokeOp({op:`commitPackage`,params:e,apiSchema:pr,endpoint:z.commitPackage,requestRoot:R.COMMIT_PACKAGE_REQUEST,responseRoot:R.COMMIT_PACKAGE_RESPONSE,responseSchema:mr})}};const Y={VALIDATION:`validation`,API:`api`,UNKNOWN:`unknown`};var X=class extends Error{kind;message;status;code;constructor(e,t,n,r){super(t),this.kind=e,this.message=t,this.status=n,this.code=r,this.name=`AvesError`,this.status=n?.toLowerCase(),this.code=this.parseCode(r)}parseCode(e){return typeof e==`string`?Number.parseInt(e,10):e??0}};function Z(e){return new X(Y.VALIDATION,e)}function Q(e,t,n){return new X(Y.API,e,t,n)}function gr(e){return new X(Y.UNKNOWN,e)}function _r(e){return e.map(vr).join(`; `)}function vr(e){let t=yr(e.path),n=e.message??`Invalid value`;return t?`${t}: ${n}`:n}function yr(e){if(!e||e.length===0)return;let t=e.map(br).filter(e=>e!==void 0);return t.length>0?t.join(`.`):void 0}function br(e){if(typeof e==`string`||typeof e==`number`)return String(e);if(typeof e==`object`&&e&&`key`in e)return String(e.key)}function xr(e){return e instanceof Error&&e.name===`AbortError`}function Sr(e){return{success:!0,data:e}}function $(e){return{success:!1,error:e}}function Cr(e){return e===200}function wr(e){let t=new AbortController;if(!e||e<=0)return{signal:t.signal};let n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function Tr(e,t){try{let n=new URL(e),r=(n.pathname.endsWith(`/`)?n.pathname.slice(0,-1):n.pathname)+t;return new URL(r,n)}catch(e){throw new X(`validation`,`Invalid baseURL: ${e instanceof Error?e.message:`Invalid URL format`}`)}}function Er(e,t){if(!t.startsWith(`/`))throw new X(`validation`,`Invalid endpoint: endpoint must start with '/' but got '${t}'`);let n=Tr(e.replace(/\/$/,``),t);if(n.protocol!==`http:`&&n.protocol!==`https:`)throw new X(`validation`,`Invalid protocol: baseURL must use http:// or https:// but got '${n.protocol}'`);return n.toString()}const Dr={ignoreAttributes:!1,attributeNamePrefix:`@`,parseAttributeValue:!1,trimValues:!0,ignoreNameSpace:!0,removeNSPrefix:!0,parseTagValue:!1},Or={ignoreAttributes:!1,attributeNamePrefix:`@`,suppressEmptyNode:!0},kr=new o(Dr),Ar=new a(Or);function jr(e){try{return Ar.build(e)}catch(e){throw new X(`validation`,`Failed to convert JSON to XML: ${e instanceof Error?e.message:`Unknown error`}`)}}function Mr(e){try{return kr.parse(e)}catch(e){throw new X(`validation`,`Failed to convert XML to JSON: ${e instanceof Error?e.message:`Unknown error`}`)}}var Nr=class{options;constructor(e){this.options=e}createRqHeader(){return{"@HostID":this.options.hostID,"@Xtoken":this.options.xtoken,"@Interface":`WEB`,"@UserName":`WEB`,...this.options.languageCode&&{"@LanguageCode":this.options.languageCode}}}toAvesError(e,n){return e instanceof X?e:e instanceof t?Z(`Validation error: ${_r(e.issues)}`):e instanceof Error?gr(e.message):gr(n)}handleApiStatus(e){let{rsStatus:t}=e;return t?.status===`OK`?Sr(e):$(Q(t.errorDescription??``,t.status,t.errorCode))}async request(e,t,n,a){let{signal:o,clear:s}=wr(this.options.timeoutMs??3e4);try{let s=await i(Er(this.options.baseURL,e),{method:`POST`,headers:{"Content-Type":`application/xml`},body:jr(t),signal:o}),c=await s.body.text();if(!Cr(s.statusCode))return $(Q(c,`ERROR`,s.statusCode));let l=Mr(c)[n];if(!l)return $(Z(`Invalid response structure: missing root element '${n}'`));let u=r(a,l);return u.success?this.handleApiStatus(u.output):$(Z(`Invalid response format: ${_r(u.issues)}`))}catch(e){return xr(e)?$(Q(`Request timed out`,`TIMEOUT`)):$(this.toAvesError(e,`Unknown error occurred`))}finally{s?.()}}async invokeOp(e){try{let t=n(e.apiSchema,e.params),r=e.bodyKey?{[e.bodyKey]:t}:t;return this.request(e.endpoint,pn(e.requestRoot,{RqHeader:this.createRqHeader(),...r}),e.responseRoot,e.responseSchema)}catch(t){return $(this.toAvesError(t,`Validation error occurred during ${e.op}`))}}};const Pr=[`master`,`booking`,`packages`];function Fr(e){for(let t of Pr){let n=e[t],r=Object.getPrototypeOf(n);for(let t of Object.getOwnPropertyNames(r)){if(t===`constructor`||t in e)continue;let i=Object.getOwnPropertyDescriptor(r,t)?.value;typeof i==`function`&&Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:i.bind(n)})}}}const Ir=class{transport;master;booking;packages;constructor(e,t={}){this.transport=t.transport??new Nr(e),this.master=t.master??new Bn(this.transport),this.booking=t.booking??new mn(this.transport),this.packages=t.packages??new hr(this.transport),Fr(this)}};export{Ir as AvesClient,X as AvesError,Nr as AvesTransport,mn as BookingClient,Bn as MasterRecordsClient,hr as PackageCatalogClient};
|
|
1
|
+
import*as e from"valibot";import{ValiError as t,parse as n,safeParse as r}from"valibot";import{request as i}from"undici";import a from"fast-xml-builder";import{XMLParser as o}from"fast-xml-parser";function s(e){return e.charAt(0).toUpperCase()+e.slice(1)}function c(e){return e.charAt(0).toLowerCase()+e.slice(1)}function l(e){return e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error}const u=new Map([[`toServiceType`,`TOServiceType`],[`rph`,`RPH`]]),ee=new Map([[`TOServiceType`,`toServiceType`],[`RPH`,`rph`]]);function te(e,t,n){return n?`@${t}`:`@${e}`}function d(e,t){if(!e||typeof e!=`object`||l(e))return e;if(Array.isArray(e))return e.map(e=>d(e,t));let n=t?.attrs,r=t?.preserveCamel,i={};for(let[a,o]of Object.entries(e)){let e=u.get(a)??s(a),c=n?.includes(a)?te(e,a,!!r?.includes(a)):e,l=t?.children?.[a];i[c]=ne(o,e=>d(e,l))}return i}function f(e){if(typeof e!=`object`||!e||l(e))return e;if(Array.isArray(e))return e.map(e=>f(e));let t={};for(let[n,r]of Object.entries(e)){let e=n.startsWith(`@`)?n.slice(1):n,i=ee.get(e)??c(e);t[i]=ne(r,f)}return t}function ne(e,t){return!e||typeof e!=`object`||l(e)?e:Array.isArray(e)?e.map(e=>ne(e,t)):t(e)}const re={financialDeadlineList:`deadlineDetail`};function ie(e){return re[e]??e.replace(/List$/,`Detail`)}function ae(e,{listKeys:t,arrayOfOne:n}){let r={...e},i=n??new Set;for(let e of t){let t=Reflect.get(r,e);if(!Array.isArray(t))continue;let n=ie(e);Reflect.set(r,e,i.has(e)?t.map(e=>({[n]:e})):{[n]:t})}return r}const oe=[`selectedServiceList`,`passengerList`,`selectedPackageList`,`extraQuoteServiceList`,`deadlineList`,`financialDeadlineList`,`paymentList`,`noteList`],se=new Set([`selectedServiceList`,`passengerList`]),ce=[`selectedServiceList`,`passengerList`,`cancellableBookedServiceList`,`deadlineList`],le=[`passengerList`,`financialDeadlineList`],ue=[`filePaymentList`];function de(e){let t=e=>{if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(t);let n={};for(let[r,i]of Object.entries(e)){if(r===`paxAssociated`&&Array.isArray(i)){if(!i.length){n[r]=``;continue}if(i.every(e=>typeof e==`string`)){n[r]=i.map(e=>({pax:e}));continue}}n[r]=t(i)}return n};return t(e)}function p(e,t,n){return d(de(n?ae(e,n):e),t)}function m(t,n,r){return e.pipe(t,e.transform(e=>p(e,n,r)))}function fe(t){return e.pipe(e.union([e.array(t),t]),e.transform(e=>Array.isArray(e)?e:[e]))}function h(t,n){let r=e.optional(fe(n));return e.pipe(e.object({[t]:r}),e.transform(e=>e[t]??[]))}function g(t){return e.pipe(t,e.transform(e=>f(e)))}function pe(e){return t=>{if(typeof t!=`object`||!t)return t;let n=t,r=n[e],{[e]:i,...a}=n;return!r||typeof r!=`object`||Array.isArray(r)?a:{...a,...r}}}function me(t,n){return e.pipe(g(t),e.transform(e=>pe(n)(e)))}function he(t,n){let r=e.object({value:t,...n??{}});return e.pipe(e.union([t,r]),e.transform(e=>typeof e==`object`&&e?e:{value:e}))}function ge(e,t){return n=>{let r=Reflect.get(n,e),i=Reflect.get(n,t),a={...n};return Reflect.deleteProperty(a,e),Reflect.set(a,t,i??(Array.isArray(r)?r[0]:void 0)),a}}function _e(e){let{customerRecordCode:t,customerDetail:n,...r}=e;return{...r,customerDetail:{...n,recordCode:n?.recordCode??t}}}function ve(t,n={}){let r={},i=n.attrs??[],a=n.preserveCamel??[];for(let e in t.entries){let n=e.charAt(0).toUpperCase()+e.slice(1),o=i.includes(e)?a.includes(e)?`@${e}`:`@${n}`:n;r[o]=t.entries[e]}return e.object(r)}function _(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t;for(let e of r)if(n[e]!==void 0&&n[e]!==null){t=n[e];break}for(let t of r)t!==e&&delete n[t];t===void 0?delete n[e]:n[e]=t}return n}function v(e,t){return{api:m(e,t),validation:ve(e,t)}}const ye={attrs:[`currencyCode`,`creditLimit`,`c_PaymentType`,`c_SpecPaymentTypeCode`,`s_PaymentType`,`s_SpecPaymentTypeCode`,`enableElectronicInvoicing`,`electronicInvoicingType`]},y={attrs:[`idType`,`idCode`,`idIssueLocation`,`idIssueCounty`,`idIssueDate`,`idExpireDate`]},be={attrs:[`acceptProfilingPolicies`,`acceptPrivacyPolicies`,`acceptNewsletterPolicies`]},b={attrs:[`key`,`value`]},xe={attrs:[`supplierRefCode`,`companyMainBusinessType`,`carrierType`]},Se={attrs:[`recordCode`,`insertCriteria`],children:{financialDetail:ye,idDocumentDetail:y,accountPolicies:be,dynamicFields:b,supplierRefMasterRecords:xe}},Ce={children:{lastModificationDate:{attrs:[`minDate`,`maxDate`]}}},x={attrs:[`sCode1`,`sCode2`,`sCode3`,`sCode4`,`sCode5`,`sCode6`],preserveCamel:[`sCode1`,`sCode2`,`sCode3`,`sCode4`,`sCode5`,`sCode6`]},we={attrs:[`code`,`iataCode`,`nationCode`,`type`]},S={attrs:[`nType`,`title`]},Te={attrs:[`rph`,`roomRph`,`billingHolder`],children:{notes:{children:{noteDetail:S}},idDocInfo:y}},Ee={attrs:[`currencyCode`,`exchangeRate`,`cost`,`costTax`,`costType`,`vatCostCurrencyCode`,`price`,`priceTax`,`priceType`]},De={attrs:[`pCode`,`startDate`,`endDate`,`getServicesFromPackage`],preserveCamel:[`pCode`]},Oe={children:{selectedServiceDetail:{attrs:[`sCode`,`ssCode`,`supplierMasterCode`,`supplierName`,`supplierMasterSearchField`,`supplierFiscalCode`],preserveCamel:[`sCode`,`ssCode`],children:{serviceFare:Ee,avesServiceInfo:{children:{serviceFare:Ee}},noteList:{children:{noteDetail:S}}}}}},C={children:{passengerDetail:Te}},ke={children:{selectedPackageDetail:De}},Ae={children:{deadlineDetail:{attrs:[`deadlineCode`,`description`,`expireDate`,`reschedulingCode`]}}},je={children:{deadlineDetail:{attrs:[`reschedulingCode`,`expireDate`,`totalAmount`]}}},Me={children:{paymentDetail:{attrs:[`paymentDate`,`paumentNote`,`amount`,`paymentUser`,`paymentType`]}}},Ne={children:{filePaymentDetail:{attrs:[`paymentDate`,`paymentNote`,`payerMasterCode`,`payerName`,`amount`,`paymentType`]}}},Pe={children:{cancellableBookedServiceDetail:{attrs:[`cancelOperationType`,`serviceRefType`,`serviceRefValue`]}}},Fe={children:{noteDetail:S}},Ie={attrs:[`printDoc`,`sendDocViaEmail`],children:{infoDocumentsToPrint:{children:{infoDocumentToPrint:{children:{documentCustomizablePrintParameters:{attrs:[`makeDocumentTo`,`fillInCode`]}}}}}}},Le={attrs:[`value`,`expiredDate`]},Re={attrs:[`recordCode`]},ze={attrs:[`customer_PaymentType`,`customer_SpecPaymentTypeCode`]},Be={attrs:[`getAllDeptDate`,`getFlightPlan`,`getAllAccomodation`,`getRealAvailability`]},Ve={attrs:[`compatibleAccomodation`,`alternativeAccomodation`]},He={children:{featureDetail:{attrs:[`code`,`name`]}}},Ue={attrs:[`value`,`expiredDate`,`optionedFileExpireDatePolicy`]},We={attrs:[`apply`,`specificCode`]},w={children:{customerDetail:Re,bookingFileStatus:Le,statisticCodes:x,destination:we,bookingFileDocument:Ie,bookingFinancialInfo:ze,selectedPackageDetail:De,selectedPackageList:ke,selectedServiceList:Oe,extraQuoteServiceList:Oe,passengerList:C,deadlineList:Ae,financialDeadlineList:je,paymentList:Me,cancellableBookedServiceList:Pe,noteList:Fe}},Ge={attrs:[`paymentUser`],children:{filePaymentList:Ne}},Ke={children:{fileStatus:{attrs:[`value`,`expireDate`]},startDate:{attrs:[`minDate`,`maxDate`]},createdDate:{attrs:[`minDate`,`maxDate`]},lastModificationDate:{attrs:[`minDate`,`maxDate`]},insurance:{attrs:[`code`,`number`]}}},qe={children:{statisticCodes:x,selectedServiceList:{children:{selectedServiceDetail:{attrs:[`serviceCode`,`packageRow`]}}},passengerList:C}},Je={children:{passengerList:C}},Ye={children:{destination:we,statisticCodes:x,packageParams:Be,topServiceParams:Ve,featureList:He}},Xe={children:{fileStatus:Ue,penalty:We,bookingFileDocument:Ie}},T={};function E(t){let n=Object.values(t);return e.picklist(n)}const Ze={M:`M`,F:`F`},D=E(Ze),Qe={OK:`OK`,ERROR:`ERROR`,WARNING:`WARNING`,TIMEOUT:`TIMEOUT`},$e=E(Qe),O={CODE:`CODE`,NAME:`NAME`,VATCODE:`VATCODE`,ZONE:`ZONE`,CATEGORY:`CATEGORY`,EMAIL:`EMAIL`,LASTMODDATE:`LASTMODDATE`,SEARCH_FIELD:`SEARCH_FIELD`,EXTERNAL_REF_CODE:`EXTERNAL_REF_CODE`},et=E(O),tt={CUSTOMER:`CUSTOMER`,SUPPLIER:`SUPPLIER`,GENERAL:`GENERAL`},nt=E(tt),rt={ENABLED:`ENABLED`,DISABLED:`DISABLED`,WARNING:`WARNING`,BLACKLISTED:`BLACKLISTED`},it=E(rt),at={S:`S`,N:`N`,T:`T`,M:`M`},ot=E(at),st={CASH:`CASH`,BANK:`BANK`,RID:`RID`,RIBA:`RIBA`,SPECIFIC_CODE:`SPECIFIC_CODE`},ct=E(st),lt={NOT_SET:`NOT_SET`,FLIGHT:`FLIGHT`,SHIP:`SHIP`,TRAIN:`TRAIN`,RENTCAR:`RENTCAR`,BUS:`BUS`,DP_HOTEL:`DP_HOTEL`,TO_HOTEL:`TO_HOTEL`,TO_TOUR:`TO_TOUR`,TO_HOTEL_AND_TOUR:`TO_HOTEL_AND_TOUR`,DP_AUTO:`DP_AUTO`,DP_GDS_NAVI:`DP_GDS_NAVI`,DP_GDS_VOLI:`DP_GDS_VOLI`,TOUR_OPERATOR:`TOUR_OPERATOR`,TICKETING_EV:`TICKETING_EV`,OTHER:`OTHER`},ut=E(lt),dt={QUOTATION:`QUOTATION`,WORK_IN_PROGRESS:`WORK_IN_PROGRESS`,CONFIRMED:`CONFIRMED`,OPTIONED:`OPTIONED`,CANCELED:`CANCELED`},ft=E(dt),pt={...dt,NULLIFIED:`NULLIFIED`},mt=E(pt),k={QUOTATION:`QUOTATION`,WORK_IN_PROGRESS:`WORK_IN_PROGRESS`,CONFIRM:`CONFIRM`,CONFIRMED:`CONFIRMED`,OPTION:`OPTION`,OPTIONED:`OPTIONED`,REQUEST:`REQUEST`,REQUESTED:`REQUESTED`,NULLIFIED:`NULLIFIED`,CANCELED:`CANCELED`},ht=E(k),gt={TOP:`TOP`,TOP_SS:`TOP_SS`,ADV:`ADV`,GRP:`GRP`,OTHER:`OTHER`},_t=E(gt),vt={ACCOMODATION:`ACCOMODATION`,TRANSPORT:`TRANSPORT`,CHARTER:`CHARTER`,TRANSFER:`TRANSFER`,PULLMAN:`PULLMAN`,FERRY:`FERRY`,CRUISE:`CRUISE`,INSURANCE:`INSURANCE`,EXTRAFEE:`EXTRAFEE`,PENALTY:`PENALTY`,PROMO:`PROMO`,OTHER:`OTHER`,NOT_SET:`NOT_SET`,RESIDENCE:`RESIDENCE`},yt=E(vt),bt={REQUEST:`REQUEST`,ALLOTMENT_REQUEST:`ALLOTMENT_REQUEST`,CONFIRMED_REQUEST:`CONFIRMED_REQUEST`,CONFIRMED_EXTRA_ALLOTMENT:`CONFIRMED_EXTRA_ALLOTMENT`,WAITLISTED:`WAITLISTED`,ALLOTMENT:`ALLOTMENT`,REFUSED:`REFUSED`,NULLIFIED:`NULLIFIED`,CANCELED:`CANCELED`,MESSAGE:`MESSAGE`},xt=E(bt),St={C:`C`,B:`B`,D:`D`,T:`T`,P:`P`,R:`R`,A:`A`,H:`H`,I:`I`,J:`J`,K:`K`,L:`L`,M:`M`,N:`N`,O:`O`,Q:`Q`,S:`S`,U:`U`,V:`V`},A=E(St),Ct={CASH:`CASH`,BANK:`BANK`,RID:`RID`,RIBA:`RIBA`,SPECIFIC_CODE:`SPECIFIC_CODE`,NOT_SET:`NOT_SET`},wt=E(Ct),Tt={AD:`AD`,CH:`CH`,IN:`IN`,OV:`OV`},Et=E(Tt),Dt={NULLIFY:`NULLIFY`,DELETE:`DELETE`},Ot=E(Dt),kt={RPH:`RPH`,FILE:`FILE`},At=E(kt),jt={NOT_SET:`NOT_SET`,CONSIDER_HOLIDAY:`CONSIDER_HOLIDAY`,CONSIDER_HOLIDAY_AND_SATURDAY:`CONSIDER_HOLIDAY_AND_SATURDAY`},Mt=E(jt),Nt={AbsoluteAmountsInsertion:`AbsoluteAmountsInsertion`,FinalAmountToAchieve:`FinalAmountToAchieve`,FinalAmountToAchieveWithoutControls:`FinalAmountToAchieveWithoutControls`},Pt=E(Nt),Ft={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`},It=E(Ft),Lt={BOOKING_CUSTOMER:`BOOKING_CUSTOMER`,FIRST_PASSENGER:`FIRST_PASSENGER`},Rt=E(Lt),zt={PAX_QTY_DAY:`PAX_QTY_DAY`,PAX_QTY_NIGHT:`PAX_QTY_NIGHT`,PAX_QTY_WEEK:`PAX_QTY_WEEK`,PAX_QTY:`PAX_QTY`,PAX_DAY:`PAX_DAY`,PAX_NIGHT:`PAX_NIGHT`,PAX_WEEK:`PAX_WEEK`,PAX:`PAX`,QTY_DAY:`QTY_DAY`,QTY_NIGHT:`QTY_NIGHT`,QTY_WEE:`QTY_WEE`,QTY:`QTY`,DAY:`DAY`,NIGHT:`NIGHT`,WEEK:`WEEK`,FORFAIT:`FORFAIT`},Bt=E(zt),Vt={GROUPED_PAX:`GROUPED_PAX`,NOT_GROUPED_PAX:`NOT_GROUPED_PAX`,ONE_PAX_ONLY:`ONE_PAX_ONLY`},Ht=E(Vt),Ut={AVES2AVES:`AVES2AVES`,AVES2AVESVIA:`AVES2AVESVIA`,AVES2AVESITA:`AVES2AVESITA`},Wt=E(Ut),j={FILE_CODE:`FILE_CODE`,PAX_NAME:`PAX_NAME`,PACKAGE_CODE:`PACKAGE_CODE`,OTHER:`OTHER`},Gt=E(j),M={SERVICE:`SERVICE`,PROGRAM:`PROGRAM`,PACKAGE:`PACKAGE`},Kt=E(M),N={GREATER_THAN:`GREATER_THAN`,GREATER_OR_EQUAL:`GREATER_OR_EQUAL`,EQUAL_TO:`EQUAL_TO`,LESS_OR_EQUAL:`LESS_OR_EQUAL`,LESS_THAN:`LESS_THAN`},qt=E(N),Jt={CODE:`CODE`,SUB_LOCALITY:`SUB_LOCALITY`,LOCALITY:`LOCALITY`,SUB_SUB_ISLAND:`SUB_SUB_ISLAND`,SUB_ISLAND:`SUB_ISLAND`,ISLAND_COUNTY:`ISLAND_COUNTY`,SUB_ARCHIPELAGO:`SUB_ARCHIPELAGO`,ARCHIPELAGO:`ARCHIPELAGO`,REGION_STATE:`REGION_STATE`,SUB_SUB_NATION:`SUB_SUB_NATION`,SUB_NATION:`SUB_NATION`,NATION:`NATION`,SUB_SUB_CONTINENT:`SUB_SUB_CONTINENT`,SUB_CONTINENT:`SUB_CONTINENT`,CONTINENT:`CONTINENT`},Yt=E(Jt),P=e.union([e.literal(`true`),e.literal(`false`),e.boolean()]),Xt={[k.CONFIRM]:`CONFIRMED`,[k.OPTION]:`OPTIONED`,[k.REQUESTED]:`REQUEST`};function Zt(e){return e in Xt?Xt[e]:e}const Qt=e.pipe(e.string(),e.minLength(2),e.maxLength(2)),F=e.optional(Qt),I=e.union([e.string(),e.number()]),L=e.union([e.string(),e.number(),e.boolean()]),R=e.object({minDate:e.string(),maxDate:e.string()}),$t=e.object({"@HostID":e.pipe(e.string(),e.minLength(6),e.maxLength(6)),"@Xtoken":e.string(),"@Interface":e.literal(`WEB`),"@UserName":e.literal(`WEB`),"@LanguageCode":F}),en=e.optional(e.pipe(e.string(),e.transform(e=>e.split(`,`)))),z=e.pipe(e.object({"@Status":$e,ErrorCode:e.optional(e.pipe(I,e.transform(e=>Number(e)))),ErrorDescription:e.optional(e.string()),Warnings:en}),e.transform(e=>({status:e[`@Status`],errorCode:e.ErrorCode,errorDescription:e.ErrorDescription,warnings:e.Warnings}))),tn=g(e.object({RsStatus:z}));function B(t,n){let r={[t]:e.optional(n)};return g(e.object({RsStatus:z,...r}))}const nn=e.pipe(e.object({"@Value":ht,"@ExpiredDate":e.optional(e.string()),"@ExpireDate":e.optional(e.string())}),e.transform(e=>({..._(e,{"@ExpiredDate":[`@ExpiredDate`,`@ExpireDate`]}),"@Value":Zt(e[`@Value`])}))),rn=h(`PricePerPaxDetail`,e.object({"@PaxRef":e.string(),"@Price":I})),an=e.object({"@CommissionCode":e.optional(e.string()),"@CommissionPercentage":e.optional(I),"@CommissionAmount":e.optional(I),"@PriceListCode":e.optional(e.string()),"@CostListCode":e.optional(e.string()),"@ServiceTotalPrice":e.optional(I),PaxPriceList:e.optional(rn)}),on=e.object({"@Code":e.optional(e.string()),"@Name":e.optional(e.string()),"@Email":e.optional(e.string()),"@LanguageCode":e.optional(e.string())}),sn=e.object({"@Code":e.optional(e.string()),"@Description":e.optional(e.string())}),cn=e.object({"@RPH":e.string(),"@ServiceCode":e.optional(e.string()),"@FromExternalProvider":e.optional(I),"@isFromExternalProvider":e.optional(I),AvesServiceType:e.optional(_t),TOServiceType:e.optional(yt),FirstDescription:e.optional(e.string()),SecondDescription:e.optional(e.string()),ThirdDescription:e.optional(e.string()),FourthDescription:e.optional(e.string()),ServiceStatus:e.optional(xt),StartDate:e.optional(e.string()),EndDate:e.optional(e.string()),Qty:e.optional(I),Pax:e.optional(I),PeriodType:e.optional(e.string()),PaxMultiplier:e.optional(e.string()),ExternalProviderCode:e.optional(e.string()),WebStatisticCode:e.optional(e.string()),WebStatisticDescription:e.optional(e.string()),WebStatistic:e.optional(sn),SupplierInfo:e.optional(on),ServiceTotalAmountDetail:e.optional(an)}),ln=h(`BookedServiceDetail`,e.pipe(cn,e.transform(e=>_(e,{"@FromExternalProvider":[`@FromExternalProvider`,`@isFromExternalProvider`]})))),un=e.object({"@CurrencyCode":e.optional(e.string()),"@TotalAmountBeforeDiscount":e.optional(I),"@TotalAmountAfterDiscount":e.optional(I),"@TotalDiscount":e.optional(I),"@TotalAmountWithoutVat":e.optional(I),"@DueAmount":e.optional(I),"@PaiedAmount":e.optional(I),"@Balance":e.optional(I)}),dn=h(`PassengerDetail`,e.object({"@RPH":e.string(),"@RoomRPH":e.optional(e.string()),"@BillingHolder":e.optional(I),Name:e.optional(e.string()),CategoryCode:e.optional(e.string()),Sex:e.optional(e.string()),BirthDate:e.optional(e.string()),BirthPlace:e.optional(e.string()),NationCode:e.optional(e.string()),CitizenshipCode:e.optional(e.string()),FiscalCode:e.optional(e.string()),PhoneNumber:e.optional(e.string()),EMail:e.optional(e.string()),MasterRecordCode:e.optional(e.string())})),fn=e.object({"@ReschedulingCode":e.optional(e.string()),"@ExpireDate":e.optional(e.string()),"@TotalAmount":e.optional(I),ReschedulingCode:e.optional(e.string()),ExpireDate:e.optional(e.string()),TotalAmount:e.optional(I)}),pn=h(`DeadlineDetail`,e.pipe(fn,e.transform(e=>_(e,{"@ReschedulingCode":[`@ReschedulingCode`,`ReschedulingCode`],"@ExpireDate":[`@ExpireDate`,`ExpireDate`],"@TotalAmount":[`@TotalAmount`,`TotalAmount`]})))),mn=h(`StoredDocumentDetail`,e.object({DocumentRefCode:e.optional(e.string()),DocumentType:e.optional(e.string()),DocumentName:e.optional(e.string()),ArchiviationDescription:e.optional(e.string())})),hn=h(`PrintableDocumentDetail`,e.object({DocumentType:e.optional(e.string()),DocumentName:e.optional(e.string()),Enabled:e.optional(I)})),gn=e.object({"@BookingFileCode":e.optional(e.string()),BookingFileCode:e.optional(e.string()),CustomerRecordCode:e.optional(e.string()),CustomerName:e.optional(e.string()),CustomerEmail:e.optional(e.string()),TravelAgencyName:e.optional(e.string()),TravelAgencyEmail:e.optional(e.string()),BookingFileStatus:e.optional(nn),Description:e.optional(e.string()),Nation:e.optional(e.string()),Destination:e.optional(e.string()),CreationDate:e.optional(e.string()),FirstConfirmationDate:e.optional(e.string()),StartDate:e.optional(e.string()),EndDate:e.optional(e.string()),PackageCode:e.optional(e.string()),BookedServiceList:e.optional(ln),TotalAmountDetail:e.optional(un),PaxNumber:e.optional(I),PassengerList:e.optional(dn),Reference:e.optional(e.string()),ClerkName:e.optional(e.string()),StoredDocumentsList:e.optional(mn),PrintableDocumentsList:e.optional(hn),FinancialDeadlineList:e.optional(pn)}),_n=e.pipe(gn,e.transform(e=>_(e,{"@BookingFileCode":[`@BookingFileCode`,`BookingFileCode`]}))),vn=ct,yn=e.object({currencyCode:e.optional(e.string()),creditLimit:e.optional(e.string()),c_PaymentType:e.optional(vn),c_SpecPaymentTypeCode:e.optional(e.string()),s_PaymentType:e.optional(vn),s_SpecPaymentTypeCode:e.optional(e.string()),enableElectronicInvoicing:e.optional(P),electronicInvoicingType:e.optional(e.string())}),bn=v(yn,ye);bn.api;const xn=bn.validation,V=e.object({idType:e.optional(e.string()),idCode:e.optional(e.string()),idIssueLocation:e.optional(e.string()),idIssueCounty:e.optional(e.string()),idIssueDate:e.optional(e.string()),idExpireDate:e.optional(e.string())}),Sn=v(V,y);Sn.api;const Cn=Sn.validation,H=e.object({key:e.string(),value:e.string()});m(e.array(H),b);const wn=ve(H,b),Tn=e.object({supplierRefCode:e.optional(e.string()),companyMainBusinessType:e.optional(e.string()),carrierType:e.optional(ut)}),En=v(Tn,xe);En.api;const Dn=En.validation,U=e.union([e.literal(0),e.literal(1)]),On=it,kn=nt,An=ot,jn=e.object({acceptProfilingPolicies:e.optional(U),acceptPrivacyPolicies:e.optional(U),acceptNewsletterPolicies:e.optional(U)}),Mn=v(jn,be);Mn.api;const Nn=Mn.validation,Pn=m(e.object({recordCode:e.optional(e.pipe(e.string(),e.minLength(6),e.maxLength(6))),insertCriteria:e.optional(An),createdDate:e.optional(e.string()),recordType:e.optional(e.union([kn],tt.CUSTOMER)),recordStatus:e.optional(e.union([On],rt.ENABLED)),moniker:e.optional(e.string()),name:e.optional(e.string()),extraInfo:e.optional(e.string()),languageCode:Qt,address:e.optional(e.string()),zipCode:e.optional(e.string()),cityName:e.optional(e.string()),countyCode:e.optional(e.string()),stateCode:e.optional(e.string()),categoryCode:e.optional(e.string()),firstPhoneNumber:e.optional(e.string()),mobilePhoneNumber:e.optional(e.string()),email:e.optional(e.string()),gender:e.optional(D),birthDate:e.optional(e.string()),birthCity:e.optional(e.string()),birthCounty:e.optional(e.string()),fiscalCode:e.optional(e.string()),vatCode:e.optional(e.string()),thirdPartRecordCode:e.optional(e.string()),idDocumentDetail:e.optional(V),accountPolicies:e.optional(jn),financialDetail:e.optional(yn),dynamicFields:e.optional(H),supplierRefMasterRecords:e.optional(Tn)}),Se);g(Pn);const W=e.object({"@RecordCode":e.optional(e.pipe(e.string(),e.minLength(6),e.maxLength(6))),"@InsertCriteria":e.optional(An),CreatedDate:e.optional(e.string()),ModifiedDate:e.optional(e.string()),RecordType:e.optional(kn),LoginType:e.optional(e.string()),RecordStatus:e.optional(On),Moniker:e.optional(e.string()),Name:e.optional(e.string()),ExtraInfo:e.optional(e.string()),LanguageCode:e.optional(e.pipe(e.string(),e.minLength(1),e.maxLength(2))),Address:e.optional(e.string()),ZipCode:e.optional(e.string()),CityName:e.optional(e.string()),CountyCode:e.optional(e.string()),StateCode:e.optional(e.string()),CategoryCode:e.optional(e.string()),PromoterCode:e.optional(e.string()),FirstPhoneNumber:e.optional(e.string()),MobilePhoneNumber:e.optional(e.string()),Email:e.optional(e.string()),Gender:e.optional(D),BirthDate:e.optional(e.string()),BirthCity:e.optional(e.string()),BirthCounty:e.optional(e.string()),EncryptedPassword:e.optional(P),FiscalCode:e.optional(e.string()),VatCode:e.optional(e.string()),ThirdPartRecordCode:e.optional(e.string()),IdDocumentDetail:e.optional(Cn),NewsletterDisabled:e.optional(P),SupplierRefMasterRecords:e.optional(Dn),AccountPolicies:e.optional(Nn),FinancialDetail:e.optional(xn),DynamicFields:e.optional(wn)}),Fn=he(ft,{expiredDate:e.optional(e.string())}),G=e.object({sCode1:e.optional(e.pipe(e.string(),e.maxLength(4))),sCode2:e.optional(e.pipe(e.string(),e.maxLength(4))),sCode3:e.optional(e.pipe(e.string(),e.maxLength(4))),sCode4:e.optional(e.pipe(e.string(),e.maxLength(4))),sCode5:e.optional(e.pipe(e.string(),e.maxLength(4))),sCode6:e.optional(e.pipe(e.string(),e.maxLength(4)))}),In=e.object({code:e.optional(e.string()),iataCode:e.optional(e.string()),nationCode:e.optional(e.string())}),Ln=e.object({recordCode:e.optional(e.string())}),Rn=It,zn=e.object({makeDocumentTo:e.optional(Rt)}),Bn=e.object({fillInCode:e.optional(e.string())}),Vn=e.union([zn,Bn]),Hn=e.object({documentType:Rn,documentCustomizablePrintParameters:e.optional(Vn)}),Un=e.object({printDoc:e.optional(P),sendDocViaEmail:e.optional(P),infoDocumentsToPrint:e.optional(e.array(Hn))}),Wn=e.object({reschedulingCode:e.optional(e.string()),expireDate:e.optional(e.string()),totalAmount:e.optional(e.string())}),Gn=e.object({deadlineCode:e.optional(e.string()),description:e.optional(e.string()),expireDate:e.optional(e.string())}),Kn=e.object({paymentDate:e.optional(e.string()),paumentNote:e.optional(e.string()),amount:e.optional(e.string()),paymentUser:e.optional(e.string()),paymentType:e.optional(A)}),qn=Bt,Jn=e.object({currencyCode:e.optional(e.string()),exchangeRate:e.optional(e.string()),cost:e.optional(e.string()),costTax:e.optional(e.string()),costType:e.optional(qn),vatCostCurrencyCode:e.optional(e.string()),price:e.optional(e.string()),priceTax:e.optional(e.string()),priceType:e.optional(qn)}),Yn=e.object({packageCode:e.optional(e.string()),packageReference:e.optional(e.string()),suballotmentCode:e.optional(e.string()),priceListCode:e.optional(e.string()),costListCode:e.optional(e.string()),externalFileCode:e.optional(e.string()),externalReference:e.optional(e.string()),serviceStatus:e.optional(e.string()),serviceStatisticCode:e.optional(e.string()),serviceFare:e.optional(Jn)}),Xn=e.object({sCode:e.string(),ssCode:e.optional(e.string()),avesServiceType:_t,toServiceType:e.optional(yt),subServiceDesc:e.optional(e.string()),startDate:e.string(),endDate:e.string(),qty:e.string(),pax:e.string(),paxAssociated:e.optional(e.union([e.array(e.string()),e.array(e.object({pax:e.string()}))])),avesSession:e.string(),avesServiceInfo:e.optional(Yn),serviceFare:e.optional(Jn),bookedServiceRef:e.optional(e.string()),supplierMasterCode:e.optional(e.string()),voucherMasterCode:e.optional(e.string()),hotelServiceInfo:e.optional(e.string()),carRentalServiceInfo:e.optional(e.string()),flightServiceInfo:e.optional(e.string()),shipServiceInfo:e.optional(e.string()),ticketServiceInfo:e.optional(e.string()),commission:e.optional(e.string()),noteList:e.optional(e.string()),voucherInfo:e.optional(e.string()),firstDescription:e.optional(e.string()),secondDescription:e.optional(e.string())}),Zn=e.object({pCode:e.string(),startDate:e.string(),endDate:e.string(),getServicesFromPackage:e.optional(P)}),Qn=e.object({nType:e.optional(e.string()),title:e.optional(e.string()),text:e.optional(e.string())}),$n=Et,er={rph:e.string(),roomRph:e.optional(e.string()),billingHolder:e.optional(P),masterRecordCode:e.optional(e.string()),name:e.string(),sex:D,birthDate:e.optional(e.string()),birthPlace:e.optional(e.string()),nationCode:e.optional(e.string()),citizenshipCode:e.optional(e.string()),fiscalCode:e.optional(e.string()),phoneNumber:e.optional(e.string()),eMail:e.optional(e.string()),notes:e.optional(e.array(Qn)),flagStatus:e.optional(e.string()),offerCode:e.optional(e.string()),idDocInfo:e.optional(V)},tr=e.object({...er,categoryCode:$n}),nr=e.object({...er,categoryCode:e.optional($n)}),rr=e.object({customer_PaymentType:e.optional(wt),customer_SpecPaymentTypeCode:e.optional(e.string())}),ir=Ht,ar=Wt,or=m(e.pipe(e.object({createDate:e.optional(e.string()),bookingFileRefCode:e.optional(e.string()),travelAgentCode:e.optional(e.string()),clerkName:e.optional(e.string()),customerDetail:e.optional(Ln),customerRecordCode:e.optional(e.string()),currencyCode:e.optional(e.string()),markupCode:e.optional(e.string()),bookingFileStatus:Fn,statisticCodes:e.optional(G),destination:e.optional(In),bookingFileDescription:e.optional(e.string()),startDate:e.string(),endDate:e.string(),earlyBookingDate:e.optional(e.string()),cupCode:e.optional(e.string()),cigCode:e.optional(e.string()),customerPromoterCode:e.optional(e.string()),billingReferenceCode:e.optional(e.string()),paymentReferenceCode:e.optional(e.string()),bookingFileDocument:e.optional(Un),financialDeadlineList:e.optional(e.array(Wn)),deadlineList:e.optional(e.array(Gn)),paymentList:e.optional(e.array(Kn)),selectedPackageList:e.optional(e.array(Zn)),selectedServiceList:e.array(Xn),extraQuotaRefCode:e.optional(e.string()),extraQuoteServiceList:e.optional(e.array(Xn)),getExtraQuoteFromSystem:e.optional(P),passengerList:e.array(tr),noteList:e.optional(e.array(Qn)),bookingFinancialInfo:e.optional(rr),bookingFileCode:e.optional(e.string()),groupingPaxPolicy:e.optional(ir),groupBookingFile:e.optional(P),typeDownloadFile:e.optional(ar),setBookingFileCodeFromStartDate:e.optional(P)}),e.check(e=>!!(e.customerDetail||e.customerRecordCode),`customerDetail or customerRecordCode is required`),e.transform(_e)),w,{listKeys:oe,arrayOfOne:se}),sr=me(e.object({RsStatus:z,BookingFileDetail:e.optional(_n),PrintableDocumentsList:e.optional(hn),TotalAmountDetailAfterCancellation:e.optional(un),Base64DocContent:e.optional(e.string())}),`bookingFileDetail`),cr=tn,K={customerRecordCode:e.string(),bookingFileCode:e.string()},q=sr,lr=e.object({reschedulingCode:e.string(),description:e.optional(e.string()),expireDate:e.optional(e.string())}),ur=e.object({cancelOperationType:Ot,serviceRefType:At,serviceRefValue:e.string()}),dr=m(e.pipe(e.object({...K,currencyCode:e.optional(e.string()),deadlineList:e.optional(e.array(lr)),selectedPackageDetail:e.optional(Zn),selectedPackageList:e.optional(e.pipe(e.array(Zn),e.maxLength(1))),selectedServiceList:e.pipe(e.array(Xn),e.minLength(1)),cancellableBookedServiceList:e.optional(e.array(ur)),passengerList:e.optional(e.array(nr))}),e.transform(ge(`selectedPackageList`,`selectedPackageDetail`))),w,{listKeys:ce}),fr=m(e.object({...K,bookingFileStartDate:e.string(),newCustomerRecordCode:e.optional(e.string()),bookingFileReferenceName:e.optional(e.string()),travelAgentCode:e.optional(e.string()),billingReferenceCode:e.optional(e.string()),paymentReferenceCode:e.optional(e.string()),cupCode:e.optional(e.string()),cigCode:e.optional(e.string()),customerPromoterCode:e.optional(e.string()),bookingNote:e.optional(e.string()),passengerList:e.optional(e.array(nr)),statisticCodes:e.optional(G),bookingFinancialInfo:e.optional(rr),financialDeadlineList:e.optional(e.array(e.object({reschedulingCode:e.string(),expireDate:e.string(),totalAmount:e.string()})))}),w,{listKeys:le}),pr=m(e.object({...K}),T),mr=Mt,hr=m(e.object({...K,fileStatus:he(mt,{expiredDate:e.optional(e.string()),optionedFileExpireDatePolicy:e.optional(mr)}),backOfficeRequest:e.optional(P),bookingFileDocument:e.optional(Un),penalty:e.optional(e.object({apply:e.optional(P),specificCode:e.optional(e.string())})),simulateCancelAndGetPenaltyAmount:e.optional(P)}),Xe),gr=m(e.object({...K,bookingServiceRef:e.string(),bookingFileServiceStatus:e.literal(`NULLIFIED`),bookingFileServiceStatusDate:e.optional(e.string())}),T),_r=Pt,vr=e.object({paymentDate:e.string(),paymentNote:e.optional(e.string()),payerMasterCode:e.optional(e.string()),payerName:e.optional(e.string()),amount:e.string(),paymentType:A}),yr=m(e.pipe(e.object({bookingFileCode:e.optional(e.string()),bookingFileRefCode:e.optional(e.string()),paymentUser:e.optional(e.string()),enableMultiplePayments:P,operationType:_r,filePaymentList:e.pipe(e.array(vr),e.minLength(1))}),e.check(e=>!!(e.bookingFileCode||e.bookingFileRefCode),`bookingFileCode or bookingFileRefCode is required`)),Ge,{listKeys:ue}),br=he(ht,{expireDate:e.optional(e.string())}),xr=e.object({code:e.optional(e.string()),number:e.optional(e.string())}),J={customerRecordCode:e.string(),customerPromoterCode:e.optional(e.string()),getSupplierInfo:e.optional(P),user:e.optional(e.string()),officeCode:e.optional(e.string())},Sr=e.object({...J,searchType:e.literal(j.FILE_CODE),bookingFileCode:e.string()}),Cr=e.object({...J,searchType:e.literal(j.PAX_NAME),firstPaxName:e.string()}),wr=e.object({...J,searchType:e.literal(j.PACKAGE_CODE),packageCode:e.string()}),Tr=e.object({...J,searchType:e.literal(j.OTHER),fileStatus:e.optional(br),startDate:e.optional(R),createdDate:e.optional(R),lastModificationDate:e.optional(R),insurance:e.optional(xr),isSearchForB2C:e.optional(P)}),Er=m(e.union([Sr,Cr,wr,Tr]),Ke),Dr=B(`BookingFileList`,h(`BookingFileDetail`,_n)),Y={SEARCH_REQUEST:`SearchMasterRecordRQ`,SEARCH_RESPONSE:`SearchMasterRecordRS`,UPSERT_REQUEST:`ManageMasterRecordRQ`,UPSERT_RESPONSE:`ManageMasterRecordRS`,BOOKING_REQUEST:`BookFileRQ`,BOOKING_RESPONSE:`BookingFileRS`,MOD_FILE_SERVICES_REQUEST:`ModFileServicesRQ`,MOD_FILE_HEADER_REQUEST:`ModFileHeaderRQ`,MOD_FILE_HEADER_RESPONSE:`ModFileHeaderRS`,CANCEL_FILE_REQUEST:`CancelFileRQ`,CANCEL_FILE_RESPONSE:`CancelFileRS`,SET_STATUS_REQUEST:`SetStatusRQ`,SET_STATUS_RESPONSE:`SetStatusRS`,SET_STATUS_SERVICE_REQUEST:`SetStatusServiceRQ`,SET_STATUS_SERVICE_RESPONSE:`SetStatusServiceRS`,FILE_PAYMENT_LIST_REQUEST:`FilePaymentListRQ`,FILE_PAYMENT_LIST_RESPONSE:`FilePaymentListRS`,AVES_SEARCH_REQUEST:`AvesSearchRQ`,SEARCH_PACKAGE_RESPONSE:`SearchPackageRS`,SEARCH_SERVICES_RESPONSE:`SearchServicesRS`,PACKAGE_DETAIL_REQUEST:`PackageDetailRQ`,PACKAGE_DETAIL_RESPONSE:`PackageDetailRS`,COMMIT_PACKAGE_REQUEST:`CommitPackRQ`,COMMIT_PACKAGE_RESPONSE:`CommitPackRS`,SEARCH_BOOKING_FILE_REQUEST:`SearchFileRQ`,SEARCH_BOOKING_FILE_RESPONSE:`SearchFileRS`};function Or(e,t){return{[e]:t}}const X={search:`/interop/masterRecords/v2/rest/Search`,upsert:`/interop/masterRecords/v2/rest/InsertOrUpdate`,createBooking:`/interop/booking/v2/rest/CreateBookingFile`,modBookingServices:`/interop/booking/v2/rest/ModBookingFileServices`,modBookingHeader:`/interop/booking/v2/rest/ModBookingFileHeader`,cancelBooking:`/interop/booking/v2/rest/CancelBookingFile`,setBookingStatus:`/interop/booking/v2/rest/SetBookingFileStatus`,setBookingServiceStatus:`/interop/booking/v2/rest/SetBookingFileServiceStatus`,insertFilePaymentList:`/interop/booking/v2/rest/InsertFilePaymentList`,searchAvesPackages:`/interop/booking/v2/rest/SearchAvesPackages`,searchTopServices:`/interop/booking/v2/rest/SearchTopServices`,getPackageDetail:`/interop/booking/v2/rest/GetPackageDetail`,commitPackage:`/interop/booking/v2/rest/CommitPackage`,searchBookingFile:`/interop/booking/v2/rest/SearchBookingFile`};var kr=class{transport;constructor(e){this.transport=e}createBooking(e){return this.transport.invokeOp({op:`createBooking`,params:e,apiSchema:or,endpoint:X.createBooking,requestRoot:Y.BOOKING_REQUEST,responseRoot:Y.BOOKING_RESPONSE,responseSchema:sr})}modBookingServices(e){return this.transport.invokeOp({op:`modBookingServices`,params:e,apiSchema:dr,endpoint:X.modBookingServices,requestRoot:Y.MOD_FILE_SERVICES_REQUEST,responseRoot:Y.BOOKING_RESPONSE,responseSchema:q})}modBookingHeader(e){return this.transport.invokeOp({op:`modBookingHeader`,params:e,apiSchema:fr,endpoint:X.modBookingHeader,requestRoot:Y.MOD_FILE_HEADER_REQUEST,responseRoot:Y.MOD_FILE_HEADER_RESPONSE,responseSchema:cr})}cancelBooking(e){return this.transport.invokeOp({op:`cancelBooking`,params:e,apiSchema:pr,endpoint:X.cancelBooking,requestRoot:Y.CANCEL_FILE_REQUEST,responseRoot:Y.CANCEL_FILE_RESPONSE,responseSchema:cr})}setBookingStatus(e){return this.transport.invokeOp({op:`setBookingStatus`,params:e,apiSchema:hr,endpoint:X.setBookingStatus,requestRoot:Y.SET_STATUS_REQUEST,responseRoot:Y.SET_STATUS_RESPONSE,responseSchema:q})}setBookingServiceStatus(e){return this.transport.invokeOp({op:`setBookingServiceStatus`,params:e,apiSchema:gr,endpoint:X.setBookingServiceStatus,requestRoot:Y.SET_STATUS_SERVICE_REQUEST,responseRoot:Y.SET_STATUS_SERVICE_RESPONSE,responseSchema:q})}insertFilePaymentList(e){return this.transport.invokeOp({op:`insertFilePaymentList`,params:e,apiSchema:yr,endpoint:X.insertFilePaymentList,requestRoot:Y.FILE_PAYMENT_LIST_REQUEST,responseRoot:Y.FILE_PAYMENT_LIST_RESPONSE,responseSchema:cr})}searchBookingFiles(e){return this.transport.invokeOp({op:`searchBookingFiles`,params:e,apiSchema:Er,endpoint:X.searchBookingFile,requestRoot:Y.SEARCH_BOOKING_FILE_REQUEST,responseRoot:Y.SEARCH_BOOKING_FILE_RESPONSE,responseSchema:Dr})}};const Ar=R,Z=F,jr=e.object({searchType:e.literal(O.CODE),recordCode:e.pipe(e.string(),e.minLength(5),e.maxLength(6)),languageCode:Z}),Mr=e.object({searchType:e.literal(O.NAME),name:e.string(),city:e.optional(e.string()),languageCode:Z}),Nr=e.object({searchType:e.literal(O.VATCODE),vatCode:e.string(),phoneNumber:e.optional(e.string()),languageCode:Z}),Pr=e.object({searchType:e.literal(O.ZONE),zipCode:e.string(),countyCode:e.string(),city:e.optional(e.string()),languageCode:Z}),Fr=e.object({searchType:e.literal(O.CATEGORY),categoryCode:e.string(),languageCode:Z}),Ir=e.object({searchType:e.literal(O.EMAIL),email:e.string(),languageCode:Z}),Lr=e.object({searchType:e.literal(O.LASTMODDATE),lastModificationDate:Ar,languageCode:Z}),Rr=e.object({searchType:e.literal(O.SEARCH_FIELD),searchFieldValue:e.string(),languageCode:Z}),zr=e.object({searchType:e.literal(O.EXTERNAL_REF_CODE),searchFieldValue:e.string(),languageCode:Z}),Br=m(e.union([jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr]),Ce);e.pipe(e.object({RqHeader:$t,SearchMasterRecord:Br}),e.transform(e=>{let{SearchMasterRecord:t,RqHeader:n,...r}=e;return{RqHeader:n,...t,...r}}));const Vr=B(`MasterRecordList`,h(`MasterRecordDetail`,W));e.object({RqHeader:$t,MasterRecordDetail:W});const Hr=me(e.object({RsStatus:z,MasterRecordDetail:e.optional(W)}),`masterRecordDetail`);var Ur=class{transport;constructor(e){this.transport=e}search(e){return this.transport.invokeOp({op:`search`,params:e,apiSchema:Br,endpoint:X.search,requestRoot:Y.SEARCH_REQUEST,responseRoot:Y.SEARCH_RESPONSE,responseSchema:Vr})}upsertRecord(e){return this.transport.invokeOp({op:`upsertRecord`,params:e,apiSchema:Pn,bodyKey:`MasterRecordDetail`,endpoint:X.upsert,requestRoot:Y.UPSERT_REQUEST,responseRoot:Y.UPSERT_RESPONSE,responseSchema:Hr})}};const Wr=h(`FeatureDetail`,e.object({"@Code":e.optional(e.string()),"@Name":e.optional(e.string()),ValueCode:e.optional(e.string()),ValueName:e.optional(e.string())})),Gr=e.object({"@PackageCode":e.optional(e.string()),"@PackageReference":e.optional(e.string()),"@PackageServiceType":e.optional(e.string()),"@ServiceCodeForPackageDetail":e.optional(e.string())}),Kr=h(`SubServiceDetail`,e.object({"@ssCode":e.optional(e.string()),FirstDescription:e.optional(e.string()),SubServiceType:e.optional(e.string()),SubServiceLevel:e.optional(L),StartDate:e.optional(e.string()),EndDate:e.optional(e.string())})),qr=h(`ServiceDetail`,e.object({"@sCode":e.optional(e.string()),FirstDescription:e.optional(e.string()),SecondDescription:e.optional(e.string()),AvesServiceType:e.optional(e.string()),TOServiceType:e.optional(e.string()),StartDate:e.optional(e.string()),EndDate:e.optional(e.string()),RefPackageInfo:e.optional(Gr),SubServiceList:e.optional(Kr)})),Jr=e.object({"@pCode":e.optional(e.string()),FirstDescription:e.optional(e.string()),SecondDescription:e.optional(e.string()),FrequencyType:e.optional(e.string()),ProgramType:e.optional(e.string()),StartValidation:e.optional(e.string()),EndValidation:e.optional(e.string()),StartDate:e.optional(e.string()),EndDate:e.optional(e.string()),BasePrice:e.optional(L),BasePax:e.optional(L),CanCommitPack:e.optional(L),FeatureList:e.optional(Wr),ServiceList:e.optional(qr)}),Yr=h(`PackageDetail`,Jr),Xr=e.object({code:e.optional(e.string()),type:e.optional(Yt)}),Zr=e.object({code:e.string(),name:e.optional(e.string())}),Qr=e.object({getAllDeptDate:e.optional(P),getFlightPlan:e.optional(P),getAllAccomodation:e.optional(P),getRealAvailability:e.optional(P),minStay:e.optional(I),maxStay:e.optional(I)}),$r=e.object({compatibleAccomodation:e.optional(P),alternativeAccomodation:e.optional(P)}),ei=e.object({customerRecordCode:e.string(),languageCode:F,currencyCode:e.optional(e.string()),startDate:e.string(),endDate:e.string(),earlyBookingDate:e.optional(e.string()),passengerList:e.pipe(e.array(tr),e.minLength(1)),avesSearchType:e.optional(Kt),paxQty:e.optional(I),paxQtyCriteria:e.optional(qt),discartNotAvailables:e.optional(P),discartNotAvailablesMinSales:e.optional(P),discartNotAvailablesDaysInOut:e.optional(P),discardPriceZero:e.optional(P),discardZeroPriceDays:e.optional(P),destination:e.optional(Xr),objectTypeCode:e.optional(e.string()),featureList:e.optional(e.array(Zr)),servOrPackCode:e.optional(e.string()),servOrPackDesc:e.optional(e.string()),priceListCode:e.optional(e.string()),costListCode:e.optional(e.string()),suballotmentCode:e.optional(e.string()),markupCode:e.optional(e.string()),statisticCodes:e.optional(G),mergeBoardAndAccomodation:e.optional(P),packageParams:e.optional(Qr),topServiceParams:e.optional($r),getDocumentation:e.optional(P)}),ti=e.required(ei,[`languageCode`,`avesSearchType`]);function ni(e){let{customerRecordCode:t,languageCode:n,currencyCode:r,startDate:i,endDate:a,earlyBookingDate:o,passengerList:s,paxQty:c,paxQtyCriteria:l,avesSearchType:u,...ee}=e;return{BaseSearch:p({customerRecordCode:t,languageCode:n,currencyCode:r,startDate:i,endDate:a,earlyBookingDate:o,passengerList:ae({passengerList:s},{listKeys:[`passengerList`]}).passengerList},Je),...p({...ee,avesSearchType:u,paxQty:c??s.length,paxQtyCriteria:l??N.GREATER_OR_EQUAL},Ye,{listKeys:[`featureList`]})}}const ri=e.pipe(ti,e.transform(ni)),ii=B(`PackageList`,Yr),ai=B(`ServiceList`,qr),oi=e.object({serviceCode:e.string(),packageRow:e.string()}),si=m(e.object({customerRecordCode:e.string(),languageCode:F,currencyCode:e.optional(e.string()),packageCode:e.string(),startDate:e.string(),endDate:e.string(),priceListCode:e.optional(e.string()),costListCode:e.optional(e.string()),markupCode:e.optional(e.string()),statisticCodes:e.optional(G),selectedServiceList:e.pipe(e.array(oi),e.minLength(1)),passengerList:e.optional(e.array(tr))}),qe,{listKeys:[`selectedServiceList`,`passengerList`]}),ci=me(e.object({RsStatus:z,PackageDetail:e.optional(Jr)}),`packageDetail`),li=m(e.object({packageCode:e.string()}),T),ui=tn;var di=class{transport;constructor(e){this.transport=e}prepareSearch(e,t){return{...this.transport.languageCode&&{languageCode:this.transport.languageCode},avesSearchType:t,...e}}searchPackages(e){return this.transport.invokeOp({op:`searchPackages`,params:this.prepareSearch(e,M.PACKAGE),apiSchema:ri,endpoint:X.searchAvesPackages,requestRoot:Y.AVES_SEARCH_REQUEST,responseRoot:Y.SEARCH_PACKAGE_RESPONSE,responseSchema:ii})}searchTopServices(e){return this.transport.invokeOp({op:`searchTopServices`,params:this.prepareSearch(e,M.SERVICE),apiSchema:ri,endpoint:X.searchTopServices,requestRoot:Y.AVES_SEARCH_REQUEST,responseRoot:Y.SEARCH_SERVICES_RESPONSE,responseSchema:ai})}getPackageDetail(e){return this.transport.invokeOp({op:`getPackageDetail`,params:e,apiSchema:si,endpoint:X.getPackageDetail,requestRoot:Y.PACKAGE_DETAIL_REQUEST,responseRoot:Y.PACKAGE_DETAIL_RESPONSE,responseSchema:ci})}commitPackage(e){return this.transport.invokeOp({op:`commitPackage`,params:e,apiSchema:li,endpoint:X.commitPackage,requestRoot:Y.COMMIT_PACKAGE_REQUEST,responseRoot:Y.COMMIT_PACKAGE_RESPONSE,responseSchema:ui})}};const fi={VALIDATION:`validation`,API:`api`,UNKNOWN:`unknown`};var Q=class extends Error{kind;message;status;code;constructor(e,t,n,r){super(t),this.kind=e,this.message=t,this.status=n,this.code=r,this.name=`AvesError`,this.status=n?.toLowerCase(),this.code=this.parseCode(r)}parseCode(e){return typeof e==`string`?Number.parseInt(e,10):e??0}};function pi(e){return new Q(fi.VALIDATION,e)}function mi(e,t,n){return new Q(fi.API,e,t,n)}function hi(e){return new Q(fi.UNKNOWN,e)}function gi(e){return e.map(_i).join(`; `)}function _i(e){let t=vi(e.path),n=e.message??`Invalid value`;return t?`${t}: ${n}`:n}function vi(e){if(!e||e.length===0)return;let t=e.map(yi).filter(e=>e!==void 0);return t.length>0?t.join(`.`):void 0}function yi(e){if(typeof e==`string`||typeof e==`number`)return String(e);if(typeof e==`object`&&e&&`key`in e)return String(e.key)}function bi(e){return e instanceof Error&&e.name===`AbortError`}function xi(e){return{success:!0,data:e}}function $(e){return{success:!1,error:e}}function Si(e){return e===200}function Ci(e){let t=new AbortController;if(!e||e<=0)return{signal:t.signal};let n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function wi(e,t){try{let n=new URL(e),r=(n.pathname.endsWith(`/`)?n.pathname.slice(0,-1):n.pathname)+t;return new URL(r,n)}catch(e){throw new Q(`validation`,`Invalid baseURL: ${e instanceof Error?e.message:`Invalid URL format`}`)}}function Ti(e,t){if(!t.startsWith(`/`))throw new Q(`validation`,`Invalid endpoint: endpoint must start with '/' but got '${t}'`);let n=wi(e.replace(/\/$/,``),t);if(n.protocol!==`http:`&&n.protocol!==`https:`)throw new Q(`validation`,`Invalid protocol: baseURL must use http:// or https:// but got '${n.protocol}'`);return n.toString()}const Ei={ignoreAttributes:!1,attributeNamePrefix:`@`,parseAttributeValue:!1,trimValues:!0,ignoreNameSpace:!0,removeNSPrefix:!0,parseTagValue:!1},Di={ignoreAttributes:!1,attributeNamePrefix:`@`,suppressEmptyNode:!0},Oi=new o(Ei),ki=new a(Di);function Ai(e){try{return ki.build(e)}catch(e){throw new Q(`validation`,`Failed to convert JSON to XML: ${e instanceof Error?e.message:`Unknown error`}`)}}function ji(e){try{return Oi.parse(e)}catch(e){throw new Q(`validation`,`Failed to convert XML to JSON: ${e instanceof Error?e.message:`Unknown error`}`)}}var Mi=class{options;constructor(e){this.options=e}get languageCode(){return this.options.languageCode}createRqHeader(){return{"@HostID":this.options.hostID,"@Xtoken":this.options.xtoken,"@Interface":`WEB`,"@UserName":`WEB`,...this.options.languageCode&&{"@LanguageCode":this.options.languageCode}}}toAvesError(e,n){return e instanceof Q?e:e instanceof t?pi(`Validation error: ${gi(e.issues)}`):e instanceof Error?hi(e.message):hi(n)}handleApiStatus(e){let{rsStatus:t}=e;return t?.status===`OK`?xi(e):$(mi(t.errorDescription??``,t.status,t.errorCode))}async request(e,t,n,a){let{signal:o,clear:s}=Ci(this.options.timeoutMs??3e4);try{let s=await i(Ti(this.options.baseURL,e),{method:`POST`,headers:{"Content-Type":`application/xml`},body:Ai(t),signal:o}),c=await s.body.text();if(!Si(s.statusCode))return $(mi(c,`ERROR`,s.statusCode));let l=ji(c)[n];if(!l)return $(pi(`Invalid response structure: missing root element '${n}'`));let u=r(a,l);return u.success?this.handleApiStatus(u.output):$(pi(`Invalid response format: ${gi(u.issues)}`))}catch(e){return bi(e)?$(mi(`Request timed out`,`TIMEOUT`)):$(this.toAvesError(e,`Unknown error occurred`))}finally{s?.()}}async invokeOp(e){try{let t=n(e.apiSchema,e.params),r=e.bodyKey?{[e.bodyKey]:t}:t;return this.request(e.endpoint,Or(e.requestRoot,{RqHeader:this.createRqHeader(),...r}),e.responseRoot,e.responseSchema)}catch(t){return $(this.toAvesError(t,`Validation error occurred during ${e.op}`))}}};const Ni=[`master`,`booking`,`packages`];function Pi(e){for(let t of Ni){let n=e[t],r=Object.getPrototypeOf(n);for(let t of Object.getOwnPropertyNames(r)){if(t===`constructor`||t in e)continue;let i=Object.getOwnPropertyDescriptor(r,t)?.value;typeof i==`function`&&Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:i.bind(n)})}}}const Fi=class{transport;master;booking;packages;constructor(e,t={}){this.transport=t.transport??new Mi(e),this.master=t.master??new Ur(this.transport),this.booking=t.booking??new kr(this.transport),this.packages=t.packages??new di(this.transport),Pi(this)}};export{Fi as AvesClient,Q as AvesError,M as AvesSearchType,Kt as AvesSearchTypeSchema,gt as AvesServiceType,_t as AvesServiceTypeSchema,Mi as AvesTransport,bt as BookedServiceStatus,xt as BookedServiceStatusSchema,kr as BookingClient,dt as BookingFileStatus,ft as BookingFileStatusSchema,k as BookingFileStatusWire,ht as BookingFileStatusWireSchema,Dt as CancelOperationType,Ot as CancelOperationTypeSchema,lt as CarrierType,ut as CarrierTypeSchema,zt as CostPriceType,Bt as CostPriceTypeSchema,Ct as CustomerPaymentType,wt as CustomerPaymentTypeSchema,Jt as DestinationType,Yt as DestinationTypeSchema,Ft as DocumentType,It as DocumentTypeSchema,Nt as FilePaymentOperationType,Pt as FilePaymentOperationTypeSchema,Ze as Gender,D as GenderSchema,Vt as GroupingPaxPolicy,Ht as GroupingPaxPolicySchema,at as InsertCriteria,ot as InsertCriteriaSchema,Lt as MakeDocumentTo,Rt as MakeDocumentToSchema,st as MasterPaymentType,ct as MasterPaymentTypeSchema,Ur as MasterRecordsClient,jt as OptionedExpirePolicy,Mt as OptionedExpirePolicySchema,di as PackageCatalogClient,Tt as PassengerCategory,Et as PassengerCategorySchema,N as PaxQtyCriteria,qt as PaxQtyCriteriaSchema,St as PaymentType,A as PaymentTypeSchema,rt as RecordStatus,it as RecordStatusSchema,tt as RecordType,nt as RecordTypeSchema,Qe as RsStatusValue,$e as RsStatusValueSchema,j as SearchBookingFileType,Gt as SearchBookingFileTypeSchema,O as SearchMasterType,et as SearchMasterTypeSchema,kt as ServiceRefType,At as ServiceRefTypeSchema,pt as SetFileStatusValue,mt as SetFileStatusValueSchema,vt as ToServiceType,yt as ToServiceTypeSchema,Ut as TypeDownloadFile,Wt as TypeDownloadFileSchema};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|