aves-sdk 3.1.0 → 4.0.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 CHANGED
@@ -5,7 +5,52 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [3.1.0] - 2026-08-06
8
+ ## [4.0.0] - 2026-08-06
9
+
10
+ ### Added
11
+
12
+ - `OpBodyKey` object enum (`MasterRecordDetail`) for RQ payload nest keys; typed on `AVES_OPS` / envelope.
13
+ - `AvesOp` object enum (+ `AvesOpSchema`) for `invokeOp` keys; domains use `AvesOp.create` instead of string literals.
14
+
15
+ ### Changed
16
+
17
+ - **Breaking:** Domain method names no longer repeat the namespace / AVES verb soup. `AVES_OPS` keys follow the same short names (with `searchBookings` / `searchPackages` where `search` would collide).
18
+
19
+ | Namespace | 3.x | 4.x |
20
+ | --------- | --- | --- |
21
+ | `master` | `upsertRecord` | `upsert` |
22
+ | `booking` | `createBooking` | `create` |
23
+ | `booking` | `modBookingServices` | `updateServices` |
24
+ | `booking` | `modBookingHeader` | `updateHeader` |
25
+ | `booking` | `cancelBooking` | `cancel` |
26
+ | `booking` | `setBookingStatus` | `setStatus` |
27
+ | `booking` | `setBookingServiceStatus` | `setServiceStatus` |
28
+ | `booking` | `insertFilePaymentList` | `addPayments` |
29
+ | `booking` | `searchBookingFiles` | `search` |
30
+ | `packages` | `searchPackages` | `search` |
31
+ | `packages` | `searchTopServices` | `searchServices` |
32
+ | `packages` | `getPackageDetail` | `get` |
33
+ | `packages` | `commitPackage` | `commit` |
34
+
35
+ `master.search` is unchanged. Endpoint URLs and XML roots are unchanged.
36
+
37
+ ### Migration (1.x / 3.x → 4.x)
38
+
39
+ Jump straight to 4.x for September apps: apply the 3.x facade + `master.search` flat-array notes, then rename methods per the table above (no compatibility aliases).
40
+
41
+ ```ts
42
+ // 3.x
43
+ await client.booking.createBooking(params);
44
+ await client.packages.searchPackages(params);
45
+ await client.master.upsertRecord(record);
46
+
47
+ // 4.x
48
+ await client.booking.create(params);
49
+ await client.packages.search(params);
50
+ await client.master.upsert(record);
51
+ ```
52
+
53
+ ## [3.1.1] - 2026-08-06
9
54
 
10
55
  ### Added
11
56
 
@@ -13,6 +58,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
58
  - Schema-owned dual keys via `facadeObject` / `coalesceAliases` (same pattern as `coalesceCustomerRecordCode`).
14
59
  - Simplified public type aliases including `BookingInput`, `Booking`, `MasterRecord`, `PackageInput`, and `Package`.
15
60
  - `AVES_OPS` registry + `invokeOp(op, params)` with external `OpParams` / `OpResult` typings.
61
+ - Full facade alias property map in README (outbound `publicKeyAliases` + inbound scoped maps).
62
+ - 2.x → 3.x migration notes for `master.search` (flat array success payload).
16
63
 
17
64
  ### Changed
18
65
 
@@ -32,6 +79,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
32
79
 
33
80
  - **Breaking:** `master.search` success payload is now `MasterRecordDetailResponse[]` — always a flat array (`[]`, one element, or many). No `rsStatus` wrapper on success (non-OK AVES status remains `result.error`). Replaces the prior `{ rsStatus, masterRecordList }` shape.
34
81
 
82
+ ### Migration (2.x → 3.x)
83
+
84
+ Only `master.search` success shape changed. Other domain methods and error/`Result` contracts are unchanged from 2.x.
85
+
86
+ | Change | Symptom on upgrade | Fix |
87
+ | ------ | ------------------ | --- |
88
+ | `master.search` success is a flat array | `result.data.masterRecordList` / `result.data.rsStatus` are `undefined`; types fail | Use `result.data` as `MasterRecordDetailResponse[]` (e.g. `const [record] = result.data` or `result.data.map(...)`) |
89
+ | Looking for `rsStatus` on success | Always missing when `result.success` | Keep using `result.error` for non-OK AVES / HTTP failures (`error.kind`, `error.status`, `error.code`) |
90
+ | Empty search | May have expected a missing list or wrapper | Success with no hits is `result.data === []` |
91
+
92
+ **Before (2.x):**
93
+
94
+ ```ts
95
+ const result = await client.master.search({
96
+ searchType: "CODE",
97
+ recordCode: "508558",
98
+ });
99
+ if (result.success) {
100
+ const records = result.data.masterRecordList ?? [];
101
+ console.log(result.data.rsStatus.status, records[0]?.recordCode);
102
+ }
103
+ ```
104
+
105
+ **After (3.x):**
106
+
107
+ ```ts
108
+ const result = await client.master.search({
109
+ searchType: "CODE",
110
+ recordCode: "508558",
111
+ });
112
+ if (result.success) {
113
+ const [record] = result.data; // MasterRecordDetailResponse[]
114
+ console.log(record?.recordCode);
115
+ } else {
116
+ console.error(result.error.kind, result.error.status, result.error.message);
117
+ }
118
+ ```
119
+
120
+ 3.1.x on top of 3.0 is additive (facade aliases / internal transport). No further breaking migration from 3.0 → 3.1.1.
121
+
35
122
  ## [2.0.1] - 2026-08-05
36
123
 
37
124
  ### Changed
package/README.md CHANGED
@@ -45,19 +45,25 @@ if (result.success) {
45
45
  `AvesClient` is a facade over domain clients. Operations are namespaced by domain.
46
46
 
47
47
  ```typescript
48
- await client.booking.createBooking(params);
49
- await client.packages.searchPackages(params);
48
+ await client.booking.create(params);
49
+ await client.packages.search(params);
50
50
  await client.master.search({ searchType: 'CODE', recordCode: '508558' });
51
51
  ```
52
52
 
53
53
  Migration from 1.x: insert the appropriate domain namespace (for example,
54
- `client.search` → `client.master.search`). See the [2.0.0 migration notes](./CHANGELOG.md).
54
+ `client.search` → `client.master.search`). See the [2.0.0 migration notes](./CHANGELOG.md#200---2026-08-05).
55
+
56
+ Migration from 2.x: `master.search` success is a flat array — see the
57
+ [3.0.0 migration notes](./CHANGELOG.md#300---2026-08-06).
58
+
59
+ Migration from 3.x: domain method names were shortened — see the
60
+ [4.0.0 migration notes](./CHANGELOG.md#400---2026-08-06).
55
61
 
56
62
  | Namespace | Methods |
57
63
  | --------- | ------- |
58
- | `master` | `search`, `upsertRecord` |
59
- | `booking` | `createBooking`, `modBookingServices`, `modBookingHeader`, `cancelBooking`, `setBookingStatus`, `setBookingServiceStatus`, `insertFilePaymentList`, `searchBookingFiles` |
60
- | `packages` | `searchPackages`, `searchTopServices`, `getPackageDetail`, `commitPackage` |
64
+ | `master` | `search`, `upsert` |
65
+ | `booking` | `create`, `updateServices`, `updateHeader`, `cancel`, `setStatus`, `setServiceStatus`, `addPayments`, `search` |
66
+ | `packages` | `search`, `searchServices`, `get`, `commit` |
61
67
 
62
68
  ### Constructor
63
69
 
@@ -106,21 +112,203 @@ dual keys are owned by Valibot input schemas (`facadeObject` / `coalesceAliases`
106
112
  and coalesced to AVES camelCase before wire encoding. Outbound success payloads
107
113
  keep AVES names and add concise compatibility aliases. XML shapes are unchanged.
108
114
 
115
+ Source of truth in code:
116
+
117
+ - Outbound (AVES → facade): `publicKeyAliases` in `src/utils/facade-transform.ts`
118
+ - Inbound (facade → AVES): scoped maps in `src/utils/facade-aliases.ts`
119
+
120
+ Some facade names are reused (`services`, `status`, `passengerCount`, `financial`,
121
+ `payments`, `packages`, `identityDocument`). Resolution is **schema-scoped** on
122
+ input and **target-key presence** on Proxy output — not a single global rename.
123
+
124
+ ### Outbound map (AVES → facade)
125
+
126
+ Applied on success payloads via `withPublicAliases` (both names remain readable).
127
+
109
128
  | AVES-shaped name | Facade name |
110
129
  | ---------------- | ----------- |
130
+ | `rsStatus` | `response` |
111
131
  | `customerRecordCode` | `customerCode` |
112
- | `bookingFileCode` / `bookingFileRefCode` | `bookingCode` / `bookingReference` |
132
+ | `bookingFileCode` | `bookingCode` |
133
+ | `bookingFileRefCode` | `bookingReference` |
134
+ | `bookingFileStatus` | `status` |
135
+ | `fileStatus` | `status` |
136
+ | `bookingFileDescription` | `description` |
137
+ | `bookingFileStartDate` | `startDate` |
138
+ | `bookingFileReferenceName` | `referenceName` |
139
+ | `bookingFileServiceStatus` | `serviceStatus` |
140
+ | `bookingFileServiceStatusDate` | `serviceStatusDate` |
141
+ | `bookingServiceRef` | `serviceReference` |
142
+ | `newCustomerRecordCode` | `newCustomerCode` |
143
+ | `customerDetail` | `customer` |
144
+ | `bookingFileDocument` | `documents` |
145
+ | `bookingFinancialInfo` | `financial` |
146
+ | `financialDetail` | `financial` |
147
+ | `idDocumentDetail` | `identityDocument` |
148
+ | `idDocInfo` | `identityDocument` |
149
+ | `accountPolicies` | `policies` |
150
+ | `dynamicFields` | `customFields` |
151
+ | `supplierRefMasterRecords` | `supplierReference` |
113
152
  | `selectedPackageDetail` | `package` |
114
- | `*List` collections | plural collections, for example `services`, `passengers`, `payments` |
115
- | `pCode` / `sCode` / `ssCode` | `packageCode` / `serviceCode` / `subServiceCode` |
116
- | `rph` / `roomRph` | `passengerRef` / `roomRef` |
117
- | `qty` / `pax` / `avesSession` | `quantity` / `passengerCount` / `session` |
118
- | `rsStatus` | `response` |
153
+ | `selectedPackageList` | `packages` |
154
+ | `packageList` | `packages` |
155
+ | `selectedServiceList` | `services` |
156
+ | `bookedServiceList` | `services` |
157
+ | `serviceList` | `services` |
158
+ | `extraQuoteServiceList` | `extraServices` |
159
+ | `passengerList` | `passengers` |
160
+ | `noteList` | `notes` |
161
+ | `deadlineList` | `deadlines` |
162
+ | `financialDeadlineList` | `financialDeadlines` |
163
+ | `paymentList` | `payments` |
164
+ | `filePaymentList` | `payments` |
165
+ | `cancellableBookedServiceList` | `cancellableServices` |
166
+ | `subServiceList` | `subServices` |
167
+ | `featureList` | `features` |
168
+ | `pCode` | `packageCode` |
169
+ | `sCode` | `serviceCode` |
170
+ | `ssCode` | `subServiceCode` |
171
+ | `rph` | `passengerRef` |
172
+ | `roomRph` | `roomRef` |
173
+ | `avesSession` | `session` |
174
+ | `paxAssociated` | `passengerRefs` |
175
+ | `paxQty` | `passengerCount` |
176
+ | `pax` | `passengerCount` |
177
+ | `paxQtyCriteria` | `passengerCountRule` |
178
+ | `qty` | `quantity` |
179
+ | `eMail` | `email` |
180
+ | `sex` | `gender` |
181
+ | `nType` | `noteType` |
182
+ | `avesServiceType` | `serviceType` |
183
+ | `toServiceType` | `targetType` |
184
+ | `packageParams` | `packageOptions` |
185
+ | `topServiceParams` | `serviceOptions` |
186
+ | `servOrPackCode` | `serviceOrPackageCode` |
187
+ | `servOrPackDesc` | `serviceOrPackageDescription` |
188
+ | `getDocumentation` | `includeDocumentation` |
189
+ | `getServicesFromPackage` | `includeServices` |
190
+ | `mergeBoardAndAccomodation` | `mergeBoardAndAccommodation` |
191
+ | `discartNotAvailables` | `discardUnavailable` |
192
+ | `discartNotAvailablesMinSales` | `discardUnavailableMinSales` |
193
+ | `discartNotAvailablesDaysInOut` | `discardUnavailableDaysInOut` |
194
+ | `getAllDeptDate` | `allDepartureDates` |
195
+ | `getAllAccomodation` | `allAccommodation` |
196
+ | `compatibleAccomodation` | `compatibleAccommodation` |
197
+ | `alternativeAccomodation` | `alternativeAccommodation` |
198
+
199
+ ### Inbound map (facade → AVES)
200
+
201
+ Applied only on the schema that owns each fragment (`facadeObject` / `coalesceAliases`).
202
+
203
+ #### Shared refs
204
+
205
+ | Facade | AVES |
206
+ | ------ | ---- |
207
+ | `customerCode` | `customerRecordCode` |
208
+ | `bookingCode` | `bookingFileCode` |
209
+ | `bookingReference` | `bookingFileRefCode` |
210
+
211
+ #### Passenger / note / service line
212
+
213
+ | Facade | AVES |
214
+ | ------ | ---- |
215
+ | `passengerRef` | `rph` |
216
+ | `roomRef` | `roomRph` |
217
+ | `gender` | `sex` |
218
+ | `email` | `eMail` |
219
+ | `identityDocument` | `idDocInfo` |
220
+ | `noteType` | `nType` |
221
+ | `serviceCode` | `sCode` |
222
+ | `subServiceCode` | `ssCode` |
223
+ | `quantity` | `qty` |
224
+ | `passengerCount` | `pax` |
225
+ | `session` | `avesSession` |
226
+ | `passengerRefs` | `paxAssociated` |
227
+ | `serviceType` | `avesServiceType` |
228
+ | `targetType` | `toServiceType` |
229
+ | `notes` | `noteList` |
230
+ | `packageCode` | `pCode` |
231
+ | `includeServices` | `getServicesFromPackage` |
232
+
233
+ #### Booking root (`create`)
234
+
235
+ | Facade | AVES |
236
+ | ------ | ---- |
237
+ | `customer` | `customerDetail` |
238
+ | `status` | `bookingFileStatus` |
239
+ | `description` | `bookingFileDescription` |
240
+ | `referenceName` | `bookingFileReferenceName` |
241
+ | `financial` | `bookingFinancialInfo` |
242
+ | `package` | `selectedPackageDetail` |
243
+ | `packages` | `selectedPackageList` |
244
+ | `services` | `selectedServiceList` |
245
+ | `extraServices` | `extraQuoteServiceList` |
246
+ | `passengers` | `passengerList` |
247
+ | `payments` | `paymentList` |
248
+ | `documents` | `bookingFileDocument` |
249
+ | `deadlines` | `deadlineList` |
250
+ | `financialDeadlines` | `financialDeadlineList` |
251
+ | `notes` | `noteList` |
252
+
253
+ (+ shared refs above)
254
+
255
+ #### Mod services / mod header / status / payments / search booking
256
+
257
+ | Scope | Facade | AVES |
258
+ | ----- | ------ | ---- |
259
+ | Mod services | `package` / `packages` | `selectedPackageDetail` / `selectedPackageList` |
260
+ | Mod services | `services` / `passengers` / `deadlines` | `selectedServiceList` / `passengerList` / `deadlineList` |
261
+ | Mod services | `cancellableServices` | `cancellableBookedServiceList` |
262
+ | Mod header | `startDate` | `bookingFileStartDate` |
263
+ | Mod header | `newCustomerCode` | `newCustomerRecordCode` |
264
+ | Mod header | `referenceName` / `passengers` / `financial` / `financialDeadlines` | `bookingFileReferenceName` / `passengerList` / `bookingFinancialInfo` / `financialDeadlineList` |
265
+ | Set file status | `status` / `documents` | `fileStatus` / `bookingFileDocument` |
266
+ | Set service status | `serviceReference` / `serviceStatus` / `serviceStatusDate` | `bookingServiceRef` / `bookingFileServiceStatus` / `bookingFileServiceStatusDate` |
267
+ | Insert payments | `payments` | `filePaymentList` |
268
+ | Search booking files | `status` | `fileStatus` |
269
+
270
+ (+ shared refs where listed in each map)
271
+
272
+ #### Master record
273
+
274
+ | Facade | AVES |
275
+ | ------ | ---- |
276
+ | `financial` | `financialDetail` |
277
+ | `identityDocument` | `idDocumentDetail` |
278
+ | `policies` | `accountPolicies` |
279
+ | `customFields` | `dynamicFields` |
280
+ | `supplierReference` | `supplierRefMasterRecords` |
281
+
282
+ #### Package / top-service search + package params + get package detail
283
+
284
+ | Facade | AVES |
285
+ | ------ | ---- |
286
+ | `searchType` | `avesSearchType` |
287
+ | `passengers` | `passengerList` |
288
+ | `packageOptions` | `packageParams` |
289
+ | `serviceOptions` | `topServiceParams` |
290
+ | `serviceOrPackageCode` | `servOrPackCode` |
291
+ | `serviceOrPackageDescription` | `servOrPackDesc` |
292
+ | `passengerCount` | `paxQty` |
293
+ | `passengerCountRule` | `paxQtyCriteria` |
294
+ | `features` | `featureList` |
295
+ | `includeDocumentation` | `getDocumentation` |
296
+ | `mergeBoardAndAccommodation` | `mergeBoardAndAccomodation` |
297
+ | `discardUnavailable` | `discartNotAvailables` |
298
+ | `discardUnavailableMinSales` | `discartNotAvailablesMinSales` |
299
+ | `discardUnavailableDaysInOut` | `discartNotAvailablesDaysInOut` |
300
+ | `allDepartureDates` | `getAllDeptDate` |
301
+ | `allAccommodation` | `getAllAccomodation` |
302
+ | `compatibleAccommodation` | `compatibleAccomodation` |
303
+ | `alternativeAccommodation` | `alternativeAccomodation` |
304
+ | `services` (package detail RQ) | `selectedServiceList` |
305
+
306
+ (+ shared refs on search / package detail)
119
307
 
120
308
  New code can use the simplified vocabulary directly:
121
309
 
122
310
  ```typescript
123
- const created = await client.booking.createBooking({
311
+ const created = await client.booking.create({
124
312
  customerCode: '138311',
125
313
  status: 'CONFIRMED',
126
314
  startDate: '2026-08-06',
@@ -189,12 +377,12 @@ const byEmail = await client.master.search({
189
377
  });
190
378
  ```
191
379
 
192
- ### `client.master.upsertRecord(record)`
380
+ ### `client.master.upsert(record)`
193
381
 
194
382
  `insertCriteria`: `'S'` always insert · `'N'` skip if exists · `'T'` update all (default) · `'M'` secondary fields only.
195
383
 
196
384
  ```typescript
197
- const result = await client.master.upsertRecord({
385
+ const result = await client.master.upsert({
198
386
  name: 'Jane Smith',
199
387
  email: 'jane@example.com',
200
388
  languageCode: '02',
@@ -214,19 +402,19 @@ if (result.success) {
214
402
 
215
403
  | Method | Purpose |
216
404
  | ------ | ------- |
217
- | `createBooking` | Create booking file |
218
- | `modBookingServices` | Add/replace services, assign package, delete/nullify lines |
219
- | `modBookingHeader` | Header only (pax, notes, billing) — no costs |
220
- | `cancelBooking` | Delete booking file |
221
- | `setBookingStatus` | Change file status (`CANCELED` / `NULLIFIED` / …) |
222
- | `setBookingServiceStatus` | Nullify a single service line |
223
- | `insertFilePaymentList` | Register payments |
224
- | `searchBookingFiles` | Search practices (`FILE_CODE`, `PAX_NAME`, `PACKAGE_CODE`, `OTHER`) |
405
+ | `create` | Create booking file |
406
+ | `updateServices` | Add/replace services, assign package, delete/nullify lines |
407
+ | `updateHeader` | Header only (pax, notes, billing) — no costs |
408
+ | `cancel` | Delete booking file |
409
+ | `setStatus` | Change file status (`CANCELED` / `NULLIFIED` / …) |
410
+ | `setServiceStatus` | Nullify a single service line |
411
+ | `addPayments` | Register payments |
412
+ | `search` | Search practices (`FILE_CODE`, `PAX_NAME`, `PACKAGE_CODE`, `OTHER`) |
225
413
 
226
414
  ### Create
227
415
 
228
416
  ```typescript
229
- const created = await client.booking.createBooking({
417
+ const created = await client.booking.create({
230
418
  customerRecordCode: '138311', // or customerDetail: { recordCode: '138311' }
231
419
  bookingFileStatus: 'QUOTATION', // or { value: 'QUOTATION', expiredDate? }
232
420
  startDate: '2015-01-22T00:00:00',
@@ -265,7 +453,7 @@ if (created.success) {
265
453
  ### Modify services / package / overwrite lines
266
454
 
267
455
  ```typescript
268
- await client.booking.modBookingServices({
456
+ await client.booking.updateServices({
269
457
  customerRecordCode: '138311',
270
458
  bookingFileCode: '14/036654',
271
459
  selectedPackageDetail: {
@@ -304,7 +492,7 @@ Requires `bookingFileCode` **or** `bookingFileRefCode`.
304
492
  `paymentUser` is serialized as an XML **attribute** on `FilePaymentListRQ` (`PaymentUser="…"`), not as a child element.
305
493
 
306
494
  ```typescript
307
- await client.booking.insertFilePaymentList({
495
+ await client.booking.addPayments({
308
496
  bookingFileCode: '18/000172',
309
497
  paymentUser: 'MLDN',
310
498
  enableMultiplePayments: true,
@@ -323,32 +511,32 @@ await client.booking.insertFilePaymentList({
323
511
  ### Header, status, cancel, search practices
324
512
 
325
513
  ```typescript
326
- await client.booking.modBookingHeader({
514
+ await client.booking.updateHeader({
327
515
  bookingFileCode: '14/000043',
328
516
  bookingFileStartDate: '2014-04-28',
329
517
  customerRecordCode: '103737',
330
518
  passengerList: [{ rph: '001', name: 'ADULTI 001', sex: 'M' }],
331
519
  });
332
520
 
333
- await client.booking.setBookingStatus({
521
+ await client.booking.setStatus({
334
522
  customerRecordCode: '000170',
335
523
  bookingFileCode: '14/000081',
336
524
  fileStatus: 'CANCELED', // or { value: 'CANCELED' }
337
525
  });
338
526
 
339
- await client.booking.setBookingServiceStatus({
527
+ await client.booking.setServiceStatus({
340
528
  customerRecordCode: '000001',
341
529
  bookingFileCode: '18/000252',
342
530
  bookingServiceRef: '002',
343
531
  bookingFileServiceStatus: 'NULLIFIED',
344
532
  });
345
533
 
346
- await client.booking.cancelBooking({
534
+ await client.booking.cancel({
347
535
  bookingFileCode: '14/000081',
348
536
  customerRecordCode: '000170',
349
537
  });
350
538
 
351
- await client.booking.searchBookingFiles({
539
+ await client.booking.search({
352
540
  searchType: 'PACKAGE_CODE',
353
541
  customerRecordCode: '138311',
354
542
  packageCode: '2014MDE0000010',
@@ -363,15 +551,15 @@ There is **no** Create Package API in AVES XML 1.8.0. Search, detail, and commit
363
551
 
364
552
  | Method | Purpose |
365
553
  | ------ | ------- |
366
- | `searchPackages` | Search programs (defaults `avesSearchType: 'PACKAGE'`) |
367
- | `searchTopServices` | Search TOP services (defaults `avesSearchType: 'SERVICE'`) |
368
- | `getPackageDetail` | Package base info + service list |
369
- | `commitPackage` | Publish existing package (`packageCode` only) |
554
+ | `search` | Search programs (defaults `avesSearchType: 'PACKAGE'`) |
555
+ | `searchServices` | Search TOP services (defaults `avesSearchType: 'SERVICE'`) |
556
+ | `get` | Package base info + service list |
557
+ | `commit` | Publish existing package (`packageCode` only) |
370
558
 
371
559
  `paxQty` defaults to `passengerList.length`; `paxQtyCriteria` defaults to `GREATER_OR_EQUAL`. `languageCode` can be omitted when set on `AvesClient` options.
372
560
 
373
561
  ```typescript
374
- const packages = await client.packages.searchPackages({
562
+ const packages = await client.packages.search({
375
563
  customerRecordCode: '138311',
376
564
  languageCode: '01',
377
565
  currencyCode: 'EUR',
@@ -389,7 +577,7 @@ const packages = await client.packages.searchPackages({
389
577
  servOrPackCode: '2014MDE0000010',
390
578
  });
391
579
 
392
- const detail = await client.packages.getPackageDetail({
580
+ const detail = await client.packages.get({
393
581
  customerRecordCode: '001692',
394
582
  packageCode: '2015F042',
395
583
  startDate: '2015-05-02T00:00:00',
@@ -399,7 +587,7 @@ const detail = await client.packages.getPackageDetail({
399
587
  ],
400
588
  });
401
589
 
402
- await client.packages.commitPackage({ packageCode: '14/PACKAGE001' });
590
+ await client.packages.commit({ packageCode: '14/PACKAGE001' });
403
591
 
404
592
  if (packages.success) console.log(packages.data.packageList?.[0]?.pCode);
405
593
  if (detail.success) console.log(detail.data.pCode, detail.data.serviceList?.[0]);
@@ -483,8 +671,9 @@ Outbound path: validate → `createApiSchema` / `toWireBody` → `invokeOp` →
483
671
  ## Types
484
672
 
485
673
  Operations are available only through `client.master`, `client.booking`, and
486
- `client.packages`; flat aliases were removed in 2.0.0. See the
487
- [migration notes](./CHANGELOG.md) when upgrading.
674
+ `client.packages`; flat aliases were removed in 2.0.0. When upgrading from 2.x,
675
+ also update `master.search` consumers for the flat array success payload (3.0.0).
676
+ See the [CHANGELOG migration notes](./CHANGELOG.md).
488
677
 
489
678
  ```typescript
490
679
  import type {
package/dist/index.d.mts CHANGED
@@ -26,6 +26,12 @@ declare const RsStatusValueSchema: import("valibot").PicklistSchema<EnumValue<{
26
26
  readonly WARNING: "WARNING";
27
27
  readonly TIMEOUT: "TIMEOUT";
28
28
  }>[], undefined>;
29
+ /** Nest key when an op wraps the API body under a Detail element (vs spread at RQ root). */
30
+ declare const OpBodyKey: {
31
+ readonly MasterRecordDetail: "MasterRecordDetail";
32
+ };
33
+ type OpBodyKey = EnumValue<typeof OpBodyKey>;
34
+ declare const OpBodyKeySchema: import("valibot").PicklistSchema<"MasterRecordDetail"[], undefined>;
29
35
  declare const SearchMasterType: {
30
36
  readonly CODE: "CODE";
31
37
  readonly NAME: "NAME";
@@ -11247,7 +11253,7 @@ declare const MasterRecordDetailResponseSchema: v.SchemaWithPipe<readonly [Omit<
11247
11253
  /**
11248
11254
  * Flat AvesSearchRQ body (camelCase) — shared by SearchAvesPackages / SearchTopServices.
11249
11255
  * BaseSearch fields live at the root; wire transform nests them under `BaseSearch`.
11250
- * `searchPackages` / `searchTopServices` default `avesSearchType`; `paxQty` defaults to
11256
+ * `packages.search` / `packages.searchServices` default `avesSearchType`; `paxQty` defaults to
11251
11257
  * `passengerList.length`; `paxQtyCriteria` defaults to `GREATER_OR_EQUAL`.
11252
11258
  * `languageCode` may come from `AvesClient` options when omitted.
11253
11259
  */
@@ -16497,7 +16503,7 @@ type DynamicFields = InferInput<typeof DynamicFieldsInputSchema>;
16497
16503
  /**
16498
16504
  * Master record detail for creating or updating customer, supplier, or general records.
16499
16505
  *
16500
- * This is the primary input type for the `upsertRecord` method.
16506
+ * This is the primary input type for the `upsert` method.
16501
16507
  *
16502
16508
  * @property recordCode - 6-character unique identifier (auto-generated if not provided)
16503
16509
  * @property insertCriteria - Duplicate handling strategy:
@@ -16632,7 +16638,7 @@ type SearchMasterRecordRS = MasterRecordDetailResponse[];
16632
16638
  * @property MasterRecordDetail - Record data to insert or update
16633
16639
  *
16634
16640
  * @internal This type is primarily for internal SDK use. Use {@link MasterRecordDetail}
16635
- * as the input type for `client.master.upsertRecord()`.
16641
+ * as the input type for `client.master.upsert()`.
16636
16642
  */
16637
16643
  type ManageMasterRecordRequest = InferInput<typeof ManageMasterRecordRequestSchema>;
16638
16644
  /**
@@ -16644,7 +16650,7 @@ type ManageMasterRecordRequest = InferInput<typeof ManageMasterRecordRequestSche
16644
16650
  *
16645
16651
  * @example
16646
16652
  * ```typescript
16647
- * const result = await client.master.upsertRecord({
16653
+ * const result = await client.master.upsert({
16648
16654
  * languageCode: '02',
16649
16655
  * name: 'New Customer',
16650
16656
  * insertCriteria: 'N',
@@ -16877,11 +16883,49 @@ type OpConfig<TIn, TApiBody extends Record<string, unknown>, TOut extends {
16877
16883
  responseRoot: string;
16878
16884
  apiSchema: BaseSchema<TIn, TApiBody, BaseIssue<unknown>>;
16879
16885
  responseSchema: BaseSchema<unknown, TOut, BaseIssue<unknown>>;
16880
- bodyKey?: string;
16886
+ bodyKey?: OpBodyKey;
16881
16887
  };
16888
+ /**
16889
+ * Object enum of `invokeOp` / `AVES_OPS` keys.
16890
+ * Prefer `AvesOp.create` over string literals in domain clients.
16891
+ */
16892
+ declare const AvesOp: {
16893
+ readonly search: "search";
16894
+ readonly upsert: "upsert";
16895
+ readonly create: "create";
16896
+ readonly updateServices: "updateServices";
16897
+ readonly updateHeader: "updateHeader";
16898
+ readonly cancel: "cancel";
16899
+ readonly setStatus: "setStatus";
16900
+ readonly setServiceStatus: "setServiceStatus";
16901
+ readonly addPayments: "addPayments";
16902
+ readonly searchBookings: "searchBookings";
16903
+ readonly searchPackages: "searchPackages";
16904
+ readonly searchServices: "searchServices";
16905
+ readonly get: "get";
16906
+ readonly commit: "commit";
16907
+ };
16908
+ type AvesOp = EnumValue<typeof AvesOp>;
16909
+ declare const AvesOpSchema: import("valibot").PicklistSchema<EnumValue<{
16910
+ readonly search: "search";
16911
+ readonly upsert: "upsert";
16912
+ readonly create: "create";
16913
+ readonly updateServices: "updateServices";
16914
+ readonly updateHeader: "updateHeader";
16915
+ readonly cancel: "cancel";
16916
+ readonly setStatus: "setStatus";
16917
+ readonly setServiceStatus: "setServiceStatus";
16918
+ readonly addPayments: "addPayments";
16919
+ readonly searchBookings: "searchBookings";
16920
+ readonly searchPackages: "searchPackages";
16921
+ readonly searchServices: "searchServices";
16922
+ readonly get: "get";
16923
+ readonly commit: "commit";
16924
+ }>[], undefined>;
16882
16925
  /**
16883
16926
  * Static descriptor per AVES operation: endpoint, XML roots, schemas, optional body nest.
16884
- * Domains call `invokeOp(op, params)` — everything else is looked up here.
16927
+ * Domains call `invokeOp(AvesOp.*, params)` — keys match public method names where unique;
16928
+ * collisions across namespaces use a short domain qualifier (`searchBookings`, `searchPackages`).
16885
16929
  */
16886
16930
  declare const AVES_OPS: {
16887
16931
  readonly search: OpConfig<{
@@ -17095,7 +17139,7 @@ declare const AVES_OPS: {
17095
17139
  warnings: string | undefined;
17096
17140
  };
17097
17141
  }>;
17098
- readonly upsertRecord: OpConfig<{
17142
+ readonly upsert: OpConfig<{
17099
17143
  recordCode?: string | undefined;
17100
17144
  insertCriteria?: EnumValue<{
17101
17145
  readonly S: "S";
@@ -17605,7 +17649,7 @@ declare const AVES_OPS: {
17605
17649
  vatCode?: string | undefined;
17606
17650
  zipCode?: string | undefined;
17607
17651
  }>;
17608
- readonly createBooking: OpConfig<{
17652
+ readonly create: OpConfig<{
17609
17653
  createDate?: string | undefined;
17610
17654
  bookingFileRefCode?: string | undefined;
17611
17655
  travelAgentCode?: string | undefined;
@@ -19639,7 +19683,7 @@ declare const AVES_OPS: {
19639
19683
  travelAgencyEmail?: string | undefined;
19640
19684
  travelAgencyName?: string | undefined;
19641
19685
  }>;
19642
- readonly modBookingServices: OpConfig<{
19686
+ readonly updateServices: OpConfig<{
19643
19687
  customerRecordCode: string;
19644
19688
  bookingFileCode: string;
19645
19689
  currencyCode?: string | undefined;
@@ -20752,7 +20796,7 @@ declare const AVES_OPS: {
20752
20796
  travelAgencyEmail?: string | undefined;
20753
20797
  travelAgencyName?: string | undefined;
20754
20798
  }>;
20755
- readonly modBookingHeader: OpConfig<{
20799
+ readonly updateHeader: OpConfig<{
20756
20800
  customerRecordCode: string;
20757
20801
  bookingFileCode: string;
20758
20802
  bookingFileStartDate: string;
@@ -21014,7 +21058,7 @@ declare const AVES_OPS: {
21014
21058
  warnings: string | undefined;
21015
21059
  };
21016
21060
  }>;
21017
- readonly cancelBooking: OpConfig<{
21061
+ readonly cancel: OpConfig<{
21018
21062
  customerRecordCode: string;
21019
21063
  bookingFileCode: string;
21020
21064
  } & {
@@ -21036,7 +21080,7 @@ declare const AVES_OPS: {
21036
21080
  warnings: string | undefined;
21037
21081
  };
21038
21082
  }>;
21039
- readonly setBookingStatus: OpConfig<{
21083
+ readonly setStatus: OpConfig<{
21040
21084
  customerRecordCode: string;
21041
21085
  bookingFileCode: string;
21042
21086
  fileStatus: {
@@ -21543,7 +21587,7 @@ declare const AVES_OPS: {
21543
21587
  travelAgencyEmail?: string | undefined;
21544
21588
  travelAgencyName?: string | undefined;
21545
21589
  }>;
21546
- readonly setBookingServiceStatus: OpConfig<{
21590
+ readonly setServiceStatus: OpConfig<{
21547
21591
  customerRecordCode: string;
21548
21592
  bookingFileCode: string;
21549
21593
  bookingServiceRef: string;
@@ -21871,7 +21915,7 @@ declare const AVES_OPS: {
21871
21915
  travelAgencyEmail?: string | undefined;
21872
21916
  travelAgencyName?: string | undefined;
21873
21917
  }>;
21874
- readonly insertFilePaymentList: OpConfig<{
21918
+ readonly addPayments: OpConfig<{
21875
21919
  bookingFileCode?: string | undefined;
21876
21920
  bookingFileRefCode?: string | undefined;
21877
21921
  paymentUser?: string | undefined;
@@ -21991,7 +22035,7 @@ declare const AVES_OPS: {
21991
22035
  warnings: string | undefined;
21992
22036
  };
21993
22037
  }>;
21994
- readonly searchBookingFiles: OpConfig<({
22038
+ readonly searchBookings: OpConfig<({
21995
22039
  customerRecordCode: string;
21996
22040
  customerPromoterCode?: string | undefined;
21997
22041
  getSupplierInfo?: "false" | "true" | boolean | undefined;
@@ -22765,7 +22809,7 @@ declare const AVES_OPS: {
22765
22809
  warnings: string | undefined;
22766
22810
  };
22767
22811
  }>;
22768
- readonly searchTopServices: OpConfig<{
22812
+ readonly searchServices: OpConfig<{
22769
22813
  customerRecordCode: string;
22770
22814
  languageCode?: string | undefined;
22771
22815
  currencyCode?: string | undefined;
@@ -23166,7 +23210,7 @@ declare const AVES_OPS: {
23166
23210
  toServiceType?: string | undefined;
23167
23211
  }[] | undefined;
23168
23212
  }>;
23169
- readonly getPackageDetail: OpConfig<{
23213
+ readonly get: OpConfig<{
23170
23214
  customerRecordCode: string;
23171
23215
  languageCode?: string | undefined;
23172
23216
  currencyCode?: string | undefined;
@@ -23467,7 +23511,7 @@ declare const AVES_OPS: {
23467
23511
  startDate?: string | undefined;
23468
23512
  startValidation?: string | undefined;
23469
23513
  }>;
23470
- readonly commitPackage: OpConfig<{
23514
+ readonly commit: OpConfig<{
23471
23515
  packageCode: string;
23472
23516
  }, {
23473
23517
  PackageCode: string;
@@ -23485,7 +23529,6 @@ declare const AVES_OPS: {
23485
23529
  };
23486
23530
  }>;
23487
23531
  };
23488
- type AvesOp = keyof typeof AVES_OPS;
23489
23532
  /** Runtime input accepted by an op's API schema (facade + AVES dual keys). */
23490
23533
  type OpParams<K extends AvesOp> = InferInput<(typeof AVES_OPS)[K]["apiSchema"]>;
23491
23534
  /** Parsed success payload for an op (before facade aliases). */
@@ -23520,21 +23563,21 @@ declare class BookingClient {
23520
23563
  private readonly transport;
23521
23564
  constructor(transport: AvesTransport);
23522
23565
  /** Create a booking file (CreateBookingFile). */
23523
- createBooking(params: BookingFileRQ): Promise<Result<FacadeOutput<BookingFileRS>, AvesError>>;
23566
+ create(params: BookingFileRQ): Promise<Result<FacadeOutput<BookingFileRS>, AvesError>>;
23524
23567
  /** Add/replace services, assign package, delete/nullify cost items. */
23525
- modBookingServices(params: ModFileServicesRQ): Promise<Result<FacadeOutput<BookingFileDetailRS>, AvesError>>;
23568
+ updateServices(params: ModFileServicesRQ): Promise<Result<FacadeOutput<BookingFileDetailRS>, AvesError>>;
23526
23569
  /** Header only (pax, notes, billing) — no costs. */
23527
- modBookingHeader(params: ModFileHeaderRQ): Promise<Result<FacadeOutput<BookingStatusOnlyRS>, AvesError>>;
23570
+ updateHeader(params: ModFileHeaderRQ): Promise<Result<FacadeOutput<BookingStatusOnlyRS>, AvesError>>;
23528
23571
  /** Delete a booking file (CancelBookingFile). */
23529
- cancelBooking(params: CancelFileRQ): Promise<Result<FacadeOutput<BookingStatusOnlyRS>, AvesError>>;
23572
+ cancel(params: CancelFileRQ): Promise<Result<FacadeOutput<BookingStatusOnlyRS>, AvesError>>;
23530
23573
  /** Change booking file status (incl. CANCELED / NULLIFIED). */
23531
- setBookingStatus(params: SetFileStatusRQ): Promise<Result<FacadeOutput<BookingFileDetailRS>, AvesError>>;
23574
+ setStatus(params: SetFileStatusRQ): Promise<Result<FacadeOutput<BookingFileDetailRS>, AvesError>>;
23532
23575
  /** Nullify a single booked service line. */
23533
- setBookingServiceStatus(params: SetFileServiceStatusRQ): Promise<Result<FacadeOutput<BookingFileDetailRS>, AvesError>>;
23576
+ setServiceStatus(params: SetFileServiceStatusRQ): Promise<Result<FacadeOutput<BookingFileDetailRS>, AvesError>>;
23534
23577
  /** Register one or more payments on a booking file. */
23535
- insertFilePaymentList(params: FilePaymentListRQ): Promise<Result<FacadeOutput<BookingStatusOnlyRS>, AvesError>>;
23578
+ addPayments(params: FilePaymentListRQ): Promise<Result<FacadeOutput<BookingStatusOnlyRS>, AvesError>>;
23536
23579
  /** Search booking files, incl. by PACKAGE_CODE. */
23537
- searchBookingFiles(params: SearchBookingFileRQ): Promise<Result<FacadeOutput<SearchBookingFileRS>, AvesError>>;
23580
+ search(params: SearchBookingFileRQ): Promise<Result<FacadeOutput<SearchBookingFileRS>, AvesError>>;
23538
23581
  }
23539
23582
  //#endregion
23540
23583
  //#region src/client/master-records.d.ts
@@ -23544,7 +23587,7 @@ declare class MasterRecordsClient {
23544
23587
  /** Search master records. Success returns a flat array (empty when no matches). */
23545
23588
  search(params: SearchMasterRecord): Promise<Result<FacadeOutput<SearchMasterRecordRS>, AvesError>>;
23546
23589
  /** Insert or update a master record. */
23547
- upsertRecord(record: MasterRecordDetail): Promise<Result<FacadeOutput<ManageMasterRecordRS>, AvesError>>;
23590
+ upsert(record: MasterRecordDetail): Promise<Result<FacadeOutput<ManageMasterRecordRS>, AvesError>>;
23548
23591
  }
23549
23592
  //#endregion
23550
23593
  //#region src/client/packages.d.ts
@@ -23553,13 +23596,13 @@ declare class PackageCatalogClient {
23553
23596
  private readonly transport;
23554
23597
  constructor(transport: AvesTransport);
23555
23598
  /** Search packages / programs. Defaults `avesSearchType` to `PACKAGE`. */
23556
- searchPackages(params: AvesSearchRQ): Promise<Result<FacadeOutput<SearchPackageRS>, AvesError>>;
23599
+ search(params: AvesSearchRQ): Promise<Result<FacadeOutput<SearchPackageRS>, AvesError>>;
23557
23600
  /** Search TOP services. Defaults `avesSearchType` to `SERVICE`. */
23558
- searchTopServices(params: AvesSearchRQ): Promise<Result<FacadeOutput<SearchServicesRS>, AvesError>>;
23601
+ searchServices(params: AvesSearchRQ): Promise<Result<FacadeOutput<SearchServicesRS>, AvesError>>;
23559
23602
  /** Package / program detail + service list. */
23560
- getPackageDetail(params: PackageDetailRQ): Promise<Result<FacadeOutput<PackageDetailRS>, AvesError>>;
23603
+ get(params: PackageDetailRQ): Promise<Result<FacadeOutput<PackageDetailRS>, AvesError>>;
23561
23604
  /** Publish an existing package. Does not create packages. */
23562
- commitPackage(params: CommitPackageRQ): Promise<Result<FacadeOutput<CommitPackageRS>, AvesError>>;
23605
+ commit(params: CommitPackageRQ): Promise<Result<FacadeOutput<CommitPackageRS>, AvesError>>;
23563
23606
  }
23564
23607
  //#endregion
23565
23608
  //#region src/client/types.d.ts
@@ -23580,4 +23623,4 @@ declare class AvesClient {
23580
23623
  constructor(options: AvesClientOptions, deps?: AvesClientDeps);
23581
23624
  }
23582
23625
  //#endregion
23583
- export { type AccountPolicies, AvesClient, type AvesClientDeps, type AvesClientOptions, AvesError, type AvesOp, type AvesSearchRQ, AvesSearchType, AvesSearchTypeSchema, AvesServiceType, AvesServiceTypeSchema, AvesTransport, BookedServiceStatus, BookedServiceStatusSchema, type Booking, type BookingCancelInput, BookingClient, type BookingFileDetailRS, type BookingFileRQ, type BookingFileRS, BookingFileStatus, BookingFileStatusSchema, BookingFileStatusWire, BookingFileStatusWireSchema, type BookingHeaderInput, type BookingInput, type BookingSearchInput, type BookingSearchResult, type BookingStatusInput, type BookingStatusOnlyRS, type CancelFileRQ, CancelOperationType, CancelOperationTypeSchema, CarrierType, CarrierTypeSchema, type CatalogSearchInput, type CommitInput, type CommitPackageRQ, type CommitPackageRS, CostPriceType, CostPriceTypeSchema, CustomerPaymentType, CustomerPaymentTypeSchema, DestinationType, DestinationTypeSchema, DocumentType, DocumentTypeSchema, type DynamicFields, type FilePaymentListRQ, FilePaymentOperationType, FilePaymentOperationTypeSchema, type FinancialDetail, Gender, GenderSchema, GroupingPaxPolicy, GroupingPaxPolicySchema, type IdDocumentDetail, InsertCriteria, InsertCriteriaSchema, MakeDocumentTo, MakeDocumentToSchema, type ManageMasterRecordRS, type ManageMasterRecordRequest, MasterPaymentType, MasterPaymentTypeSchema, type MasterRecord, type MasterRecordDetail, type MasterRecordDetailResponse, type MasterRecordInput, MasterRecordsClient, type MasterSearchInput, type MasterSearchResult, type ModFileHeaderRQ, type ModFileServicesRQ, type OpParams, type OpResult, type OperationStatus, OptionedExpirePolicy, OptionedExpirePolicySchema, type Package, PackageCatalogClient, type PackageDetailRQ, type PackageDetailRS, type PackageInput, type PackageSearchResult, PassengerCategory, PassengerCategorySchema, PaxQtyCriteria, PaxQtyCriteriaSchema, type PaymentInput, PaymentType, PaymentTypeSchema, RecordStatus, RecordStatusSchema, RecordType, RecordTypeSchema, type RqHeader, type RsStatus, RsStatusValue, RsStatusValueSchema, type SearchBookingFileRQ, type SearchBookingFileRS, SearchBookingFileType, SearchBookingFileTypeSchema, type SearchMasterRecord, type SearchMasterRecordRS, SearchMasterType, SearchMasterTypeSchema, type SearchPackageRS, type SearchServicesRS, ServiceRefType, ServiceRefTypeSchema, type ServiceSearchResult, type ServiceStatusInput, type ServiceUpdateInput, type SetFileServiceStatusRQ, type SetFileStatusRQ, SetFileStatusValue, SetFileStatusValueSchema, ToServiceType, ToServiceTypeSchema, TypeDownloadFile, TypeDownloadFileSchema };
23626
+ export { type AccountPolicies, AvesClient, type AvesClientDeps, type AvesClientOptions, AvesError, AvesOp, AvesOpSchema, type AvesSearchRQ, AvesSearchType, AvesSearchTypeSchema, AvesServiceType, AvesServiceTypeSchema, AvesTransport, BookedServiceStatus, BookedServiceStatusSchema, type Booking, type BookingCancelInput, BookingClient, type BookingFileDetailRS, type BookingFileRQ, type BookingFileRS, BookingFileStatus, BookingFileStatusSchema, BookingFileStatusWire, BookingFileStatusWireSchema, type BookingHeaderInput, type BookingInput, type BookingSearchInput, type BookingSearchResult, type BookingStatusInput, type BookingStatusOnlyRS, type CancelFileRQ, CancelOperationType, CancelOperationTypeSchema, CarrierType, CarrierTypeSchema, type CatalogSearchInput, type CommitInput, type CommitPackageRQ, type CommitPackageRS, CostPriceType, CostPriceTypeSchema, CustomerPaymentType, CustomerPaymentTypeSchema, DestinationType, DestinationTypeSchema, DocumentType, DocumentTypeSchema, type DynamicFields, type FilePaymentListRQ, FilePaymentOperationType, FilePaymentOperationTypeSchema, type FinancialDetail, Gender, GenderSchema, GroupingPaxPolicy, GroupingPaxPolicySchema, type IdDocumentDetail, InsertCriteria, InsertCriteriaSchema, MakeDocumentTo, MakeDocumentToSchema, type ManageMasterRecordRS, type ManageMasterRecordRequest, MasterPaymentType, MasterPaymentTypeSchema, type MasterRecord, type MasterRecordDetail, type MasterRecordDetailResponse, type MasterRecordInput, MasterRecordsClient, type MasterSearchInput, type MasterSearchResult, type ModFileHeaderRQ, type ModFileServicesRQ, OpBodyKey, OpBodyKeySchema, type OpParams, type OpResult, type OperationStatus, OptionedExpirePolicy, OptionedExpirePolicySchema, type Package, PackageCatalogClient, type PackageDetailRQ, type PackageDetailRS, type PackageInput, type PackageSearchResult, PassengerCategory, PassengerCategorySchema, PaxQtyCriteria, PaxQtyCriteriaSchema, type PaymentInput, PaymentType, PaymentTypeSchema, RecordStatus, RecordStatusSchema, RecordType, RecordTypeSchema, type RqHeader, type RsStatus, RsStatusValue, RsStatusValueSchema, type SearchBookingFileRQ, type SearchBookingFileRS, SearchBookingFileType, SearchBookingFileTypeSchema, type SearchMasterRecord, type SearchMasterRecordRS, SearchMasterType, SearchMasterTypeSchema, type SearchPackageRS, type SearchServicesRS, ServiceRefType, ServiceRefTypeSchema, type ServiceSearchResult, type ServiceStatusInput, type ServiceUpdateInput, type SetFileServiceStatusRQ, type SetFileStatusRQ, SetFileStatusValue, SetFileStatusValueSchema, ToServiceType, ToServiceTypeSchema, TypeDownloadFile, TypeDownloadFileSchema };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import*as e from"valibot";import{ValiError as t,parse as n,safeParse as r}from"valibot";import i from"fast-xml-builder";import{XMLParser as a}from"fast-xml-parser";import{request as o}from"undici";const s={rph:`RPH`,toServiceType:`TOServiceType`,text:`#text`},ee=Object.fromEntries(Object.entries(s).map(([e,t])=>[t,e]));function c(e){return typeof e!=`object`||!e?!1:e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error||e instanceof URL||ArrayBuffer.isView(e)||typeof Buffer<`u`&&Buffer.isBuffer(e)}function te(e){return s[e]??e.charAt(0).toUpperCase()+e.slice(1)}function ne(e){return ee[e]??e.charAt(0).toLowerCase()+e.slice(1)}function l(e,t){let n=t?.textContent===e?`#text`:t?.rename?.[e]??te(e);return n===`#text`||!t?.attrs?.includes(e)?n:t.preserveCamel?.includes(e)?`@${e}`:`@${n}`}const re=new WeakMap,ie=new WeakMap;function ae(e){let t=re.get(e);if(t)return t;let{listWrap:n,detailKey:r,...i}=e;return re.set(e,i),i}function oe(e,t){if(!t?.listWrap)return t;let n=ie.get(t);n||(n=new Map,ie.set(t,n));let r=n.get(e);if(r)return r;let i={children:{[t.detailKey??(e.endsWith(`List`)?`${e.slice(0,-4)}Detail`:`${e}Detail`)]:ae(t)}};return n.set(e,i),i}function se(e){return ce(e)}function ce(e){if(typeof e!=`object`||!e||c(e))return e;if(Array.isArray(e)){for(let t=0;t<e.length;t++)e[t]=ce(e[t]);return e}let t=e;for(let e of Object.keys(t)){let n=ce(t[e]),r=ne(e.startsWith(`@`)?e.slice(1):e);r!==e&&delete t[e],t[r]=n}return t}const le={rsStatus:`response`,customerRecordCode:`customerCode`,bookingFileCode:`bookingCode`,bookingFileRefCode:`bookingReference`,bookingFileStatus:`status`,bookingFileDescription:`description`,bookingFileStartDate:`startDate`,bookingFileReferenceName:`referenceName`,bookingFileServiceStatus:`serviceStatus`,bookingFileServiceStatusDate:`serviceStatusDate`,bookingServiceRef:`serviceReference`,newCustomerRecordCode:`newCustomerCode`,customerDetail:`customer`,bookingFileDocument:`documents`,bookingFinancialInfo:`financial`,financialDetail:`financial`,idDocumentDetail:`identityDocument`,idDocInfo:`identityDocument`,accountPolicies:`policies`,dynamicFields:`customFields`,supplierRefMasterRecords:`supplierReference`,selectedPackageDetail:`package`,selectedPackageList:`packages`,selectedServiceList:`services`,extraQuoteServiceList:`extraServices`,passengerList:`passengers`,noteList:`notes`,deadlineList:`deadlines`,financialDeadlineList:`financialDeadlines`,paymentList:`payments`,filePaymentList:`payments`,cancellableBookedServiceList:`cancellableServices`,bookedServiceList:`services`,serviceList:`services`,subServiceList:`subServices`,featureList:`features`,packageList:`packages`,pCode:`packageCode`,sCode:`serviceCode`,ssCode:`subServiceCode`,rph:`passengerRef`,roomRph:`roomRef`,avesSession:`session`,paxAssociated:`passengerRefs`,paxQty:`passengerCount`,paxQtyCriteria:`passengerCountRule`,qty:`quantity`,pax:`passengerCount`,eMail:`email`,sex:`gender`,nType:`noteType`,avesServiceType:`serviceType`,toServiceType:`targetType`,packageParams:`packageOptions`,topServiceParams:`serviceOptions`,servOrPackCode:`serviceOrPackageCode`,servOrPackDesc:`serviceOrPackageDescription`,getDocumentation:`includeDocumentation`,getServicesFromPackage:`includeServices`,mergeBoardAndAccomodation:`mergeBoardAndAccommodation`,discartNotAvailables:`discardUnavailable`,discartNotAvailablesMinSales:`discardUnavailableMinSales`,discartNotAvailablesDaysInOut:`discardUnavailableDaysInOut`,getAllDeptDate:`allDepartureDates`,getAllAccomodation:`allAccommodation`,compatibleAccomodation:`compatibleAccommodation`,alternativeAccomodation:`alternativeAccommodation`,fileStatus:`status`},ue=new Set([`__proto__`,`prototype`,`constructor`]),u={};for(let[e,t]of Object.entries(le))u[t]||(u[t]=[]),u[t].push(e);const de=new WeakMap;function d(e){return typeof e==`string`&&ue.has(e)}function f(e,t){if(typeof t!=`string`||Reflect.has(e,t))return t;let n=u[t];if(!n)return t;for(let t of n)if(Reflect.has(e,t))return t;return n[0]??t}function p(e){return typeof e!=`object`||!e||c(e)?e:de.get(e)||(Array.isArray(e)?fe(e):pe(e))}function fe(e){let t=new Proxy(e,{get(e,t,n){if(t===`length`)return e.length;if(typeof t==`string`&&/^\d+$/.test(t)){let n=Number(t);if(n<0||n>=e.length)return;let r=e[n];return typeof r==`function`?r.bind(e):p(r)}let r=Reflect.get(e,t,n);return typeof r==`function`?r.bind(e):r},set(e,t,n,r){return!d(t)&&Reflect.set(e,t,n,r)},defineProperty(e,t,n){return!d(t)&&Reflect.defineProperty(e,t,n)},deleteProperty(e,t){return!d(t)&&Reflect.deleteProperty(e,t)},setPrototypeOf(){return!1}});return de.set(e,t),t}function pe(e){let t=new Proxy(e,{get(e,t,n){let r=f(e,t);return p(Reflect.get(e,r,n))},set(e,t,n,r){return!d(t)&&Reflect.set(e,f(e,t),n,r)},has(e,t){return typeof t==`string`&&!Reflect.has(e,t)&&u[t]?.some(t=>Reflect.has(e,t))?!0:Reflect.has(e,f(e,t))},ownKeys(e){let t=Reflect.ownKeys(e),n=new Set(t),r=[];for(let e of t){if(typeof e!=`string`)continue;let t=le[e];t&&!n.has(t)&&(n.add(t),r.push(t))}return[...t,...r]},getOwnPropertyDescriptor(e,t){let n=f(e,t),r=Reflect.getOwnPropertyDescriptor(e,n);if(r)return n===t?`value`in r?{...r,value:p(r.value)}:r:{configurable:!0,enumerable:!0,writable:!0,value:p(`value`in r?r.value:Reflect.get(e,n))}},defineProperty(e,t,n){return!d(t)&&Reflect.defineProperty(e,f(e,t),n)},deleteProperty(e,t){return!d(t)&&Reflect.deleteProperty(e,f(e,t))},getPrototypeOf(e){return Reflect.getPrototypeOf(e)},setPrototypeOf(){return!1}});return de.set(e,t),t}function me(e){return p(e)}function m(e){return e.success?{success:!0,data:me(e.data)}:e}var he=class{transport;constructor(e){this.transport=e}async createBooking(e){return m(await this.transport.invokeOp(`createBooking`,e))}async modBookingServices(e){return m(await this.transport.invokeOp(`modBookingServices`,e))}async modBookingHeader(e){return m(await this.transport.invokeOp(`modBookingHeader`,e))}async cancelBooking(e){return m(await this.transport.invokeOp(`cancelBooking`,e))}async setBookingStatus(e){return m(await this.transport.invokeOp(`setBookingStatus`,e))}async setBookingServiceStatus(e){return m(await this.transport.invokeOp(`setBookingServiceStatus`,e))}async insertFilePaymentList(e){return m(await this.transport.invokeOp(`insertFilePaymentList`,e))}async searchBookingFiles(e){return m(await this.transport.invokeOp(`searchBookingFiles`,e))}};function ge(e){return{success:!0,data:e}}function h(e){return{success:!1,error:e}}var _e=class{transport;constructor(e){this.transport=e}async search(e){let t=await this.transport.invokeOp(`search`,e);return t.success?ge(me(t.data.masterRecordList??[])):t}async upsertRecord(e){return m(await this.transport.invokeOp(`upsertRecord`,e))}};function g(t){return e.picklist(Object.values(t))}const ve={M:`M`,F:`F`},ye=g(ve),be={OK:`OK`,ERROR:`ERROR`,WARNING:`WARNING`,TIMEOUT:`TIMEOUT`},xe=g(be),_={CODE:`CODE`,NAME:`NAME`,VATCODE:`VATCODE`,ZONE:`ZONE`,CATEGORY:`CATEGORY`,EMAIL:`EMAIL`,LASTMODDATE:`LASTMODDATE`,SEARCH_FIELD:`SEARCH_FIELD`,EXTERNAL_REF_CODE:`EXTERNAL_REF_CODE`},Se=g(_),Ce={CUSTOMER:`CUSTOMER`,SUPPLIER:`SUPPLIER`,VOUCHER:`VOUCHER`,SUPPLIER_VOUCHER:`SUPPLIER_VOUCHER`,GENERAL:`GENERAL`},we=g(Ce),Te={ENABLED:`ENABLED`,DISABLED:`DISABLED`,WARNING:`WARNING`,BLACKLISTED:`BLACKLISTED`},Ee=g(Te),De={S:`S`,N:`N`,T:`T`,M:`M`},Oe=g(De),ke={CASH:`CASH`,BANK:`BANK`,RID:`RID`,RIBA:`RIBA`,SPECIFIC_CODE:`SPECIFIC_CODE`},Ae=g(ke),je={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`},Me=g(je),Ne={QUOTATION:`QUOTATION`,WORK_IN_PROGRESS:`WORK_IN_PROGRESS`,CONFIRMED:`CONFIRMED`,OPTIONED:`OPTIONED`,CANCELED:`CANCELED`},Pe=g(Ne),Fe={...Ne,NULLIFIED:`NULLIFIED`},Ie=g(Fe),v={QUOTATION:`QUOTATION`,WORK_IN_PROGRESS:`WORK_IN_PROGRESS`,CONFIRM:`CONFIRM`,CONFIRMED:`CONFIRMED`,OPTION:`OPTION`,OPTIONED:`OPTIONED`,REQUEST:`REQUEST`,REQUESTED:`REQUESTED`,NULLIFIED:`NULLIFIED`,CANCELED:`CANCELED`},Le=g(v),Re={TOP:`TOP`,TOP_SS:`TOP_SS`,ADV:`ADV`,GRP:`GRP`,OTHER:`OTHER`},ze=g(Re),Be={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`,TOUR:`TOUR`},Ve=g(Be),He={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`},Ue=g(He),We={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`},Ge=g(We),Ke={CASH:`CASH`,BANK:`BANK`,RID:`RID`,RIBA:`RIBA`,SPECIFIC_CODE:`SPECIFIC_CODE`,NOT_SET:`NOT_SET`},qe=g(Ke),Je={AD:`AD`,CH:`CH`,IN:`IN`,OV:`OV`},Ye=g(Je),Xe={NULLIFY:`NULLIFY`,DELETE:`DELETE`},Ze=g(Xe),Qe={RPH:`RPH`,FILE:`FILE`},$e=g(Qe),et={NOT_SET:`NOT_SET`,CONSIDER_HOLIDAY:`CONSIDER_HOLIDAY`,CONSIDER_HOLIDAY_AND_SATURDAY:`CONSIDER_HOLIDAY_AND_SATURDAY`},tt=g(et),nt={AbsoluteAmountsInsertion:`AbsoluteAmountsInsertion`,FinalAmountToAchieve:`FinalAmountToAchieve`,FinalAmountToAchieveWithoutControls:`FinalAmountToAchieveWithoutControls`},rt=g(nt),it={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`},at=g(it),ot={BOOKING_CUSTOMER:`BOOKING_CUSTOMER`,FIRST_PASSENGER:`FIRST_PASSENGER`},st=g(ot),ct={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`},lt=g(ct),ut={GROUPED_PAX:`GROUPED_PAX`,NOT_GROUPED_PAX:`NOT_GROUPED_PAX`,ONE_PAX_ONLY:`ONE_PAX_ONLY`},dt=g(ut),ft={AVES2AVES:`AVES2AVES`,AVES2AVESVIA:`AVES2AVESVIA`,AVES2AVESITA:`AVES2AVESITA`},pt=g(ft),y={FILE_CODE:`FILE_CODE`,PAX_NAME:`PAX_NAME`,PACKAGE_CODE:`PACKAGE_CODE`,OTHER:`OTHER`},mt=g(y),b={SERVICE:`SERVICE`,PROGRAM:`PROGRAM`,PACKAGE:`PACKAGE`},ht=g(b),gt={GREATER_THAN:`GREATER_THAN`,GREATER_OR_EQUAL:`GREATER_OR_EQUAL`,EQUAL_TO:`EQUAL_TO`,LESS_OR_EQUAL:`LESS_OR_EQUAL`,LESS_THAN:`LESS_THAN`},_t=g(gt),vt={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=g(vt);var bt=class{transport;constructor(e){this.transport=e}#e(e,t){return{...this.transport.languageCode&&{languageCode:this.transport.languageCode},...e,avesSearchType:e.avesSearchType??e.searchType??t}}async searchPackages(e){return m(await this.transport.invokeOp(`searchPackages`,this.#e(e,b.PACKAGE)))}async searchTopServices(e){return m(await this.transport.invokeOp(`searchTopServices`,this.#e(e,b.SERVICE)))}async getPackageDetail(e){return m(await this.transport.invokeOp(`getPackageDetail`,e))}async commitPackage(e){return m(await this.transport.invokeOp(`commitPackage`,e))}};const xt={VALIDATION:`validation`,API:`api`,UNKNOWN:`unknown`};var x=class extends Error{kind;status;code;constructor(e,t,n,r){super(t),this.kind=e,this.status=n,this.code=r,this.name=`AvesError`}};function S(e){return new x(xt.VALIDATION,e)}function St(e,t,n){return new x(xt.API,e,t,n)}function Ct(e){return new x(xt.UNKNOWN,e)}function wt(e,n){return e instanceof x?e:e instanceof t?S(`Validation error: ${Tt(e.issues)}`):e instanceof Error?Ct(e.message):Ct(n)}function Tt(e){return e.map(Et).join(`; `)}function Et(e){let t=Dt(e.path),n=e.message??`Invalid value`;return t?`${t}: ${n}`:n}function Dt(e){if(!e||e.length===0)return;let t=e.map(Ot).filter(e=>e!==void 0);return t.length>0?t.join(`.`):void 0}function Ot(e){if(typeof e==`string`||typeof e==`number`)return String(e);if(typeof e==`object`&&e&&`key`in e)return String(e.key)}function kt(e){return e instanceof Error&&e.name===`AbortError`}const At=e=>e<200||e>299,jt={ignoreAttributes:!1,attributeNamePrefix:`@`,parseAttributeValue:!1,trimValues:!0,ignoreNameSpace:!0,removeNSPrefix:!0,parseTagValue:!1},Mt={ignoreAttributes:!1,attributeNamePrefix:`@`,suppressEmptyNode:!0},Nt=new a(jt),Pt=new i(Mt);function Ft(e){try{return Pt.build(e)}catch(e){throw S(`Failed to convert JSON to XML: ${e instanceof Error?e.message:`Unknown error`}`)}}function It(e){try{return Nt.parse(e)}catch(e){throw S(`Failed to convert XML to JSON: ${e instanceof Error?e.message:`Unknown error`}`)}}const C={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 Lt(e,t){return{[e]:t}}function Rt(e,t,n){let r=e.bodyKey?{[e.bodyKey]:t}:t;return Lt(e.requestRoot,{RqHeader:n,...r})}function zt(e){return typeof e==`string`?e:e instanceof Uint8Array||Buffer.isBuffer(e)?Buffer.from(e).toString(`utf8`):String(e)}async function Bt(e,t){let n=``;for await(let r of e){if(n.length>=t)continue;let e=zt(r),i=t-n.length;n+=e.length<=i?e:e.slice(0,i)}return n}function Vt(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 Ht(e,t){if(!t.startsWith(`/`))throw S(`Invalid endpoint: endpoint must start with '/' but got '${t}'`);let n;try{n=new URL(e)}catch(e){throw S(`Invalid baseURL: ${e instanceof Error?e.message:`Invalid URL format`}`)}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw S(`Invalid protocol: baseURL must use http:// or https:// but got '${n.protocol}'`);let{pathname:r}=n;if(r===`/`||r===``)return new URL(t,n).href;let i=(r.endsWith(`/`)?r.slice(0,-1):r)+t;return new URL(i,n).href}const Ut={"Content-Type":`application/xml`};var Wt=class{options;urlByEndpoint=new Map;constructor(e){this.options=e}async postXml(e,t){let{signal:n,clear:r}=Vt(this.options.timeoutMs??3e4);try{let r=await o(this.resolveUrl(e),{method:`POST`,headers:Ut,body:t,signal:n}),i=At(r.statusCode),a=i?await Bt(r.body,4096):await r.body.text();return i?h(St(a,`ERROR`,r.statusCode)):ge({statusCode:r.statusCode,body:a})}catch(e){return kt(e)?h(St(`Request timed out`,`TIMEOUT`)):h(wt(e,`Unknown error occurred`))}finally{r?.()}}resolveUrl(e){let t=this.urlByEndpoint.get(e);if(t)return t;let n=Ht(this.options.baseURL,e);return this.urlByEndpoint.set(e,n),n}};const w={customerCode:`customerRecordCode`,bookingCode:`bookingFileCode`,bookingReference:`bookingFileRefCode`},Gt={noteType:`nType`},Kt={passengerRef:`rph`,roomRef:`roomRph`,gender:`sex`,email:`eMail`,identityDocument:`idDocInfo`},qt={serviceCode:`sCode`,subServiceCode:`ssCode`,quantity:`qty`,passengerCount:`pax`,session:`avesSession`,passengerRefs:`paxAssociated`,serviceType:`avesServiceType`,targetType:`toServiceType`,notes:`noteList`},Jt={packageCode:`pCode`,includeServices:`getServicesFromPackage`},Yt={...w,customer:`customerDetail`,status:`bookingFileStatus`,description:`bookingFileDescription`,referenceName:`bookingFileReferenceName`,financial:`bookingFinancialInfo`,package:`selectedPackageDetail`,packages:`selectedPackageList`,services:`selectedServiceList`,extraServices:`extraQuoteServiceList`,passengers:`passengerList`,payments:`paymentList`,documents:`bookingFileDocument`,deadlines:`deadlineList`,financialDeadlines:`financialDeadlineList`,notes:`noteList`},Xt={...w,package:`selectedPackageDetail`,packages:`selectedPackageList`,services:`selectedServiceList`,passengers:`passengerList`,deadlines:`deadlineList`,cancellableServices:`cancellableBookedServiceList`},Zt={...w,startDate:`bookingFileStartDate`,newCustomerCode:`newCustomerRecordCode`,referenceName:`bookingFileReferenceName`,passengers:`passengerList`,financial:`bookingFinancialInfo`,financialDeadlines:`financialDeadlineList`},Qt={...w,status:`fileStatus`,documents:`bookingFileDocument`},$t={...w,serviceReference:`bookingServiceRef`,serviceStatus:`bookingFileServiceStatus`,serviceStatusDate:`bookingFileServiceStatusDate`},en={...w,payments:`filePaymentList`},T={...w,status:`fileStatus`},tn={financial:`financialDetail`,identityDocument:`idDocumentDetail`,policies:`accountPolicies`,customFields:`dynamicFields`,supplierReference:`supplierRefMasterRecords`},nn={...w,searchType:`avesSearchType`,passengers:`passengerList`,packageOptions:`packageParams`,serviceOptions:`topServiceParams`,serviceOrPackageCode:`servOrPackCode`,serviceOrPackageDescription:`servOrPackDesc`,passengerCount:`paxQty`,passengerCountRule:`paxQtyCriteria`,features:`featureList`,includeDocumentation:`getDocumentation`,mergeBoardAndAccommodation:`mergeBoardAndAccomodation`,discardUnavailable:`discartNotAvailables`,discardUnavailableMinSales:`discartNotAvailablesMinSales`,discardUnavailableDaysInOut:`discartNotAvailablesDaysInOut`},rn={allDepartureDates:`getAllDeptDate`,allAccommodation:`getAllAccomodation`,compatibleAccommodation:`compatibleAccomodation`,alternativeAccommodation:`alternativeAccomodation`},an={...w,services:`selectedServiceList`,passengers:`passengerList`},on=e.pipe(e.string(),e.minLength(2),e.maxLength(2)),E=e.optional(on),D=e.union([e.string(),e.number()]),O=e.union([e.string(),e.number(),e.boolean()]),k=e.object({minDate:e.string(),maxDate:e.string()}),sn=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}),cn=e.optional(e.string()),A=e.pipe(e.object({"@Status":xe,ErrorCode:e.optional(e.pipe(D,e.transform(e=>Number(e)))),ErrorDescription:e.optional(e.string()),Warnings:cn}),e.transform(e=>({status:e[`@Status`],errorCode:e.ErrorCode,errorDescription:e.ErrorDescription,warnings:e.Warnings}))),ln=P(e.object({RsStatus:A})),un={financialDeadlineList:`deadlineDetail`};function dn(e,t){return t?.detailKey??un[e]??(e.endsWith(`List`)?`${e.slice(0,-4)}Detail`:`${e}Detail`)}function fn(e){return Array.isArray(e)?e.length?e.every(e=>typeof e==`string`)?e.map(e=>({pax:e})):e:``:e}function j(e,t){if(typeof e!=`object`||!e||c(e))return e;if(Array.isArray(e))return e.map(e=>j(e,t));let n={};for(let[r,i]of Object.entries(e)){let e=t?.children?.[r],a=r===`paxAssociated`?fn(i):i;if(e?.listWrap&&Array.isArray(a)){let i=l(dn(r,e)),o=a.map(t=>j(t,ae(e)));n[l(r,t)]=e.listWrap===`one`?o.map(e=>({[i]:e})):{[i]:o};continue}n[l(r,t)]=j(a,oe(r,e))}return n}function pn(e,t){return j(e,t)}function M(t,n){return e.pipe(t,e.transform(e=>pn(e,n)))}function mn(t){return e.pipe(e.union([e.array(t),t]),e.transform(e=>Array.isArray(e)?e:[e]))}function N(t,n){let r=e.optional(mn(n));return e.pipe(e.object({[t]:r}),e.transform(e=>e[t]??[]))}function P(t){return e.pipe(t,e.transform(e=>se(e)))}function F(t,n){let r={[t]:e.optional(n)};return P(e.object({RsStatus:A,...r}))}function hn(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 gn(t,n){return e.pipe(P(t),e.transform(e=>hn(n)(e)))}function _n(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 vn(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 yn(e){let{customerRecordCode:t,customerDetail:n,...r}=e;return{...r,customerDetail:{...n,recordCode:n?.recordCode??t}}}function bn(e){return t=>{let n={...t};for(let[t,r]of Object.entries(e)){let e=n[t];delete n[t],n[r]===void 0&&e!==void 0&&(n[r]=e)}return n}}function I(t,n){let r={...t},i={};for(let[a,o]of Object.entries(n)){let n=t[o];n!==void 0&&(i[a]=o,r[a]=Sn(n)?n:e.optional(n),Sn(n)||(r[o]=e.optional(n)))}return e.pipe(e.object(r),e.transform(bn(i)),e.object(t))}function xn(e){return e.type===`object`&&`entries`in e}function Sn(e){return e.type===`optional`&&`wrapped`in e}function Cn(e){return e.type===`array`&&`item`in e}function wn(t,n){if(Sn(t)){let r=wn(t.wrapped,n);return t.default===void 0?e.optional(r):e.optional(r,t.default)}return Cn(t)?mn(wn(t.item,n)):xn(t)?Tn(t,n):t}function Tn(t,n,r){let i={};for(let e in t.entries){let r=n.children?.[e]??{};i[l(e,n)]=wn(t.entries[e],r)}return e.object({...i,...r})}function En(e,t={},n){return Tn(e,t,n)}function L(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 R(e,t){return{api:M(e,t),validation:En(e,t)}}function z(e){return e}function B(...e){return z({attrs:e})}function Dn(...e){return z({attrs:e,preserveCamel:e})}function On(e,t){return z({attrs:e,preserveCamel:t})}function V(e){return z({children:e})}function H(e,t){return z({attrs:e,children:t})}function U(e,t,n){return z(n?{...e,listWrap:t,detailKey:n}:{...e,listWrap:t})}function W(e,...t){return U(B(...t),e)}function kn(e){return{one:U(e,`one`),many:U(e,`many`)}}B(`hostID`,`xtoken`,`interface`,`userName`,`status`,`languageCode`);const An=B(`currencyCode`,`creditLimit`,`c_PaymentType`,`c_SpecPaymentTypeCode`,`s_PaymentType`,`s_SpecPaymentTypeCode`,`enableElectronicInvoicing`,`electronicInvoicingType`),jn=B(`idType`,`idCode`,`idIssueLocation`,`idIssueCounty`,`idIssueDate`,`idExpireDate`),Mn=B(`acceptProfilingPolicies`,`acceptPrivacyPolicies`,`acceptNewsletterPolicies`),Nn=B(`key`,`value`),Pn=B(`supplierRefCode`,`companyMainBusinessType`,`carrierType`),Fn=H([`recordCode`,`insertCriteria`],{financialDetail:An,idDocumentDetail:jn,accountPolicies:Mn,dynamicFields:Nn,supplierRefMasterRecords:Pn}),G=B(`minDate`,`maxDate`),In=V({lastModificationDate:G}),Ln=Dn(`sCode1`,`sCode2`,`sCode3`,`sCode4`,`sCode5`,`sCode6`),Rn=B(`code`,`iataCode`,`nationCode`,`type`),zn=B(`nType`,`title`),Bn=U(zn,`many`),Vn=H([`rph`,`roomRph`,`billingHolder`],{notes:U(zn,`many`,`noteDetail`),idDocInfo:jn}),Hn=B(`currencyCode`,`exchangeRate`,`cost`,`costTax`,`costType`,`vatCostCurrencyCode`,`price`,`priceTax`,`priceType`),Un=On([`pCode`,`startDate`,`endDate`,`getServicesFromPackage`],[`pCode`]),K=kn(z({...On([`sCode`,`ssCode`],[`sCode`,`ssCode`]),children:{serviceFare:Hn,avesServiceInfo:V({serviceFare:Hn}),noteList:Bn}})),q=kn(Vn);q.one,q.many;const Wn=U(Un,`many`),Gn=W(`many`,`deadlineCode`,`description`,`expireDate`),Kn=W(`many`,`reschedulingCode`,`description`,`expireDate`),qn=U(B(`reschedulingCode`,`expireDate`,`totalAmount`),`many`,`deadlineDetail`),Jn=U(z({...B(`paymentDate`,`paymentNote`,`amount`,`paymentUser`,`paymentType`),rename:{paymentNote:`PaumentNote`}}),`many`),Yn=W(`many`,`paymentDate`,`paymentNote`,`payerMasterCode`,`payerName`,`amount`,`paymentType`),Xn=W(`many`,`cancelOperationType`,`serviceRefType`,`serviceRefValue`),Zn=H([`printDoc`,`sendDocViaEmail`],{infoDocumentsToPrint:V({documentCustomizablePrintParameters:B(`makeDocumentTo`,`fillInCode`)})}),Qn=B(`value`,`expiredDate`),$n=B(`recordCode`),er=B(`customer_PaymentType`,`customer_SpecPaymentTypeCode`),tr=B(`getAllDeptDate`,`getFlightPlan`,`getAllAccomodation`,`getRealAvailability`),nr=B(`compatibleAccomodation`,`alternativeAccomodation`),rr=W(`many`,`code`,`name`),ir=B(`value`,`expiredDate`,`optionedFileExpireDatePolicy`),ar=B(`apply`,`specificCode`),or={customerDetail:$n,bookingFileStatus:Qn,statisticCodes:Ln,destination:Rn,bookingFileDocument:Zn,bookingFinancialInfo:er,selectedPackageDetail:Un,selectedPackageList:Wn,financialDeadlineList:qn,paymentList:Jn,cancellableBookedServiceList:Xn,noteList:Bn},sr=V({...or,deadlineList:Gn,selectedServiceList:K.one,extraQuoteServiceList:K.one,passengerList:q.one}),cr=V({...or,deadlineList:Kn,selectedServiceList:K.many,extraQuoteServiceList:K.many,passengerList:q.many}),lr=H([`paymentUser`],{filePaymentList:Yn}),ur=V({fileStatus:B(`value`,`expireDate`),startDate:G,createdDate:G,lastModificationDate:G,insurance:B(`code`,`number`)}),dr=V({statisticCodes:Ln,selectedServiceList:U(B(`serviceCode`,`packageRow`),`many`),passengerList:q.many}),fr=V({passengerList:q.many}),pr=V({destination:Rn,statisticCodes:Ln,packageParams:tr,topServiceParams:nr,featureList:rr}),mr=V({fileStatus:ir,penalty:ar,bookingFileDocument:Zn}),hr=z({}),J=e.union([e.literal(`true`),e.literal(`false`),e.boolean()]),gr={[v.CONFIRM]:`CONFIRMED`,[v.OPTION]:`OPTIONED`,[v.REQUESTED]:`REQUEST`};function _r(e){return e in gr?gr[e]:e}const vr=e.pipe(e.object({"@Value":Le,"@ExpiredDate":e.optional(e.string()),"@ExpireDate":e.optional(e.string())}),e.transform(e=>({...L(e,{"@ExpiredDate":[`@ExpiredDate`,`@ExpireDate`]}),"@Value":_r(e[`@Value`])}))),yr=N(`PricePerPaxDetail`,e.object({"@PaxRef":e.string(),"@Price":D})),br=e.object({"@CommissionCode":e.optional(e.string()),"@CommissionPercentage":e.optional(D),"@CommissionAmount":e.optional(D),"@PriceListCode":e.optional(e.string()),"@CostListCode":e.optional(e.string()),"@ServiceTotalPrice":e.optional(D),PaxPriceList:e.optional(yr)}),xr=e.object({"@Code":e.optional(e.string()),"@Name":e.optional(e.string()),"@Email":e.optional(e.string()),"@LanguageCode":e.optional(e.string())}),Sr=e.object({"@Code":e.optional(e.string()),"@Description":e.optional(e.string())}),Cr=e.object({"@RPH":e.string(),"@ServiceCode":e.optional(e.string()),"@FromExternalProvider":e.optional(D),"@isFromExternalProvider":e.optional(D),AvesServiceType:e.optional(ze),TOServiceType:e.optional(Ve),FirstDescription:e.optional(e.string()),SecondDescription:e.optional(e.string()),ThirdDescription:e.optional(e.string()),FourthDescription:e.optional(e.string()),ServiceStatus:e.optional(Ue),StartDate:e.optional(e.string()),EndDate:e.optional(e.string()),Qty:e.optional(D),Pax:e.optional(D),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(Sr),SupplierInfo:e.optional(xr),ServiceTotalAmountDetail:e.optional(br)}),wr=N(`BookedServiceDetail`,e.pipe(Cr,e.transform(e=>L(e,{"@FromExternalProvider":[`@FromExternalProvider`,`@isFromExternalProvider`]})))),Tr=e.object({"@CurrencyCode":e.optional(e.string()),"@TotalAmountBeforeDiscount":e.optional(D),"@TotalAmountAfterDiscount":e.optional(D),"@TotalDiscount":e.optional(D),"@TotalAmountWithoutVat":e.optional(D),"@DueAmount":e.optional(D),"@PaiedAmount":e.optional(D),"@Balance":e.optional(D)}),Er=N(`PassengerDetail`,e.object({"@RPH":e.string(),"@RoomRPH":e.optional(e.string()),"@BillingHolder":e.optional(D),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())})),Dr=e.object({"@ReschedulingCode":e.optional(e.string()),"@ExpireDate":e.optional(e.string()),"@TotalAmount":e.optional(D),ReschedulingCode:e.optional(e.string()),ExpireDate:e.optional(e.string()),TotalAmount:e.optional(D)}),Or=N(`DeadlineDetail`,e.pipe(Dr,e.transform(e=>L(e,{"@ReschedulingCode":[`@ReschedulingCode`,`ReschedulingCode`],"@ExpireDate":[`@ExpireDate`,`ExpireDate`],"@TotalAmount":[`@TotalAmount`,`TotalAmount`]})))),kr=N(`StoredDocumentDetail`,e.object({DocumentRefCode:e.optional(e.string()),DocumentType:e.optional(e.string()),DocumentName:e.optional(e.string()),ArchiviationDescription:e.optional(e.string())})),Ar=N(`PrintableDocumentDetail`,e.object({DocumentType:e.optional(e.string()),DocumentName:e.optional(e.string()),Enabled:e.optional(D)})),jr=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(vr),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(wr),TotalAmountDetail:e.optional(Tr),PaxNumber:e.optional(D),PassengerList:e.optional(Er),Reference:e.optional(e.string()),ClerkName:e.optional(e.string()),StoredDocumentsList:e.optional(kr),PrintableDocumentsList:e.optional(Ar),FinancialDeadlineList:e.optional(Or)}),Mr=e.pipe(jr,e.transform(e=>L(e,{"@BookingFileCode":[`@BookingFileCode`,`BookingFileCode`]}))),Nr=e.object({currencyCode:e.optional(e.string()),creditLimit:e.optional(e.string()),c_PaymentType:e.optional(Ae),c_SpecPaymentTypeCode:e.optional(e.string()),s_PaymentType:e.optional(Ae),s_SpecPaymentTypeCode:e.optional(e.string()),enableElectronicInvoicing:e.optional(J),electronicInvoicingType:e.optional(e.string())}),Pr=R(Nr,An);Pr.api,Pr.validation;const Fr=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())}),Ir=R(Fr,jn);Ir.api,Ir.validation;const Lr=e.object({key:e.string(),value:e.string()});En(Lr,Nn);const Rr=e.object({supplierRefCode:e.optional(e.string()),companyMainBusinessType:e.optional(e.string()),carrierType:e.optional(Me)}),zr=R(Rr,Pn);zr.api,zr.validation;const Br=e.union([e.literal(0),e.literal(1)]),Vr=e.object({acceptProfilingPolicies:e.optional(Br),acceptPrivacyPolicies:e.optional(Br),acceptNewsletterPolicies:e.optional(Br)}),Hr=R(Vr,Mn);Hr.api,Hr.validation;const Ur={recordCode:e.optional(e.pipe(e.string(),e.minLength(6),e.maxLength(6))),insertCriteria:e.optional(Oe),createdDate:e.optional(e.string()),recordType:e.optional(we,Ce.CUSTOMER),recordStatus:e.optional(Ee,Te.ENABLED),moniker:e.optional(e.string()),name:e.optional(e.string()),extraInfo:e.optional(e.string()),languageCode:on,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(ye),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(Fr),accountPolicies:e.optional(Vr),financialDetail:e.optional(Nr),dynamicFields:e.optional(e.array(Lr)),supplierRefMasterRecords:e.optional(Rr)},Wr=M(I(Ur,tn),Fn),Gr=e.partial(En(e.object(Ur),Fn,{ModifiedDate:e.optional(e.string()),LoginType:e.optional(e.string()),PromoterCode:e.optional(e.string()),EncryptedPassword:e.optional(J),NewsletterDisabled:e.optional(J)}));P(Gr);const Kr=_n(Pe,{expiredDate:e.optional(e.string())}),qr=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)))}),Jr=e.object({code:e.optional(e.string()),iataCode:e.optional(e.string()),nationCode:e.optional(e.string()),type:e.optional(yt)}),Yr=e.object({recordCode:e.optional(e.string())}),Xr=e.object({makeDocumentTo:e.optional(st)}),Zr=e.object({fillInCode:e.optional(e.string())}),Qr=e.union([Xr,Zr]),$r=e.object({documentType:at,documentCustomizablePrintParameters:e.optional(Qr)}),ei=e.object({printDoc:e.optional(J),sendDocViaEmail:e.optional(J),infoDocumentsToPrint:e.optional(e.array($r))}),ti=e.object({reschedulingCode:e.optional(e.string()),expireDate:e.optional(e.string()),totalAmount:e.optional(e.string())}),ni=e.object({deadlineCode:e.optional(e.string()),description:e.optional(e.string()),expireDate:e.optional(e.string())}),ri=e.object({paymentDate:e.optional(e.string()),paymentNote:e.optional(e.string()),amount:e.optional(e.string()),paymentUser:e.optional(e.string()),paymentType:e.optional(Ge)}),ii=I({nType:e.optional(e.string()),title:e.optional(e.string()),text:e.optional(e.string())},Gt),ai=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(lt),vatCostCurrencyCode:e.optional(e.string()),price:e.optional(e.string()),priceTax:e.optional(e.string()),priceType:e.optional(lt)}),oi=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(ai)}),si=I({sCode:e.string(),ssCode:e.optional(e.string()),avesServiceType:ze,toServiceType:e.optional(Ve),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(oi),serviceFare:e.optional(ai),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.array(ii)),voucherInfo:e.optional(e.string()),firstDescription:e.optional(e.string()),secondDescription:e.optional(e.string())},qt),ci=I({pCode:e.string(),startDate:e.string(),endDate:e.string(),getServicesFromPackage:e.optional(J)},Jt),li={rph:e.string(),roomRph:e.optional(e.string()),billingHolder:e.optional(J),masterRecordCode:e.optional(e.string()),name:e.string(),sex:ye,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(ii)),flagStatus:e.optional(e.string()),offerCode:e.optional(e.string()),idDocInfo:e.optional(Fr)},ui=I({...li,categoryCode:Ye},Kt),di=I({...li,categoryCode:e.optional(Ye)},Kt),fi=e.object({customer_PaymentType:e.optional(qe),customer_SpecPaymentTypeCode:e.optional(e.string())}),pi=M(e.pipe(I({createDate:e.optional(e.string()),bookingFileRefCode:e.optional(e.string()),travelAgentCode:e.optional(e.string()),clerkName:e.optional(e.string()),customerDetail:e.optional(Yr),customerRecordCode:e.optional(e.string()),currencyCode:e.optional(e.string()),markupCode:e.optional(e.string()),bookingFileStatus:Kr,statisticCodes:e.optional(qr),destination:e.optional(Jr),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(ei),financialDeadlineList:e.optional(e.array(ti)),deadlineList:e.optional(e.array(ni)),paymentList:e.optional(e.array(ri)),selectedPackageList:e.optional(e.array(ci)),selectedServiceList:e.array(si),extraQuotaRefCode:e.optional(e.string()),extraQuoteServiceList:e.optional(e.array(si)),getExtraQuoteFromSystem:e.optional(J),passengerList:e.array(ui),noteList:e.optional(e.array(ii)),bookingFinancialInfo:e.optional(fi),bookingFileCode:e.optional(e.string()),groupingPaxPolicy:e.optional(dt),groupBookingFile:e.optional(J),typeDownloadFile:e.optional(pt),setBookingFileCodeFromStartDate:e.optional(J)},Yt),e.check(e=>!!(e.customerDetail||e.customerRecordCode),`customerDetail or customerRecordCode is required`),e.transform(yn)),sr),mi=gn(e.object({RsStatus:A,BookingFileDetail:e.optional(Mr),PrintableDocumentsList:e.optional(Ar),TotalAmountDetailAfterCancellation:e.optional(Tr),Base64DocContent:e.optional(e.string())}),`bookingFileDetail`),hi=ln,Y={customerRecordCode:e.string(),bookingFileCode:e.string()},gi=mi,_i=e.object({reschedulingCode:e.string(),description:e.optional(e.string()),expireDate:e.optional(e.string())}),vi=e.object({cancelOperationType:Ze,serviceRefType:$e,serviceRefValue:e.string()}),yi=M(e.pipe(I({...Y,currencyCode:e.optional(e.string()),deadlineList:e.optional(e.array(_i)),selectedPackageDetail:e.optional(ci),selectedPackageList:e.optional(e.pipe(e.array(ci),e.maxLength(1))),selectedServiceList:e.pipe(e.array(si),e.minLength(1)),cancellableBookedServiceList:e.optional(e.array(vi)),passengerList:e.optional(e.array(di))},Xt),e.transform(vn(`selectedPackageList`,`selectedPackageDetail`))),cr),bi=M(I({...Y,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(di)),statisticCodes:e.optional(qr),bookingFinancialInfo:e.optional(fi),financialDeadlineList:e.optional(e.array(e.object({reschedulingCode:e.string(),expireDate:e.string(),totalAmount:e.string()})))},Zt),cr),xi=M(I(Y,w),hr),Si=M(I({...Y,fileStatus:_n(Ie,{expiredDate:e.optional(e.string()),optionedFileExpireDatePolicy:e.optional(tt)}),backOfficeRequest:e.optional(J),bookingFileDocument:e.optional(ei),penalty:e.optional(e.object({apply:e.optional(J),specificCode:e.optional(e.string())})),simulateCancelAndGetPenaltyAmount:e.optional(J)},Qt),mr),Ci=M(I({...Y,bookingServiceRef:e.string(),bookingFileServiceStatus:e.literal(`NULLIFIED`),bookingFileServiceStatusDate:e.optional(e.string())},$t),hr),wi=e.object({paymentDate:e.string(),paymentNote:e.optional(e.string()),payerMasterCode:e.optional(e.string()),payerName:e.optional(e.string()),amount:e.string(),paymentType:Ge}),Ti=M(e.pipe(I({bookingFileCode:e.optional(e.string()),bookingFileRefCode:e.optional(e.string()),paymentUser:e.optional(e.string()),enableMultiplePayments:J,operationType:rt,filePaymentList:e.pipe(e.array(wi),e.minLength(1))},en),e.check(e=>!!(e.bookingFileCode||e.bookingFileRefCode),`bookingFileCode or bookingFileRefCode is required`)),lr),Ei=N(`FeatureDetail`,e.object({"@Code":e.optional(e.string()),"@Name":e.optional(e.string()),ValueCode:e.optional(e.string()),ValueName:e.optional(e.string())})),Di=e.object({"@PackageCode":e.optional(e.string()),"@PackageReference":e.optional(e.string()),"@PackageServiceType":e.optional(e.string()),"@ServiceCodeForPackageDetail":e.optional(e.string())}),Oi=N(`SubServiceDetail`,e.object({"@ssCode":e.optional(e.string()),FirstDescription:e.optional(e.string()),SubServiceType:e.optional(e.string()),SubServiceLevel:e.optional(O),StartDate:e.optional(e.string()),EndDate:e.optional(e.string())})),ki=N(`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(Di),SubServiceList:e.optional(Oi)})),Ai=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(O),BasePax:e.optional(O),CanCommitPack:e.optional(O),FeatureList:e.optional(Ei),ServiceList:e.optional(ki)}),ji=N(`PackageDetail`,Ai),Mi=e.object({code:e.string(),name:e.optional(e.string())}),Ni=I({getAllDeptDate:e.optional(J),getFlightPlan:e.optional(J),getAllAccomodation:e.optional(J),getRealAvailability:e.optional(J),minStay:e.optional(D),maxStay:e.optional(D)},rn),Pi=I({compatibleAccomodation:e.optional(J),alternativeAccomodation:e.optional(J)},rn),Fi=I({customerRecordCode:e.string(),languageCode:E,currencyCode:e.optional(e.string()),startDate:e.string(),endDate:e.string(),earlyBookingDate:e.optional(e.string()),passengerList:e.pipe(e.array(ui),e.minLength(1)),avesSearchType:e.optional(ht),paxQty:e.optional(D),paxQtyCriteria:e.optional(_t),discartNotAvailables:e.optional(J),discartNotAvailablesMinSales:e.optional(J),discartNotAvailablesDaysInOut:e.optional(J),discardPriceZero:e.optional(J),discardZeroPriceDays:e.optional(J),destination:e.optional(Jr),objectTypeCode:e.optional(e.string()),featureList:e.optional(e.array(Mi)),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(qr),mergeBoardAndAccomodation:e.optional(J),packageParams:e.optional(Ni),topServiceParams:e.optional(Pi),getDocumentation:e.optional(J)},nn),Ii=e.pipe(Fi,e.check(e=>e.languageCode!=null&&e.avesSearchType!=null,`languageCode and avesSearchType required`));function Li(e){let{customerRecordCode:t,languageCode:n,currencyCode:r,startDate:i,endDate:a,earlyBookingDate:o,passengerList:s,paxQty:ee,paxQtyCriteria:c,avesSearchType:te,...ne}=e;return{BaseSearch:pn({customerRecordCode:t,languageCode:n,currencyCode:r,startDate:i,endDate:a,earlyBookingDate:o,passengerList:s},fr),...pn({...ne,avesSearchType:te,paxQty:ee??s.length,paxQtyCriteria:c??gt.GREATER_OR_EQUAL},pr)}}const Ri=e.pipe(Ii,e.transform(Li)),zi=F(`PackageList`,ji),Bi=F(`ServiceList`,ki),Vi=e.object({serviceCode:e.string(),packageRow:e.string()}),Hi=M(I({customerRecordCode:e.string(),languageCode:E,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(qr),selectedServiceList:e.pipe(e.array(Vi),e.minLength(1)),passengerList:e.optional(e.array(ui))},an),dr),Ui=gn(e.object({RsStatus:A,PackageDetail:e.optional(Ai)}),`packageDetail`),Wi=M(e.object({packageCode:e.string()}),hr),Gi=ln,Ki=k,X=E,qi=e.object({searchType:e.literal(_.CODE),recordCode:e.pipe(e.string(),e.minLength(5),e.maxLength(6)),languageCode:X}),Ji=e.object({searchType:e.literal(_.NAME),name:e.string(),city:e.optional(e.string()),languageCode:X}),Yi=e.object({searchType:e.literal(_.VATCODE),vatCode:e.string(),phoneNumber:e.optional(e.string()),languageCode:X}),Xi=e.object({searchType:e.literal(_.ZONE),zipCode:e.string(),countyCode:e.string(),city:e.optional(e.string()),languageCode:X}),Zi=e.object({searchType:e.literal(_.CATEGORY),categoryCode:e.string(),languageCode:X}),Qi=e.object({searchType:e.literal(_.EMAIL),email:e.string(),languageCode:X}),$i=e.object({searchType:e.literal(_.LASTMODDATE),lastModificationDate:Ki,languageCode:X}),ea=e.object({searchType:e.literal(_.SEARCH_FIELD),searchFieldValue:e.string(),languageCode:X}),ta=e.object({searchType:e.literal(_.EXTERNAL_REF_CODE),searchFieldValue:e.string(),languageCode:X}),na=M(e.union([qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta]),In);e.pipe(e.object({RqHeader:sn,SearchMasterRecord:na}),e.transform(e=>{let{SearchMasterRecord:t,RqHeader:n,...r}=e;return{RqHeader:n,...t,...r}}));const ra=F(`MasterRecordList`,N(`MasterRecordDetail`,Gr)),ia=_n(Le,{expireDate:e.optional(e.string())}),aa=e.object({code:e.optional(e.string()),number:e.optional(e.string())}),Z={customerRecordCode:e.string(),customerPromoterCode:e.optional(e.string()),getSupplierInfo:e.optional(J),user:e.optional(e.string()),officeCode:e.optional(e.string())},oa=I({...Z,searchType:e.literal(y.FILE_CODE),bookingFileCode:e.string()},T),sa=I({...Z,searchType:e.literal(y.PAX_NAME),firstPaxName:e.string()},T),ca=I({...Z,searchType:e.literal(y.PACKAGE_CODE),packageCode:e.string()},T),la=I({...Z,searchType:e.literal(y.OTHER),fileStatus:e.optional(ia),startDate:e.optional(k),createdDate:e.optional(k),lastModificationDate:e.optional(k),insurance:e.optional(aa),isSearchForB2C:e.optional(J)},T),ua=M(e.union([oa,sa,ca,la]),ur),da=F(`BookingFileList`,N(`BookingFileDetail`,Mr));e.object({RqHeader:sn,MasterRecordDetail:Gr});const fa=gn(e.object({RsStatus:A,MasterRecordDetail:e.optional(Gr)}),`masterRecordDetail`),Q={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`};function $(e){return e}const pa={search:$({endpoint:Q.search,requestRoot:C.SEARCH_REQUEST,responseRoot:C.SEARCH_RESPONSE,apiSchema:na,responseSchema:ra}),upsertRecord:$({endpoint:Q.upsert,requestRoot:C.UPSERT_REQUEST,responseRoot:C.UPSERT_RESPONSE,apiSchema:Wr,responseSchema:fa,bodyKey:`MasterRecordDetail`}),createBooking:$({endpoint:Q.createBooking,requestRoot:C.BOOKING_REQUEST,responseRoot:C.BOOKING_RESPONSE,apiSchema:pi,responseSchema:mi}),modBookingServices:$({endpoint:Q.modBookingServices,requestRoot:C.MOD_FILE_SERVICES_REQUEST,responseRoot:C.BOOKING_RESPONSE,apiSchema:yi,responseSchema:gi}),modBookingHeader:$({endpoint:Q.modBookingHeader,requestRoot:C.MOD_FILE_HEADER_REQUEST,responseRoot:C.MOD_FILE_HEADER_RESPONSE,apiSchema:bi,responseSchema:hi}),cancelBooking:$({endpoint:Q.cancelBooking,requestRoot:C.CANCEL_FILE_REQUEST,responseRoot:C.CANCEL_FILE_RESPONSE,apiSchema:xi,responseSchema:hi}),setBookingStatus:$({endpoint:Q.setBookingStatus,requestRoot:C.SET_STATUS_REQUEST,responseRoot:C.SET_STATUS_RESPONSE,apiSchema:Si,responseSchema:gi}),setBookingServiceStatus:$({endpoint:Q.setBookingServiceStatus,requestRoot:C.SET_STATUS_SERVICE_REQUEST,responseRoot:C.SET_STATUS_SERVICE_RESPONSE,apiSchema:Ci,responseSchema:gi}),insertFilePaymentList:$({endpoint:Q.insertFilePaymentList,requestRoot:C.FILE_PAYMENT_LIST_REQUEST,responseRoot:C.FILE_PAYMENT_LIST_RESPONSE,apiSchema:Ti,responseSchema:hi}),searchBookingFiles:$({endpoint:Q.searchBookingFile,requestRoot:C.SEARCH_BOOKING_FILE_REQUEST,responseRoot:C.SEARCH_BOOKING_FILE_RESPONSE,apiSchema:ua,responseSchema:da}),searchPackages:$({endpoint:Q.searchAvesPackages,requestRoot:C.AVES_SEARCH_REQUEST,responseRoot:C.SEARCH_PACKAGE_RESPONSE,apiSchema:Ri,responseSchema:zi}),searchTopServices:$({endpoint:Q.searchTopServices,requestRoot:C.AVES_SEARCH_REQUEST,responseRoot:C.SEARCH_SERVICES_RESPONSE,apiSchema:Ri,responseSchema:Bi}),getPackageDetail:$({endpoint:Q.getPackageDetail,requestRoot:C.PACKAGE_DETAIL_REQUEST,responseRoot:C.PACKAGE_DETAIL_RESPONSE,apiSchema:Hi,responseSchema:Ui}),commitPackage:$({endpoint:Q.commitPackage,requestRoot:C.COMMIT_PACKAGE_REQUEST,responseRoot:C.COMMIT_PACKAGE_RESPONSE,apiSchema:Wi,responseSchema:Gi})};function ma(e,t,n){let i=It(e)[t];if(!i)return h(S(`Invalid response structure: missing root element '${t}'`));let a=r(n,i);return a.success?ha(a.output):h(S(`Invalid response format: ${Tt(a.issues)}`))}function ha(e){let{rsStatus:t}=e;return t.status===`OK`?ge(e):h(St(t.errorDescription??``,t.status,t.errorCode))}function ga(e){return{"@HostID":e.hostID,"@Xtoken":e.xtoken,"@Interface":`WEB`,"@UserName":`WEB`,...e.languageCode&&{"@LanguageCode":e.languageCode}}}var _a=class{options;http;rqHeader;constructor(e){this.options=e,this.http=new Wt({baseURL:e.baseURL,timeoutMs:e.timeoutMs}),this.rqHeader=Object.freeze(ga(e))}get languageCode(){return this.options.languageCode}createRqHeader(){return this.rqHeader}async invokeOp(e,t){let r=pa[e];try{let e=Rt(r,n(r.apiSchema,t),this.rqHeader),i=await this.http.postXml(r.endpoint,Ft(e));return i.success?ma(i.data.body,r.responseRoot,r.responseSchema):i}catch(t){return h(wt(t,`Validation error occurred during ${e}`))}}},va=class{transport;master;booking;packages;constructor(e,t={}){this.transport=t.transport??new _a(e),this.master=t.master??new _e(this.transport),this.booking=t.booking??new he(this.transport),this.packages=t.packages??new bt(this.transport)}};export{va as AvesClient,x as AvesError,b as AvesSearchType,ht as AvesSearchTypeSchema,Re as AvesServiceType,ze as AvesServiceTypeSchema,_a as AvesTransport,He as BookedServiceStatus,Ue as BookedServiceStatusSchema,he as BookingClient,Ne as BookingFileStatus,Pe as BookingFileStatusSchema,v as BookingFileStatusWire,Le as BookingFileStatusWireSchema,Xe as CancelOperationType,Ze as CancelOperationTypeSchema,je as CarrierType,Me as CarrierTypeSchema,ct as CostPriceType,lt as CostPriceTypeSchema,Ke as CustomerPaymentType,qe as CustomerPaymentTypeSchema,vt as DestinationType,yt as DestinationTypeSchema,it as DocumentType,at as DocumentTypeSchema,nt as FilePaymentOperationType,rt as FilePaymentOperationTypeSchema,ve as Gender,ye as GenderSchema,ut as GroupingPaxPolicy,dt as GroupingPaxPolicySchema,De as InsertCriteria,Oe as InsertCriteriaSchema,ot as MakeDocumentTo,st as MakeDocumentToSchema,ke as MasterPaymentType,Ae as MasterPaymentTypeSchema,_e as MasterRecordsClient,et as OptionedExpirePolicy,tt as OptionedExpirePolicySchema,bt as PackageCatalogClient,Je as PassengerCategory,Ye as PassengerCategorySchema,gt as PaxQtyCriteria,_t as PaxQtyCriteriaSchema,We as PaymentType,Ge as PaymentTypeSchema,Te as RecordStatus,Ee as RecordStatusSchema,Ce as RecordType,we as RecordTypeSchema,be as RsStatusValue,xe as RsStatusValueSchema,y as SearchBookingFileType,mt as SearchBookingFileTypeSchema,_ as SearchMasterType,Se as SearchMasterTypeSchema,Qe as ServiceRefType,$e as ServiceRefTypeSchema,Fe as SetFileStatusValue,Ie as SetFileStatusValueSchema,Be as ToServiceType,Ve as ToServiceTypeSchema,ft as TypeDownloadFile,pt as TypeDownloadFileSchema};
1
+ import*as e from"valibot";import{ValiError as t,parse as n,safeParse as r}from"valibot";import i from"fast-xml-builder";import{XMLParser as a}from"fast-xml-parser";import{request as o}from"undici";const s={rph:`RPH`,toServiceType:`TOServiceType`,text:`#text`},ee=Object.fromEntries(Object.entries(s).map(([e,t])=>[t,e]));function c(e){return typeof e!=`object`||!e?!1:e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error||e instanceof URL||ArrayBuffer.isView(e)||typeof Buffer<`u`&&Buffer.isBuffer(e)}function te(e){return s[e]??e.charAt(0).toUpperCase()+e.slice(1)}function ne(e){return ee[e]??e.charAt(0).toLowerCase()+e.slice(1)}function re(e,t){let n=t?.textContent===e?`#text`:t?.rename?.[e]??te(e);return n===`#text`||!t?.attrs?.includes(e)?n:t.preserveCamel?.includes(e)?`@${e}`:`@${n}`}const ie=new WeakMap,ae=new WeakMap;function oe(e){let t=ie.get(e);if(t)return t;let{listWrap:n,detailKey:r,...i}=e;return ie.set(e,i),i}function se(e,t){if(!t?.listWrap)return t;let n=ae.get(t);n||(n=new Map,ae.set(t,n));let r=n.get(e);if(r)return r;let i={children:{[t.detailKey??(e.endsWith(`List`)?`${e.slice(0,-4)}Detail`:`${e}Detail`)]:oe(t)}};return n.set(e,i),i}function ce(e){return le(e)}function le(e){if(typeof e!=`object`||!e||c(e))return e;if(Array.isArray(e)){for(let t=0;t<e.length;t++)e[t]=le(e[t]);return e}let t=e;for(let e of Object.keys(t)){let n=le(t[e]),r=ne(e.startsWith(`@`)?e.slice(1):e);r!==e&&delete t[e],t[r]=n}return t}const ue={rsStatus:`response`,customerRecordCode:`customerCode`,bookingFileCode:`bookingCode`,bookingFileRefCode:`bookingReference`,bookingFileStatus:`status`,bookingFileDescription:`description`,bookingFileStartDate:`startDate`,bookingFileReferenceName:`referenceName`,bookingFileServiceStatus:`serviceStatus`,bookingFileServiceStatusDate:`serviceStatusDate`,bookingServiceRef:`serviceReference`,newCustomerRecordCode:`newCustomerCode`,customerDetail:`customer`,bookingFileDocument:`documents`,bookingFinancialInfo:`financial`,financialDetail:`financial`,idDocumentDetail:`identityDocument`,idDocInfo:`identityDocument`,accountPolicies:`policies`,dynamicFields:`customFields`,supplierRefMasterRecords:`supplierReference`,selectedPackageDetail:`package`,selectedPackageList:`packages`,selectedServiceList:`services`,extraQuoteServiceList:`extraServices`,passengerList:`passengers`,noteList:`notes`,deadlineList:`deadlines`,financialDeadlineList:`financialDeadlines`,paymentList:`payments`,filePaymentList:`payments`,cancellableBookedServiceList:`cancellableServices`,bookedServiceList:`services`,serviceList:`services`,subServiceList:`subServices`,featureList:`features`,packageList:`packages`,pCode:`packageCode`,sCode:`serviceCode`,ssCode:`subServiceCode`,rph:`passengerRef`,roomRph:`roomRef`,avesSession:`session`,paxAssociated:`passengerRefs`,paxQty:`passengerCount`,paxQtyCriteria:`passengerCountRule`,qty:`quantity`,pax:`passengerCount`,eMail:`email`,sex:`gender`,nType:`noteType`,avesServiceType:`serviceType`,toServiceType:`targetType`,packageParams:`packageOptions`,topServiceParams:`serviceOptions`,servOrPackCode:`serviceOrPackageCode`,servOrPackDesc:`serviceOrPackageDescription`,getDocumentation:`includeDocumentation`,getServicesFromPackage:`includeServices`,mergeBoardAndAccomodation:`mergeBoardAndAccommodation`,discartNotAvailables:`discardUnavailable`,discartNotAvailablesMinSales:`discardUnavailableMinSales`,discartNotAvailablesDaysInOut:`discardUnavailableDaysInOut`,getAllDeptDate:`allDepartureDates`,getAllAccomodation:`allAccommodation`,compatibleAccomodation:`compatibleAccommodation`,alternativeAccomodation:`alternativeAccommodation`,fileStatus:`status`},de=new Set([`__proto__`,`prototype`,`constructor`]),l={};for(let[e,t]of Object.entries(ue))l[t]||(l[t]=[]),l[t].push(e);const fe=new WeakMap;function u(e){return typeof e==`string`&&de.has(e)}function d(e,t){if(typeof t!=`string`||Reflect.has(e,t))return t;let n=l[t];if(!n)return t;for(let t of n)if(Reflect.has(e,t))return t;return n[0]??t}function f(e){return typeof e!=`object`||!e||c(e)?e:fe.get(e)||(Array.isArray(e)?pe(e):me(e))}function pe(e){let t=new Proxy(e,{get(e,t,n){if(t===`length`)return e.length;if(typeof t==`string`&&/^\d+$/.test(t)){let n=Number(t);if(n<0||n>=e.length)return;let r=e[n];return typeof r==`function`?r.bind(e):f(r)}let r=Reflect.get(e,t,n);return typeof r==`function`?r.bind(e):r},set(e,t,n,r){return!u(t)&&Reflect.set(e,t,n,r)},defineProperty(e,t,n){return!u(t)&&Reflect.defineProperty(e,t,n)},deleteProperty(e,t){return!u(t)&&Reflect.deleteProperty(e,t)},setPrototypeOf(){return!1}});return fe.set(e,t),t}function me(e){let t=new Proxy(e,{get(e,t,n){let r=d(e,t);return f(Reflect.get(e,r,n))},set(e,t,n,r){return!u(t)&&Reflect.set(e,d(e,t),n,r)},has(e,t){return typeof t==`string`&&!Reflect.has(e,t)&&l[t]?.some(t=>Reflect.has(e,t))?!0:Reflect.has(e,d(e,t))},ownKeys(e){let t=Reflect.ownKeys(e),n=new Set(t),r=[];for(let e of t){if(typeof e!=`string`)continue;let t=ue[e];t&&!n.has(t)&&(n.add(t),r.push(t))}return[...t,...r]},getOwnPropertyDescriptor(e,t){let n=d(e,t),r=Reflect.getOwnPropertyDescriptor(e,n);if(r)return n===t?`value`in r?{...r,value:f(r.value)}:r:{configurable:!0,enumerable:!0,writable:!0,value:f(`value`in r?r.value:Reflect.get(e,n))}},defineProperty(e,t,n){return!u(t)&&Reflect.defineProperty(e,d(e,t),n)},deleteProperty(e,t){return!u(t)&&Reflect.deleteProperty(e,d(e,t))},getPrototypeOf(e){return Reflect.getPrototypeOf(e)},setPrototypeOf(){return!1}});return fe.set(e,t),t}function he(e){return f(e)}function p(e){return e.success?{success:!0,data:he(e.data)}:e}const m={customerCode:`customerRecordCode`,bookingCode:`bookingFileCode`,bookingReference:`bookingFileRefCode`},ge={noteType:`nType`},_e={passengerRef:`rph`,roomRef:`roomRph`,gender:`sex`,email:`eMail`,identityDocument:`idDocInfo`},ve={serviceCode:`sCode`,subServiceCode:`ssCode`,quantity:`qty`,passengerCount:`pax`,session:`avesSession`,passengerRefs:`paxAssociated`,serviceType:`avesServiceType`,targetType:`toServiceType`,notes:`noteList`},ye={packageCode:`pCode`,includeServices:`getServicesFromPackage`},be={...m,customer:`customerDetail`,status:`bookingFileStatus`,description:`bookingFileDescription`,referenceName:`bookingFileReferenceName`,financial:`bookingFinancialInfo`,package:`selectedPackageDetail`,packages:`selectedPackageList`,services:`selectedServiceList`,extraServices:`extraQuoteServiceList`,passengers:`passengerList`,payments:`paymentList`,documents:`bookingFileDocument`,deadlines:`deadlineList`,financialDeadlines:`financialDeadlineList`,notes:`noteList`},xe={...m,package:`selectedPackageDetail`,packages:`selectedPackageList`,services:`selectedServiceList`,passengers:`passengerList`,deadlines:`deadlineList`,cancellableServices:`cancellableBookedServiceList`},Se={...m,startDate:`bookingFileStartDate`,newCustomerCode:`newCustomerRecordCode`,referenceName:`bookingFileReferenceName`,passengers:`passengerList`,financial:`bookingFinancialInfo`,financialDeadlines:`financialDeadlineList`},Ce={...m,status:`fileStatus`,documents:`bookingFileDocument`},we={...m,serviceReference:`bookingServiceRef`,serviceStatus:`bookingFileServiceStatus`,serviceStatusDate:`bookingFileServiceStatusDate`},Te={...m,payments:`filePaymentList`},Ee={...m,status:`fileStatus`},De={financial:`financialDetail`,identityDocument:`idDocumentDetail`,policies:`accountPolicies`,customFields:`dynamicFields`,supplierReference:`supplierRefMasterRecords`},Oe={...m,searchType:`avesSearchType`,passengers:`passengerList`,packageOptions:`packageParams`,serviceOptions:`topServiceParams`,serviceOrPackageCode:`servOrPackCode`,serviceOrPackageDescription:`servOrPackDesc`,passengerCount:`paxQty`,passengerCountRule:`paxQtyCriteria`,features:`featureList`,includeDocumentation:`getDocumentation`,mergeBoardAndAccommodation:`mergeBoardAndAccomodation`,discardUnavailable:`discartNotAvailables`,discardUnavailableMinSales:`discartNotAvailablesMinSales`,discardUnavailableDaysInOut:`discartNotAvailablesDaysInOut`},ke={allDepartureDates:`getAllDeptDate`,allAccommodation:`getAllAccomodation`,compatibleAccommodation:`compatibleAccomodation`,alternativeAccommodation:`alternativeAccomodation`},Ae={...m,services:`selectedServiceList`,passengers:`passengerList`};function h(t){return e.picklist(Object.values(t))}const je={M:`M`,F:`F`},Me=h(je),Ne={OK:`OK`,ERROR:`ERROR`,WARNING:`WARNING`,TIMEOUT:`TIMEOUT`},Pe=h(Ne),Fe={MasterRecordDetail:`MasterRecordDetail`},Ie=h(Fe),g={CODE:`CODE`,NAME:`NAME`,VATCODE:`VATCODE`,ZONE:`ZONE`,CATEGORY:`CATEGORY`,EMAIL:`EMAIL`,LASTMODDATE:`LASTMODDATE`,SEARCH_FIELD:`SEARCH_FIELD`,EXTERNAL_REF_CODE:`EXTERNAL_REF_CODE`},Le=h(g),Re={CUSTOMER:`CUSTOMER`,SUPPLIER:`SUPPLIER`,VOUCHER:`VOUCHER`,SUPPLIER_VOUCHER:`SUPPLIER_VOUCHER`,GENERAL:`GENERAL`},ze=h(Re),Be={ENABLED:`ENABLED`,DISABLED:`DISABLED`,WARNING:`WARNING`,BLACKLISTED:`BLACKLISTED`},Ve=h(Be),He={S:`S`,N:`N`,T:`T`,M:`M`},Ue=h(He),We={CASH:`CASH`,BANK:`BANK`,RID:`RID`,RIBA:`RIBA`,SPECIFIC_CODE:`SPECIFIC_CODE`},Ge=h(We),Ke={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`},qe=h(Ke),Je={QUOTATION:`QUOTATION`,WORK_IN_PROGRESS:`WORK_IN_PROGRESS`,CONFIRMED:`CONFIRMED`,OPTIONED:`OPTIONED`,CANCELED:`CANCELED`},Ye=h(Je),Xe={...Je,NULLIFIED:`NULLIFIED`},Ze=h(Xe),_={QUOTATION:`QUOTATION`,WORK_IN_PROGRESS:`WORK_IN_PROGRESS`,CONFIRM:`CONFIRM`,CONFIRMED:`CONFIRMED`,OPTION:`OPTION`,OPTIONED:`OPTIONED`,REQUEST:`REQUEST`,REQUESTED:`REQUESTED`,NULLIFIED:`NULLIFIED`,CANCELED:`CANCELED`},Qe=h(_),$e={TOP:`TOP`,TOP_SS:`TOP_SS`,ADV:`ADV`,GRP:`GRP`,OTHER:`OTHER`},et=h($e),tt={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`,TOUR:`TOUR`},nt=h(tt),rt={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`},it=h(rt),at={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`},ot=h(at),st={CASH:`CASH`,BANK:`BANK`,RID:`RID`,RIBA:`RIBA`,SPECIFIC_CODE:`SPECIFIC_CODE`,NOT_SET:`NOT_SET`},ct=h(st),lt={AD:`AD`,CH:`CH`,IN:`IN`,OV:`OV`},ut=h(lt),dt={NULLIFY:`NULLIFY`,DELETE:`DELETE`},ft=h(dt),pt={RPH:`RPH`,FILE:`FILE`},mt=h(pt),ht={NOT_SET:`NOT_SET`,CONSIDER_HOLIDAY:`CONSIDER_HOLIDAY`,CONSIDER_HOLIDAY_AND_SATURDAY:`CONSIDER_HOLIDAY_AND_SATURDAY`},gt=h(ht),_t={AbsoluteAmountsInsertion:`AbsoluteAmountsInsertion`,FinalAmountToAchieve:`FinalAmountToAchieve`,FinalAmountToAchieveWithoutControls:`FinalAmountToAchieveWithoutControls`},vt=h(_t),yt={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`},bt=h(yt),xt={BOOKING_CUSTOMER:`BOOKING_CUSTOMER`,FIRST_PASSENGER:`FIRST_PASSENGER`},St=h(xt),Ct={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`},wt=h(Ct),Tt={GROUPED_PAX:`GROUPED_PAX`,NOT_GROUPED_PAX:`NOT_GROUPED_PAX`,ONE_PAX_ONLY:`ONE_PAX_ONLY`},Et=h(Tt),Dt={AVES2AVES:`AVES2AVES`,AVES2AVESVIA:`AVES2AVESVIA`,AVES2AVESITA:`AVES2AVESITA`},Ot=h(Dt),v={FILE_CODE:`FILE_CODE`,PAX_NAME:`PAX_NAME`,PACKAGE_CODE:`PACKAGE_CODE`,OTHER:`OTHER`},kt=h(v),y={SERVICE:`SERVICE`,PROGRAM:`PROGRAM`,PACKAGE:`PACKAGE`},At=h(y),jt={GREATER_THAN:`GREATER_THAN`,GREATER_OR_EQUAL:`GREATER_OR_EQUAL`,EQUAL_TO:`EQUAL_TO`,LESS_OR_EQUAL:`LESS_OR_EQUAL`,LESS_THAN:`LESS_THAN`},Mt=h(jt),Nt={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`},Pt=h(Nt),Ft=e.pipe(e.string(),e.minLength(2),e.maxLength(2)),b=e.optional(Ft),x=e.union([e.string(),e.number()]),S=e.union([e.string(),e.number(),e.boolean()]),C=e.object({minDate:e.string(),maxDate:e.string()}),It=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":b}),Lt=e.optional(e.string()),w=e.pipe(e.object({"@Status":Pe,ErrorCode:e.optional(e.pipe(x,e.transform(e=>Number(e)))),ErrorDescription:e.optional(e.string()),Warnings:Lt}),e.transform(e=>({status:e[`@Status`],errorCode:e.ErrorCode,errorDescription:e.ErrorDescription,warnings:e.Warnings}))),Rt=O(e.object({RsStatus:w})),zt={financialDeadlineList:`deadlineDetail`};function Bt(e,t){return t?.detailKey??zt[e]??(e.endsWith(`List`)?`${e.slice(0,-4)}Detail`:`${e}Detail`)}function Vt(e){return Array.isArray(e)?e.length?e.every(e=>typeof e==`string`)?e.map(e=>({pax:e})):e:``:e}function T(e,t){if(typeof e!=`object`||!e||c(e))return e;if(Array.isArray(e))return e.map(e=>T(e,t));let n={};for(let[r,i]of Object.entries(e)){let e=t?.children?.[r],a=r===`paxAssociated`?Vt(i):i;if(e?.listWrap&&Array.isArray(a)){let i=re(Bt(r,e)),o=a.map(t=>T(t,oe(e)));n[re(r,t)]=e.listWrap===`one`?o.map(e=>({[i]:e})):{[i]:o};continue}n[re(r,t)]=T(a,se(r,e))}return n}function Ht(e,t){return T(e,t)}function E(t,n){return e.pipe(t,e.transform(e=>Ht(e,n)))}function Ut(t){return e.pipe(e.union([e.array(t),t]),e.transform(e=>Array.isArray(e)?e:[e]))}function D(t,n){let r=e.optional(Ut(n));return e.pipe(e.object({[t]:r}),e.transform(e=>e[t]??[]))}function O(t){return e.pipe(t,e.transform(e=>ce(e)))}function k(t,n){let r={[t]:e.optional(n)};return O(e.object({RsStatus:w,...r}))}function Wt(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 Gt(t,n){return e.pipe(O(t),e.transform(e=>Wt(n)(e)))}function Kt(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 qt(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 Jt(e){let{customerRecordCode:t,customerDetail:n,...r}=e;return{...r,customerDetail:{...n,recordCode:n?.recordCode??t}}}function Yt(e){return t=>{let n={...t};for(let[t,r]of Object.entries(e)){let e=n[t];delete n[t],n[r]===void 0&&e!==void 0&&(n[r]=e)}return n}}function A(t,n){let r={...t},i={};for(let[a,o]of Object.entries(n)){let n=t[o];n!==void 0&&(i[a]=o,r[a]=Zt(n)?n:e.optional(n),Zt(n)||(r[o]=e.optional(n)))}return e.pipe(e.object(r),e.transform(Yt(i)),e.object(t))}function Xt(e){return e.type===`object`&&`entries`in e}function Zt(e){return e.type===`optional`&&`wrapped`in e}function Qt(e){return e.type===`array`&&`item`in e}function $t(t,n){if(Zt(t)){let r=$t(t.wrapped,n);return t.default===void 0?e.optional(r):e.optional(r,t.default)}return Qt(t)?Ut($t(t.item,n)):Xt(t)?en(t,n):t}function en(t,n,r){let i={};for(let e in t.entries){let r=n.children?.[e]??{};i[re(e,n)]=$t(t.entries[e],r)}return e.object({...i,...r})}function tn(e,t={},n){return en(e,t,n)}function j(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 M(e,t){return{api:E(e,t),validation:tn(e,t)}}function N(e){return e}function P(...e){return N({attrs:e})}function nn(...e){return N({attrs:e,preserveCamel:e})}function rn(e,t){return N({attrs:e,preserveCamel:t})}function F(e){return N({children:e})}function I(e,t){return N({attrs:e,children:t})}function L(e,t,n){return N(n?{...e,listWrap:t,detailKey:n}:{...e,listWrap:t})}function R(e,...t){return L(P(...t),e)}function an(e){return{one:L(e,`one`),many:L(e,`many`)}}P(`hostID`,`xtoken`,`interface`,`userName`,`status`,`languageCode`);const on=P(`currencyCode`,`creditLimit`,`c_PaymentType`,`c_SpecPaymentTypeCode`,`s_PaymentType`,`s_SpecPaymentTypeCode`,`enableElectronicInvoicing`,`electronicInvoicingType`),sn=P(`idType`,`idCode`,`idIssueLocation`,`idIssueCounty`,`idIssueDate`,`idExpireDate`),cn=P(`acceptProfilingPolicies`,`acceptPrivacyPolicies`,`acceptNewsletterPolicies`),ln=P(`key`,`value`),un=P(`supplierRefCode`,`companyMainBusinessType`,`carrierType`),dn=I([`recordCode`,`insertCriteria`],{financialDetail:on,idDocumentDetail:sn,accountPolicies:cn,dynamicFields:ln,supplierRefMasterRecords:un}),z=P(`minDate`,`maxDate`),fn=F({lastModificationDate:z}),pn=nn(`sCode1`,`sCode2`,`sCode3`,`sCode4`,`sCode5`,`sCode6`),mn=P(`code`,`iataCode`,`nationCode`,`type`),hn=P(`nType`,`title`),gn=L(hn,`many`),_n=I([`rph`,`roomRph`,`billingHolder`],{notes:L(hn,`many`,`noteDetail`),idDocInfo:sn}),vn=P(`currencyCode`,`exchangeRate`,`cost`,`costTax`,`costType`,`vatCostCurrencyCode`,`price`,`priceTax`,`priceType`),yn=rn([`pCode`,`startDate`,`endDate`,`getServicesFromPackage`],[`pCode`]),B=an(N({...rn([`sCode`,`ssCode`],[`sCode`,`ssCode`]),children:{serviceFare:vn,avesServiceInfo:F({serviceFare:vn}),noteList:gn}})),V=an(_n);V.one,V.many;const bn=L(yn,`many`),xn=R(`many`,`deadlineCode`,`description`,`expireDate`),Sn=R(`many`,`reschedulingCode`,`description`,`expireDate`),Cn=L(P(`reschedulingCode`,`expireDate`,`totalAmount`),`many`,`deadlineDetail`),wn=L(N({...P(`paymentDate`,`paymentNote`,`amount`,`paymentUser`,`paymentType`),rename:{paymentNote:`PaumentNote`}}),`many`),Tn=R(`many`,`paymentDate`,`paymentNote`,`payerMasterCode`,`payerName`,`amount`,`paymentType`),En=R(`many`,`cancelOperationType`,`serviceRefType`,`serviceRefValue`),Dn=I([`printDoc`,`sendDocViaEmail`],{infoDocumentsToPrint:F({documentCustomizablePrintParameters:P(`makeDocumentTo`,`fillInCode`)})}),On=P(`value`,`expiredDate`),kn=P(`recordCode`),An=P(`customer_PaymentType`,`customer_SpecPaymentTypeCode`),jn=P(`getAllDeptDate`,`getFlightPlan`,`getAllAccomodation`,`getRealAvailability`),Mn=P(`compatibleAccomodation`,`alternativeAccomodation`),Nn=R(`many`,`code`,`name`),Pn=P(`value`,`expiredDate`,`optionedFileExpireDatePolicy`),Fn=P(`apply`,`specificCode`),In={customerDetail:kn,bookingFileStatus:On,statisticCodes:pn,destination:mn,bookingFileDocument:Dn,bookingFinancialInfo:An,selectedPackageDetail:yn,selectedPackageList:bn,financialDeadlineList:Cn,paymentList:wn,cancellableBookedServiceList:En,noteList:gn},Ln=F({...In,deadlineList:xn,selectedServiceList:B.one,extraQuoteServiceList:B.one,passengerList:V.one}),Rn=F({...In,deadlineList:Sn,selectedServiceList:B.many,extraQuoteServiceList:B.many,passengerList:V.many}),zn=I([`paymentUser`],{filePaymentList:Tn}),Bn=F({fileStatus:P(`value`,`expireDate`),startDate:z,createdDate:z,lastModificationDate:z,insurance:P(`code`,`number`)}),Vn=F({statisticCodes:pn,selectedServiceList:L(P(`serviceCode`,`packageRow`),`many`),passengerList:V.many}),Hn=F({passengerList:V.many}),Un=F({destination:mn,statisticCodes:pn,packageParams:jn,topServiceParams:Mn,featureList:Nn}),Wn=F({fileStatus:Pn,penalty:Fn,bookingFileDocument:Dn}),Gn=N({}),H=e.union([e.literal(`true`),e.literal(`false`),e.boolean()]),Kn={[_.CONFIRM]:`CONFIRMED`,[_.OPTION]:`OPTIONED`,[_.REQUESTED]:`REQUEST`};function qn(e){return e in Kn?Kn[e]:e}const Jn=e.pipe(e.object({"@Value":Qe,"@ExpiredDate":e.optional(e.string()),"@ExpireDate":e.optional(e.string())}),e.transform(e=>({...j(e,{"@ExpiredDate":[`@ExpiredDate`,`@ExpireDate`]}),"@Value":qn(e[`@Value`])}))),Yn=D(`PricePerPaxDetail`,e.object({"@PaxRef":e.string(),"@Price":x})),Xn=e.object({"@CommissionCode":e.optional(e.string()),"@CommissionPercentage":e.optional(x),"@CommissionAmount":e.optional(x),"@PriceListCode":e.optional(e.string()),"@CostListCode":e.optional(e.string()),"@ServiceTotalPrice":e.optional(x),PaxPriceList:e.optional(Yn)}),Zn=e.object({"@Code":e.optional(e.string()),"@Name":e.optional(e.string()),"@Email":e.optional(e.string()),"@LanguageCode":e.optional(e.string())}),Qn=e.object({"@Code":e.optional(e.string()),"@Description":e.optional(e.string())}),$n=e.object({"@RPH":e.string(),"@ServiceCode":e.optional(e.string()),"@FromExternalProvider":e.optional(x),"@isFromExternalProvider":e.optional(x),AvesServiceType:e.optional(et),TOServiceType:e.optional(nt),FirstDescription:e.optional(e.string()),SecondDescription:e.optional(e.string()),ThirdDescription:e.optional(e.string()),FourthDescription:e.optional(e.string()),ServiceStatus:e.optional(it),StartDate:e.optional(e.string()),EndDate:e.optional(e.string()),Qty:e.optional(x),Pax:e.optional(x),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(Qn),SupplierInfo:e.optional(Zn),ServiceTotalAmountDetail:e.optional(Xn)}),er=D(`BookedServiceDetail`,e.pipe($n,e.transform(e=>j(e,{"@FromExternalProvider":[`@FromExternalProvider`,`@isFromExternalProvider`]})))),tr=e.object({"@CurrencyCode":e.optional(e.string()),"@TotalAmountBeforeDiscount":e.optional(x),"@TotalAmountAfterDiscount":e.optional(x),"@TotalDiscount":e.optional(x),"@TotalAmountWithoutVat":e.optional(x),"@DueAmount":e.optional(x),"@PaiedAmount":e.optional(x),"@Balance":e.optional(x)}),nr=D(`PassengerDetail`,e.object({"@RPH":e.string(),"@RoomRPH":e.optional(e.string()),"@BillingHolder":e.optional(x),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())})),rr=e.object({"@ReschedulingCode":e.optional(e.string()),"@ExpireDate":e.optional(e.string()),"@TotalAmount":e.optional(x),ReschedulingCode:e.optional(e.string()),ExpireDate:e.optional(e.string()),TotalAmount:e.optional(x)}),ir=D(`DeadlineDetail`,e.pipe(rr,e.transform(e=>j(e,{"@ReschedulingCode":[`@ReschedulingCode`,`ReschedulingCode`],"@ExpireDate":[`@ExpireDate`,`ExpireDate`],"@TotalAmount":[`@TotalAmount`,`TotalAmount`]})))),ar=D(`StoredDocumentDetail`,e.object({DocumentRefCode:e.optional(e.string()),DocumentType:e.optional(e.string()),DocumentName:e.optional(e.string()),ArchiviationDescription:e.optional(e.string())})),or=D(`PrintableDocumentDetail`,e.object({DocumentType:e.optional(e.string()),DocumentName:e.optional(e.string()),Enabled:e.optional(x)})),sr=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(Jn),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(er),TotalAmountDetail:e.optional(tr),PaxNumber:e.optional(x),PassengerList:e.optional(nr),Reference:e.optional(e.string()),ClerkName:e.optional(e.string()),StoredDocumentsList:e.optional(ar),PrintableDocumentsList:e.optional(or),FinancialDeadlineList:e.optional(ir)}),cr=e.pipe(sr,e.transform(e=>j(e,{"@BookingFileCode":[`@BookingFileCode`,`BookingFileCode`]}))),lr=e.object({currencyCode:e.optional(e.string()),creditLimit:e.optional(e.string()),c_PaymentType:e.optional(Ge),c_SpecPaymentTypeCode:e.optional(e.string()),s_PaymentType:e.optional(Ge),s_SpecPaymentTypeCode:e.optional(e.string()),enableElectronicInvoicing:e.optional(H),electronicInvoicingType:e.optional(e.string())}),ur=M(lr,on);ur.api,ur.validation;const dr=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())}),fr=M(dr,sn);fr.api,fr.validation;const pr=e.object({key:e.string(),value:e.string()});tn(pr,ln);const mr=e.object({supplierRefCode:e.optional(e.string()),companyMainBusinessType:e.optional(e.string()),carrierType:e.optional(qe)}),hr=M(mr,un);hr.api,hr.validation;const gr=e.union([e.literal(0),e.literal(1)]),_r=e.object({acceptProfilingPolicies:e.optional(gr),acceptPrivacyPolicies:e.optional(gr),acceptNewsletterPolicies:e.optional(gr)}),vr=M(_r,cn);vr.api,vr.validation;const yr={recordCode:e.optional(e.pipe(e.string(),e.minLength(6),e.maxLength(6))),insertCriteria:e.optional(Ue),createdDate:e.optional(e.string()),recordType:e.optional(ze,Re.CUSTOMER),recordStatus:e.optional(Ve,Be.ENABLED),moniker:e.optional(e.string()),name:e.optional(e.string()),extraInfo:e.optional(e.string()),languageCode:Ft,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(Me),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(dr),accountPolicies:e.optional(_r),financialDetail:e.optional(lr),dynamicFields:e.optional(e.array(pr)),supplierRefMasterRecords:e.optional(mr)},br=E(A(yr,De),dn),U=e.partial(tn(e.object(yr),dn,{ModifiedDate:e.optional(e.string()),LoginType:e.optional(e.string()),PromoterCode:e.optional(e.string()),EncryptedPassword:e.optional(H),NewsletterDisabled:e.optional(H)}));O(U);const xr=Kt(Ye,{expiredDate:e.optional(e.string())}),W=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)))}),Sr=e.object({code:e.optional(e.string()),iataCode:e.optional(e.string()),nationCode:e.optional(e.string()),type:e.optional(Pt)}),Cr=e.object({recordCode:e.optional(e.string())}),wr=e.object({makeDocumentTo:e.optional(St)}),Tr=e.object({fillInCode:e.optional(e.string())}),Er=e.union([wr,Tr]),Dr=e.object({documentType:bt,documentCustomizablePrintParameters:e.optional(Er)}),Or=e.object({printDoc:e.optional(H),sendDocViaEmail:e.optional(H),infoDocumentsToPrint:e.optional(e.array(Dr))}),kr=e.object({reschedulingCode:e.optional(e.string()),expireDate:e.optional(e.string()),totalAmount:e.optional(e.string())}),Ar=e.object({deadlineCode:e.optional(e.string()),description:e.optional(e.string()),expireDate:e.optional(e.string())}),jr=e.object({paymentDate:e.optional(e.string()),paymentNote:e.optional(e.string()),amount:e.optional(e.string()),paymentUser:e.optional(e.string()),paymentType:e.optional(ot)}),Mr=A({nType:e.optional(e.string()),title:e.optional(e.string()),text:e.optional(e.string())},ge),Nr=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(wt),vatCostCurrencyCode:e.optional(e.string()),price:e.optional(e.string()),priceTax:e.optional(e.string()),priceType:e.optional(wt)}),Pr=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(Nr)}),Fr=A({sCode:e.string(),ssCode:e.optional(e.string()),avesServiceType:et,toServiceType:e.optional(nt),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(Pr),serviceFare:e.optional(Nr),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.array(Mr)),voucherInfo:e.optional(e.string()),firstDescription:e.optional(e.string()),secondDescription:e.optional(e.string())},ve),Ir=A({pCode:e.string(),startDate:e.string(),endDate:e.string(),getServicesFromPackage:e.optional(H)},ye),Lr={rph:e.string(),roomRph:e.optional(e.string()),billingHolder:e.optional(H),masterRecordCode:e.optional(e.string()),name:e.string(),sex:Me,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(Mr)),flagStatus:e.optional(e.string()),offerCode:e.optional(e.string()),idDocInfo:e.optional(dr)},Rr=A({...Lr,categoryCode:ut},_e),zr=A({...Lr,categoryCode:e.optional(ut)},_e),Br=e.object({customer_PaymentType:e.optional(ct),customer_SpecPaymentTypeCode:e.optional(e.string())}),Vr=E(e.pipe(A({createDate:e.optional(e.string()),bookingFileRefCode:e.optional(e.string()),travelAgentCode:e.optional(e.string()),clerkName:e.optional(e.string()),customerDetail:e.optional(Cr),customerRecordCode:e.optional(e.string()),currencyCode:e.optional(e.string()),markupCode:e.optional(e.string()),bookingFileStatus:xr,statisticCodes:e.optional(W),destination:e.optional(Sr),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(Or),financialDeadlineList:e.optional(e.array(kr)),deadlineList:e.optional(e.array(Ar)),paymentList:e.optional(e.array(jr)),selectedPackageList:e.optional(e.array(Ir)),selectedServiceList:e.array(Fr),extraQuotaRefCode:e.optional(e.string()),extraQuoteServiceList:e.optional(e.array(Fr)),getExtraQuoteFromSystem:e.optional(H),passengerList:e.array(Rr),noteList:e.optional(e.array(Mr)),bookingFinancialInfo:e.optional(Br),bookingFileCode:e.optional(e.string()),groupingPaxPolicy:e.optional(Et),groupBookingFile:e.optional(H),typeDownloadFile:e.optional(Ot),setBookingFileCodeFromStartDate:e.optional(H)},be),e.check(e=>!!(e.customerDetail||e.customerRecordCode),`customerDetail or customerRecordCode is required`),e.transform(Jt)),Ln),Hr=Gt(e.object({RsStatus:w,BookingFileDetail:e.optional(cr),PrintableDocumentsList:e.optional(or),TotalAmountDetailAfterCancellation:e.optional(tr),Base64DocContent:e.optional(e.string())}),`bookingFileDetail`),Ur=Rt,G={customerRecordCode:e.string(),bookingFileCode:e.string()},Wr=Hr,Gr=e.object({reschedulingCode:e.string(),description:e.optional(e.string()),expireDate:e.optional(e.string())}),Kr=e.object({cancelOperationType:ft,serviceRefType:mt,serviceRefValue:e.string()}),qr=E(e.pipe(A({...G,currencyCode:e.optional(e.string()),deadlineList:e.optional(e.array(Gr)),selectedPackageDetail:e.optional(Ir),selectedPackageList:e.optional(e.pipe(e.array(Ir),e.maxLength(1))),selectedServiceList:e.pipe(e.array(Fr),e.minLength(1)),cancellableBookedServiceList:e.optional(e.array(Kr)),passengerList:e.optional(e.array(zr))},xe),e.transform(qt(`selectedPackageList`,`selectedPackageDetail`))),Rn),Jr=E(A({...G,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(zr)),statisticCodes:e.optional(W),bookingFinancialInfo:e.optional(Br),financialDeadlineList:e.optional(e.array(e.object({reschedulingCode:e.string(),expireDate:e.string(),totalAmount:e.string()})))},Se),Rn),Yr=E(A(G,m),Gn),Xr=E(A({...G,fileStatus:Kt(Ze,{expiredDate:e.optional(e.string()),optionedFileExpireDatePolicy:e.optional(gt)}),backOfficeRequest:e.optional(H),bookingFileDocument:e.optional(Or),penalty:e.optional(e.object({apply:e.optional(H),specificCode:e.optional(e.string())})),simulateCancelAndGetPenaltyAmount:e.optional(H)},Ce),Wn),Zr=E(A({...G,bookingServiceRef:e.string(),bookingFileServiceStatus:e.literal(`NULLIFIED`),bookingFileServiceStatusDate:e.optional(e.string())},we),Gn),Qr=e.object({paymentDate:e.string(),paymentNote:e.optional(e.string()),payerMasterCode:e.optional(e.string()),payerName:e.optional(e.string()),amount:e.string(),paymentType:ot}),$r=E(e.pipe(A({bookingFileCode:e.optional(e.string()),bookingFileRefCode:e.optional(e.string()),paymentUser:e.optional(e.string()),enableMultiplePayments:H,operationType:vt,filePaymentList:e.pipe(e.array(Qr),e.minLength(1))},Te),e.check(e=>!!(e.bookingFileCode||e.bookingFileRefCode),`bookingFileCode or bookingFileRefCode is required`)),zn),ei=D(`FeatureDetail`,e.object({"@Code":e.optional(e.string()),"@Name":e.optional(e.string()),ValueCode:e.optional(e.string()),ValueName:e.optional(e.string())})),ti=e.object({"@PackageCode":e.optional(e.string()),"@PackageReference":e.optional(e.string()),"@PackageServiceType":e.optional(e.string()),"@ServiceCodeForPackageDetail":e.optional(e.string())}),ni=D(`SubServiceDetail`,e.object({"@ssCode":e.optional(e.string()),FirstDescription:e.optional(e.string()),SubServiceType:e.optional(e.string()),SubServiceLevel:e.optional(S),StartDate:e.optional(e.string()),EndDate:e.optional(e.string())})),ri=D(`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(ti),SubServiceList:e.optional(ni)})),ii=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(S),BasePax:e.optional(S),CanCommitPack:e.optional(S),FeatureList:e.optional(ei),ServiceList:e.optional(ri)}),ai=D(`PackageDetail`,ii),oi=e.object({code:e.string(),name:e.optional(e.string())}),si=A({getAllDeptDate:e.optional(H),getFlightPlan:e.optional(H),getAllAccomodation:e.optional(H),getRealAvailability:e.optional(H),minStay:e.optional(x),maxStay:e.optional(x)},ke),ci=A({compatibleAccomodation:e.optional(H),alternativeAccomodation:e.optional(H)},ke),li=A({customerRecordCode:e.string(),languageCode:b,currencyCode:e.optional(e.string()),startDate:e.string(),endDate:e.string(),earlyBookingDate:e.optional(e.string()),passengerList:e.pipe(e.array(Rr),e.minLength(1)),avesSearchType:e.optional(At),paxQty:e.optional(x),paxQtyCriteria:e.optional(Mt),discartNotAvailables:e.optional(H),discartNotAvailablesMinSales:e.optional(H),discartNotAvailablesDaysInOut:e.optional(H),discardPriceZero:e.optional(H),discardZeroPriceDays:e.optional(H),destination:e.optional(Sr),objectTypeCode:e.optional(e.string()),featureList:e.optional(e.array(oi)),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(W),mergeBoardAndAccomodation:e.optional(H),packageParams:e.optional(si),topServiceParams:e.optional(ci),getDocumentation:e.optional(H)},Oe),ui=e.pipe(li,e.check(e=>e.languageCode!=null&&e.avesSearchType!=null,`languageCode and avesSearchType required`));function di(e){let{customerRecordCode:t,languageCode:n,currencyCode:r,startDate:i,endDate:a,earlyBookingDate:o,passengerList:s,paxQty:ee,paxQtyCriteria:c,avesSearchType:te,...ne}=e;return{BaseSearch:Ht({customerRecordCode:t,languageCode:n,currencyCode:r,startDate:i,endDate:a,earlyBookingDate:o,passengerList:s},Hn),...Ht({...ne,avesSearchType:te,paxQty:ee??s.length,paxQtyCriteria:c??jt.GREATER_OR_EQUAL},Un)}}const fi=e.pipe(ui,e.transform(di)),pi=k(`PackageList`,ai),mi=k(`ServiceList`,ri),hi=e.object({serviceCode:e.string(),packageRow:e.string()}),gi=E(A({customerRecordCode:e.string(),languageCode:b,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(W),selectedServiceList:e.pipe(e.array(hi),e.minLength(1)),passengerList:e.optional(e.array(Rr))},Ae),Vn),_i=Gt(e.object({RsStatus:w,PackageDetail:e.optional(ii)}),`packageDetail`),vi=E(e.object({packageCode:e.string()}),Gn),yi=Rt,bi=C,K=b,xi=e.object({searchType:e.literal(g.CODE),recordCode:e.pipe(e.string(),e.minLength(5),e.maxLength(6)),languageCode:K}),Si=e.object({searchType:e.literal(g.NAME),name:e.string(),city:e.optional(e.string()),languageCode:K}),Ci=e.object({searchType:e.literal(g.VATCODE),vatCode:e.string(),phoneNumber:e.optional(e.string()),languageCode:K}),wi=e.object({searchType:e.literal(g.ZONE),zipCode:e.string(),countyCode:e.string(),city:e.optional(e.string()),languageCode:K}),Ti=e.object({searchType:e.literal(g.CATEGORY),categoryCode:e.string(),languageCode:K}),Ei=e.object({searchType:e.literal(g.EMAIL),email:e.string(),languageCode:K}),Di=e.object({searchType:e.literal(g.LASTMODDATE),lastModificationDate:bi,languageCode:K}),Oi=e.object({searchType:e.literal(g.SEARCH_FIELD),searchFieldValue:e.string(),languageCode:K}),ki=e.object({searchType:e.literal(g.EXTERNAL_REF_CODE),searchFieldValue:e.string(),languageCode:K}),Ai=E(e.union([xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki]),fn);e.pipe(e.object({RqHeader:It,SearchMasterRecord:Ai}),e.transform(e=>{let{SearchMasterRecord:t,RqHeader:n,...r}=e;return{RqHeader:n,...t,...r}}));const ji=k(`MasterRecordList`,D(`MasterRecordDetail`,U)),Mi=Kt(Qe,{expireDate:e.optional(e.string())}),Ni=e.object({code:e.optional(e.string()),number:e.optional(e.string())}),Pi={customerRecordCode:e.string(),customerPromoterCode:e.optional(e.string()),getSupplierInfo:e.optional(H),user:e.optional(e.string()),officeCode:e.optional(e.string())},Fi=A({...Pi,searchType:e.literal(v.FILE_CODE),bookingFileCode:e.string()},Ee),Ii=A({...Pi,searchType:e.literal(v.PAX_NAME),firstPaxName:e.string()},Ee),Li=A({...Pi,searchType:e.literal(v.PACKAGE_CODE),packageCode:e.string()},Ee),Ri=A({...Pi,searchType:e.literal(v.OTHER),fileStatus:e.optional(Mi),startDate:e.optional(C),createdDate:e.optional(C),lastModificationDate:e.optional(C),insurance:e.optional(Ni),isSearchForB2C:e.optional(H)},Ee),zi=E(e.union([Fi,Ii,Li,Ri]),Bn),Bi=k(`BookingFileList`,D(`BookingFileDetail`,cr));e.object({RqHeader:It,MasterRecordDetail:U});const Vi=Gt(e.object({RsStatus:w,MasterRecordDetail:e.optional(U)}),`masterRecordDetail`),q={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 Hi(e,t){return{[e]:t}}const J={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`};function Y(e){return e}const X={search:`search`,upsert:`upsert`,create:`create`,updateServices:`updateServices`,updateHeader:`updateHeader`,cancel:`cancel`,setStatus:`setStatus`,setServiceStatus:`setServiceStatus`,addPayments:`addPayments`,searchBookings:`searchBookings`,searchPackages:`searchPackages`,searchServices:`searchServices`,get:`get`,commit:`commit`},Ui=h(X),Wi={[X.search]:Y({endpoint:J.search,requestRoot:q.SEARCH_REQUEST,responseRoot:q.SEARCH_RESPONSE,apiSchema:Ai,responseSchema:ji}),[X.upsert]:Y({endpoint:J.upsert,requestRoot:q.UPSERT_REQUEST,responseRoot:q.UPSERT_RESPONSE,apiSchema:br,responseSchema:Vi,bodyKey:Fe.MasterRecordDetail}),[X.create]:Y({endpoint:J.createBooking,requestRoot:q.BOOKING_REQUEST,responseRoot:q.BOOKING_RESPONSE,apiSchema:Vr,responseSchema:Hr}),[X.updateServices]:Y({endpoint:J.modBookingServices,requestRoot:q.MOD_FILE_SERVICES_REQUEST,responseRoot:q.BOOKING_RESPONSE,apiSchema:qr,responseSchema:Wr}),[X.updateHeader]:Y({endpoint:J.modBookingHeader,requestRoot:q.MOD_FILE_HEADER_REQUEST,responseRoot:q.MOD_FILE_HEADER_RESPONSE,apiSchema:Jr,responseSchema:Ur}),[X.cancel]:Y({endpoint:J.cancelBooking,requestRoot:q.CANCEL_FILE_REQUEST,responseRoot:q.CANCEL_FILE_RESPONSE,apiSchema:Yr,responseSchema:Ur}),[X.setStatus]:Y({endpoint:J.setBookingStatus,requestRoot:q.SET_STATUS_REQUEST,responseRoot:q.SET_STATUS_RESPONSE,apiSchema:Xr,responseSchema:Wr}),[X.setServiceStatus]:Y({endpoint:J.setBookingServiceStatus,requestRoot:q.SET_STATUS_SERVICE_REQUEST,responseRoot:q.SET_STATUS_SERVICE_RESPONSE,apiSchema:Zr,responseSchema:Wr}),[X.addPayments]:Y({endpoint:J.insertFilePaymentList,requestRoot:q.FILE_PAYMENT_LIST_REQUEST,responseRoot:q.FILE_PAYMENT_LIST_RESPONSE,apiSchema:$r,responseSchema:Ur}),[X.searchBookings]:Y({endpoint:J.searchBookingFile,requestRoot:q.SEARCH_BOOKING_FILE_REQUEST,responseRoot:q.SEARCH_BOOKING_FILE_RESPONSE,apiSchema:zi,responseSchema:Bi}),[X.searchPackages]:Y({endpoint:J.searchAvesPackages,requestRoot:q.AVES_SEARCH_REQUEST,responseRoot:q.SEARCH_PACKAGE_RESPONSE,apiSchema:fi,responseSchema:pi}),[X.searchServices]:Y({endpoint:J.searchTopServices,requestRoot:q.AVES_SEARCH_REQUEST,responseRoot:q.SEARCH_SERVICES_RESPONSE,apiSchema:fi,responseSchema:mi}),[X.get]:Y({endpoint:J.getPackageDetail,requestRoot:q.PACKAGE_DETAIL_REQUEST,responseRoot:q.PACKAGE_DETAIL_RESPONSE,apiSchema:gi,responseSchema:_i}),[X.commit]:Y({endpoint:J.commitPackage,requestRoot:q.COMMIT_PACKAGE_REQUEST,responseRoot:q.COMMIT_PACKAGE_RESPONSE,apiSchema:vi,responseSchema:yi})};var Gi=class{transport;constructor(e){this.transport=e}async create(e){return p(await this.transport.invokeOp(X.create,e))}async updateServices(e){return p(await this.transport.invokeOp(X.updateServices,e))}async updateHeader(e){return p(await this.transport.invokeOp(X.updateHeader,e))}async cancel(e){return p(await this.transport.invokeOp(X.cancel,e))}async setStatus(e){return p(await this.transport.invokeOp(X.setStatus,e))}async setServiceStatus(e){return p(await this.transport.invokeOp(X.setServiceStatus,e))}async addPayments(e){return p(await this.transport.invokeOp(X.addPayments,e))}async search(e){return p(await this.transport.invokeOp(X.searchBookings,e))}};function Ki(e){return{success:!0,data:e}}function Z(e){return{success:!1,error:e}}var qi=class{transport;constructor(e){this.transport=e}async search(e){let t=await this.transport.invokeOp(X.search,e);return t.success?Ki(he(t.data.masterRecordList??[])):t}async upsert(e){return p(await this.transport.invokeOp(X.upsert,e))}},Ji=class{transport;constructor(e){this.transport=e}#e(e,t){return{...this.transport.languageCode&&{languageCode:this.transport.languageCode},...e,avesSearchType:e.avesSearchType??e.searchType??t}}async search(e){return p(await this.transport.invokeOp(X.searchPackages,this.#e(e,y.PACKAGE)))}async searchServices(e){return p(await this.transport.invokeOp(X.searchServices,this.#e(e,y.SERVICE)))}async get(e){return p(await this.transport.invokeOp(X.get,e))}async commit(e){return p(await this.transport.invokeOp(X.commit,e))}};const Yi={VALIDATION:`validation`,API:`api`,UNKNOWN:`unknown`};var Q=class extends Error{kind;status;code;constructor(e,t,n,r){super(t),this.kind=e,this.status=n,this.code=r,this.name=`AvesError`}};function $(e){return new Q(Yi.VALIDATION,e)}function Xi(e,t,n){return new Q(Yi.API,e,t,n)}function Zi(e){return new Q(Yi.UNKNOWN,e)}function Qi(e,n){return e instanceof Q?e:e instanceof t?$(`Validation error: ${$i(e.issues)}`):e instanceof Error?Zi(e.message):Zi(n)}function $i(e){return e.map(ea).join(`; `)}function ea(e){let t=ta(e.path),n=e.message??`Invalid value`;return t?`${t}: ${n}`:n}function ta(e){if(!e||e.length===0)return;let t=e.map(na).filter(e=>e!==void 0);return t.length>0?t.join(`.`):void 0}function na(e){if(typeof e==`string`||typeof e==`number`)return String(e);if(typeof e==`object`&&e&&`key`in e)return String(e.key)}function ra(e){return e instanceof Error&&e.name===`AbortError`}const ia=e=>e<200||e>299,aa={ignoreAttributes:!1,attributeNamePrefix:`@`,parseAttributeValue:!1,trimValues:!0,ignoreNameSpace:!0,removeNSPrefix:!0,parseTagValue:!1},oa={ignoreAttributes:!1,attributeNamePrefix:`@`,suppressEmptyNode:!0},sa=new a(aa),ca=new i(oa);function la(e){try{return ca.build(e)}catch(e){throw $(`Failed to convert JSON to XML: ${e instanceof Error?e.message:`Unknown error`}`)}}function ua(e){try{return sa.parse(e)}catch(e){throw $(`Failed to convert XML to JSON: ${e instanceof Error?e.message:`Unknown error`}`)}}function da(e,t,n){let r=e.bodyKey?{[e.bodyKey]:t}:t;return Hi(e.requestRoot,{RqHeader:n,...r})}function fa(e){return typeof e==`string`?e:e instanceof Uint8Array||Buffer.isBuffer(e)?Buffer.from(e).toString(`utf8`):String(e)}async function pa(e,t){let n=``;for await(let r of e){if(n.length>=t)continue;let e=fa(r),i=t-n.length;n+=e.length<=i?e:e.slice(0,i)}return n}function ma(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 ha(e,t){if(!t.startsWith(`/`))throw $(`Invalid endpoint: endpoint must start with '/' but got '${t}'`);let n;try{n=new URL(e)}catch(e){throw $(`Invalid baseURL: ${e instanceof Error?e.message:`Invalid URL format`}`)}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw $(`Invalid protocol: baseURL must use http:// or https:// but got '${n.protocol}'`);let{pathname:r}=n;if(r===`/`||r===``)return new URL(t,n).href;let i=(r.endsWith(`/`)?r.slice(0,-1):r)+t;return new URL(i,n).href}const ga={"Content-Type":`application/xml`};var _a=class{options;urlByEndpoint=new Map;constructor(e){this.options=e}async postXml(e,t){let{signal:n,clear:r}=ma(this.options.timeoutMs??3e4);try{let r=await o(this.resolveUrl(e),{method:`POST`,headers:ga,body:t,signal:n}),i=ia(r.statusCode),a=i?await pa(r.body,4096):await r.body.text();return i?Z(Xi(a,`ERROR`,r.statusCode)):Ki({statusCode:r.statusCode,body:a})}catch(e){return ra(e)?Z(Xi(`Request timed out`,`TIMEOUT`)):Z(Qi(e,`Unknown error occurred`))}finally{r?.()}}resolveUrl(e){let t=this.urlByEndpoint.get(e);if(t)return t;let n=ha(this.options.baseURL,e);return this.urlByEndpoint.set(e,n),n}};function va(e,t,n){let i=ua(e)[t];if(!i)return Z($(`Invalid response structure: missing root element '${t}'`));let a=r(n,i);return a.success?ya(a.output):Z($(`Invalid response format: ${$i(a.issues)}`))}function ya(e){let{rsStatus:t}=e;return t.status===`OK`?Ki(e):Z(Xi(t.errorDescription??``,t.status,t.errorCode))}function ba(e){return{"@HostID":e.hostID,"@Xtoken":e.xtoken,"@Interface":`WEB`,"@UserName":`WEB`,...e.languageCode&&{"@LanguageCode":e.languageCode}}}var xa=class{options;http;rqHeader;constructor(e){this.options=e,this.http=new _a({baseURL:e.baseURL,timeoutMs:e.timeoutMs}),this.rqHeader=Object.freeze(ba(e))}get languageCode(){return this.options.languageCode}createRqHeader(){return this.rqHeader}async invokeOp(e,t){let r=Wi[e];try{let e=da(r,n(r.apiSchema,t),this.rqHeader),i=await this.http.postXml(r.endpoint,la(e));return i.success?va(i.data.body,r.responseRoot,r.responseSchema):i}catch(t){return Z(Qi(t,`Validation error occurred during ${e}`))}}},Sa=class{transport;master;booking;packages;constructor(e,t={}){this.transport=t.transport??new xa(e),this.master=t.master??new qi(this.transport),this.booking=t.booking??new Gi(this.transport),this.packages=t.packages??new Ji(this.transport)}};export{Sa as AvesClient,Q as AvesError,X as AvesOp,Ui as AvesOpSchema,y as AvesSearchType,At as AvesSearchTypeSchema,$e as AvesServiceType,et as AvesServiceTypeSchema,xa as AvesTransport,rt as BookedServiceStatus,it as BookedServiceStatusSchema,Gi as BookingClient,Je as BookingFileStatus,Ye as BookingFileStatusSchema,_ as BookingFileStatusWire,Qe as BookingFileStatusWireSchema,dt as CancelOperationType,ft as CancelOperationTypeSchema,Ke as CarrierType,qe as CarrierTypeSchema,Ct as CostPriceType,wt as CostPriceTypeSchema,st as CustomerPaymentType,ct as CustomerPaymentTypeSchema,Nt as DestinationType,Pt as DestinationTypeSchema,yt as DocumentType,bt as DocumentTypeSchema,_t as FilePaymentOperationType,vt as FilePaymentOperationTypeSchema,je as Gender,Me as GenderSchema,Tt as GroupingPaxPolicy,Et as GroupingPaxPolicySchema,He as InsertCriteria,Ue as InsertCriteriaSchema,xt as MakeDocumentTo,St as MakeDocumentToSchema,We as MasterPaymentType,Ge as MasterPaymentTypeSchema,qi as MasterRecordsClient,Fe as OpBodyKey,Ie as OpBodyKeySchema,ht as OptionedExpirePolicy,gt as OptionedExpirePolicySchema,Ji as PackageCatalogClient,lt as PassengerCategory,ut as PassengerCategorySchema,jt as PaxQtyCriteria,Mt as PaxQtyCriteriaSchema,at as PaymentType,ot as PaymentTypeSchema,Be as RecordStatus,Ve as RecordStatusSchema,Re as RecordType,ze as RecordTypeSchema,Ne as RsStatusValue,Pe as RsStatusValueSchema,v as SearchBookingFileType,kt as SearchBookingFileTypeSchema,g as SearchMasterType,Le as SearchMasterTypeSchema,pt as ServiceRefType,mt as ServiceRefTypeSchema,Xe as SetFileStatusValue,Ze as SetFileStatusValueSchema,tt as ToServiceType,nt as ToServiceTypeSchema,Dt as TypeDownloadFile,Ot as TypeDownloadFileSchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aves-sdk",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
4
  "description": "TypeScript SDK for AVES XML REST",
5
5
  "homepage": "https://github.com/simoneguglielmi/aves-sdk#readme",
6
6
  "repository": [