aves-sdk 4.0.1 → 5.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/dist/CHANGELOG.md CHANGED
@@ -5,12 +5,118 @@ 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
+ <a id="v5.0.0"></a>
9
+ ## [5.0.0] - 2026-08-24
10
+
11
+ Effect-native core: **Effect Schema** + **`@effect/platform` HttpClient**, Promise `Result` facade at the edge, optional Layers / `ManagedRuntime` for Effect apps.
12
+
13
+ ### Added
14
+
15
+ - `makeAvesRuntime(options, deps?)` — `ManagedRuntime` over `avesClientLayer` for `yield* AvesBooking` / `AvesMaster` / `AvesPackages` / `AvesTransport`
16
+ - `avesClientLayer` / `AvesClientLive` — composable Effect Layers (`config → http → transport → domains`)
17
+ - Domain Tags: `AvesBooking`, `AvesMaster`, `AvesPackages`, `AvesTransport`, `AvesHttp`, `AvesConfig`
18
+ - `createAvesClient` — plain-object Promise facade (same shape as `AvesClient`)
19
+ - Public `Result` / `ok` / `err`; `isAvesError`; tagged errors `AvesValidationError` / `AvesApiError` / `AvesUnknownError` (+ factories)
20
+ - Test DI: `deps.httpClient` (`HttpClient.make`) and/or `deps.http` / domain service overrides
21
+
22
+ ### Changed
23
+
24
+ - **Breaking:** Validation stack is **Effect Schema** (`effect`). Valibot is removed.
25
+ - **Breaking:** HTTP is **`@effect/platform`** (`FetchHttpClient` by default). Undici is no longer a dependency; do not use `MockAgent` / `setGlobalDispatcher` for SDK tests — inject `HttpClient.make` via `deps.httpClient`.
26
+ - **Breaking:** Domains are Effect-native (`Effect.Effect<…, AvesError>`). The Promise API is a thin `toPromiseFacade` edge on `createAvesClient` / `AvesClient`.
27
+ - **Breaking:** `client.transport` is **removed** from the Promise facade. Effect programs use `yield* AvesTransport` (or domain Tags) with `makeAvesRuntime` / `avesClientLayer`.
28
+ - **Breaking:** `AvesError` is a **tagged union**, not a single constructible class. Prefer `isAvesError(e)`, `e instanceof AvesApiError`, or `Effect.catchTag("AvesApiError", …)`. Promise `error.kind` (`validation` | `api` | `unknown`) is unchanged.
29
+ - **Breaking:** DI no longer uses `new AvesTransport(options)` / `new BookingClient(transport)`. Use `AvesClientDeps`: `{ httpClient?, http?, transport?, master?, booking?, packages? }`.
30
+ - Internal layout: `src/client/{booking,master,packages,http,transport,config}/` (types / tag / service / layer).
31
+ - Published types shrank from 1.21 MB to 404 kB (npm tarball 115 kB → 72 kB): op params/results and the domain service types are now written against named types instead of inferred, so the declaration bundle references `BookingInput` & co. instead of inlining every schema structure. The public API is unchanged — `src/client/{ops,services}.test-d.ts` pin each op and domain method against the schema the transport actually uses.
32
+
33
+ ### Migration (4.x → 5.x)
34
+
35
+ 1. **Install** — `aves-sdk@5` pulls `effect` and `@effect/platform`. No Valibot/undici required.
36
+ 2. **Promise apps** — keep `new AvesClient(options)` / `createAvesClient(options)`. Import `Result` from `aves-sdk` if you typed it locally. Stop reading `client.transport`.
37
+ 3. **Errors** — replace `instanceof AvesError` with `isAvesError(error)` (or the concrete tagged class). `error.kind` / `message` / `status` / `code` still work on the Promise path.
38
+ 4. **Tests / DI** — replace undici `MockAgent` with platform mocks:
39
+
40
+ ```ts
41
+ import { HttpClient, HttpClientResponse } from "@effect/platform";
42
+ import { Effect } from "effect";
43
+ import { AvesClient } from "aves-sdk";
44
+
45
+ const httpClient = HttpClient.make((request, url) =>
46
+ Effect.succeed(
47
+ HttpClientResponse.fromWeb(
48
+ request,
49
+ new Response(`<SearchMasterRecordRS><RsStatus Status="OK"/></SearchMasterRecordRS>`, {
50
+ status: 200,
51
+ }),
52
+ ),
53
+ ),
54
+ );
55
+
56
+ const client = new AvesClient(options, { httpClient });
57
+ ```
58
+
59
+ 5. **Effect apps** — use Layers instead of the Promise facade:
60
+
61
+ ```ts
62
+ import { Effect } from "effect";
63
+ import { AvesMaster, makeAvesRuntime } from "aves-sdk";
64
+
65
+ const runtime = makeAvesRuntime(options);
66
+ const records = await runtime.runPromise(
67
+ Effect.gen(function* () {
68
+ const master = yield* AvesMaster;
69
+ return yield* master.search({ searchType: "CODE", recordCode: "508558" });
70
+ }),
71
+ );
72
+ await runtime.dispose();
73
+ ```
74
+
75
+ Or `Effect.provide(avesClientLayer(options, deps))` without a ManagedRuntime. Recover with `Effect.catchTag("AvesApiError", …)` / `"AvesValidationError"` / `"AvesUnknownError"`.
76
+
77
+ XML wire shapes, facade aliases, and domain method names from 4.x are unchanged.
78
+
79
+ <a id="v4.1.0"></a>
80
+ ## [4.1.0] - 2026-08-07
81
+
82
+ ### Added
83
+
84
+ - `client.booking.exportData(params)` — **ExportBookingData** (`BookingDataExportRQ` / `BookingDataExportRS`). The only AVES operation that reads a booking file back whole: header, passengers, booked services with per-line `amountsDetail`, file-level `bookedFileAmounts`, and **registered payments**. `addPayments` finally has a read counterpart.
85
+ - `ExtraInfo` lookup tables on the response: `currencyList`, `vatList`, `nationList`, `travelAgentList`, `programList`, `statisticList`, `priceOffertList`, `userList`, `passengerCategoryList`, `masterDataSet`, `masterDataSetExtraInfo`. `nationList[].territoriality` (`IN_UE` / `OUT_UE` / `MIXED_UE`) is the VAT-regime input.
86
+ - Object enums (+ schemas) for every closed picklist the export returns: `ExportType`, `Territoriality`, `StatisticType`, `ToSubServiceType`, `SellingType`, `Printable`, `PrintType`, `DeadlineStatus`, `CommissionIncomeType`, `CommissionOwedType`.
87
+ - `RecordTypeWire` — `RecordType` plus `NOT_SET`, for read responses. Mirrors the existing `BookingFileStatus` / `BookingFileStatusWire` split.
88
+ - Remaining documented export structures are now typed: `customerProcessedPrintList`, `instalmentPlanList`, `supplierInstalmentPlanList`, file- and service-level `deadlineList`, `commissionIncomeDetails`, `commissionOwedDetails`.
89
+ - Types `ExportBookingDataRQ` / `ExportBookingDataRS`, `ExportedBookingFile`, `ExportExtraInfo`, and facade aliases `BookingExportInput` / `BookingExportResult`.
90
+ - Facade output aliases: `bookingFileList` → `bookings`, `bookedServices` → `services`, `amountsDetail` → `amounts`, `bookedFileAmounts` → `totals`.
91
+
92
+ ### Fixed
93
+
94
+ - `master.search` / `master.upsert` responses no longer reject a record whose `RecordType` is `NOT_SET`. The response validation schema was reusing the request picklist, which omits it. Server-only fields AVES returns on read (`AreaCode`, `LastDateContact`, `UseSupplierDataOnTravelDoc`, `BookingEnabled`, `PrivacyPolicyAccepted`, and the misspelled `ModifitedDate`) are no longer dropped.
95
+
96
+ Note for TypeScript consumers: `MasterRecordDetailResponse["recordType"]` widens from `RecordType` to `RecordTypeWire`, so an exhaustive `switch` over it now needs a `NOT_SET` branch. Input types are unchanged.
97
+ - Facade arrays now expose public aliases when **iterated**, not only when indexed. `withPublicAliases` bound array methods to the raw target, so `for…of`, destructuring, spread, `Array.from`, `map`, `filter`, `find`, `forEach` and `at` all handed back rows without their alias keys — `const [p] = result.data.payments` yielded a row with `paymentDate` but no aliases, while `result.data.payments[0]` worked. Methods now run with `this` bound to the proxy. This also makes `indexOf` / `includes` consistent: `arr.indexOf(arr[0])` returned `-1` before, since it compared wrapped items against raw ones.
98
+
99
+ ### Changed
100
+
101
+ - `BoolishSchema` moved from `schemas/booking-shared.ts` to `schemas/common.ts`, next to `StringishSchema` — it is a cross-domain wire primitive, and `master-record` / `package-catalog` were already importing it out of the booking module. Internal only; it is not part of the published entry point.
102
+
103
+ ### Notes
104
+
105
+ - Request roots are `BookingDataExport*`, not `ExportBookingData*`: the spec's section tables name the endpoint, while its index and both worked XML examples name the elements.
106
+ - `limitRange` enforces the documented bounds (`skip` ≥ 0, `take` ≤ 1000) before the request leaves the SDK.
107
+ - Wire misspellings are normalized on the way in: `PaumentNote` → `paymentNote`, `FirstConfemationDate` → `firstConfirmationDate`, `UsersList` → `userList`, `TOSubServiceType` → `toSubServiceType`.
108
+ - `extraInfo.masterDataSet` rows validate as full master records, reusing the schema behind `master.search`.
109
+ - `regimeType` and `customerPayAt` are the only response fields left as plain strings: Booking.txt:11312 documents no value list for the first, and the second appears nowhere in the response table — only in the example, as `OUR_AGENCY`. There is nothing to validate against; an enum built from one sample would reject every other value.
110
+ - `Printable` values are rejoined from a spec table that hard-wraps identifiers mid-token. If a live response is ever rejected on that field, check the reconstruction against Booking.txt:11261-11289 first.
111
+
112
+ <a id="v4.0.1"></a>
8
113
  ## [4.0.1] - 2026-08-06
9
114
 
10
115
  ### Added
11
116
 
12
117
  - Copy `CHANGELOG.md` into `dist/` on build (`tsdown` `copy`) and include `dist/CHANGELOG.md` in published `files`.
13
118
 
119
+ <a id="v4.0.0"></a>
14
120
  ## [4.0.0] - 2026-08-06
15
121
 
16
122
  ### Added
@@ -56,6 +162,7 @@ await client.packages.search(params);
56
162
  await client.master.upsert(record);
57
163
  ```
58
164
 
165
+ <a id="v3.1.1"></a>
59
166
  ## [3.1.1] - 2026-08-06
60
167
 
61
168
  ### Added
@@ -76,9 +183,10 @@ await client.master.upsert(record);
76
183
  - WeakMap cache for `itemShape` / `encodeShapeFor` on static WireShape refs.
77
184
  - `toWireBody` single shape-driven walk (list wrap + pax normalize + wire keys).
78
185
  - 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).
186
+ - `createResponseSchema` camelizes Valibot output **in place** (`pascalToCamelKeysInPlace`) — no second deep-copy.
80
187
  - Performance harness: `yarn test:bench` (Vitest bench) and `AVES_PERF=1 yarn test:perf` (relative hot-path asserts).
81
188
 
189
+ <a id="v3.0.0"></a>
82
190
  ## [3.0.0] - 2026-08-06
83
191
 
84
192
  ### Changed
@@ -125,6 +233,7 @@ if (result.success) {
125
233
 
126
234
  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
235
 
236
+ <a id="v2.0.1"></a>
128
237
  ## [2.0.1] - 2026-08-05
129
238
 
130
239
  ### Changed
@@ -132,6 +241,7 @@ if (result.success) {
132
241
  - Omit source maps from the published package; `files` now ships only
133
242
  `dist/index.mjs` and `dist/index.d.mts`.
134
243
 
244
+ <a id="v2.0.0"></a>
135
245
  ## [2.0.0] - 2026-08-05
136
246
 
137
247
  ### Changed
@@ -155,6 +265,7 @@ if (result.success) {
155
265
 
156
266
  ---
157
267
 
268
+ <a id="v1.9.0"></a>
158
269
  ## [1.9.0] - 2026-08-03
159
270
 
160
271
  ### Changed
@@ -175,6 +286,7 @@ if (result.success) {
175
286
 
176
287
  ---
177
288
 
289
+ <a id="v1.8.0"></a>
178
290
  ## [1.8.0] - 2026-08-03
179
291
 
180
292
  ### Added
@@ -190,6 +302,7 @@ if (result.success) {
190
302
 
191
303
  ---
192
304
 
305
+ <a id="v1.7.0"></a>
193
306
  ## [1.7.0] - 2026-08-03
194
307
 
195
308
  ### Added
@@ -218,6 +331,7 @@ if (result.success) {
218
331
 
219
332
  ---
220
333
 
334
+ <a id="v1.6.0"></a>
221
335
  ## [1.6.0] - 2026-07-29
222
336
 
223
337
  ### Changed
@@ -229,6 +343,7 @@ if (result.success) {
229
343
 
230
344
  ---
231
345
 
346
+ <a id="v1.5.1"></a>
232
347
  ## [1.5.1] - 2026-07-29
233
348
 
234
349
  ### Changed
@@ -238,6 +353,7 @@ if (result.success) {
238
353
 
239
354
  ---
240
355
 
356
+ <a id="v1.5.0"></a>
241
357
  ## [1.5.0] - 2026-07-29
242
358
 
243
359
  ### Added
@@ -248,6 +364,7 @@ if (result.success) {
248
364
 
249
365
  ---
250
366
 
367
+ <a id="v1.4.0"></a>
251
368
  ## [1.4.0] - 2026-07-29
252
369
 
253
370
  ### Added
@@ -262,6 +379,7 @@ if (result.success) {
262
379
 
263
380
  ---
264
381
 
382
+ <a id="v1.3.4"></a>
265
383
  ## [1.3.4] - 2026-03-09
266
384
 
267
385
  ### Added
@@ -279,6 +397,7 @@ if (result.success) {
279
397
 
280
398
  ---
281
399
 
400
+ <a id="v1.3.3"></a>
282
401
  ## [1.3.3] - 2026-02-26
283
402
 
284
403
  ### Fixed
@@ -287,6 +406,7 @@ if (result.success) {
287
406
 
288
407
  ---
289
408
 
409
+ <a id="v1.3.2"></a>
290
410
  ## [1.3.2] - 2026-02-10
291
411
 
292
412
  ### Added
@@ -300,6 +420,7 @@ if (result.success) {
300
420
 
301
421
  ---
302
422
 
423
+ <a id="v1.3.1"></a>
303
424
  ## [1.3.1] - 2026-02-01
304
425
 
305
426
  ### Changed
@@ -309,6 +430,7 @@ if (result.success) {
309
430
 
310
431
  ---
311
432
 
433
+ <a id="v1.3.0"></a>
312
434
  ## [1.3.0] - 2026-02-01
313
435
 
314
436
  ### Added
@@ -324,6 +446,7 @@ if (result.success) {
324
446
 
325
447
  ---
326
448
 
449
+ <a id="v1.2.16"></a>
327
450
  ## [1.2.16] - 2026-01-27
328
451
 
329
452
  ### Changed
@@ -332,6 +455,7 @@ if (result.success) {
332
455
 
333
456
  ---
334
457
 
458
+ <a id="v1.2.15"></a>
335
459
  ## [1.2.15] - 2026-01-27
336
460
 
337
461
  ### Fixed
@@ -340,6 +464,7 @@ if (result.success) {
340
464
 
341
465
  ---
342
466
 
467
+ <a id="v1.2.14"></a>
343
468
  ## [1.2.14] - 2026-01-27
344
469
 
345
470
  ### Changed
@@ -348,6 +473,7 @@ if (result.success) {
348
473
 
349
474
  ---
350
475
 
476
+ <a id="v1.2.13"></a>
351
477
  ## [1.2.13] - 2026-01-27
352
478
 
353
479
  ### Added
@@ -364,6 +490,7 @@ if (result.success) {
364
490
 
365
491
  ---
366
492
 
493
+ <a id="v1.2.12"></a>
367
494
  ## [1.2.12] - 2026-01-26
368
495
 
369
496
  ### Added
@@ -382,6 +509,7 @@ if (result.success) {
382
509
 
383
510
  ---
384
511
 
512
+ <a id="v1.2.11"></a>
385
513
  ## [1.2.11] - 2026-01-21
386
514
 
387
515
  ### Fixed
@@ -390,6 +518,7 @@ if (result.success) {
390
518
 
391
519
  ---
392
520
 
521
+ <a id="v1.0.3"></a>
393
522
  ## [1.0.3] - 2025-10-04
394
523
 
395
524
  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.