aves-sdk 3.0.0 → 3.1.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 +21 -0
- package/README.md +59 -2
- package/dist/index.d.mts +11454 -2275
- package/dist/index.mjs +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,27 @@ 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
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Concise facade aliases for common I/O properties: `customerCode`, `bookingCode`, `services`, `passengers`, `packageCode`, `serviceCode`, `quantity`, `session`, and related fields.
|
|
13
|
+
- Schema-owned dual keys via `facadeObject` / `coalesceAliases` (same pattern as `coalesceCustomerRecordCode`).
|
|
14
|
+
- Simplified public type aliases including `BookingInput`, `Booking`, `MasterRecord`, `PackageInput`, and `Package`.
|
|
15
|
+
- `AVES_OPS` registry + `invokeOp(op, params)` with external `OpParams` / `OpResult` typings.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Facade names are accepted on Valibot input schemas and coalesced to AVES camelCase before wire encoding. Success payloads also expose concise compatibility aliases.
|
|
20
|
+
- Internal transport split: `HttpClient`, `buildOpEnvelope`, `readAvesResponse`, `createRqHeader`; `toAvesError` lives in `error.ts`. Public `invokeOp` API unchanged.
|
|
21
|
+
- Hot-path micro-opts: cached endpoint URLs, shared XML POST headers, frozen cached `RqHeader`, single `AVES_OPS` lookup per `invokeOp`.
|
|
22
|
+
- Cap HTTP error body reads via `readTextCapped` (drain stream, keep ≤ `MAX_ERROR_BODY`).
|
|
23
|
+
- WeakMap cache for `itemShape` / `encodeShapeFor` on static WireShape refs.
|
|
24
|
+
- `toWireBody` single shape-driven walk (list wrap + pax normalize + wire keys).
|
|
25
|
+
- Zero-copy `withPublicAliases` via hardened lazy Proxy (WeakMap identity, proto-pollution blocked).
|
|
26
|
+
- 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).
|
|
27
|
+
- Performance harness: `yarn test:bench` (Vitest bench) and `AVES_PERF=1 yarn test:perf` (relative hot-path asserts).
|
|
28
|
+
|
|
8
29
|
## [3.0.0] - 2026-08-06
|
|
9
30
|
|
|
10
31
|
### Changed
|
package/README.md
CHANGED
|
@@ -99,6 +99,62 @@ type Result<T, E> =
|
|
|
99
99
|
| { success: false; error: E };
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
## Simple facade names
|
|
103
|
+
|
|
104
|
+
The facade exposes concise aliases for the AVES payload vocabulary. Inbound
|
|
105
|
+
dual keys are owned by Valibot input schemas (`facadeObject` / `coalesceAliases`)
|
|
106
|
+
and coalesced to AVES camelCase before wire encoding. Outbound success payloads
|
|
107
|
+
keep AVES names and add concise compatibility aliases. XML shapes are unchanged.
|
|
108
|
+
|
|
109
|
+
| AVES-shaped name | Facade name |
|
|
110
|
+
| ---------------- | ----------- |
|
|
111
|
+
| `customerRecordCode` | `customerCode` |
|
|
112
|
+
| `bookingFileCode` / `bookingFileRefCode` | `bookingCode` / `bookingReference` |
|
|
113
|
+
| `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` |
|
|
119
|
+
|
|
120
|
+
New code can use the simplified vocabulary directly:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
const created = await client.booking.createBooking({
|
|
124
|
+
customerCode: '138311',
|
|
125
|
+
status: 'CONFIRMED',
|
|
126
|
+
startDate: '2026-08-06',
|
|
127
|
+
endDate: '2026-08-07',
|
|
128
|
+
services: [
|
|
129
|
+
{
|
|
130
|
+
serviceCode: 'HT00110840',
|
|
131
|
+
serviceType: 'TOP',
|
|
132
|
+
targetType: 'RESIDENCE',
|
|
133
|
+
quantity: '1',
|
|
134
|
+
passengerCount: '2',
|
|
135
|
+
session: '1',
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
passengers: [
|
|
139
|
+
{
|
|
140
|
+
passengerRef: '001',
|
|
141
|
+
name: 'ADULT 001',
|
|
142
|
+
categoryCode: 'AD',
|
|
143
|
+
gender: 'M',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
if (created.success) {
|
|
149
|
+
console.log(created.data.bookingCode);
|
|
150
|
+
console.log(created.data.services?.[0]?.serviceStatus);
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The previous AVES-shaped names remain accepted and returned as compatibility
|
|
155
|
+
aliases. New type aliases such as `BookingInput`, `Booking`, `MasterRecord`,
|
|
156
|
+
`PackageInput`, and `Package` are exported for new integrations.
|
|
157
|
+
|
|
102
158
|
---
|
|
103
159
|
|
|
104
160
|
## Master records
|
|
@@ -371,9 +427,10 @@ if (!result.success) {
|
|
|
371
427
|
|
|
372
428
|
## Case transformation & wire shapes
|
|
373
429
|
|
|
374
|
-
- **
|
|
430
|
+
- **Facade input**: concise camelCase (`customerCode`, `services`, `passengers`)
|
|
431
|
+
- **Wire input**: AVES-shaped camelCase before XML (`recordCode`, `selectedServiceList`, `paymentUser`)
|
|
375
432
|
- **Wire**: PascalCase keys; `@`-prefixed keys become XML attributes
|
|
376
|
-
- **Output**:
|
|
433
|
+
- **Output**: concise facade aliases plus compatibility aliases
|
|
377
434
|
|
|
378
435
|
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
436
|
|