aves-sdk 3.0.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 +108 -0
- package/README.md +281 -35
- package/dist/index.d.mts +11500 -2278
- package/dist/index.mjs +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,12 +5,120 @@ 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
|
+
## [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
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- Concise facade aliases for common I/O properties: `customerCode`, `bookingCode`, `services`, `passengers`, `packageCode`, `serviceCode`, `quantity`, `session`, and related fields.
|
|
58
|
+
- Schema-owned dual keys via `facadeObject` / `coalesceAliases` (same pattern as `coalesceCustomerRecordCode`).
|
|
59
|
+
- Simplified public type aliases including `BookingInput`, `Booking`, `MasterRecord`, `PackageInput`, and `Package`.
|
|
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).
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- Facade names are accepted on Valibot input schemas and coalesced to AVES camelCase before wire encoding. Success payloads also expose concise compatibility aliases.
|
|
67
|
+
- Internal transport split: `HttpClient`, `buildOpEnvelope`, `readAvesResponse`, `createRqHeader`; `toAvesError` lives in `error.ts`. Public `invokeOp` API unchanged.
|
|
68
|
+
- Hot-path micro-opts: cached endpoint URLs, shared XML POST headers, frozen cached `RqHeader`, single `AVES_OPS` lookup per `invokeOp`.
|
|
69
|
+
- Cap HTTP error body reads via `readTextCapped` (drain stream, keep ≤ `MAX_ERROR_BODY`).
|
|
70
|
+
- WeakMap cache for `itemShape` / `encodeShapeFor` on static WireShape refs.
|
|
71
|
+
- `toWireBody` single shape-driven walk (list wrap + pax normalize + wire keys).
|
|
72
|
+
- Zero-copy `withPublicAliases` via hardened lazy Proxy (WeakMap identity, proto-pollution blocked).
|
|
73
|
+
- ADR 0001 Phase 2a: `createResponseSchema` camelizes Valibot output **in place** (`pascalToCamelKeysInPlace`) — no second deep-copy. See [`docs/adr/0001-validate-during-camelize.md`](docs/adr/0001-validate-during-camelize.md).
|
|
74
|
+
- Performance harness: `yarn test:bench` (Vitest bench) and `AVES_PERF=1 yarn test:perf` (relative hot-path asserts).
|
|
75
|
+
|
|
8
76
|
## [3.0.0] - 2026-08-06
|
|
9
77
|
|
|
10
78
|
### Changed
|
|
11
79
|
|
|
12
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.
|
|
13
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
|
+
|
|
14
122
|
## [2.0.1] - 2026-08-05
|
|
15
123
|
|
|
16
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.
|
|
49
|
-
await client.packages.
|
|
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`, `
|
|
59
|
-
| `booking` | `
|
|
60
|
-
| `packages` | `
|
|
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
|
|
|
@@ -99,6 +105,244 @@ type Result<T, E> =
|
|
|
99
105
|
| { success: false; error: E };
|
|
100
106
|
```
|
|
101
107
|
|
|
108
|
+
## Simple facade names
|
|
109
|
+
|
|
110
|
+
The facade exposes concise aliases for the AVES payload vocabulary. Inbound
|
|
111
|
+
dual keys are owned by Valibot input schemas (`facadeObject` / `coalesceAliases`)
|
|
112
|
+
and coalesced to AVES camelCase before wire encoding. Outbound success payloads
|
|
113
|
+
keep AVES names and add concise compatibility aliases. XML shapes are unchanged.
|
|
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
|
+
|
|
128
|
+
| AVES-shaped name | Facade name |
|
|
129
|
+
| ---------------- | ----------- |
|
|
130
|
+
| `rsStatus` | `response` |
|
|
131
|
+
| `customerRecordCode` | `customerCode` |
|
|
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` |
|
|
152
|
+
| `selectedPackageDetail` | `package` |
|
|
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)
|
|
307
|
+
|
|
308
|
+
New code can use the simplified vocabulary directly:
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
const created = await client.booking.create({
|
|
312
|
+
customerCode: '138311',
|
|
313
|
+
status: 'CONFIRMED',
|
|
314
|
+
startDate: '2026-08-06',
|
|
315
|
+
endDate: '2026-08-07',
|
|
316
|
+
services: [
|
|
317
|
+
{
|
|
318
|
+
serviceCode: 'HT00110840',
|
|
319
|
+
serviceType: 'TOP',
|
|
320
|
+
targetType: 'RESIDENCE',
|
|
321
|
+
quantity: '1',
|
|
322
|
+
passengerCount: '2',
|
|
323
|
+
session: '1',
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
passengers: [
|
|
327
|
+
{
|
|
328
|
+
passengerRef: '001',
|
|
329
|
+
name: 'ADULT 001',
|
|
330
|
+
categoryCode: 'AD',
|
|
331
|
+
gender: 'M',
|
|
332
|
+
},
|
|
333
|
+
],
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
if (created.success) {
|
|
337
|
+
console.log(created.data.bookingCode);
|
|
338
|
+
console.log(created.data.services?.[0]?.serviceStatus);
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
The previous AVES-shaped names remain accepted and returned as compatibility
|
|
343
|
+
aliases. New type aliases such as `BookingInput`, `Booking`, `MasterRecord`,
|
|
344
|
+
`PackageInput`, and `Package` are exported for new integrations.
|
|
345
|
+
|
|
102
346
|
---
|
|
103
347
|
|
|
104
348
|
## Master records
|
|
@@ -133,12 +377,12 @@ const byEmail = await client.master.search({
|
|
|
133
377
|
});
|
|
134
378
|
```
|
|
135
379
|
|
|
136
|
-
### `client.master.
|
|
380
|
+
### `client.master.upsert(record)`
|
|
137
381
|
|
|
138
382
|
`insertCriteria`: `'S'` always insert · `'N'` skip if exists · `'T'` update all (default) · `'M'` secondary fields only.
|
|
139
383
|
|
|
140
384
|
```typescript
|
|
141
|
-
const result = await client.master.
|
|
385
|
+
const result = await client.master.upsert({
|
|
142
386
|
name: 'Jane Smith',
|
|
143
387
|
email: 'jane@example.com',
|
|
144
388
|
languageCode: '02',
|
|
@@ -158,19 +402,19 @@ if (result.success) {
|
|
|
158
402
|
|
|
159
403
|
| Method | Purpose |
|
|
160
404
|
| ------ | ------- |
|
|
161
|
-
| `
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
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`) |
|
|
169
413
|
|
|
170
414
|
### Create
|
|
171
415
|
|
|
172
416
|
```typescript
|
|
173
|
-
const created = await client.booking.
|
|
417
|
+
const created = await client.booking.create({
|
|
174
418
|
customerRecordCode: '138311', // or customerDetail: { recordCode: '138311' }
|
|
175
419
|
bookingFileStatus: 'QUOTATION', // or { value: 'QUOTATION', expiredDate? }
|
|
176
420
|
startDate: '2015-01-22T00:00:00',
|
|
@@ -209,7 +453,7 @@ if (created.success) {
|
|
|
209
453
|
### Modify services / package / overwrite lines
|
|
210
454
|
|
|
211
455
|
```typescript
|
|
212
|
-
await client.booking.
|
|
456
|
+
await client.booking.updateServices({
|
|
213
457
|
customerRecordCode: '138311',
|
|
214
458
|
bookingFileCode: '14/036654',
|
|
215
459
|
selectedPackageDetail: {
|
|
@@ -248,7 +492,7 @@ Requires `bookingFileCode` **or** `bookingFileRefCode`.
|
|
|
248
492
|
`paymentUser` is serialized as an XML **attribute** on `FilePaymentListRQ` (`PaymentUser="…"`), not as a child element.
|
|
249
493
|
|
|
250
494
|
```typescript
|
|
251
|
-
await client.booking.
|
|
495
|
+
await client.booking.addPayments({
|
|
252
496
|
bookingFileCode: '18/000172',
|
|
253
497
|
paymentUser: 'MLDN',
|
|
254
498
|
enableMultiplePayments: true,
|
|
@@ -267,32 +511,32 @@ await client.booking.insertFilePaymentList({
|
|
|
267
511
|
### Header, status, cancel, search practices
|
|
268
512
|
|
|
269
513
|
```typescript
|
|
270
|
-
await client.booking.
|
|
514
|
+
await client.booking.updateHeader({
|
|
271
515
|
bookingFileCode: '14/000043',
|
|
272
516
|
bookingFileStartDate: '2014-04-28',
|
|
273
517
|
customerRecordCode: '103737',
|
|
274
518
|
passengerList: [{ rph: '001', name: 'ADULTI 001', sex: 'M' }],
|
|
275
519
|
});
|
|
276
520
|
|
|
277
|
-
await client.booking.
|
|
521
|
+
await client.booking.setStatus({
|
|
278
522
|
customerRecordCode: '000170',
|
|
279
523
|
bookingFileCode: '14/000081',
|
|
280
524
|
fileStatus: 'CANCELED', // or { value: 'CANCELED' }
|
|
281
525
|
});
|
|
282
526
|
|
|
283
|
-
await client.booking.
|
|
527
|
+
await client.booking.setServiceStatus({
|
|
284
528
|
customerRecordCode: '000001',
|
|
285
529
|
bookingFileCode: '18/000252',
|
|
286
530
|
bookingServiceRef: '002',
|
|
287
531
|
bookingFileServiceStatus: 'NULLIFIED',
|
|
288
532
|
});
|
|
289
533
|
|
|
290
|
-
await client.booking.
|
|
534
|
+
await client.booking.cancel({
|
|
291
535
|
bookingFileCode: '14/000081',
|
|
292
536
|
customerRecordCode: '000170',
|
|
293
537
|
});
|
|
294
538
|
|
|
295
|
-
await client.booking.
|
|
539
|
+
await client.booking.search({
|
|
296
540
|
searchType: 'PACKAGE_CODE',
|
|
297
541
|
customerRecordCode: '138311',
|
|
298
542
|
packageCode: '2014MDE0000010',
|
|
@@ -307,15 +551,15 @@ There is **no** Create Package API in AVES XML 1.8.0. Search, detail, and commit
|
|
|
307
551
|
|
|
308
552
|
| Method | Purpose |
|
|
309
553
|
| ------ | ------- |
|
|
310
|
-
| `
|
|
311
|
-
| `
|
|
312
|
-
| `
|
|
313
|
-
| `
|
|
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) |
|
|
314
558
|
|
|
315
559
|
`paxQty` defaults to `passengerList.length`; `paxQtyCriteria` defaults to `GREATER_OR_EQUAL`. `languageCode` can be omitted when set on `AvesClient` options.
|
|
316
560
|
|
|
317
561
|
```typescript
|
|
318
|
-
const packages = await client.packages.
|
|
562
|
+
const packages = await client.packages.search({
|
|
319
563
|
customerRecordCode: '138311',
|
|
320
564
|
languageCode: '01',
|
|
321
565
|
currencyCode: 'EUR',
|
|
@@ -333,7 +577,7 @@ const packages = await client.packages.searchPackages({
|
|
|
333
577
|
servOrPackCode: '2014MDE0000010',
|
|
334
578
|
});
|
|
335
579
|
|
|
336
|
-
const detail = await client.packages.
|
|
580
|
+
const detail = await client.packages.get({
|
|
337
581
|
customerRecordCode: '001692',
|
|
338
582
|
packageCode: '2015F042',
|
|
339
583
|
startDate: '2015-05-02T00:00:00',
|
|
@@ -343,7 +587,7 @@ const detail = await client.packages.getPackageDetail({
|
|
|
343
587
|
],
|
|
344
588
|
});
|
|
345
589
|
|
|
346
|
-
await client.packages.
|
|
590
|
+
await client.packages.commit({ packageCode: '14/PACKAGE001' });
|
|
347
591
|
|
|
348
592
|
if (packages.success) console.log(packages.data.packageList?.[0]?.pCode);
|
|
349
593
|
if (detail.success) console.log(detail.data.pCode, detail.data.serviceList?.[0]);
|
|
@@ -371,9 +615,10 @@ if (!result.success) {
|
|
|
371
615
|
|
|
372
616
|
## Case transformation & wire shapes
|
|
373
617
|
|
|
374
|
-
- **
|
|
618
|
+
- **Facade input**: concise camelCase (`customerCode`, `services`, `passengers`)
|
|
619
|
+
- **Wire input**: AVES-shaped camelCase before XML (`recordCode`, `selectedServiceList`, `paymentUser`)
|
|
375
620
|
- **Wire**: PascalCase keys; `@`-prefixed keys become XML attributes
|
|
376
|
-
- **Output**:
|
|
621
|
+
- **Output**: concise facade aliases plus compatibility aliases
|
|
377
622
|
|
|
378
623
|
You do not handle XML attribute prefixes yourself. Attr vs element is decided by a **per-request `WireShape`** (`src/utils/wire-shapes.ts`), not a global field set.
|
|
379
624
|
|
|
@@ -426,8 +671,9 @@ Outbound path: validate → `createApiSchema` / `toWireBody` → `invokeOp` →
|
|
|
426
671
|
## Types
|
|
427
672
|
|
|
428
673
|
Operations are available only through `client.master`, `client.booking`, and
|
|
429
|
-
`client.packages`; flat aliases were removed in 2.0.0.
|
|
430
|
-
|
|
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).
|
|
431
677
|
|
|
432
678
|
```typescript
|
|
433
679
|
import type {
|