@voyant-travel/allotments.
room_block_nights and room_block_pickups in @voyant-travel/accommodations, space blocks in @voyant-travel/operations).
Key concepts
The contract rests on a clear separation between the block header lifecycle, which tracks negotiation, and the pickup counters, which track draw-down.- Allotment. A held block of capacity with an option, cutoff, and release lifecycle plus live pickup counters.
- Block header status. The negotiation lifecycle of the block, not its pickup progress. The stages are
inquiry,held,confirmed,released,cancelled, andexpired, exposed asALLOTMENT_STATUSES. - Closed statuses.
released,cancelled, andexpiredcan no longer accrue pickups, exposed asCLOSED_ALLOTMENT_STATUSESand tested withisClosedAllotmentStatus(status). - Pickup ledger. An append-only record of draw-downs. A pickup is
activeorreversed, exposed asALLOTMENT_PICKUP_STATUSES. The ledger is compensated by reversal, never deleted. - Counters. Per-slot
held,pickedUp, andreleasednumbers. Remaining capacity isheld − pickedUp − released. - Slots. One date is one allotment slot, such as a hotel night or a space-day. A stay occupies each date from
start(inclusive) toend(exclusive).
Pickup progress is derived from the counters at read time, never stored.
allotmentPickupProgress(counters) returns none, partial, or full so the projection cannot drift from the ledger.The state model
A block header moves through the negotiation lifecycle: aninquiry becomes held (an option deadline against the supplier), then confirmed once the operator commits. From there the block can be released (capacity handed back), cancelled, or expired (a cutoff passed). The three closed statuses are terminal for pickup accrual.
Independently of the header status, each slot tracks its own counters. Travelers booking against the block record a pickup, incrementing pickedUp; capacity handed back increments released. Remaining capacity falls out of the math:
Working with it
Enumerate the slots a stay or hold occupies. Dates areYYYY-MM-DD and parse as UTC to avoid timezone drift across the day boundary:
[].
Check whether a block can still accept pickups before recording one:
Links to other modules
- Accommodations. Room blocks are an allotment. The room-block service in
@voyant-travel/accommodationsowns theroom_block_nightsandroom_block_pickupstables and maintains its per-night counters usingallotmentRemaining,allotmentPickupProgress,eachDateInRange, andisClosedAllotmentStatus. See Accommodations. - Operations. Space blocks reuse the same contract for function-space allotments. See Operations.
- Bookings. A pickup is recorded against a booking item, so the draw-down counters move as bookings are placed and reversed. See Bookings.
Next steps
Accommodations
Room blocks, the reference allotment consumer with the night-level ledger.
Operations
Space blocks and the shared availability spine.
Bookings
The booking items that draw pickups down against a block.
Glossary
The held-inventory vocabulary behind allotments and pickups.