@flaks/onerecord 0.5.0 → 0.6.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 +67 -0
- package/MIGRATING.md +86 -0
- package/README.md +7 -0
- package/dist/booking-flow/can-transition.d.ts +3 -0
- package/dist/booking-flow/can-transition.d.ts.map +1 -1
- package/dist/booking-flow/can-transition.js +3 -0
- package/dist/booking-flow/can-transition.js.map +1 -1
- package/dist/booking-flow/state-diagram.d.ts +5 -1
- package/dist/booking-flow/state-diagram.d.ts.map +1 -1
- package/dist/booking-flow/state-diagram.js +5 -1
- package/dist/booking-flow/state-diagram.js.map +1 -1
- package/dist/booking-flow/transitions.d.ts +14 -1
- package/dist/booking-flow/transitions.d.ts.map +1 -1
- package/dist/booking-flow/transitions.js +73 -18
- package/dist/booking-flow/transitions.js.map +1 -1
- package/dist/classes/booking/schema.d.ts +94 -4
- package/dist/classes/booking/schema.d.ts.map +1 -1
- package/dist/classes/booking/schema.js +43 -2
- package/dist/classes/booking/schema.js.map +1 -1
- package/dist/classes/booking-option/schema.d.ts +58 -4
- package/dist/classes/booking-option/schema.d.ts.map +1 -1
- package/dist/classes/booking-option/schema.js +24 -2
- package/dist/classes/booking-option/schema.js.map +1 -1
- package/dist/classes/booking-request/schema.d.ts +17 -4
- package/dist/classes/booking-request/schema.d.ts.map +1 -1
- package/dist/classes/booking-request/schema.js +20 -7
- package/dist/classes/booking-request/schema.js.map +1 -1
- package/dist/classes/party/schema.d.ts +1 -1
- package/dist/classes/price/codec.d.ts +4 -0
- package/dist/classes/price/codec.d.ts.map +1 -0
- package/dist/classes/price/codec.js +11 -0
- package/dist/classes/price/codec.js.map +1 -0
- package/dist/classes/price/deserialize.d.ts +5 -0
- package/dist/classes/price/deserialize.d.ts.map +1 -0
- package/dist/classes/price/deserialize.js +64 -0
- package/dist/classes/price/deserialize.js.map +1 -0
- package/dist/classes/price/index.d.ts +6 -0
- package/dist/classes/price/index.d.ts.map +1 -0
- package/dist/classes/price/index.js +5 -0
- package/dist/classes/price/index.js.map +1 -0
- package/dist/classes/price/schema.d.ts +14 -0
- package/dist/classes/price/schema.d.ts.map +1 -0
- package/dist/classes/price/schema.js +12 -0
- package/dist/classes/price/schema.js.map +1 -0
- package/dist/classes/price/serialize.d.ts +6 -0
- package/dist/classes/price/serialize.d.ts.map +1 -0
- package/dist/classes/price/serialize.js +28 -0
- package/dist/classes/price/serialize.js.map +1 -0
- package/dist/classes/ratings/codec.d.ts +4 -0
- package/dist/classes/ratings/codec.d.ts.map +1 -0
- package/dist/classes/ratings/codec.js +11 -0
- package/dist/classes/ratings/codec.js.map +1 -0
- package/dist/classes/ratings/deserialize.d.ts +5 -0
- package/dist/classes/ratings/deserialize.d.ts.map +1 -0
- package/dist/classes/ratings/deserialize.js +64 -0
- package/dist/classes/ratings/deserialize.js.map +1 -0
- package/dist/classes/ratings/index.d.ts +6 -0
- package/dist/classes/ratings/index.d.ts.map +1 -0
- package/dist/classes/ratings/index.js +5 -0
- package/dist/classes/ratings/index.js.map +1 -0
- package/dist/classes/ratings/schema.d.ts +60 -0
- package/dist/classes/ratings/schema.d.ts.map +1 -0
- package/dist/classes/ratings/schema.js +23 -0
- package/dist/classes/ratings/schema.js.map +1 -0
- package/dist/classes/ratings/serialize.d.ts +6 -0
- package/dist/classes/ratings/serialize.d.ts.map +1 -0
- package/dist/classes/ratings/serialize.js +28 -0
- package/dist/classes/ratings/serialize.js.map +1 -0
- package/dist/classes/shared/distribution.d.ts +109 -0
- package/dist/classes/shared/distribution.d.ts.map +1 -0
- package/dist/classes/shared/distribution.js +97 -0
- package/dist/classes/shared/distribution.js.map +1 -0
- package/dist/classes/transport-legs/codec.d.ts +4 -0
- package/dist/classes/transport-legs/codec.d.ts.map +1 -0
- package/dist/classes/transport-legs/codec.js +11 -0
- package/dist/classes/transport-legs/codec.js.map +1 -0
- package/dist/classes/transport-legs/deserialize.d.ts +5 -0
- package/dist/classes/transport-legs/deserialize.d.ts.map +1 -0
- package/dist/classes/transport-legs/deserialize.js +64 -0
- package/dist/classes/transport-legs/deserialize.js.map +1 -0
- package/dist/classes/transport-legs/index.d.ts +6 -0
- package/dist/classes/transport-legs/index.d.ts.map +1 -0
- package/dist/classes/transport-legs/index.js +5 -0
- package/dist/classes/transport-legs/index.js.map +1 -0
- package/dist/classes/transport-legs/schema.d.ts +25 -0
- package/dist/classes/transport-legs/schema.d.ts.map +1 -0
- package/dist/classes/transport-legs/schema.js +19 -0
- package/dist/classes/transport-legs/schema.js.map +1 -0
- package/dist/classes/transport-legs/serialize.d.ts +6 -0
- package/dist/classes/transport-legs/serialize.d.ts.map +1 -0
- package/dist/classes/transport-legs/serialize.js +28 -0
- package/dist/classes/transport-legs/serialize.js.map +1 -0
- package/dist/classes/transport-movement/schema.d.ts +1 -1
- package/dist/codecs.d.ts +3 -0
- package/dist/codecs.d.ts.map +1 -1
- package/dist/codecs.js +3 -0
- package/dist/codecs.js.map +1 -1
- package/dist/codes/enums.d.ts +59 -8
- package/dist/codes/enums.d.ts.map +1 -1
- package/dist/codes/enums.js +45 -10
- package/dist/codes/enums.js.map +1 -1
- package/dist/codes/index.d.ts +1 -1
- package/dist/codes/index.d.ts.map +1 -1
- package/dist/codes/index.js +1 -1
- package/dist/codes/index.js.map +1 -1
- package/dist/dispatch/field-types.d.ts.map +1 -1
- package/dist/dispatch/field-types.js +30 -1
- package/dist/dispatch/field-types.js.map +1 -1
- package/dist/dispatch/iri-canonical.d.ts +5 -1
- package/dist/dispatch/iri-canonical.d.ts.map +1 -1
- package/dist/dispatch/iri-canonical.js +6 -2
- package/dist/dispatch/iri-canonical.js.map +1 -1
- package/dist/facade.d.ts +7 -4
- package/dist/facade.d.ts.map +1 -1
- package/dist/factory-classes.d.ts +6 -0
- package/dist/factory-classes.d.ts.map +1 -1
- package/dist/factory-classes.js +6 -0
- package/dist/factory-classes.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,73 @@ All notable changes are documented here. Format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/), versioning follows
|
|
5
5
|
[SemVer](https://semver.org/) per the policy in `MIGRATING.md`.
|
|
6
6
|
|
|
7
|
+
## [0.6.0] - 2026-11-13
|
|
8
|
+
|
|
9
|
+
ONE Record 3.2.0 Quote & Book charge chain: `Price`, `Ratings` and
|
|
10
|
+
`TransportLegs`, and a full ontology realignment of `BookingOption`,
|
|
11
|
+
`BookingRequest` and `Booking`. Every payload 0.5.0 accepted still parses;
|
|
12
|
+
the 0.5.0 booking keys are kept and deprecated. The ontology pin stays 3.2.0.
|
|
13
|
+
Upgrade receivers first (see `MIGRATING.md`).
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- `Price`, `Ratings` and `TransportLegs` classes with codecs, schemas and
|
|
18
|
+
`serialize*` / `serialize*Strict` / `deserialize*` helpers; registered in
|
|
19
|
+
`CLASSES`, `CODECS`, the facade and `createMapper`.
|
|
20
|
+
- Code lists `ChargeIdentifier`, `PrepaidCollectIndicator`, `EntitlementCode`,
|
|
21
|
+
`SpaceAllocationCode` and `TransportMeansServiceType`.
|
|
22
|
+
- Nine embedded shapes, exported as types only: `Ranges`, `UnitsPreference`,
|
|
23
|
+
`CarrierProduct`, `StationRemarks`, `EmbeddedBookingTimes`, `PieceGroup`,
|
|
24
|
+
`EmbeddedBookingSegment`, `ActivitySequence`, `ContactDetail`.
|
|
25
|
+
- The complete 3.2.0 property sets on `BookingOption`, `BookingRequest` and
|
|
26
|
+
`Booking` (including the inherited `:LogisticsService` properties).
|
|
27
|
+
- 21 `FIELD_TYPES` entries for the new links.
|
|
28
|
+
- Vendored IATA ONE Record 3.2 / 3.3.0 ontology files (MIT), a typed
|
|
29
|
+
restriction extractor and a conformance guard that checks the chain
|
|
30
|
+
schemas against them. 3.3.0 was endorsed on 2026-07-25 and is the current
|
|
31
|
+
endorsed release; the package intentionally stays on the 3.2.0 pin, and
|
|
32
|
+
every in-scope Quote & Book class is identical in 3.3.0 (the guard proves
|
|
33
|
+
this).
|
|
34
|
+
- A `./codecs` runtime-surface snapshot, superset and mixed-fleet property
|
|
35
|
+
tests against a frozen 0.5.0 oracle, and a Quote & Book chain fixture.
|
|
36
|
+
- Deviations #18 to #22 in `docs/spec-deviations.md`, a Quote & Book wire
|
|
37
|
+
section in `docs/ONE_RECORD_2_2_PROFILE.md`, and conformance-matrix rows.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- `codes.BookingStatus` is now `CONFIRMED | DELETED | QUEUED | REJECTED` and
|
|
42
|
+
`codes.BookingOptionStatus` is now `BOOKABLE | BOOKED | EXPIRED |
|
|
43
|
+
NONBOOKABLE | NOT_BOOKABLE | ON_REQUEST | QUEUED` (the ontology values).
|
|
44
|
+
The old `REQUEST_*` values are no longer in these enums.
|
|
45
|
+
- `Booking.bookingStatus` is widened and optional: it accepts the four ontology values plus
|
|
46
|
+
`REQUEST_ACCEPTED` and `REQUEST_REVOKED` for 0.5.0 compatibility.
|
|
47
|
+
- `BookingOption.optionStatus`, `BookingRequest.requestStatus` and
|
|
48
|
+
`BookingRequest.requestor` were required and are now optional;
|
|
49
|
+
`BookingOption.forBookingRequest` is no longer required.
|
|
50
|
+
- `Booking.bookingStatus` and `Booking.forBookingRequest` were required in
|
|
51
|
+
0.5.0 and are now optional.
|
|
52
|
+
- The booking-flow helpers refuse ontology-shaped inputs explicitly
|
|
53
|
+
(`ontology_status_present`, `legacy_status_absent`); 0.5.0-valid inputs
|
|
54
|
+
behave as before.
|
|
55
|
+
- `__VERSION__` now reports `0.6.0`.
|
|
56
|
+
|
|
57
|
+
### Deprecated
|
|
58
|
+
|
|
59
|
+
- Legacy booking-chain keys: `BookingOption.optionStatus`, `expiresAt`,
|
|
60
|
+
`preferences`; `BookingRequest.requestStatus`, `requestor`, `preferences`;
|
|
61
|
+
`Booking.forBookingRequest`, `forBookingOption`. Removal is planned for
|
|
62
|
+
booking Path A, at the latest by 0.8.0 (deviation #18).
|
|
63
|
+
- The booking-flow helpers (the transition functions), `STATE_DIAGRAM` and
|
|
64
|
+
`canTransition` (deviation #21).
|
|
65
|
+
|
|
66
|
+
### Fixed
|
|
67
|
+
|
|
68
|
+
- `FIELD_TYPES['Waybill.referredBookingOption']` pointed at `BookingOption`;
|
|
69
|
+
the ontology target is `Booking`.
|
|
70
|
+
- `looksLikeIri` now rejects strings that contain whitespace, so free text
|
|
71
|
+
such as `"NOTE: prepaid"` no longer triggers `iri_not_canonical` under the
|
|
72
|
+
graph walk (deviation #9).
|
|
73
|
+
|
|
7
74
|
## [0.5.0] - 2026-07-26
|
|
8
75
|
|
|
9
76
|
ONE Record API 2.2.0 interoperability boundary for applications that must
|
package/MIGRATING.md
CHANGED
|
@@ -2,6 +2,92 @@
|
|
|
2
2
|
|
|
3
3
|
This file documents one entry per minor release.
|
|
4
4
|
|
|
5
|
+
## Migrating from v0.5.x to v0.6.0
|
|
6
|
+
|
|
7
|
+
0.6.0 aligns `BookingOption`, `BookingRequest` and `Booking` with the ONE
|
|
8
|
+
Record 3.2.0 Quote & Book chain and adds `Price`, `Ratings` and
|
|
9
|
+
`TransportLegs`. Every payload 0.5.0 accepted still parses (superset
|
|
10
|
+
acceptance), so a mixed fleet keeps working, and a legacy-shaped object
|
|
11
|
+
serialized by 0.6.0 is byte-identical to 0.5.0 output. **Upgrade receivers
|
|
12
|
+
first**: a 0.5.0 receiver rejects the new ontology keys (every schema is
|
|
13
|
+
strict), so a 0.6.0 producer must not send ontology-shaped objects to a
|
|
14
|
+
0.5.0 receiver.
|
|
15
|
+
|
|
16
|
+
### Breaking or behaviour-changing
|
|
17
|
+
|
|
18
|
+
- **Keys made optional.** `BookingOption.forBookingRequest` remains an
|
|
19
|
+
ontology key but is no longer required. The legacy keys
|
|
20
|
+
`BookingOption.optionStatus`, `BookingRequest.requestStatus` and
|
|
21
|
+
`BookingRequest.requestor` were required and are now optional. Likewise
|
|
22
|
+
`Booking.bookingStatus` and `Booking.forBookingRequest` were required in
|
|
23
|
+
0.5.0 and are now optional. Code that reads them must handle `undefined`
|
|
24
|
+
(deviation #18).
|
|
25
|
+
- **`Booking.bookingStatus` widened and optional.** It accepts the four `:BookingStatus`
|
|
26
|
+
values (`CONFIRMED`, `DELETED`, `QUEUED`, `REJECTED`) and, for 0.5.0
|
|
27
|
+
compatibility, `REQUEST_ACCEPTED` and `REQUEST_REVOKED`.
|
|
28
|
+
- **`codes.BookingStatus` and `codes.BookingOptionStatus` changed values.**
|
|
29
|
+
`BookingStatus` is now `CONFIRMED | DELETED | QUEUED | REJECTED`;
|
|
30
|
+
`BookingOptionStatus` is now `BOOKABLE | BOOKED | EXPIRED | NONBOOKABLE |
|
|
31
|
+
NOT_BOOKABLE | ON_REQUEST | QUEUED`. Comparisons against the old
|
|
32
|
+
`REQUEST_*` values now fail silently at runtime, and
|
|
33
|
+
`BookingStatus.parse(booking.bookingStatus)` throws on legacy values; use
|
|
34
|
+
`RequestStatus` for the legacy values instead.
|
|
35
|
+
- **`FIELD_TYPES['Waybill.referredBookingOption']`** now targets `Booking`,
|
|
36
|
+
not `BookingOption`, as the ontology defines it.
|
|
37
|
+
- **Booking-flow refusals and deprecation.** The five `booking-flow` helpers,
|
|
38
|
+
`STATE_DIAGRAM` and `canTransition` are `@deprecated`. They now refuse
|
|
39
|
+
ontology-shaped inputs: `statusBookingOption` present returns
|
|
40
|
+
`reason: 'ontology_status_present'`, and an absent `optionStatus` returns
|
|
41
|
+
`reason: 'legacy_status_absent'`. `acceptBookingRequest` likewise refuses an
|
|
42
|
+
input with no `requestStatus`, returning `forbidden_state_transition` with
|
|
43
|
+
`reason: 'legacy_status_absent'` and `from: 'BookingRequest.(absent)'`. Every 0.5.0-valid input behaves as before.
|
|
44
|
+
- **Role swap.** The legacy booking flow assigns the roles the other way
|
|
45
|
+
round to the ontology, and `BookingTimes`, `BookingSegment` and
|
|
46
|
+
`BookingPreferences` are LogisticsObject-shaped legacy classes where the
|
|
47
|
+
ontology has embedded classes (deviation #21). Both go to booking Path A
|
|
48
|
+
(target 0.7.0).
|
|
49
|
+
- **`looksLikeIri` rejects whitespace.** Free text such as `"NOTE: prepaid"`
|
|
50
|
+
no longer triggers `iri_not_canonical` under the graph walk (deviation #9). Under the graph walk, whitespace-free strings in non-IRI fields that contain a scheme-like prefix (e.g. `URGENT:Handle`, or a website `HTTPS://Example.com/x` in `ContactDetail.textualValue`) are still checked for canonical IRI form and can yield `iri_not_canonical` (deviation #9).
|
|
51
|
+
|
|
52
|
+
### Deprecations
|
|
53
|
+
|
|
54
|
+
The 0.5.0 keys that are not ONE Record properties of their class are
|
|
55
|
+
`@deprecated` and will be removed in booking Path A, at the latest by 0.8.0
|
|
56
|
+
(deviation #18). Emit ontology keys only (`statusBookingOption`,
|
|
57
|
+
`bookingRequest`, `offerValidTo`, ...). Deprecation is visible only through
|
|
58
|
+
the exported `BookingOption`, `BookingRequest` and `Booking` types. It is not
|
|
59
|
+
visible on values inferred from `XSchema.parse(...)`, because the
|
|
60
|
+
deprecation tags live on the hand-written types.
|
|
61
|
+
|
|
62
|
+
### Additions
|
|
63
|
+
|
|
64
|
+
- `Price`, `Ratings` and `TransportLegs` are registered in `CLASSES`,
|
|
65
|
+
`CODECS` (and so `./codecs`), the facade and `createMapper`.
|
|
66
|
+
- New code lists: `ChargeIdentifier`, `PrepaidCollectIndicator`,
|
|
67
|
+
`EntitlementCode`, `SpaceAllocationCode`, `TransportMeansServiceType`.
|
|
68
|
+
- Nine embedded shapes are exported as types only (`Ranges`,
|
|
69
|
+
`UnitsPreference`, `CarrierProduct`, `StationRemarks`,
|
|
70
|
+
`EmbeddedBookingTimes`, `PieceGroup`, `EmbeddedBookingSegment`,
|
|
71
|
+
`ActivitySequence`, `ContactDetail`).
|
|
72
|
+
|
|
73
|
+
### Profile rules that now matter
|
|
74
|
+
|
|
75
|
+
- **Multi-valued properties need a JSON array**, even for one value:
|
|
76
|
+
`Booking.additionalInformation: "x"` is rejected, `["x"]` is accepted, and
|
|
77
|
+
`[]` is rejected as `cardinality_violation`.
|
|
78
|
+
- **Reference IRIs are canonicalised, `@id` is not.** `safeIri` lowercases
|
|
79
|
+
scheme and host and adds `/` for an empty path, but a node's `@id` is kept
|
|
80
|
+
verbatim. Compare canonical forms when joining a reference to an `@id`.
|
|
81
|
+
- **`xsd:dateTime` needs a timezone** (`Z` or an offset), deviation #22.
|
|
82
|
+
- **Currency.** `Price.grandTotal` and `Ratings.subTotal` are plain numbers
|
|
83
|
+
(deviation #20). Set `BookingOption.unitsPreference.currency` whenever an
|
|
84
|
+
option carries a `Price`; receivers may fall back to the Waybill's
|
|
85
|
+
`CurrencyValue` units. See `docs/ONE_RECORD_2_2_PROFILE.md`.
|
|
86
|
+
- **Duplicate IRIs in `Price.ratings` are accepted**; consumers must not
|
|
87
|
+
double-count.
|
|
88
|
+
- `BookingShipment` is still the legacy shape; an ontology-shaped
|
|
89
|
+
BookingShipment is rejected by its codec until booking Path A.
|
|
90
|
+
|
|
5
91
|
## Migrating from v0.4.x to v0.5.0
|
|
6
92
|
|
|
7
93
|
Existing cargo-model imports require no changes. v0.5.0 adds a stricter,
|
package/README.md
CHANGED
|
@@ -77,6 +77,9 @@ conformance claim independently:
|
|
|
77
77
|
- The canonical cargo data model class set (Ring 1–5, booking-flow, plus
|
|
78
78
|
10 new FWB-equivalence classes in v0.3.0) with full round-trip codecs,
|
|
79
79
|
Zod schemas, snapshot tests, and pre-Zod safety primitives.
|
|
80
|
+
- **0.6.0 Quote & Book classes:** new `Price`, `Ratings` and `TransportLegs`,
|
|
81
|
+
and ontology-complete `BookingOption`, `BookingRequest` and `Booking`
|
|
82
|
+
(see CHANGELOG and MIGRATING).
|
|
80
83
|
- Opt-in **graph-walk dispatcher** (`createMapper({ graphWalk: true })` or
|
|
81
84
|
`onerecord.dispatch.deserialize.<Class>`) emitting all four cross-node
|
|
82
85
|
integrity ParseError kinds.
|
|
@@ -213,6 +216,10 @@ No bound state; suitable for one-off operations and tree-shake-friendly imports.
|
|
|
213
216
|
|
|
214
217
|
### Booking state machine
|
|
215
218
|
|
|
219
|
+
> Deprecated in 0.6.0. These helpers implement a legacy pre-ontology flow
|
|
220
|
+
> whose roles are swapped versus ONE Record (deviation #21). They refuse
|
|
221
|
+
> ontology-shaped inputs and will be replaced in "booking Path A".
|
|
222
|
+
|
|
216
223
|
```typescript
|
|
217
224
|
import { STATE_DIAGRAM, canTransition } from '@flaks/onerecord'
|
|
218
225
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { type BookingAction, type BookingType, type Transition } from './state-diagram.js';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
4
|
+
*/
|
|
2
5
|
export declare function canTransition(fromType: BookingType, fromStatus: string, action: BookingAction): Transition | null;
|
|
3
6
|
//# sourceMappingURL=can-transition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"can-transition.d.ts","sourceRoot":"","sources":["../../src/booking-flow/can-transition.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAEhB,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAA;AAE3B,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,WAAW,EACrB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,aAAa,GACpB,UAAU,GAAG,IAAI,CAGnB"}
|
|
1
|
+
{"version":3,"file":"can-transition.d.ts","sourceRoot":"","sources":["../../src/booking-flow/can-transition.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAEhB,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAA;AAE3B;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,WAAW,EACrB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,aAAa,GACpB,UAAU,GAAG,IAAI,CAGnB"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// src/booking-flow/can-transition.ts
|
|
2
2
|
import { STATE_DIAGRAM, } from './state-diagram.js';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
5
|
+
*/
|
|
3
6
|
export function canTransition(fromType, fromStatus, action) {
|
|
4
7
|
const t = STATE_DIAGRAM[fromType]?.[fromStatus]?.[action];
|
|
5
8
|
return t ?? null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"can-transition.js","sourceRoot":"","sources":["../../src/booking-flow/can-transition.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAGL,aAAa,GAEd,MAAM,oBAAoB,CAAA;AAE3B,MAAM,UAAU,aAAa,CAC3B,QAAqB,EACrB,UAAkB,EAClB,MAAqB;IAErB,MAAM,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA;IACzD,OAAO,CAAC,IAAI,IAAI,CAAA;AAClB,CAAC"}
|
|
1
|
+
{"version":3,"file":"can-transition.js","sourceRoot":"","sources":["../../src/booking-flow/can-transition.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAGL,aAAa,GAEd,MAAM,oBAAoB,CAAA;AAE3B;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAqB,EACrB,UAAkB,EAClB,MAAqB;IAErB,MAAM,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA;IACzD,OAAO,CAAC,IAAI,IAAI,CAAA;AAClB,CAAC"}
|
|
@@ -13,7 +13,11 @@ export interface StateDiagram {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
18
|
+
*
|
|
19
|
+
* v2 (A1 risk #2): deepFreeze covers leaf Transition objects so STATE_DIAGRAM.X.Y.Z.accept.nextType = '...' fails at runtime.
|
|
20
|
+
*/
|
|
17
21
|
export declare const STATE_DIAGRAM: StateDiagram;
|
|
18
22
|
export {};
|
|
19
23
|
//# sourceMappingURL=state-diagram.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-diagram.d.ts","sourceRoot":"","sources":["../../src/booking-flow/state-diagram.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,eAAe,GAAG,sBAAsB,GAAG,SAAS,CAAA;AACjG,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAErE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAA;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,KAAK,IAAI,GAAG,UAAU,GAAG,SAAS,CAAA;AAElC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG;QAC3B,QAAQ,EAAE,UAAU,EAAE,MAAM,GAAG;YAC7B,QAAQ,EAAE,MAAM,IAAI,aAAa,CAAC,CAAC,EAAE,IAAI;SAC1C,CAAA;KACF,CAAA;CACF;AAED
|
|
1
|
+
{"version":3,"file":"state-diagram.d.ts","sourceRoot":"","sources":["../../src/booking-flow/state-diagram.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,eAAe,GAAG,sBAAsB,GAAG,SAAS,CAAA;AACjG,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAErE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAA;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,KAAK,IAAI,GAAG,UAAU,GAAG,SAAS,CAAA;AAElC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG;QAC3B,QAAQ,EAAE,UAAU,EAAE,MAAM,GAAG;YAC7B,QAAQ,EAAE,MAAM,IAAI,aAAa,CAAC,CAAC,EAAE,IAAI;SAC1C,CAAA;KACF,CAAA;CACF;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,YA6B1B,CAAA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// src/booking-flow/state-diagram.ts
|
|
2
2
|
import { deepFreeze } from '../util/deep-freeze.js';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
5
|
+
*
|
|
6
|
+
* v2 (A1 risk #2): deepFreeze covers leaf Transition objects so STATE_DIAGRAM.X.Y.Z.accept.nextType = '...' fails at runtime.
|
|
7
|
+
*/
|
|
4
8
|
export const STATE_DIAGRAM = deepFreeze({
|
|
5
9
|
BookingRequest: {
|
|
6
10
|
REQUEST_PENDING: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-diagram.js","sourceRoot":"","sources":["../../src/booking-flow/state-diagram.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,OAAO,EAAE,UAAU,EAA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sBAAsB,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC3F,MAAM,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE;SACrE;KACF;IACD,OAAO,EAAE;QACP,gBAAgB,EAAE;YAChB,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC/E;KACF;CACF,CAAC,CAAA"}
|
|
@@ -3,9 +3,14 @@ import type { BookingOption } from '../classes/booking-option/schema.js';
|
|
|
3
3
|
import type { BookingRequest } from '../classes/booking-request/schema.js';
|
|
4
4
|
import type { Booking } from '../classes/booking/schema.js';
|
|
5
5
|
import type { ParseResult } from '../result.js';
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
8
|
+
*/
|
|
6
9
|
export declare function acceptBookingRequest(req: BookingRequest): ParseResult<BookingOption>;
|
|
7
10
|
/**
|
|
8
|
-
* @deprecated
|
|
11
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
12
|
+
*
|
|
13
|
+
* (Earlier v0.2 deprecation: skips the intermediate state.)
|
|
9
14
|
*
|
|
10
15
|
* Skips the `BookingOptionRequest` intermediate state per spec §5.4
|
|
11
16
|
* STATE_DIAGRAM. Use `acceptBookingOptionViaRequest(opt)` instead and
|
|
@@ -14,7 +19,13 @@ export declare function acceptBookingRequest(req: BookingRequest): ParseResult<B
|
|
|
14
19
|
* shortcut, this annotation will be relaxed.
|
|
15
20
|
*/
|
|
16
21
|
export declare function acceptBookingOption(opt: BookingOption): ParseResult<Booking>;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
24
|
+
*/
|
|
17
25
|
export declare function rejectBookingOption(opt: BookingOption, _reason?: string): ParseResult<BookingOption>;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
28
|
+
*/
|
|
18
29
|
export declare function revokeBookingOption(opt: BookingOption, _reason?: string): ParseResult<BookingOption>;
|
|
19
30
|
/**
|
|
20
31
|
* Accept a BookingOption per spec §5.4 STATE_DIAGRAM. Returns the
|
|
@@ -25,6 +36,8 @@ export declare function revokeBookingOption(opt: BookingOption, _reason?: string
|
|
|
25
36
|
* only models the forwarder->carrier request transition.
|
|
26
37
|
*
|
|
27
38
|
* Source-state hardcode: see top-of-file comment + deviation #11.
|
|
39
|
+
*
|
|
40
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
28
41
|
*/
|
|
29
42
|
export declare function acceptBookingOptionViaRequest(opt: BookingOption): ParseResult<BookingOptionRequest>;
|
|
30
43
|
//# sourceMappingURL=transitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitions.d.ts","sourceRoot":"","sources":["../../src/booking-flow/transitions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAA;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAE3D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"transitions.d.ts","sourceRoot":"","sources":["../../src/booking-flow/transitions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAA;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAE3D,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,cAAc,CAAA;AAuD3D;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,WAAW,CAAC,aAAa,CAAC,CA+BpF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC,CAuB5E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,WAAW,CAAC,aAAa,CAAC,CAqB5B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,WAAW,CAAC,aAAa,CAAC,CAe5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,aAAa,GACjB,WAAW,CAAC,oBAAoB,CAAC,CAsBnC"}
|
|
@@ -3,30 +3,63 @@ import { randomUUID } from 'node:crypto';
|
|
|
3
3
|
import { CARGO_CONTEXT_IRI } from '../version.js';
|
|
4
4
|
import { canTransition } from './can-transition.js';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - `
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation
|
|
7
|
+
* #21). These helpers neither read nor write ontology keys: they work only
|
|
8
|
+
* on the legacy `optionStatus` / `requestStatus` state model and refuse
|
|
9
|
+
* ontology-shaped inputs (`statusBookingOption` present, or the legacy
|
|
10
|
+
* status absent) with a `forbidden_state_transition` error carrying a
|
|
11
|
+
* `reason`. Every 0.5.0-valid input behaves exactly as before.
|
|
12
12
|
*
|
|
13
|
-
* Source-state hardcode:
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* `opt.optionStatus`. This is intentional — see deviation #11 in
|
|
18
|
-
* `docs/spec-deviations.md`. The schema's optionStatus enum
|
|
19
|
-
* (OPTION_PROPOSED/_ACCEPTED/_REJECTED) does not align with
|
|
20
|
-
* STATE_DIAGRAM.BookingOption's source-state keys (REQUEST_PENDING).
|
|
21
|
-
* Reading `opt.optionStatus` would make every transition fail.
|
|
22
|
-
* Reconciliation deferred to v0.3.
|
|
13
|
+
* Source-state hardcode: the four BookingOption helpers still pass the
|
|
14
|
+
* constant `'REQUEST_PENDING'` to `canTransition` rather than mapping
|
|
15
|
+
* `opt.optionStatus` onto STATE_DIAGRAM keys (deviation #11). They only
|
|
16
|
+
* check that `optionStatus` is present.
|
|
23
17
|
*/
|
|
24
18
|
const TENANT = 'transitions';
|
|
25
19
|
const HOST = 'flaks.example';
|
|
26
20
|
function makeId(type) {
|
|
27
21
|
return `https://${HOST}/${TENANT}/${type.toLowerCase()}/${randomUUID()}`;
|
|
28
22
|
}
|
|
23
|
+
function refuseOptionInput(opt, to) {
|
|
24
|
+
if (opt.statusBookingOption !== undefined)
|
|
25
|
+
return {
|
|
26
|
+
ok: false,
|
|
27
|
+
error: {
|
|
28
|
+
kind: 'forbidden_state_transition',
|
|
29
|
+
from: `BookingOption.${opt.statusBookingOption}`,
|
|
30
|
+
to,
|
|
31
|
+
reason: 'ontology_status_present',
|
|
32
|
+
path: '$',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
if (opt.optionStatus === undefined)
|
|
36
|
+
return {
|
|
37
|
+
ok: false,
|
|
38
|
+
error: {
|
|
39
|
+
kind: 'forbidden_state_transition',
|
|
40
|
+
from: 'BookingOption.(absent)',
|
|
41
|
+
to,
|
|
42
|
+
reason: 'legacy_status_absent',
|
|
43
|
+
path: '$',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
50
|
+
*/
|
|
29
51
|
export function acceptBookingRequest(req) {
|
|
52
|
+
if (req.requestStatus === undefined)
|
|
53
|
+
return {
|
|
54
|
+
ok: false,
|
|
55
|
+
error: {
|
|
56
|
+
kind: 'forbidden_state_transition',
|
|
57
|
+
from: 'BookingRequest.(absent)',
|
|
58
|
+
to: 'accept',
|
|
59
|
+
reason: 'legacy_status_absent',
|
|
60
|
+
path: '$',
|
|
61
|
+
},
|
|
62
|
+
};
|
|
30
63
|
const t = canTransition('BookingRequest', req.requestStatus, 'accept');
|
|
31
64
|
if (!t)
|
|
32
65
|
return {
|
|
@@ -48,7 +81,9 @@ export function acceptBookingRequest(req) {
|
|
|
48
81
|
return { ok: true, value: opt };
|
|
49
82
|
}
|
|
50
83
|
/**
|
|
51
|
-
* @deprecated
|
|
84
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
85
|
+
*
|
|
86
|
+
* (Earlier v0.2 deprecation: skips the intermediate state.)
|
|
52
87
|
*
|
|
53
88
|
* Skips the `BookingOptionRequest` intermediate state per spec §5.4
|
|
54
89
|
* STATE_DIAGRAM. Use `acceptBookingOptionViaRequest(opt)` instead and
|
|
@@ -57,6 +92,9 @@ export function acceptBookingRequest(req) {
|
|
|
57
92
|
* shortcut, this annotation will be relaxed.
|
|
58
93
|
*/
|
|
59
94
|
export function acceptBookingOption(opt) {
|
|
95
|
+
const refused = refuseOptionInput(opt, 'accept');
|
|
96
|
+
if (refused)
|
|
97
|
+
return refused;
|
|
60
98
|
const t = canTransition('BookingOption', 'REQUEST_PENDING', 'accept');
|
|
61
99
|
if (!t)
|
|
62
100
|
return {
|
|
@@ -73,12 +111,18 @@ export function acceptBookingOption(opt) {
|
|
|
73
111
|
'@type': 'Booking',
|
|
74
112
|
'@id': makeId('Booking'),
|
|
75
113
|
bookingStatus: 'REQUEST_ACCEPTED',
|
|
76
|
-
forBookingRequest: opt.forBookingRequest,
|
|
114
|
+
...(opt.forBookingRequest !== undefined && { forBookingRequest: opt.forBookingRequest }),
|
|
77
115
|
forBookingOption: opt['@id'],
|
|
78
116
|
};
|
|
79
117
|
return { ok: true, value: booking };
|
|
80
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
121
|
+
*/
|
|
81
122
|
export function rejectBookingOption(opt, _reason) {
|
|
123
|
+
const refused = refuseOptionInput(opt, 'reject');
|
|
124
|
+
if (refused)
|
|
125
|
+
return refused;
|
|
82
126
|
const t = canTransition('BookingOption', 'REQUEST_PENDING', 'reject');
|
|
83
127
|
if (!t)
|
|
84
128
|
return {
|
|
@@ -98,7 +142,13 @@ export function rejectBookingOption(opt, _reason) {
|
|
|
98
142
|
},
|
|
99
143
|
};
|
|
100
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
147
|
+
*/
|
|
101
148
|
export function revokeBookingOption(opt, _reason) {
|
|
149
|
+
const refused = refuseOptionInput(opt, 'revoke');
|
|
150
|
+
if (refused)
|
|
151
|
+
return refused;
|
|
102
152
|
const t = canTransition('BookingOption', 'REQUEST_PENDING', 'revoke');
|
|
103
153
|
if (!t)
|
|
104
154
|
return {
|
|
@@ -121,8 +171,13 @@ export function revokeBookingOption(opt, _reason) {
|
|
|
121
171
|
* only models the forwarder->carrier request transition.
|
|
122
172
|
*
|
|
123
173
|
* Source-state hardcode: see top-of-file comment + deviation #11.
|
|
174
|
+
*
|
|
175
|
+
* @deprecated Legacy pre-ontology booking flow (roles swapped vs ONE Record, deviation #21). Replacement: booking Path A.
|
|
124
176
|
*/
|
|
125
177
|
export function acceptBookingOptionViaRequest(opt) {
|
|
178
|
+
const refused = refuseOptionInput(opt, 'accept');
|
|
179
|
+
if (refused)
|
|
180
|
+
return refused;
|
|
126
181
|
const t = canTransition('BookingOption', 'REQUEST_PENDING', 'accept');
|
|
127
182
|
if (!t)
|
|
128
183
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitions.js","sourceRoot":"","sources":["../../src/booking-flow/transitions.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAOxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"transitions.js","sourceRoot":"","sources":["../../src/booking-flow/transitions.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAOxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,GAAG,aAAa,CAAA;AAC5B,MAAM,IAAI,GAAG,eAAe,CAAA;AAE5B,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,WAAW,IAAI,IAAI,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,UAAU,EAAE,EAAE,CAAA;AAC1E,CAAC;AAED,SAAS,iBAAiB,CACxB,GAAkB,EAClB,EAAiB;IAEjB,IAAI,GAAG,CAAC,mBAAmB,KAAK,SAAS;QACvC,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,4BAA4B;gBAClC,IAAI,EAAE,iBAAiB,GAAG,CAAC,mBAAmB,EAAE;gBAChD,EAAE;gBACF,MAAM,EAAE,yBAAyB;gBACjC,IAAI,EAAE,GAAG;aACV;SACF,CAAA;IACH,IAAI,GAAG,CA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EAAE,MAAM,CAAC,sBAAsB,CAAC;QACrC,gBAAgB,EAAE,GAAG,CAAC,KAAK,CAAuB;QAClD,aAAa,EAAE,iBAAiB;KACjC,CAAA;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;AACjC,CAAC"}
|
|
@@ -4,13 +4,103 @@ export declare const BookingSchema: z.ZodObject<{
|
|
|
4
4
|
'@context': z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
5
5
|
'@id': z.ZodString;
|
|
6
6
|
'@type': z.ZodLiteral<"Booking">;
|
|
7
|
-
bookingStatus: z.ZodEnum<{
|
|
7
|
+
bookingStatus: z.ZodOptional<z.ZodEnum<{
|
|
8
8
|
REQUEST_ACCEPTED: "REQUEST_ACCEPTED";
|
|
9
9
|
REQUEST_REVOKED: "REQUEST_REVOKED";
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
CONFIRMED: "CONFIRMED";
|
|
11
|
+
DELETED: "DELETED";
|
|
12
|
+
QUEUED: "QUEUED";
|
|
13
|
+
REJECTED: "REJECTED";
|
|
14
|
+
}>>;
|
|
15
|
+
forBookingRequest: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
12
16
|
forBookingOption: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
17
|
+
additionalInformation: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
18
|
+
arrivalLocation: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
19
|
+
departureLocation: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
20
|
+
bookingRequest: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
21
|
+
bookingSegments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
22
|
+
'@type': z.ZodOptional<z.ZodLiteral<"BookingSegment">>;
|
|
23
|
+
allotmentCode: z.ZodOptional<z.ZodString>;
|
|
24
|
+
pieceGroups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
'@type': z.ZodOptional<z.ZodLiteral<"PieceGroup">>;
|
|
26
|
+
dryIceWeight: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
'@type': z.ZodOptional<z.ZodLiteral<"Value">>;
|
|
28
|
+
numericalValue: z.ZodNumber;
|
|
29
|
+
unit: z.ZodString;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
pieceGroupCount: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
pieceGroupGrossWeight: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
'@type': z.ZodOptional<z.ZodLiteral<"Value">>;
|
|
34
|
+
numericalValue: z.ZodNumber;
|
|
35
|
+
unit: z.ZodString;
|
|
36
|
+
}, z.core.$strict>>;
|
|
37
|
+
pieceGroupId: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
}, z.core.$strict>>>;
|
|
39
|
+
spaceAllocationCode: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
CN: "CN";
|
|
41
|
+
CA: "CA";
|
|
42
|
+
HK: "HK";
|
|
43
|
+
HL: "HL";
|
|
44
|
+
HN: "HN";
|
|
45
|
+
KK: "KK";
|
|
46
|
+
LL: "LL";
|
|
47
|
+
NA: "NA";
|
|
48
|
+
NL: "NL";
|
|
49
|
+
NN: "NN";
|
|
50
|
+
SS: "SS";
|
|
51
|
+
UN: "UN";
|
|
52
|
+
UU: "UU";
|
|
53
|
+
XX: "XX";
|
|
54
|
+
}>>;
|
|
55
|
+
transportLegs: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
56
|
+
}, z.core.$strict>>>;
|
|
57
|
+
bookingShipmentDetails: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
58
|
+
bookingTimes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
59
|
+
'@type': z.ZodOptional<z.ZodLiteral<"BookingTimes">>;
|
|
60
|
+
earliestAcceptanceTime: z.ZodOptional<z.ZodString>;
|
|
61
|
+
latestAcceptanceTime: z.ZodOptional<z.ZodString>;
|
|
62
|
+
latestArrivalTime: z.ZodOptional<z.ZodString>;
|
|
63
|
+
timeOfAvailability: z.ZodOptional<z.ZodString>;
|
|
64
|
+
totalTransitTime: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, z.core.$strict>>>;
|
|
66
|
+
carrier: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
67
|
+
carrierProduct: z.ZodOptional<z.ZodObject<{
|
|
68
|
+
'@type': z.ZodOptional<z.ZodLiteral<"CarrierProduct">>;
|
|
69
|
+
productCode: z.ZodOptional<z.ZodString>;
|
|
70
|
+
serviceLevelCode: z.ZodOptional<z.ZodString>;
|
|
71
|
+
productDescription: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strict>>;
|
|
73
|
+
issuedForWaybill: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
74
|
+
shippingInfo: z.ZodOptional<z.ZodString>;
|
|
75
|
+
shippingRefNo: z.ZodOptional<z.ZodString>;
|
|
76
|
+
stationRemarks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
|
+
'@type': z.ZodOptional<z.ZodLiteral<"StationRemarks">>;
|
|
78
|
+
station: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
79
|
+
remarksText: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strict>>>;
|
|
81
|
+
transportLegs: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>>;
|
|
82
|
+
updateBookingOptionRequests: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>>;
|
|
83
|
+
waybillNumber: z.ZodOptional<z.ZodString>;
|
|
84
|
+
waybillPrefix: z.ZodOptional<z.ZodString>;
|
|
85
|
+
activitySequences: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
86
|
+
'@type': z.ZodOptional<z.ZodLiteral<"ActivitySequence">>;
|
|
87
|
+
activity: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>;
|
|
88
|
+
sequenceNumber: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strict>>>;
|
|
90
|
+
contactDetails: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
91
|
+
'@type': z.ZodOptional<z.ZodLiteral<"ContactDetail">>;
|
|
92
|
+
contactDetailType: z.ZodOptional<z.ZodString>;
|
|
93
|
+
textualValue: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.core.$strict>>>;
|
|
95
|
+
contactPersons: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("../../index.js").SafeIri, string>>>>;
|
|
13
96
|
}, z.core.$strict>;
|
|
14
|
-
|
|
97
|
+
type BookingInferred = z.infer<typeof BookingSchema>;
|
|
98
|
+
export type Booking = Omit<BookingInferred, 'forBookingRequest' | 'forBookingOption'> & {
|
|
99
|
+
/** @deprecated Not a ONE Record property of Booking. Use `bookingRequest`. Removal: booking Path A (deviation #18). */
|
|
100
|
+
forBookingRequest?: BookingInferred['forBookingRequest'];
|
|
101
|
+
/** @deprecated Not a ONE Record property of Booking (chain is Booking → BookingRequest → BookingOption). Removal: booking Path A (deviation #18). */
|
|
102
|
+
forBookingOption?: BookingInferred['forBookingOption'];
|
|
103
|
+
};
|
|
15
104
|
export type JsonLdBooking = JsonLd<'Booking'>;
|
|
105
|
+
export {};
|
|
16
106
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/classes/booking/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/classes/booking/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAWvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAKvD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA0Cf,CAAA;AAEX,KAAK,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACpD,MAAM,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,mBAAmB,GAAG,kBAAkB,CAAC,GAAG;IACtF,uHAAuH;IACvH,iBAAiB,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAA;IACxD,qJAAqJ;IACrJ,gBAAgB,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAA;CACvD,CAAA;AACD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA"}
|