aves-sdk 2.0.1 → 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 CHANGED
@@ -5,6 +5,33 @@ 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
+
29
+ ## [3.0.0] - 2026-08-06
30
+
31
+ ### Changed
32
+
33
+ - **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
+
8
35
  ## [2.0.1] - 2026-08-05
9
36
 
10
37
  ### Changed
package/README.md CHANGED
@@ -33,7 +33,8 @@ const result = await client.master.search({
33
33
  });
34
34
 
35
35
  if (result.success) {
36
- console.log(result.data.masterRecordList);
36
+ const [record] = result.data;
37
+ console.log(record?.recordCode);
37
38
  } else {
38
39
  console.error(result.error.kind, result.error.message, result.error.code);
39
40
  }
@@ -98,6 +99,62 @@ type Result<T, E> =
98
99
  | { success: false; error: E };
99
100
  ```
100
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
+
101
158
  ---
102
159
 
103
160
  ## Master records
@@ -121,6 +178,11 @@ const byCode = await client.master.search({
121
178
  recordCode: '508558',
122
179
  });
123
180
 
181
+ if (byCode.success) {
182
+ const [record] = byCode.data;
183
+ console.log(record?.recordCode);
184
+ }
185
+
124
186
  const byEmail = await client.master.search({
125
187
  searchType: 'EMAIL',
126
188
  email: 'user@example.com',
@@ -365,9 +427,10 @@ if (!result.success) {
365
427
 
366
428
  ## Case transformation & wire shapes
367
429
 
368
- - **Input**: camelCase (`recordCode`, `selectedServiceList`, `paymentUser`)
430
+ - **Facade input**: concise camelCase (`customerCode`, `services`, `passengers`)
431
+ - **Wire input**: AVES-shaped camelCase before XML (`recordCode`, `selectedServiceList`, `paymentUser`)
369
432
  - **Wire**: PascalCase keys; `@`-prefixed keys become XML attributes
370
- - **Output**: camelCase again
433
+ - **Output**: concise facade aliases plus compatibility aliases
371
434
 
372
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.
373
436