aves-sdk 4.0.0 → 4.0.1

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,12 @@ 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.1] - 2026-08-06
9
+
10
+ ### Added
11
+
12
+ - Copy `CHANGELOG.md` into `dist/` on build (`tsdown` `copy`) and include `dist/CHANGELOG.md` in published `files`.
13
+
8
14
  ## [4.0.0] - 2026-08-06
9
15
 
10
16
  ### Added
@@ -0,0 +1,409 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [4.0.1] - 2026-08-06
9
+
10
+ ### Added
11
+
12
+ - Copy `CHANGELOG.md` into `dist/` on build (`tsdown` `copy`) and include `dist/CHANGELOG.md` in published `files`.
13
+
14
+ ## [4.0.0] - 2026-08-06
15
+
16
+ ### Added
17
+
18
+ - `OpBodyKey` object enum (`MasterRecordDetail`) for RQ payload nest keys; typed on `AVES_OPS` / envelope.
19
+ - `AvesOp` object enum (+ `AvesOpSchema`) for `invokeOp` keys; domains use `AvesOp.create` instead of string literals.
20
+
21
+ ### Changed
22
+
23
+ - **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).
24
+
25
+ | Namespace | 3.x | 4.x |
26
+ | --------- | --- | --- |
27
+ | `master` | `upsertRecord` | `upsert` |
28
+ | `booking` | `createBooking` | `create` |
29
+ | `booking` | `modBookingServices` | `updateServices` |
30
+ | `booking` | `modBookingHeader` | `updateHeader` |
31
+ | `booking` | `cancelBooking` | `cancel` |
32
+ | `booking` | `setBookingStatus` | `setStatus` |
33
+ | `booking` | `setBookingServiceStatus` | `setServiceStatus` |
34
+ | `booking` | `insertFilePaymentList` | `addPayments` |
35
+ | `booking` | `searchBookingFiles` | `search` |
36
+ | `packages` | `searchPackages` | `search` |
37
+ | `packages` | `searchTopServices` | `searchServices` |
38
+ | `packages` | `getPackageDetail` | `get` |
39
+ | `packages` | `commitPackage` | `commit` |
40
+
41
+ `master.search` is unchanged. Endpoint URLs and XML roots are unchanged.
42
+
43
+ ### Migration (1.x / 3.x → 4.x)
44
+
45
+ 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).
46
+
47
+ ```ts
48
+ // 3.x
49
+ await client.booking.createBooking(params);
50
+ await client.packages.searchPackages(params);
51
+ await client.master.upsertRecord(record);
52
+
53
+ // 4.x
54
+ await client.booking.create(params);
55
+ await client.packages.search(params);
56
+ await client.master.upsert(record);
57
+ ```
58
+
59
+ ## [3.1.1] - 2026-08-06
60
+
61
+ ### Added
62
+
63
+ - Concise facade aliases for common I/O properties: `customerCode`, `bookingCode`, `services`, `passengers`, `packageCode`, `serviceCode`, `quantity`, `session`, and related fields.
64
+ - Schema-owned dual keys via `facadeObject` / `coalesceAliases` (same pattern as `coalesceCustomerRecordCode`).
65
+ - Simplified public type aliases including `BookingInput`, `Booking`, `MasterRecord`, `PackageInput`, and `Package`.
66
+ - `AVES_OPS` registry + `invokeOp(op, params)` with external `OpParams` / `OpResult` typings.
67
+ - Full facade alias property map in README (outbound `publicKeyAliases` + inbound scoped maps).
68
+ - 2.x → 3.x migration notes for `master.search` (flat array success payload).
69
+
70
+ ### Changed
71
+
72
+ - Facade names are accepted on Valibot input schemas and coalesced to AVES camelCase before wire encoding. Success payloads also expose concise compatibility aliases.
73
+ - Internal transport split: `HttpClient`, `buildOpEnvelope`, `readAvesResponse`, `createRqHeader`; `toAvesError` lives in `error.ts`. Public `invokeOp` API unchanged.
74
+ - Hot-path micro-opts: cached endpoint URLs, shared XML POST headers, frozen cached `RqHeader`, single `AVES_OPS` lookup per `invokeOp`.
75
+ - Cap HTTP error body reads via `readTextCapped` (drain stream, keep ≤ `MAX_ERROR_BODY`).
76
+ - WeakMap cache for `itemShape` / `encodeShapeFor` on static WireShape refs.
77
+ - `toWireBody` single shape-driven walk (list wrap + pax normalize + wire keys).
78
+ - Zero-copy `withPublicAliases` via hardened lazy Proxy (WeakMap identity, proto-pollution blocked).
79
+ - 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).
80
+ - Performance harness: `yarn test:bench` (Vitest bench) and `AVES_PERF=1 yarn test:perf` (relative hot-path asserts).
81
+
82
+ ## [3.0.0] - 2026-08-06
83
+
84
+ ### Changed
85
+
86
+ - **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.
87
+
88
+ ### Migration (2.x → 3.x)
89
+
90
+ Only `master.search` success shape changed. Other domain methods and error/`Result` contracts are unchanged from 2.x.
91
+
92
+ | Change | Symptom on upgrade | Fix |
93
+ | ------ | ------------------ | --- |
94
+ | `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(...)`) |
95
+ | 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`) |
96
+ | Empty search | May have expected a missing list or wrapper | Success with no hits is `result.data === []` |
97
+
98
+ **Before (2.x):**
99
+
100
+ ```ts
101
+ const result = await client.master.search({
102
+ searchType: "CODE",
103
+ recordCode: "508558",
104
+ });
105
+ if (result.success) {
106
+ const records = result.data.masterRecordList ?? [];
107
+ console.log(result.data.rsStatus.status, records[0]?.recordCode);
108
+ }
109
+ ```
110
+
111
+ **After (3.x):**
112
+
113
+ ```ts
114
+ const result = await client.master.search({
115
+ searchType: "CODE",
116
+ recordCode: "508558",
117
+ });
118
+ if (result.success) {
119
+ const [record] = result.data; // MasterRecordDetailResponse[]
120
+ console.log(record?.recordCode);
121
+ } else {
122
+ console.error(result.error.kind, result.error.status, result.error.message);
123
+ }
124
+ ```
125
+
126
+ 3.1.x on top of 3.0 is additive (facade aliases / internal transport). No further breaking migration from 3.0 → 3.1.1.
127
+
128
+ ## [2.0.1] - 2026-08-05
129
+
130
+ ### Changed
131
+
132
+ - Omit source maps from the published package; `files` now ships only
133
+ `dist/index.mjs` and `dist/index.d.mts`.
134
+
135
+ ## [2.0.0] - 2026-08-05
136
+
137
+ ### Changed
138
+
139
+ - **Breaking:** flat operation aliases were removed; use namespaced domain clients only.
140
+ - **Breaking:** enum-typed fields now reject arbitrary strings at compile time.
141
+ - **Breaking:** `AvesError.status` retains AVES casing and `AvesError.code` is `number | undefined`.
142
+ - **Breaking:** master-record responses reflect the actual API payload, including server-only fields; `dynamicFields` is an array.
143
+ - Fixed AVES language codes (`01` Italian, `02` English), raw warning text preservation, and the `PaymentDetail` `@PaumentNote` wire spelling.
144
+
145
+ ### Migration
146
+
147
+ | Change | Symptom on upgrade | Fix |
148
+ | ------ | ------------------ | --- |
149
+ | Flat aliases removed | Runtime `TypeError` | Insert the domain namespace: `client.search` → `client.master.search` |
150
+ | Enum types narrowed | Compile errors for enum fields receiving `string` | Use exported enum objects or unions |
151
+ | `AvesError.status` casing | `err.status === "error"` no longer matches | Compare with `RsStatusValue` (`"OK"`, `"ERROR"`, `"WARNING"`, `"TIMEOUT"`) |
152
+ | `AvesError.code` | Absent codes are `undefined`, not `0` | Check for `undefined` |
153
+ | `MasterRecordDetailResponse` corrected | Type gains server-only fields | Remove local re-declarations |
154
+ | `dynamicFields` is an array | Single-object assignment fails | Wrap the field in an array |
155
+
156
+ ---
157
+
158
+ ## [1.9.0] - 2026-08-03
159
+
160
+ ### Changed
161
+
162
+ - **Breaking:** `upsertRecord` spreads `masterRecordDetail` into `data` — `result.data.recordCode`
163
+ - **Breaking:** booking create/mod/status spreads `bookingFileDetail` into `data` — `result.data.bookingFileCode`
164
+ - **Breaking:** `getPackageDetail` spreads `packageDetail` into `data` — `result.data.pCode`
165
+ - **Breaking:** response `*List` fields are flat Detail arrays (no inner `*Detail` wrapper) — e.g. `data.packageList?.[0]`, `data.masterRecordList`, `data.bookingFileList`, `data.bookedServiceList`
166
+ - **Breaking:** nested booking/catalog lists unwrapped the same way (`passengerList`, `serviceList`, `paxPriceList`, …)
167
+ - Input aliases: `customerRecordCode` ↔ `customerDetail`; `bookingFileStatus` / `fileStatus` as string or `{ value }`; `paxAssociated: string[]`; mod `selectedPackageList` ↔ `selectedPackageDetail`
168
+
169
+ ### Added
170
+
171
+ - Response helpers: `listDetailApiSchema`, `flattenResponseDetail`, `createFlattenedResponseSchema`, `createListResponseSchema`
172
+ - Request helpers: `createApiSchema`, `valueFieldSchema`, `coalesceCustomerRecordCode`, `coalesceListHead`, `coalesceWireAliases`
173
+ - Shared primitives: `LanguageCodeSchema`, `StringishSchema`, `DateRangeSchema`, `StatusOnlyResponseSchema`, `createWireSchemaPair`
174
+ - `yarn typecheck` script (`tsc --noEmit`)
175
+
176
+ ---
177
+
178
+ ## [1.8.0] - 2026-08-03
179
+
180
+ ### Added
181
+
182
+ - Exportable shared object enums (`PaxQtyCriteria`, `AvesSearchType`, `PaymentType`, `InsertCriteria`, booking/master statuses, etc.) and matching `*Schema` picklists
183
+
184
+ ### Changed
185
+
186
+ - **Breaking:** `searchPackages` / `searchTopServices` payload is flat (no `baseSearch` nest)
187
+ - Defaults: `avesSearchType` (`PACKAGE` / `SERVICE` by method), `paxQty` ← `passengerList.length`, `paxQtyCriteria` ← `GREATER_OR_EQUAL`
188
+ - `languageCode` optional when set on `AvesClient` options
189
+ - Schemas use shared object enums instead of inline string unions
190
+
191
+ ---
192
+
193
+ ## [1.7.0] - 2026-08-03
194
+
195
+ ### Added
196
+
197
+ - Package / Program catalog APIs: `searchPackages`, `searchTopServices`, `getPackageDetail`, `commitPackage`
198
+ - `searchBookingFiles` (`FILE_CODE` | `PAX_NAME` | `PACKAGE_CODE` | `OTHER`)
199
+ - Domain clients with DI: `AvesTransport`, `MasterRecordsClient`, `BookingClient`, `PackageCatalogClient`, `AvesClientDeps`
200
+ - Per-request `WireShape` model (`src/utils/wire-shapes.ts`)
201
+ - Flat method aliases auto-bound from domain prototypes (`client/flat-aliases.ts`)
202
+
203
+ ### Changed
204
+
205
+ - `AvesClient` is a thin facade; prefer `client.booking.*` / `client.packages.*` / `client.master.*`
206
+ - Single outbound wire path: `createApiSchema` / `toWireBody` / `invokeOp` (optional `bodyKey`)
207
+ - XML helpers moved to `src/xml/`
208
+ - Master search/upsert routed through `invokeOp`
209
+
210
+ ### Fixed
211
+
212
+ - InsertFilePaymentList root `paymentUser` emitted as `@PaymentUser` (not a child element)
213
+
214
+ ### Removed
215
+
216
+ - Global `ATTRIBUTE_FIELDS` registry
217
+ - Versioned docs under `docs/` from git (`docs/` gitignored)
218
+
219
+ ---
220
+
221
+ ## [1.6.0] - 2026-07-29
222
+
223
+ ### Changed
224
+
225
+ - **Breaking:** booking `*List` SDK inputs are flat `Detail[]`; SDK wraps to AVES List/Detail XML
226
+ - Shared `PaymentTypeSchema` across booking ops
227
+ - README refreshed for constructor, `Result` / `AvesError`, and flat list examples
228
+ - Documented additional package managers in README
229
+
230
+ ---
231
+
232
+ ## [1.5.1] - 2026-07-29
233
+
234
+ ### Changed
235
+
236
+ - Added `fast-xml-builder` dependency
237
+ - Dependency / `tsdown` config maintenance
238
+
239
+ ---
240
+
241
+ ## [1.5.0] - 2026-07-29
242
+
243
+ ### Added
244
+
245
+ - `insertFilePaymentList` (InsertFilePaymentList) for payment registration
246
+ - Tighter `invokeOp` schema inference
247
+ - Booking ops documentation updates
248
+
249
+ ---
250
+
251
+ ## [1.4.0] - 2026-07-29
252
+
253
+ ### Added
254
+
255
+ - Booking ops: ModBookingFileServices, ModBookingFileHeader, CancelBookingFile, SetStatus / SetStatusService
256
+ - Shared transforms and typed BOOKEDFILE responses
257
+ - Unit coverage for booking ops
258
+
259
+ ### Changed
260
+
261
+ - Dependency updates
262
+
263
+ ---
264
+
265
+ ## [1.3.4] - 2026-03-09
266
+
267
+ ### Added
268
+
269
+ - Create-booking related input schemas: financial deadlines, payments, selected packages/services, notes, passengers
270
+
271
+ ### Fixed
272
+
273
+ - Union formatting in `SelectedServiceListInputSchema`
274
+
275
+ ### Changed
276
+
277
+ - Error handling via `isOk`
278
+ - Schema / quote standardization across client and types
279
+
280
+ ---
281
+
282
+ ## [1.3.3] - 2026-02-26
283
+
284
+ ### Fixed
285
+
286
+ - `package.json` packaging fix
287
+
288
+ ---
289
+
290
+ ## [1.3.2] - 2026-02-10
291
+
292
+ ### Added
293
+
294
+ - `createBooking` (CreateBookingFile) with tests
295
+ - Migrated bundler from `tsup` to `tsdown`
296
+
297
+ ### Changed
298
+
299
+ - Package configuration updates
300
+
301
+ ---
302
+
303
+ ## [1.3.1] - 2026-02-01
304
+
305
+ ### Changed
306
+
307
+ - Error-handling path formatting simplified
308
+ - String-quote standardization
309
+
310
+ ---
311
+
312
+ ## [1.3.0] - 2026-02-01
313
+
314
+ ### Added
315
+
316
+ - Biome linting
317
+ - Undici-based mock improvements in tests
318
+ - Additional master-record properties and attribute-schema refactor
319
+ - Broader test coverage
320
+
321
+ ### Changed
322
+
323
+ - Consolidated XML root element definitions and utilities
324
+
325
+ ---
326
+
327
+ ## [1.2.16] - 2026-01-27
328
+
329
+ ### Changed
330
+
331
+ - Removed unnecessary `as any` casts
332
+
333
+ ---
334
+
335
+ ## [1.2.15] - 2026-01-27
336
+
337
+ ### Fixed
338
+
339
+ - XML / validation follow-up fixes
340
+
341
+ ---
342
+
343
+ ## [1.2.14] - 2026-01-27
344
+
345
+ ### Changed
346
+
347
+ - XML ↔ JSON conversion and validation schema improvements
348
+
349
+ ---
350
+
351
+ ## [1.2.13] - 2026-01-27
352
+
353
+ ### Added
354
+
355
+ - Request timeout handling with clear timeout vs other errors
356
+ - `isAbortError` utility
357
+
358
+ ### Changed
359
+
360
+ - `AvesClientOptions` moved to `types.ts`
361
+ - Request method uses Valibot `BaseSchema` more consistently
362
+ - Upsert response schema and error detail improvements
363
+ - `recordCode` length validation tests
364
+
365
+ ---
366
+
367
+ ## [1.2.12] - 2026-01-26
368
+
369
+ ### Added
370
+
371
+ - Export `AvesClientOptions` for external usage
372
+ - Mapped profiling record support
373
+
374
+ ### Changed
375
+
376
+ - Restructured `AvesError` handling and client initialization
377
+ - Optional `insertCriteria` on upsert flow
378
+
379
+ ### Fixed
380
+
381
+ - Misc client fixes
382
+
383
+ ---
384
+
385
+ ## [1.2.11] - 2026-01-21
386
+
387
+ ### Fixed
388
+
389
+ - Error code handling uses numeric values instead of strings
390
+
391
+ ---
392
+
393
+ ## [1.0.3] - 2025-10-04
394
+
395
+ Early tagged releases (`v1.0.0` … `v1.0.3`) from the initial NestJS-oriented AVES SDK work. Detailed commit notes for those tags are limited in the current branch history.
396
+
397
+ ### Added
398
+
399
+ - Initial AVES SDK implementation with XML/REST interfaces (2025-10-03)
400
+
401
+ ---
402
+
403
+ ## Links
404
+
405
+ - [npm](https://www.npmjs.com/package/aves-sdk)
406
+ - [GitHub](https://github.com/simoneguglielmi/aves-sdk)
407
+ - Tags: [v1.0.0](https://github.com/simoneguglielmi/aves-sdk/releases/tag/v1.0.0) … [v1.0.3](https://github.com/simoneguglielmi/aves-sdk/releases/tag/v1.0.3)
408
+
409
+ > Git tags after `v1.0.3` were not present when this file was generated; version sections follow `package.json` bumps and commit messages.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aves-sdk",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "TypeScript SDK for AVES XML REST",
5
5
  "homepage": "https://github.com/simoneguglielmi/aves-sdk#readme",
6
6
  "repository": [
@@ -39,6 +39,7 @@
39
39
  "files": [
40
40
  "dist/index.mjs",
41
41
  "dist/index.d.mts",
42
+ "dist/CHANGELOG.md",
42
43
  "README.md",
43
44
  "CHANGELOG.md"
44
45
  ],