Kaizen
Browse modulesBookingsbookings/serverTypes

Type Alias: BookingPolicyContext

type BookingPolicyContext = {
  booking: {
     amountOwedCents: number | null;
     capacityUnits: number;
     id: string;
     origin: string;
     paid: boolean;
     payload: Prisma.JsonValue;
     status: string;
     uid: string;
  };
  bookingType: {
     id: string;
     key: string;
     name: string;
     vertical: string;
  };
  event: string;
  now: string;
  party: {
     email: string | null;
     name: string | null;
     ref: string | null;
  };
  policy: PolicyBag;
  schedule:   | {
     endsAt: string;
     resourceId: string;
     startsAt: string;
     timeZone: string;
   }
     | null;
};

Defined in: server/bookings/policy-guards.ts:102

The evaluation context bookings policy rules resolve field paths against: the booking, its party, the hydrated schedule, the (pinned) policy bag, and the injected clock (now, ISO — so RELATIVE_DATE_CHECK lead-time / cancellation-window rules anchored via evaluation_date_field stay deterministic under the service's injected ClockPort).

Properties

booking

booking: {
  amountOwedCents: number | null;
  capacityUnits: number;
  id: string;
  origin: string;
  paid: boolean;
  payload: Prisma.JsonValue;
  status: string;
  uid: string;
};

Defined in: server/bookings/policy-guards.ts:107

amountOwedCents

amountOwedCents: number | null;

capacityUnits

capacityUnits: number;

id

id: string;

origin

origin: string;
paid: boolean;

payload

payload: Prisma.JsonValue;

status

status: string;

uid

uid: string;

bookingType

bookingType: {
  id: string;
  key: string;
  name: string;
  vertical: string;
};

Defined in: server/bookings/policy-guards.ts:136

id

id: string;

key

key: string;

name

name: string;

vertical

vertical: string;

event

event: string;

Defined in: server/bookings/policy-guards.ts:104

The lifecycle event being attempted (e.g. "hold", "confirm", "cancel").


now

now: string;

Defined in: server/bookings/policy-guards.ts:106

The service clock at evaluation time, ISO 8601.


party

party: {
  email: string | null;
  name: string | null;
  ref: string | null;
};

Defined in: server/bookings/policy-guards.ts:117

email

email: string | null;

name

name: string | null;

ref

ref: string | null;

policy

policy: PolicyBag;

Defined in: server/bookings/policy-guards.ts:143

The PINNED policy bag (§6.2) — never the live type's current version.


schedule

schedule: 
  | {
  endsAt: string;
  resourceId: string;
  startsAt: string;
  timeZone: string;
}
  | null;

Defined in: server/bookings/policy-guards.ts:130

Hydrated schedule for this booking, or null for schedule-less bookings.

Remarks

When null, any scope or condition that traverses schedule.* resolves to no value — resource-scoped rules silently never match schedule-less bookings, and conditions evaluating schedule.startsAt etc. treat the field as unresolved.

On this page