Class: BookingRepositories
Defined in: server/bookings/booking-repositories.ts:43
Holds the bookings-feature repositories and exposes a transaction() entry
point.
Uses the ambient Prisma client registered via
registerPrismaClient / initPrismaClient on @the-kaizen-labs/taproot/persistence.
Repositories route their Prisma handle through TransactionManager, so
inside transaction(fn) every this.tx.* call on any repo resolves to the
active transaction automatically.
Constructors
Constructor
new BookingRepositories(options?: BookingRepositoriesOptions): BookingRepositories;Defined in: server/bookings/booking-repositories.ts:79
Parameters
| Parameter | Type |
|---|---|
options | BookingRepositoriesOptions |
Returns
BookingRepositories
Properties
availability
readonly availability: ResourceAvailabilityRepository;Defined in: server/bookings/booking-repositories.ts:54
bookings
readonly bookings: BookingCrudRepository;Defined in: server/bookings/booking-repositories.ts:46
events
readonly events: BookingEventRepository;Defined in: server/bookings/booking-repositories.ts:48
Append-only timeline + transactional outbox.
groups
readonly groups: BookingGroupRepository;Defined in: server/bookings/booking-repositories.ts:50
offers
readonly offers: WaitlistOfferRepository;Defined in: server/bookings/booking-repositories.ts:56
Waitlist offer sub-machine + the FIFO party queue (§6.4/§6.10).
resources
readonly resources: BookingResourceRepository;Defined in: server/bookings/booking-repositories.ts:51
ruleConditions
readonly ruleConditions: ConditionRepository;Defined in: server/bookings/booking-repositories.ts:68
rules
readonly rules: RuleRepository;Defined in: server/bookings/booking-repositories.ts:67
Engine-shaped READ repositories over the rules tables, for the §8.3
policy guards. Bound to the SAME Prisma client as every other repo here
— deliberately NOT matchRules() from rules/server, which constructs
its repositories from the ambient registry at call time and therefore
explodes ("Cannot use different Prisma clients within the same
transaction") when a transition's transaction was opened on a
non-ambient client. Mirrors the forms precedent of reading rules tables
through the feature's own transaction.
schedules
readonly schedules: BookingScheduleRepository;Defined in: server/bookings/booking-repositories.ts:52
series
readonly series: SeriesRepository;Defined in: server/bookings/booking-repositories.ts:53
types
readonly types: BookingTypeRepository;Defined in: server/bookings/booking-repositories.ts:49
Accessors
prismaForSchemaCheck
Get Signature
get prismaForSchemaCheck(): PrismaClient;Defined in: server/bookings/booking-repositories.ts:75
Raw Prisma client, exposed read-only for assertBookingsSchemaGenerated's
property-access probe (works through Proxy-wrapped test clients that
don't trap has, unlike the in operator — see that module's docstring).
Returns
PrismaClient
Methods
transaction()
transaction<T>(fn: (repos: BookingRepositories) => Promise<T>, opts?: {
resourceIds?: readonly string[];
timeout?: number;
}): Promise<T>;Defined in: server/bookings/booking-repositories.ts:106
Run fn inside a transaction. opts.timeout is FORWARDED to Prisma's
interactive transaction (§6.6) — claim + capacity work can need more than
the 5s default. NB: a timeout is honored only when this is the OUTERMOST
transaction; a joined ambient transaction ignores it. Cross-resource
compositions must declare resourceIds on this outermost boundary: the
expanded union is locked before fn, but only declared resources are write
targets. Nested service calls inherit both sets.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
fn | (repos: BookingRepositories) => Promise<T> | - |
opts? | { resourceIds?: readonly string[]; timeout?: number; } | - |
opts.resourceIds? | readonly string[] | All resource write targets; overlap dependencies are prelocked automatically. |
opts.timeout? | number | - |
Returns
Promise<T>
withClaimSavepoint()
withClaimSavepoint<T>(fn: () => Promise<T>): Promise<T>;Defined in: server/bookings/booking-repositories.ts:145
Wrap fn in an explicit Postgres SAVEPOINT — the §6.6 joined-transaction
contract. transaction() JOINS a consumer's ambient transaction verbatim
(no savepoint of its own), so if the consumer catches a mid-batch error
in their outer tx, already-applied batch members would silently commit
with it. Rolling back to the savepoint keeps the §6.10 all-or-none
guarantee even when joined. Raw SAVEPOINT (not Prisma's nested
$transaction) because the interactive-transaction handle strips
$transaction.
MUST be called inside transaction(...) — a bare SAVEPOINT statement
outside a transaction block is a Postgres error.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => Promise<T> |
Returns
Promise<T>