aves-sdk 4.0.1 → 5.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 +141 -1
- package/README.md +170 -52
- package/dist/CHANGELOG.md +141 -1
- package/dist/index.d.mts +8990 -21231
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
package/dist/CHANGELOG.md
CHANGED
|
@@ -5,12 +5,129 @@ 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.1"></a>
|
|
9
|
+
## [5.0.1] - 2026-10-21
|
|
10
|
+
|
|
11
|
+
Typed master record responses, a safe `timeoutMs`, and no empty error messages. No API change.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **Master record responses are typed again.** Since 5.0.0 `MasterRecordDetailResponse`, `ManageMasterRecordRS` and `SearchMasterRecordRS` items were published as `{ [x: Uncapitalize<string>]: any }`, because `createApiValidationSchema` returned `Schema.Schema.AnyNoContext`. It now declares the wire struct it builds (encoded input fields under their wire keys, server-only overrides replacing their twins), so `result.data.recordCode`, `email`, `modifiedDate`, `financialDetail.currencyCode`, … have their real types, as in 4.x. Pinned in `src/types.test-d.ts` (no index signature, exact field types). Declarations: 404 kB → 467 kB.
|
|
16
|
+
- **`timeoutMs` is checked when the client is built.** Effect's `Duration.millis` reads a string as nanoseconds and `NaN` / a negative value as 0, so `timeoutMs: "30000"` (typical when read from an env var, and accepted by 1.x through `setTimeout`) made every request time out at once. A numeric string is now read as milliseconds; anything that is not a positive number throws `AvesValidationError` from `createAvesClient` / `new AvesClient` / `avesClientLayer` / `makeAvesRuntime`.
|
|
17
|
+
- **`AvesApiError.message` is never empty.** A non-OK `RsStatus` without `ErrorDescription` now reads `AVES responded with status ERROR (code 7)`, and an HTTP error with an empty body `AVES responded with HTTP 503`, instead of `""`.
|
|
18
|
+
|
|
19
|
+
<a id="v5.0.0"></a>
|
|
20
|
+
## [5.0.0] - 2026-08-24
|
|
21
|
+
|
|
22
|
+
Effect-native core: **Effect Schema** + **`@effect/platform` HttpClient**, Promise `Result` facade at the edge, optional Layers / `ManagedRuntime` for Effect apps.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- `makeAvesRuntime(options, deps?)` — `ManagedRuntime` over `avesClientLayer` for `yield* AvesBooking` / `AvesMaster` / `AvesPackages` / `AvesTransport`
|
|
27
|
+
- `avesClientLayer` / `AvesClientLive` — composable Effect Layers (`config → http → transport → domains`)
|
|
28
|
+
- Domain Tags: `AvesBooking`, `AvesMaster`, `AvesPackages`, `AvesTransport`, `AvesHttp`, `AvesConfig`
|
|
29
|
+
- `createAvesClient` — plain-object Promise facade (same shape as `AvesClient`)
|
|
30
|
+
- Public `Result` / `ok` / `err`; `isAvesError`; tagged errors `AvesValidationError` / `AvesApiError` / `AvesUnknownError` (+ factories)
|
|
31
|
+
- Test DI: `deps.httpClient` (`HttpClient.make`) and/or `deps.http` / domain service overrides
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- **Breaking:** Validation stack is **Effect Schema** (`effect`). Valibot is removed.
|
|
36
|
+
- **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`.
|
|
37
|
+
- **Breaking:** Domains are Effect-native (`Effect.Effect<…, AvesError>`). The Promise API is a thin `toPromiseFacade` edge on `createAvesClient` / `AvesClient`.
|
|
38
|
+
- **Breaking:** `client.transport` is **removed** from the Promise facade. Effect programs use `yield* AvesTransport` (or domain Tags) with `makeAvesRuntime` / `avesClientLayer`.
|
|
39
|
+
- **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.
|
|
40
|
+
- **Breaking:** DI no longer uses `new AvesTransport(options)` / `new BookingClient(transport)`. Use `AvesClientDeps`: `{ httpClient?, http?, transport?, master?, booking?, packages? }`.
|
|
41
|
+
- Internal layout: `src/client/{booking,master,packages,http,transport,config}/` (types / tag / service / layer).
|
|
42
|
+
- 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.
|
|
43
|
+
|
|
44
|
+
### Migration (4.x → 5.x)
|
|
45
|
+
|
|
46
|
+
1. **Install** — `aves-sdk@5` pulls `effect` and `@effect/platform`. No Valibot/undici required.
|
|
47
|
+
2. **Promise apps** — keep `new AvesClient(options)` / `createAvesClient(options)`. Import `Result` from `aves-sdk` if you typed it locally. Stop reading `client.transport`.
|
|
48
|
+
3. **Errors** — replace `instanceof AvesError` with `isAvesError(error)` (or the concrete tagged class). `error.kind` / `message` / `status` / `code` still work on the Promise path.
|
|
49
|
+
4. **Tests / DI** — replace undici `MockAgent` with platform mocks:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { HttpClient, HttpClientResponse } from "@effect/platform";
|
|
53
|
+
import { Effect } from "effect";
|
|
54
|
+
import { AvesClient } from "aves-sdk";
|
|
55
|
+
|
|
56
|
+
const httpClient = HttpClient.make((request, url) =>
|
|
57
|
+
Effect.succeed(
|
|
58
|
+
HttpClientResponse.fromWeb(
|
|
59
|
+
request,
|
|
60
|
+
new Response(`<SearchMasterRecordRS><RsStatus Status="OK"/></SearchMasterRecordRS>`, {
|
|
61
|
+
status: 200,
|
|
62
|
+
}),
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const client = new AvesClient(options, { httpClient });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
5. **Effect apps** — use Layers instead of the Promise facade:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { Effect } from "effect";
|
|
74
|
+
import { AvesMaster, makeAvesRuntime } from "aves-sdk";
|
|
75
|
+
|
|
76
|
+
const runtime = makeAvesRuntime(options);
|
|
77
|
+
const records = await runtime.runPromise(
|
|
78
|
+
Effect.gen(function* () {
|
|
79
|
+
const master = yield* AvesMaster;
|
|
80
|
+
return yield* master.search({ searchType: "CODE", recordCode: "508558" });
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
83
|
+
await runtime.dispose();
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or `Effect.provide(avesClientLayer(options, deps))` without a ManagedRuntime. Recover with `Effect.catchTag("AvesApiError", …)` / `"AvesValidationError"` / `"AvesUnknownError"`.
|
|
87
|
+
|
|
88
|
+
XML wire shapes, facade aliases, and domain method names from 4.x are unchanged.
|
|
89
|
+
|
|
90
|
+
<a id="v4.1.0"></a>
|
|
91
|
+
## [4.1.0] - 2026-08-07
|
|
92
|
+
|
|
93
|
+
### Added
|
|
94
|
+
|
|
95
|
+
- `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.
|
|
96
|
+
- `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.
|
|
97
|
+
- Object enums (+ schemas) for every closed picklist the export returns: `ExportType`, `Territoriality`, `StatisticType`, `ToSubServiceType`, `SellingType`, `Printable`, `PrintType`, `DeadlineStatus`, `CommissionIncomeType`, `CommissionOwedType`.
|
|
98
|
+
- `RecordTypeWire` — `RecordType` plus `NOT_SET`, for read responses. Mirrors the existing `BookingFileStatus` / `BookingFileStatusWire` split.
|
|
99
|
+
- Remaining documented export structures are now typed: `customerProcessedPrintList`, `instalmentPlanList`, `supplierInstalmentPlanList`, file- and service-level `deadlineList`, `commissionIncomeDetails`, `commissionOwedDetails`.
|
|
100
|
+
- Types `ExportBookingDataRQ` / `ExportBookingDataRS`, `ExportedBookingFile`, `ExportExtraInfo`, and facade aliases `BookingExportInput` / `BookingExportResult`.
|
|
101
|
+
- Facade output aliases: `bookingFileList` → `bookings`, `bookedServices` → `services`, `amountsDetail` → `amounts`, `bookedFileAmounts` → `totals`.
|
|
102
|
+
|
|
103
|
+
### Fixed
|
|
104
|
+
|
|
105
|
+
- `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.
|
|
106
|
+
|
|
107
|
+
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.
|
|
108
|
+
- 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.
|
|
109
|
+
|
|
110
|
+
### Changed
|
|
111
|
+
|
|
112
|
+
- `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.
|
|
113
|
+
|
|
114
|
+
### Notes
|
|
115
|
+
|
|
116
|
+
- 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.
|
|
117
|
+
- `limitRange` enforces the documented bounds (`skip` ≥ 0, `take` ≤ 1000) before the request leaves the SDK.
|
|
118
|
+
- Wire misspellings are normalized on the way in: `PaumentNote` → `paymentNote`, `FirstConfemationDate` → `firstConfirmationDate`, `UsersList` → `userList`, `TOSubServiceType` → `toSubServiceType`.
|
|
119
|
+
- `extraInfo.masterDataSet` rows validate as full master records, reusing the schema behind `master.search`.
|
|
120
|
+
- `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.
|
|
121
|
+
- `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.
|
|
122
|
+
|
|
123
|
+
<a id="v4.0.1"></a>
|
|
8
124
|
## [4.0.1] - 2026-08-06
|
|
9
125
|
|
|
10
126
|
### Added
|
|
11
127
|
|
|
12
128
|
- Copy `CHANGELOG.md` into `dist/` on build (`tsdown` `copy`) and include `dist/CHANGELOG.md` in published `files`.
|
|
13
129
|
|
|
130
|
+
<a id="v4.0.0"></a>
|
|
14
131
|
## [4.0.0] - 2026-08-06
|
|
15
132
|
|
|
16
133
|
### Added
|
|
@@ -56,6 +173,7 @@ await client.packages.search(params);
|
|
|
56
173
|
await client.master.upsert(record);
|
|
57
174
|
```
|
|
58
175
|
|
|
176
|
+
<a id="v3.1.1"></a>
|
|
59
177
|
## [3.1.1] - 2026-08-06
|
|
60
178
|
|
|
61
179
|
### Added
|
|
@@ -76,9 +194,10 @@ await client.master.upsert(record);
|
|
|
76
194
|
- WeakMap cache for `itemShape` / `encodeShapeFor` on static WireShape refs.
|
|
77
195
|
- `toWireBody` single shape-driven walk (list wrap + pax normalize + wire keys).
|
|
78
196
|
- Zero-copy `withPublicAliases` via hardened lazy Proxy (WeakMap identity, proto-pollution blocked).
|
|
79
|
-
-
|
|
197
|
+
- `createResponseSchema` camelizes Valibot output **in place** (`pascalToCamelKeysInPlace`) — no second deep-copy.
|
|
80
198
|
- Performance harness: `yarn test:bench` (Vitest bench) and `AVES_PERF=1 yarn test:perf` (relative hot-path asserts).
|
|
81
199
|
|
|
200
|
+
<a id="v3.0.0"></a>
|
|
82
201
|
## [3.0.0] - 2026-08-06
|
|
83
202
|
|
|
84
203
|
### Changed
|
|
@@ -125,6 +244,7 @@ if (result.success) {
|
|
|
125
244
|
|
|
126
245
|
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
246
|
|
|
247
|
+
<a id="v2.0.1"></a>
|
|
128
248
|
## [2.0.1] - 2026-08-05
|
|
129
249
|
|
|
130
250
|
### Changed
|
|
@@ -132,6 +252,7 @@ if (result.success) {
|
|
|
132
252
|
- Omit source maps from the published package; `files` now ships only
|
|
133
253
|
`dist/index.mjs` and `dist/index.d.mts`.
|
|
134
254
|
|
|
255
|
+
<a id="v2.0.0"></a>
|
|
135
256
|
## [2.0.0] - 2026-08-05
|
|
136
257
|
|
|
137
258
|
### Changed
|
|
@@ -155,6 +276,7 @@ if (result.success) {
|
|
|
155
276
|
|
|
156
277
|
---
|
|
157
278
|
|
|
279
|
+
<a id="v1.9.0"></a>
|
|
158
280
|
## [1.9.0] - 2026-08-03
|
|
159
281
|
|
|
160
282
|
### Changed
|
|
@@ -175,6 +297,7 @@ if (result.success) {
|
|
|
175
297
|
|
|
176
298
|
---
|
|
177
299
|
|
|
300
|
+
<a id="v1.8.0"></a>
|
|
178
301
|
## [1.8.0] - 2026-08-03
|
|
179
302
|
|
|
180
303
|
### Added
|
|
@@ -190,6 +313,7 @@ if (result.success) {
|
|
|
190
313
|
|
|
191
314
|
---
|
|
192
315
|
|
|
316
|
+
<a id="v1.7.0"></a>
|
|
193
317
|
## [1.7.0] - 2026-08-03
|
|
194
318
|
|
|
195
319
|
### Added
|
|
@@ -218,6 +342,7 @@ if (result.success) {
|
|
|
218
342
|
|
|
219
343
|
---
|
|
220
344
|
|
|
345
|
+
<a id="v1.6.0"></a>
|
|
221
346
|
## [1.6.0] - 2026-07-29
|
|
222
347
|
|
|
223
348
|
### Changed
|
|
@@ -229,6 +354,7 @@ if (result.success) {
|
|
|
229
354
|
|
|
230
355
|
---
|
|
231
356
|
|
|
357
|
+
<a id="v1.5.1"></a>
|
|
232
358
|
## [1.5.1] - 2026-07-29
|
|
233
359
|
|
|
234
360
|
### Changed
|
|
@@ -238,6 +364,7 @@ if (result.success) {
|
|
|
238
364
|
|
|
239
365
|
---
|
|
240
366
|
|
|
367
|
+
<a id="v1.5.0"></a>
|
|
241
368
|
## [1.5.0] - 2026-07-29
|
|
242
369
|
|
|
243
370
|
### Added
|
|
@@ -248,6 +375,7 @@ if (result.success) {
|
|
|
248
375
|
|
|
249
376
|
---
|
|
250
377
|
|
|
378
|
+
<a id="v1.4.0"></a>
|
|
251
379
|
## [1.4.0] - 2026-07-29
|
|
252
380
|
|
|
253
381
|
### Added
|
|
@@ -262,6 +390,7 @@ if (result.success) {
|
|
|
262
390
|
|
|
263
391
|
---
|
|
264
392
|
|
|
393
|
+
<a id="v1.3.4"></a>
|
|
265
394
|
## [1.3.4] - 2026-03-09
|
|
266
395
|
|
|
267
396
|
### Added
|
|
@@ -279,6 +408,7 @@ if (result.success) {
|
|
|
279
408
|
|
|
280
409
|
---
|
|
281
410
|
|
|
411
|
+
<a id="v1.3.3"></a>
|
|
282
412
|
## [1.3.3] - 2026-02-26
|
|
283
413
|
|
|
284
414
|
### Fixed
|
|
@@ -287,6 +417,7 @@ if (result.success) {
|
|
|
287
417
|
|
|
288
418
|
---
|
|
289
419
|
|
|
420
|
+
<a id="v1.3.2"></a>
|
|
290
421
|
## [1.3.2] - 2026-02-10
|
|
291
422
|
|
|
292
423
|
### Added
|
|
@@ -300,6 +431,7 @@ if (result.success) {
|
|
|
300
431
|
|
|
301
432
|
---
|
|
302
433
|
|
|
434
|
+
<a id="v1.3.1"></a>
|
|
303
435
|
## [1.3.1] - 2026-02-01
|
|
304
436
|
|
|
305
437
|
### Changed
|
|
@@ -309,6 +441,7 @@ if (result.success) {
|
|
|
309
441
|
|
|
310
442
|
---
|
|
311
443
|
|
|
444
|
+
<a id="v1.3.0"></a>
|
|
312
445
|
## [1.3.0] - 2026-02-01
|
|
313
446
|
|
|
314
447
|
### Added
|
|
@@ -324,6 +457,7 @@ if (result.success) {
|
|
|
324
457
|
|
|
325
458
|
---
|
|
326
459
|
|
|
460
|
+
<a id="v1.2.16"></a>
|
|
327
461
|
## [1.2.16] - 2026-01-27
|
|
328
462
|
|
|
329
463
|
### Changed
|
|
@@ -332,6 +466,7 @@ if (result.success) {
|
|
|
332
466
|
|
|
333
467
|
---
|
|
334
468
|
|
|
469
|
+
<a id="v1.2.15"></a>
|
|
335
470
|
## [1.2.15] - 2026-01-27
|
|
336
471
|
|
|
337
472
|
### Fixed
|
|
@@ -340,6 +475,7 @@ if (result.success) {
|
|
|
340
475
|
|
|
341
476
|
---
|
|
342
477
|
|
|
478
|
+
<a id="v1.2.14"></a>
|
|
343
479
|
## [1.2.14] - 2026-01-27
|
|
344
480
|
|
|
345
481
|
### Changed
|
|
@@ -348,6 +484,7 @@ if (result.success) {
|
|
|
348
484
|
|
|
349
485
|
---
|
|
350
486
|
|
|
487
|
+
<a id="v1.2.13"></a>
|
|
351
488
|
## [1.2.13] - 2026-01-27
|
|
352
489
|
|
|
353
490
|
### Added
|
|
@@ -364,6 +501,7 @@ if (result.success) {
|
|
|
364
501
|
|
|
365
502
|
---
|
|
366
503
|
|
|
504
|
+
<a id="v1.2.12"></a>
|
|
367
505
|
## [1.2.12] - 2026-01-26
|
|
368
506
|
|
|
369
507
|
### Added
|
|
@@ -382,6 +520,7 @@ if (result.success) {
|
|
|
382
520
|
|
|
383
521
|
---
|
|
384
522
|
|
|
523
|
+
<a id="v1.2.11"></a>
|
|
385
524
|
## [1.2.11] - 2026-01-21
|
|
386
525
|
|
|
387
526
|
### Fixed
|
|
@@ -390,6 +529,7 @@ if (result.success) {
|
|
|
390
529
|
|
|
391
530
|
---
|
|
392
531
|
|
|
532
|
+
<a id="v1.0.3"></a>
|
|
393
533
|
## [1.0.3] - 2025-10-04
|
|
394
534
|
|
|
395
535
|
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.
|