@voyantjs/bookings 0.6.9 → 0.7.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/dist/index.d.ts CHANGED
@@ -22,6 +22,6 @@ export type { BookingTravelerDietary, BookingTravelerIdentity, BookingTravelerTr
22
22
  export { bookingTravelerDietarySchema, bookingTravelerIdentitySchema, bookingTravelerTravelDetailInsertSchema, bookingTravelerTravelDetailSelectSchema, bookingTravelerTravelDetails, bookingTravelerTravelDetailUpdateSchema, decryptedBookingTravelerTravelDetailSchema, } from "./schema/travel-details.js";
23
23
  export type { Booking, BookingActivity, BookingAllocation, BookingDocument, BookingFulfillment, BookingGroup, BookingGroupMember, BookingItem, BookingItemTraveler, BookingNote, BookingPiiAccessLog, BookingRedemptionEvent, BookingSessionState, BookingStaffAssignment, BookingSupplierStatus, BookingTraveler, NewBooking, NewBookingActivity, NewBookingAllocation, NewBookingDocument, NewBookingFulfillment, NewBookingGroup, NewBookingGroupMember, NewBookingItem, NewBookingItemTraveler, NewBookingNote, NewBookingPiiAccessLog, NewBookingRedemptionEvent, NewBookingSessionState, NewBookingStaffAssignment, NewBookingSupplierStatus, NewBookingTraveler, } from "./schema.js";
24
24
  export { bookingActivityLog, bookingAllocations, bookingDocuments, bookingFulfillments, bookingGroupKindEnum, bookingGroupMemberRoleEnum, bookingGroupMembers, bookingGroups, bookingItems, bookingItemTravelers, bookingNotes, bookingPiiAccessLog, bookingRedemptionEvents, bookingSessionStates, bookingStaffAssignments, bookingSupplierStatuses, bookings, bookingTravelers, } from "./schema.js";
25
- export { publicBookingsService } from "./service-public.js";
26
- export { addBookingGroupMemberSchema, bookingGroupKindSchema, bookingGroupListQuerySchema, bookingGroupMemberRoleSchema, bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingAllocationSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingGroupSchema, insertBookingItemSchema, insertBookingItemTravelerSchema, insertBookingNoteSchema, insertBookingSchema, insertBookingTravelerDocumentSchema, insertSupplierStatusSchema, insertTravelerSchema, internalBookingOverviewLookupQuerySchema, publicBookingOverviewLookupQuerySchema, publicBookingSessionMutationSchema, publicBookingSessionRepriceItemSchema, publicBookingSessionRepriceResultSchema, publicBookingSessionRepriceSummarySchema, publicBookingSessionStateSchema, publicCreateBookingSessionSchema, publicRepriceBookingSessionSchema, publicUpdateBookingSessionSchema, publicUpsertBookingSessionStateSchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingAllocationSchema, updateBookingFulfillmentSchema, updateBookingGroupSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateSupplierStatusSchema, updateTravelerSchema, upsertTravelerTravelDetailsSchema, } from "./validation.js";
25
+ export { publicBookingsService, resolveSessionPricingSnapshot } from "./service-public.js";
26
+ export { addBookingGroupMemberSchema, bookingGroupKindSchema, bookingGroupListQuerySchema, bookingGroupMemberRoleSchema, bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingAllocationSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingGroupSchema, insertBookingItemSchema, insertBookingItemTravelerSchema, insertBookingNoteSchema, insertBookingSchema, insertBookingTravelerDocumentSchema, insertSupplierStatusSchema, insertTravelerSchema, internalBookingOverviewLookupQuerySchema, pricingPreviewSchema, publicBookingOverviewLookupQuerySchema, publicBookingSessionMutationSchema, publicBookingSessionRepriceItemSchema, publicBookingSessionRepriceResultSchema, publicBookingSessionRepriceSummarySchema, publicBookingSessionStateSchema, publicCreateBookingSessionSchema, publicRepriceBookingSessionSchema, publicUpdateBookingSessionSchema, publicUpsertBookingSessionStateSchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingAllocationSchema, updateBookingFulfillmentSchema, updateBookingGroupSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateSupplierStatusSchema, updateTravelerSchema, upsertTravelerTravelDetailsSchema, } from "./validation.js";
27
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAMvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,uBAAuB,EACvB,KAAK,sCAAsC,GAC5C,MAAM,UAAU,CAAA;AACjB,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,oBAAoB,EACpB,KAAK,uBAAuB,EAC5B,yBAAyB,EACzB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,uBAAuB,GACxB,MAAM,kBAAkB,CAAA;AAEzB,eAAO,MAAM,eAAe,EAAE,kBAK7B,CAAA;AAED,eAAO,MAAM,gBAAgB;;CAE5B,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,MAG5B,CAAA;AAED,wBAAgB,wBAAwB,IAAI,UAAU,CAiBrD;AAED,eAAO,MAAM,kBAAkB,EAAE,UAAuC,CAAA;AAExE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EACL,mCAAmC,EACnC,wBAAwB,GACzB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B,EAC1B,oBAAoB,EACpB,iCAAiC,GAClC,MAAM,iBAAiB,CAAA"}
package/dist/index.js CHANGED
@@ -38,5 +38,5 @@ export { BOOKING_ROUTE_RUNTIME_CONTAINER_KEY, buildBookingRouteRuntime, } from "
38
38
  export { publicBookingRoutes } from "./routes-public.js";
39
39
  export { bookingTravelerDietarySchema, bookingTravelerIdentitySchema, bookingTravelerTravelDetailInsertSchema, bookingTravelerTravelDetailSelectSchema, bookingTravelerTravelDetails, bookingTravelerTravelDetailUpdateSchema, decryptedBookingTravelerTravelDetailSchema, } from "./schema/travel-details.js";
40
40
  export { bookingActivityLog, bookingAllocations, bookingDocuments, bookingFulfillments, bookingGroupKindEnum, bookingGroupMemberRoleEnum, bookingGroupMembers, bookingGroups, bookingItems, bookingItemTravelers, bookingNotes, bookingPiiAccessLog, bookingRedemptionEvents, bookingSessionStates, bookingStaffAssignments, bookingSupplierStatuses, bookings, bookingTravelers, } from "./schema.js";
41
- export { publicBookingsService } from "./service-public.js";
42
- export { addBookingGroupMemberSchema, bookingGroupKindSchema, bookingGroupListQuerySchema, bookingGroupMemberRoleSchema, bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingAllocationSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingGroupSchema, insertBookingItemSchema, insertBookingItemTravelerSchema, insertBookingNoteSchema, insertBookingSchema, insertBookingTravelerDocumentSchema, insertSupplierStatusSchema, insertTravelerSchema, internalBookingOverviewLookupQuerySchema, publicBookingOverviewLookupQuerySchema, publicBookingSessionMutationSchema, publicBookingSessionRepriceItemSchema, publicBookingSessionRepriceResultSchema, publicBookingSessionRepriceSummarySchema, publicBookingSessionStateSchema, publicCreateBookingSessionSchema, publicRepriceBookingSessionSchema, publicUpdateBookingSessionSchema, publicUpsertBookingSessionStateSchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingAllocationSchema, updateBookingFulfillmentSchema, updateBookingGroupSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateSupplierStatusSchema, updateTravelerSchema, upsertTravelerTravelDetailsSchema, } from "./validation.js";
41
+ export { publicBookingsService, resolveSessionPricingSnapshot } from "./service-public.js";
42
+ export { addBookingGroupMemberSchema, bookingGroupKindSchema, bookingGroupListQuerySchema, bookingGroupMemberRoleSchema, bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingAllocationSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingGroupSchema, insertBookingItemSchema, insertBookingItemTravelerSchema, insertBookingNoteSchema, insertBookingSchema, insertBookingTravelerDocumentSchema, insertSupplierStatusSchema, insertTravelerSchema, internalBookingOverviewLookupQuerySchema, pricingPreviewSchema, publicBookingOverviewLookupQuerySchema, publicBookingSessionMutationSchema, publicBookingSessionRepriceItemSchema, publicBookingSessionRepriceResultSchema, publicBookingSessionRepriceSummarySchema, publicBookingSessionStateSchema, publicCreateBookingSessionSchema, publicRepriceBookingSessionSchema, publicUpdateBookingSessionSchema, publicUpsertBookingSessionStateSchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingAllocationSchema, updateBookingFulfillmentSchema, updateBookingGroupSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateSupplierStatusSchema, updateTravelerSchema, upsertTravelerTravelDetailsSchema, } from "./validation.js";
@@ -631,6 +631,98 @@ export declare const optionUnitsRef: import("drizzle-orm/pg-core").PgTableWithCo
631
631
  };
632
632
  dialect: "pg";
633
633
  }>;
634
+ export declare const productItinerariesRef: import("drizzle-orm/pg-core").PgTableWithColumns<{
635
+ name: "product_itineraries";
636
+ schema: undefined;
637
+ columns: {
638
+ id: import("drizzle-orm/pg-core").PgColumn<{
639
+ name: string;
640
+ tableName: "product_itineraries";
641
+ dataType: "string";
642
+ columnType: "PgText";
643
+ data: string;
644
+ driverParam: string;
645
+ notNull: true;
646
+ hasDefault: true;
647
+ isPrimaryKey: true;
648
+ isAutoincrement: false;
649
+ hasRuntimeDefault: true;
650
+ enumValues: [string, ...string[]];
651
+ baseColumn: never;
652
+ identity: undefined;
653
+ generated: undefined;
654
+ }, {}, {}>;
655
+ productId: import("drizzle-orm/pg-core").PgColumn<{
656
+ name: string;
657
+ tableName: "product_itineraries";
658
+ dataType: "string";
659
+ columnType: "PgText";
660
+ data: string;
661
+ driverParam: string;
662
+ notNull: true;
663
+ hasDefault: false;
664
+ isPrimaryKey: false;
665
+ isAutoincrement: false;
666
+ hasRuntimeDefault: false;
667
+ enumValues: [string, ...string[]];
668
+ baseColumn: never;
669
+ identity: undefined;
670
+ generated: undefined;
671
+ }, {}, {}>;
672
+ name: import("drizzle-orm/pg-core").PgColumn<{
673
+ name: "name";
674
+ tableName: "product_itineraries";
675
+ dataType: "string";
676
+ columnType: "PgText";
677
+ data: string;
678
+ driverParam: string;
679
+ notNull: true;
680
+ hasDefault: false;
681
+ isPrimaryKey: false;
682
+ isAutoincrement: false;
683
+ hasRuntimeDefault: false;
684
+ enumValues: [string, ...string[]];
685
+ baseColumn: never;
686
+ identity: undefined;
687
+ generated: undefined;
688
+ }, {}, {}>;
689
+ isDefault: import("drizzle-orm/pg-core").PgColumn<{
690
+ name: "is_default";
691
+ tableName: "product_itineraries";
692
+ dataType: "boolean";
693
+ columnType: "PgBoolean";
694
+ data: boolean;
695
+ driverParam: boolean;
696
+ notNull: true;
697
+ hasDefault: true;
698
+ isPrimaryKey: false;
699
+ isAutoincrement: false;
700
+ hasRuntimeDefault: false;
701
+ enumValues: undefined;
702
+ baseColumn: never;
703
+ identity: undefined;
704
+ generated: undefined;
705
+ }, {}, {}>;
706
+ sortOrder: import("drizzle-orm/pg-core").PgColumn<{
707
+ name: "sort_order";
708
+ tableName: "product_itineraries";
709
+ dataType: "number";
710
+ columnType: "PgInteger";
711
+ data: number;
712
+ driverParam: string | number;
713
+ notNull: true;
714
+ hasDefault: true;
715
+ isPrimaryKey: false;
716
+ isAutoincrement: false;
717
+ hasRuntimeDefault: false;
718
+ enumValues: undefined;
719
+ baseColumn: never;
720
+ identity: undefined;
721
+ generated: undefined;
722
+ }, {}, {}>;
723
+ };
724
+ dialect: "pg";
725
+ }>;
634
726
  export declare const productDaysRef: import("drizzle-orm/pg-core").PgTableWithColumns<{
635
727
  name: "product_days";
636
728
  schema: undefined;
@@ -652,7 +744,7 @@ export declare const productDaysRef: import("drizzle-orm/pg-core").PgTableWithCo
652
744
  identity: undefined;
653
745
  generated: undefined;
654
746
  }, {}, {}>;
655
- productId: import("drizzle-orm/pg-core").PgColumn<{
747
+ itineraryId: import("drizzle-orm/pg-core").PgColumn<{
656
748
  name: string;
657
749
  tableName: "product_days";
658
750
  dataType: "string";
@@ -1 +1 @@
1
- {"version":3,"file":"products-ref.d.ts","sourceRoot":"","sources":["../src/products-ref.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EActB,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ5B,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAahC,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMnC,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMnC,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQvC,CAAA"}
@@ -42,9 +42,20 @@ export const optionUnitsRef = pgTable("option_units", {
42
42
  sortOrder: integer("sort_order").notNull().default(0),
43
43
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
44
44
  });
45
+ export const productItinerariesRef = pgTable("product_itineraries", {
46
+ id: typeId("product_itineraries").primaryKey(),
47
+ productId: typeIdRef("product_id").notNull(),
48
+ name: text("name").notNull(),
49
+ isDefault: boolean("is_default").notNull().default(false),
50
+ sortOrder: integer("sort_order").notNull().default(0),
51
+ });
52
+ // product_days was re-parented to product_itineraries in products, so the
53
+ // historical `product_days.product_id` column no longer exists. Bookings'
54
+ // getConvertProductData joins through product_itineraries to keep the
55
+ // per-product day lookup working.
45
56
  export const productDaysRef = pgTable("product_days", {
46
57
  id: typeId("product_days").primaryKey(),
47
- productId: typeIdRef("product_id").notNull(),
58
+ itineraryId: typeIdRef("itinerary_id").notNull(),
48
59
  dayNumber: integer("day_number").notNull(),
49
60
  });
50
61
  export const productDayServicesRef = pgTable("product_day_services", {
@@ -1,4 +1,4 @@
1
- import type { ModuleContainer } from "@voyantjs/core";
1
+ import type { EventBus, ModuleContainer } from "@voyantjs/core";
2
2
  import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
3
3
  import type { Context } from "hono";
4
4
  export type KmsBindings = Partial<{
@@ -25,6 +25,7 @@ export type Env = {
25
25
  Variables: {
26
26
  container?: ModuleContainer;
27
27
  db: PostgresJsDatabase;
28
+ eventBus?: EventBus;
28
29
  userId?: string;
29
30
  actor?: "staff" | "customer" | "partner" | "supplier";
30
31
  callerType?: "session" | "api_key" | "internal";
@@ -1 +1 @@
1
- {"version":3,"file":"routes-shared.d.ts","sourceRoot":"","sources":["../src/routes-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,yBAAyB,EAAE,MAAM,CAAA;IACjC,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,6BAA6B,EAAE,MAAM,CAAA;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,iBAAiB,EAAE,MAAM,CAAA;IACzB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;IACxB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,2BA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;QACxB,iBAAiB,CAAC,EAAE,OAAO,CAAA;QAC3B,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE;YAC3B,EAAE,EAAE,kBAAkB,CAAA;YACtB,MAAM,CAAC,EAAE,MAAM,CAAA;YACf,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAA;YACrD,UAAU,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAA;YAC/C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;YACxB,iBAAiB,CAAC,EAAE,OAAO,CAAA;YAC3B,SAAS,EAAE,MAAM,CAAA;YACjB,UAAU,EAAE,MAAM,CAAA;YAClB,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAA;SACrC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;KACjC,CAAA;CACF,CAAA;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;EAY5C;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM;;gBAEnE"}
package/dist/routes.d.ts CHANGED
@@ -52,6 +52,88 @@ export declare const bookingRoutes: import("hono/hono-base").HonoBase<Env, ({
52
52
  status: import("hono/utils/http-status").ContentfulStatusCode;
53
53
  };
54
54
  };
55
+ } & {
56
+ "/pricing-preview": {
57
+ $post: {
58
+ input: {};
59
+ output: {
60
+ error: string;
61
+ };
62
+ outputFormat: "json";
63
+ status: 404;
64
+ } | {
65
+ input: {};
66
+ output: {
67
+ data: {
68
+ catalog: {
69
+ id: string;
70
+ currencyCode: string | null;
71
+ };
72
+ options: {
73
+ id: string;
74
+ name: string;
75
+ isDefault: boolean;
76
+ }[];
77
+ rules: {
78
+ id: string;
79
+ optionId: string;
80
+ pricingMode: string;
81
+ baseSellAmountCents: number | null;
82
+ isDefault: boolean;
83
+ }[];
84
+ unitPrices: {
85
+ tiers: {
86
+ id: string;
87
+ optionUnitPriceRuleId: string;
88
+ minQuantity: number;
89
+ maxQuantity: number | null;
90
+ sellAmountCents: number | null;
91
+ sortOrder: number;
92
+ }[];
93
+ id: string;
94
+ optionPriceRuleId: string;
95
+ unitId: string;
96
+ unitName: string;
97
+ unitType: string | null;
98
+ pricingCategoryId: string | null;
99
+ pricingMode: string;
100
+ sellAmountCents: number | null;
101
+ minQuantity: number | null;
102
+ maxQuantity: number | null;
103
+ }[];
104
+ };
105
+ };
106
+ outputFormat: "json";
107
+ status: import("hono/utils/http-status").ContentfulStatusCode;
108
+ };
109
+ };
110
+ } & {
111
+ "/aggregates": {
112
+ $get: {
113
+ input: {};
114
+ output: {
115
+ data: {
116
+ total: number;
117
+ countsByStatus: {
118
+ status: "cancelled" | "draft" | "on_hold" | "confirmed" | "in_progress" | "completed" | "expired";
119
+ count: number;
120
+ }[];
121
+ monthlyCounts: {
122
+ yearMonth: string;
123
+ count: number;
124
+ }[];
125
+ monthlyRevenue: {
126
+ yearMonth: string;
127
+ currency: string;
128
+ sellAmountCents: number;
129
+ }[];
130
+ upcomingDepartures: number;
131
+ };
132
+ };
133
+ outputFormat: "json";
134
+ status: import("hono/utils/http-status").ContentfulStatusCode;
135
+ };
136
+ };
55
137
  } & {
56
138
  "/overview": {
57
139
  $get: {
@@ -954,7 +1036,7 @@ export declare const bookingRoutes: import("hono/hono-base").HonoBase<Env, ({
954
1036
  redeemedAt: string | null;
955
1037
  createdAt: string;
956
1038
  updatedAt: string;
957
- } | null;
1039
+ } | null | undefined;
958
1040
  };
959
1041
  outputFormat: "json";
960
1042
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAi1Ba,CAAA;AAEvC,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAA;AAChD,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
package/dist/routes.js CHANGED
@@ -6,8 +6,8 @@ import { bookingGroupRoutes } from "./routes-groups.js";
6
6
  import { bookingPiiAccessLog } from "./schema.js";
7
7
  import { bookingsService } from "./service.js";
8
8
  import { bookingGroupsService } from "./service-groups.js";
9
- import { publicBookingsService } from "./service-public.js";
10
- import { bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingItemSchema, insertBookingItemTravelerSchema, insertBookingNoteSchema, insertSupplierStatusSchema, insertTravelerSchema, internalBookingOverviewLookupQuerySchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingFulfillmentSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateSupplierStatusSchema, updateTravelerSchema, upsertTravelerTravelDetailsSchema, } from "./validation.js";
9
+ import { publicBookingsService, resolveSessionPricingSnapshot } from "./service-public.js";
10
+ import { bookingAggregatesQuerySchema, bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, createBookingSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingItemSchema, insertBookingItemTravelerSchema, insertBookingNoteSchema, insertSupplierStatusSchema, insertTravelerSchema, internalBookingOverviewLookupQuerySchema, pricingPreviewSchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingFulfillmentSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateSupplierStatusSchema, updateTravelerSchema, upsertTravelerTravelDetailsSchema, } from "./validation.js";
11
11
  function hasPiiScope(scopes, action) {
12
12
  if (!scopes || scopes.length === 0) {
13
13
  return false;
@@ -137,7 +137,24 @@ export const bookingRoutes = new Hono()
137
137
  const query = parseQuery(c, bookingListQuerySchema);
138
138
  return c.json(await bookingsService.listBookings(c.get("db"), query));
139
139
  })
140
- // 1a. GET /overviewInternal/admin booking overview lookup
140
+ // 1a. POST /pricing-previewResolve a pricing snapshot without creating a session.
141
+ .post("/pricing-preview", async (c) => {
142
+ const body = await parseJsonBody(c, pricingPreviewSchema);
143
+ const snapshot = await resolveSessionPricingSnapshot(c.get("db"), body.productId, {
144
+ optionId: body.optionId ?? undefined,
145
+ catalogId: body.catalogId ?? undefined,
146
+ });
147
+ if (!snapshot) {
148
+ return c.json({ error: "Pricing unavailable for this selection" }, 404);
149
+ }
150
+ return c.json({ data: snapshot });
151
+ })
152
+ // 1b. GET /aggregates — Pre-aggregated dashboard metrics
153
+ .get("/aggregates", async (c) => {
154
+ const query = parseQuery(c, bookingAggregatesQuerySchema);
155
+ return c.json({ data: await bookingsService.getBookingAggregates(c.get("db"), query) });
156
+ })
157
+ // 1b. GET /overview — Internal/admin booking overview lookup
141
158
  .get("/overview", async (c) => {
142
159
  const overview = await publicBookingsService.getOverviewByLookup(c.get("db"), parseQuery(c, internalBookingOverviewLookupQuerySchema));
143
160
  if (!overview) {
@@ -268,7 +285,7 @@ export const bookingRoutes = new Hono()
268
285
  // ==========================================================================
269
286
  // 7. PATCH /:id/status — Change booking status
270
287
  .patch("/:id/status", async (c) => {
271
- const result = await bookingsService.updateBookingStatus(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateBookingStatusSchema), c.get("userId"));
288
+ const result = await bookingsService.updateBookingStatus(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateBookingStatusSchema), c.get("userId"), { eventBus: c.get("eventBus") });
272
289
  if (result.status === "not_found") {
273
290
  return c.json({ error: "Booking not found" }, 404);
274
291
  }
@@ -282,7 +299,7 @@ export const bookingRoutes = new Hono()
282
299
  })
283
300
  // 8. POST /:id/confirm — Confirm an on-hold booking
284
301
  .post("/:id/confirm", async (c) => {
285
- const result = await bookingsService.confirmBooking(c.get("db"), c.req.param("id"), await parseJsonBody(c, confirmBookingSchema), c.get("userId"));
302
+ const result = await bookingsService.confirmBooking(c.get("db"), c.req.param("id"), await parseJsonBody(c, confirmBookingSchema), c.get("userId"), { eventBus: c.get("eventBus") });
286
303
  if (result.status === "not_found") {
287
304
  return c.json({ error: "Booking not found" }, 404);
288
305
  }
@@ -316,7 +333,7 @@ export const bookingRoutes = new Hono()
316
333
  })
317
334
  // 10. POST /:id/expire — Expire an on-hold booking
318
335
  .post("/:id/expire", async (c) => {
319
- const result = await bookingsService.expireBooking(c.get("db"), c.req.param("id"), await parseJsonBody(c, expireBookingSchema), c.get("userId"));
336
+ const result = await bookingsService.expireBooking(c.get("db"), c.req.param("id"), await parseJsonBody(c, expireBookingSchema), c.get("userId"), { eventBus: c.get("eventBus"), cause: "route" });
320
337
  if (result.status === "not_found") {
321
338
  return c.json({ error: "Booking not found" }, 404);
322
339
  }
@@ -330,11 +347,11 @@ export const bookingRoutes = new Hono()
330
347
  })
331
348
  // 10b. POST /expire-stale — Expire all stale on-hold bookings up to a cutoff
332
349
  .post("/expire-stale", async (c) => {
333
- return c.json(await bookingsService.expireStaleBookings(c.get("db"), await parseJsonBody(c, expireStaleBookingsSchema), c.get("userId")));
350
+ return c.json(await bookingsService.expireStaleBookings(c.get("db"), await parseJsonBody(c, expireStaleBookingsSchema), c.get("userId"), { eventBus: c.get("eventBus") }));
334
351
  })
335
352
  // 11. POST /:id/cancel — Cancel a booking and release allocations
336
353
  .post("/:id/cancel", async (c) => {
337
- const result = await bookingsService.cancelBooking(c.get("db"), c.req.param("id"), await parseJsonBody(c, cancelBookingSchema), c.get("userId"));
354
+ const result = await bookingsService.cancelBooking(c.get("db"), c.req.param("id"), await parseJsonBody(c, cancelBookingSchema), c.get("userId"), { eventBus: c.get("eventBus") });
338
355
  if (result.status === "not_found") {
339
356
  return c.json({ error: "Booking not found" }, 404);
340
357
  }
@@ -1,5 +1,58 @@
1
1
  import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
2
  import type { InternalBookingOverviewLookupQuery, PublicBookingOverviewLookupQuery, PublicBookingSessionMutationInput, PublicBookingSessionRepriceInput, PublicCreateBookingSessionInput, PublicUpdateBookingSessionInput, PublicUpsertBookingSessionStateInput } from "./validation-public.js";
3
+ /**
4
+ * Resolves the catalog-scoped pricing snapshot for a product (options → option
5
+ * price rules → per-unit price rules → tiers). The snapshot is the same data
6
+ * the storefront booking session uses to compute a total — exposing it as a
7
+ * standalone admin preview lets operator dialogs, tour-sheet exports, and
8
+ * reconciliation flows see the same numbers the customer would see, without
9
+ * creating a throwaway session.
10
+ *
11
+ * Returns `null` when the product isn't publicly visible or there's no active
12
+ * catalog / matching option (caller can decide whether to 404 or surface a
13
+ * "pricing unavailable for this selection" message).
14
+ */
15
+ export declare function resolveSessionPricingSnapshot(db: PostgresJsDatabase, productId: string, input: {
16
+ catalogId?: string | undefined;
17
+ optionId?: string | undefined;
18
+ }): Promise<{
19
+ catalog: {
20
+ id: string;
21
+ currencyCode: string | null;
22
+ };
23
+ options: {
24
+ id: string;
25
+ name: string;
26
+ isDefault: boolean;
27
+ }[];
28
+ rules: {
29
+ id: string;
30
+ optionId: string;
31
+ pricingMode: string;
32
+ baseSellAmountCents: number | null;
33
+ isDefault: boolean;
34
+ }[];
35
+ unitPrices: {
36
+ tiers: {
37
+ id: string;
38
+ optionUnitPriceRuleId: string;
39
+ minQuantity: number;
40
+ maxQuantity: number | null;
41
+ sellAmountCents: number | null;
42
+ sortOrder: number;
43
+ }[];
44
+ id: string;
45
+ optionPriceRuleId: string;
46
+ unitId: string;
47
+ unitName: string;
48
+ unitType: string | null;
49
+ pricingCategoryId: string | null;
50
+ pricingMode: string;
51
+ sellAmountCents: number | null;
52
+ minQuantity: number | null;
53
+ maxQuantity: number | null;
54
+ }[];
55
+ } | null>;
3
56
  export declare const publicBookingsService: {
4
57
  createSession(db: PostgresJsDatabase, input: PublicCreateBookingSessionInput, userId?: string): Promise<{
5
58
  status: Exclude<string, "ok">;
@@ -1 +1 @@
1
- {"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAoBjE,OAAO,KAAK,EACV,kCAAkC,EAClC,gCAAgC,EAChC,iCAAiC,EACjC,gCAAgC,EAEhC,+BAA+B,EAC/B,+BAA+B,EAC/B,oCAAoC,EACrC,MAAM,wBAAwB,CAAA;AA+xB/B,eAAO,MAAM,qBAAqB;sBAE1B,kBAAkB,SACf,+BAA+B,WAC7B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAjHT,MAAM;gCACE,MAAM;0BACZ,MAAM;+BACD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAuLH,kBAAkB,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA1LhD,MAAM;4BACE,MAAM;sBACZ,MAAM;2BACD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2LI,kBAAkB,aAAa,MAAM;;;;;;;;;;2BAUzD,kBAAkB,aACX,MAAM,SACV,oCAAoC;;;;;;;;;;;;;;;;sBAoBvC,kBAAkB,aACX,MAAM,SACV,+BAA+B,WAC7B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAjOT,MAAM;gCACE,MAAM;0BACZ,MAAM;+BACD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA6UhB,kBAAkB,aACX,MAAM,SACV,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;wBAwC7B,MA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;;;;;;;;;;;;;;;;;;;CAs/BvB,CAAA"}
@@ -313,7 +313,19 @@ function buildUnitWarnings(unit, quantity, sessionPax) {
313
313
  }
314
314
  return warnings;
315
315
  }
316
- async function resolveSessionPricingSnapshot(db, productId, input) {
316
+ /**
317
+ * Resolves the catalog-scoped pricing snapshot for a product (options → option
318
+ * price rules → per-unit price rules → tiers). The snapshot is the same data
319
+ * the storefront booking session uses to compute a total — exposing it as a
320
+ * standalone admin preview lets operator dialogs, tour-sheet exports, and
321
+ * reconciliation flows see the same numbers the customer would see, without
322
+ * creating a throwaway session.
323
+ *
324
+ * Returns `null` when the product isn't publicly visible or there's no active
325
+ * catalog / matching option (caller can decide whether to 404 or surface a
326
+ * "pricing unavailable for this selection" message).
327
+ */
328
+ export async function resolveSessionPricingSnapshot(db, productId, input) {
317
329
  const [product] = await db
318
330
  .select({
319
331
  id: productsRef.id,
package/dist/service.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import type { EventBus } from "@voyantjs/core";
1
2
  import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
3
  import type { z } from "zod";
4
+ import { bookings } from "./schema.js";
3
5
  import type { bookingListQuerySchema, cancelBookingSchema, confirmBookingSchema, convertProductSchema, expireBookingSchema, expireStaleBookingsSchema, extendBookingHoldSchema, insertBookingDocumentSchema, insertBookingFulfillmentSchema, insertBookingItemParticipantSchema, insertBookingItemSchema, insertBookingNoteSchema, insertBookingSchema, insertTravelerRecordSchema, insertTravelerSchema, recordBookingRedemptionSchema, reserveBookingFromTransactionSchema, reserveBookingSchema, updateBookingFulfillmentSchema, updateBookingItemSchema, updateBookingSchema, updateBookingStatusSchema, updateTravelerRecordSchema, updateTravelerSchema } from "./validation.js";
4
6
  type BookingListQuery = z.infer<typeof bookingListQuerySchema>;
5
7
  type ConvertProductInput = z.infer<typeof convertProductSchema>;
@@ -43,6 +45,18 @@ export interface ConvertProductData {
43
45
  id: string;
44
46
  name: string;
45
47
  } | null;
48
+ /**
49
+ * Availability slot the caller chose, if any. When set, the resulting booking
50
+ * pins its startDate/endDate to the slot so recurring/scheduled products don't
51
+ * land with null dates.
52
+ */
53
+ slot?: {
54
+ id: string;
55
+ dateLocal: string;
56
+ startsAt: Date;
57
+ endsAt: Date | null;
58
+ timezone: string;
59
+ } | null;
46
60
  dayServices: Array<{
47
61
  supplierServiceId: string | null;
48
62
  name: string;
@@ -59,7 +73,85 @@ export interface ConvertProductData {
59
73
  sortOrder: number;
60
74
  }>;
61
75
  }
76
+ /**
77
+ * Optional runtime hooks for status-transition flows. Keeps the service
78
+ * decoupled from delivery concerns — bookings only has to emit, never know
79
+ * what listens.
80
+ */
81
+ export interface BookingServiceRuntime {
82
+ eventBus?: EventBus;
83
+ }
84
+ /**
85
+ * Payload shape for `booking.confirmed`. Subscribers should treat unknown
86
+ * fields as forward-compatible additions.
87
+ */
88
+ export interface BookingConfirmedEvent {
89
+ bookingId: string;
90
+ bookingNumber: string;
91
+ actorId: string | null;
92
+ }
93
+ /**
94
+ * Payload for `booking.cancelled`. `previousStatus` is the state the booking
95
+ * transitioned *out of* — useful for subscribers that care about cancelling a
96
+ * confirmed booking (refund flow) vs cancelling a draft/hold (no side effects).
97
+ */
98
+ export interface BookingCancelledEvent {
99
+ bookingId: string;
100
+ bookingNumber: string;
101
+ previousStatus: "draft" | "on_hold" | "confirmed" | "in_progress";
102
+ actorId: string | null;
103
+ }
104
+ /**
105
+ * Payload for `booking.expired`. Fires when an on-hold booking's timer runs
106
+ * out. `cause` flags whether it was the explicit route call or the sweep job —
107
+ * subscribers that want to email the customer should probably skip
108
+ * sweep-originated events to avoid pager noise during backfills.
109
+ */
110
+ export interface BookingExpiredEvent {
111
+ bookingId: string;
112
+ bookingNumber: string;
113
+ cause: "route" | "sweep";
114
+ actorId: string | null;
115
+ }
116
+ type BookingStatus = (typeof bookings.$inferSelect)["status"];
117
+ export interface BookingAggregates {
118
+ /** Total bookings across all statuses in range. */
119
+ total: number;
120
+ /** One row per booking status (including zero counts for active statuses). */
121
+ countsByStatus: Array<{
122
+ status: BookingStatus;
123
+ count: number;
124
+ }>;
125
+ /** Booking counts bucketed by YYYY-MM (UTC), oldest first. */
126
+ monthlyCounts: Array<{
127
+ yearMonth: string;
128
+ count: number;
129
+ }>;
130
+ /**
131
+ * Sell revenue bucketed by YYYY-MM (UTC), grouped by currency. Null currency
132
+ * rows are dropped since a booking without a sell currency is malformed.
133
+ */
134
+ monthlyRevenue: Array<{
135
+ yearMonth: string;
136
+ currency: string;
137
+ sellAmountCents: number;
138
+ }>;
139
+ /** Count of active bookings with `startDate >= today`. */
140
+ upcomingDepartures: number;
141
+ }
62
142
  export declare const bookingsService: {
143
+ /**
144
+ * Pre-aggregated dashboard numbers for the admin bookings surface. Replaces
145
+ * the pattern of fetching a large `listBookings` page and deriving KPIs
146
+ * client-side — which broke past the page limit and disagreed across apps
147
+ * on which statuses count.
148
+ *
149
+ * All ranges are UTC-based.
150
+ */
151
+ getBookingAggregates(db: PostgresJsDatabase, options?: {
152
+ from?: string;
153
+ to?: string;
154
+ }): Promise<BookingAggregates>;
63
155
  listBookings(db: PostgresJsDatabase, query: BookingListQuery): Promise<{
64
156
  data: {
65
157
  id: string;
@@ -955,10 +1047,10 @@ export declare const bookingsService: {
955
1047
  deleteBooking(db: PostgresJsDatabase, id: string): Promise<{
956
1048
  id: string;
957
1049
  } | null>;
958
- updateBookingStatus(db: PostgresJsDatabase, id: string, data: UpdateBookingStatusInput, userId?: string): Promise<{
1050
+ updateBookingStatus(db: PostgresJsDatabase, id: string, data: UpdateBookingStatusInput, userId?: string, runtime?: BookingServiceRuntime): Promise<{
959
1051
  status: Exclude<string, "ok">;
960
1052
  }>;
961
- confirmBooking(db: PostgresJsDatabase, id: string, data: ConfirmBookingInput, userId?: string): Promise<{
1053
+ confirmBooking(db: PostgresJsDatabase, id: string, data: ConfirmBookingInput, userId?: string, runtime?: BookingServiceRuntime): Promise<{
962
1054
  status: "ok";
963
1055
  booking: {
964
1056
  id: string;
@@ -1046,7 +1138,9 @@ export declare const bookingsService: {
1046
1138
  } | {
1047
1139
  status: Exclude<string, "ok">;
1048
1140
  }>;
1049
- expireBooking(db: PostgresJsDatabase, id: string, data: ExpireBookingInput, userId?: string): Promise<{
1141
+ expireBooking(db: PostgresJsDatabase, id: string, data: ExpireBookingInput, userId?: string, runtime?: BookingServiceRuntime & {
1142
+ cause?: "route" | "sweep";
1143
+ }): Promise<{
1050
1144
  status: "ok";
1051
1145
  booking: {
1052
1146
  id: string;
@@ -1090,12 +1184,12 @@ export declare const bookingsService: {
1090
1184
  } | {
1091
1185
  status: Exclude<string, "ok">;
1092
1186
  }>;
1093
- expireStaleBookings(db: PostgresJsDatabase, data: ExpireStaleBookingsInput, userId?: string): Promise<{
1187
+ expireStaleBookings(db: PostgresJsDatabase, data: ExpireStaleBookingsInput, userId?: string, runtime?: BookingServiceRuntime): Promise<{
1094
1188
  expiredIds: string[];
1095
1189
  count: number;
1096
1190
  cutoff: Date;
1097
1191
  }>;
1098
- cancelBooking(db: PostgresJsDatabase, id: string, data: CancelBookingInput, userId?: string): Promise<{
1192
+ cancelBooking(db: PostgresJsDatabase, id: string, data: CancelBookingInput, userId?: string, runtime?: BookingServiceRuntime): Promise<{
1099
1193
  status: "ok";
1100
1194
  booking: {
1101
1195
  id: string;
@@ -1138,6 +1232,7 @@ export declare const bookingsService: {
1138
1232
  } | null;
1139
1233
  } | {
1140
1234
  status: Exclude<string, "ok">;
1235
+ booking?: undefined;
1141
1236
  }>;
1142
1237
  listTravelerRecords(db: PostgresJsDatabase, bookingId: string): Omit<import("drizzle-orm/pg-core").PgSelectBase<"booking_travelers", {
1143
1238
  id: import("drizzle-orm/pg-core").PgColumn<{
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAQxC,kBAAkB,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAS7C,kBAAkB,aACX,MAAM,UACT,MAAM,QACR,sBAAsB;;;;;;;mBA+BT,kBAAkB,UAAU,MAAM;;;sBASrC,kBAAkB,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBASjD,kBAAkB,aACX,MAAM,QACX,0BAA0B;;;;;;;;;;;uBA4BT,kBAAkB,cAAc,MAAM;;;CAQhE,CAAA"}
package/dist/service.js CHANGED
@@ -1,6 +1,6 @@
1
- import { and, asc, desc, eq, ilike, inArray, lte, ne, or, sql } from "drizzle-orm";
1
+ import { and, asc, desc, eq, exists, ilike, inArray, lte, ne, or, sql } from "drizzle-orm";
2
2
  import { availabilitySlotsRef } from "./availability-ref.js";
3
- import { bookingItemProductDetailsRef, bookingProductDetailsRef, optionUnitsRef, productDayServicesRef, productDaysRef, productOptionsRef, productsRef, productTicketSettingsRef, } from "./products-ref.js";
3
+ import { bookingItemProductDetailsRef, bookingProductDetailsRef, optionUnitsRef, productDayServicesRef, productDaysRef, productItinerariesRef, productOptionsRef, productsRef, productTicketSettingsRef, } from "./products-ref.js";
4
4
  import { bookingActivityLog, bookingAllocations, bookingDocuments, bookingFulfillments, bookingItems, bookingItemTravelers, bookingNotes, bookingRedemptionEvents, bookingStaffAssignments, bookingSupplierStatuses, bookings, bookingTravelers, } from "./schema.js";
5
5
  import { cleanupGroupOnBookingCancelled } from "./service-groups.js";
6
6
  import { bookingTransactionDetailsRef, offerItemParticipantsRef, offerItemsRef, offerParticipantsRef, offerStaffAssignmentsRef, offersRef, orderItemParticipantsRef, orderItemsRef, orderParticipantsRef, orderStaffAssignmentsRef, ordersRef, } from "./transactions-ref.js";
@@ -167,10 +167,15 @@ async function getConvertProductData(db, data) {
167
167
  .limit(1);
168
168
  option = defaultOption ?? null;
169
169
  }
170
+ // product_days is keyed by itinerary_id (products re-parented days onto
171
+ // product_itineraries); getConvertProductData joins through the itinerary
172
+ // ref so the per-product day lookup still works for converts that want to
173
+ // seed booking supplier statuses from the product's day services.
170
174
  const days = await db
171
- .select()
175
+ .select({ id: productDaysRef.id, dayNumber: productDaysRef.dayNumber })
172
176
  .from(productDaysRef)
173
- .where(eq(productDaysRef.productId, product.id))
177
+ .innerJoin(productItinerariesRef, eq(productDaysRef.itineraryId, productItinerariesRef.id))
178
+ .where(eq(productItinerariesRef.productId, product.id))
174
179
  .orderBy(asc(productDaysRef.dayNumber));
175
180
  const dayServices = days.length
176
181
  ? await db
@@ -184,7 +189,9 @@ async function getConvertProductData(db, data) {
184
189
  .where(sql `${productDayServicesRef.dayId} IN (
185
190
  SELECT ${productDaysRef.id}
186
191
  FROM ${productDaysRef}
187
- WHERE ${productDaysRef.productId} = ${product.id}
192
+ INNER JOIN ${productItinerariesRef}
193
+ ON ${productDaysRef.itineraryId} = ${productItinerariesRef.id}
194
+ WHERE ${productItinerariesRef.productId} = ${product.id}
188
195
  )`)
189
196
  .orderBy(asc(productDayServicesRef.sortOrder), asc(productDayServicesRef.id))
190
197
  : [];
@@ -195,6 +202,27 @@ async function getConvertProductData(db, data) {
195
202
  .from(optionUnitsRef)
196
203
  .where(eq(optionUnitsRef.optionId, option.id))
197
204
  .orderBy(asc(optionUnitsRef.sortOrder), asc(optionUnitsRef.createdAt));
205
+ let slot = null;
206
+ if (data.slotId) {
207
+ const [selectedSlot] = await db
208
+ .select()
209
+ .from(availabilitySlotsRef)
210
+ .where(and(eq(availabilitySlotsRef.id, data.slotId), eq(availabilitySlotsRef.productId, product.id)))
211
+ .limit(1);
212
+ if (!selectedSlot) {
213
+ return null;
214
+ }
215
+ if (option && selectedSlot.optionId && selectedSlot.optionId !== option.id) {
216
+ return null;
217
+ }
218
+ slot = {
219
+ id: selectedSlot.id,
220
+ dateLocal: selectedSlot.dateLocal,
221
+ startsAt: selectedSlot.startsAt,
222
+ endsAt: selectedSlot.endsAt,
223
+ timezone: selectedSlot.timezone,
224
+ };
225
+ }
198
226
  return {
199
227
  product: {
200
228
  id: product.id,
@@ -209,6 +237,7 @@ async function getConvertProductData(db, data) {
209
237
  pax: product.pax,
210
238
  },
211
239
  option: option ? { id: option.id, name: option.name } : null,
240
+ slot,
212
241
  dayServices,
213
242
  units: units.map((unit) => ({
214
243
  id: unit.id,
@@ -799,7 +828,92 @@ async function autoIssueFulfillmentsForBooking(db, bookingId, userId) {
799
828
  metadata: { count: fulfillmentsToInsert.length },
800
829
  });
801
830
  }
831
+ /**
832
+ * Booking statuses that count as "active" for aggregate purposes (matches the
833
+ * slot-unit-availability counting rules — cancelled and expired drop out).
834
+ */
835
+ const AGGREGATE_ACTIVE_STATUSES = [
836
+ "draft",
837
+ "on_hold",
838
+ "confirmed",
839
+ "in_progress",
840
+ "completed",
841
+ ];
802
842
  export const bookingsService = {
843
+ /**
844
+ * Pre-aggregated dashboard numbers for the admin bookings surface. Replaces
845
+ * the pattern of fetching a large `listBookings` page and deriving KPIs
846
+ * client-side — which broke past the page limit and disagreed across apps
847
+ * on which statuses count.
848
+ *
849
+ * All ranges are UTC-based.
850
+ */
851
+ async getBookingAggregates(db, options = {}) {
852
+ const fromDate = options.from ? new Date(options.from) : undefined;
853
+ const toDate = options.to ? new Date(options.to) : undefined;
854
+ const rangeConditions = [];
855
+ if (fromDate)
856
+ rangeConditions.push(sql `${bookings.createdAt} >= ${fromDate}`);
857
+ if (toDate)
858
+ rangeConditions.push(sql `${bookings.createdAt} < ${toDate}`);
859
+ const rangeWhere = rangeConditions.length ? and(...rangeConditions) : undefined;
860
+ const [totalRow] = await db
861
+ .select({ count: sql `count(*)::int` })
862
+ .from(bookings)
863
+ .where(rangeWhere);
864
+ const statusRows = await db
865
+ .select({
866
+ status: bookings.status,
867
+ count: sql `count(*)::int`,
868
+ })
869
+ .from(bookings)
870
+ .where(rangeWhere)
871
+ .groupBy(bookings.status);
872
+ const countsByStatusMap = new Map(statusRows.map((row) => [row.status, row.count]));
873
+ const monthlyCountsRows = await db
874
+ .select({
875
+ yearMonth: sql `to_char(${bookings.createdAt} at time zone 'UTC', 'YYYY-MM')`,
876
+ count: sql `count(*)::int`,
877
+ })
878
+ .from(bookings)
879
+ .where(rangeWhere)
880
+ .groupBy(sql `to_char(${bookings.createdAt} at time zone 'UTC', 'YYYY-MM')`)
881
+ .orderBy(sql `to_char(${bookings.createdAt} at time zone 'UTC', 'YYYY-MM')`);
882
+ const monthlyRevenueRows = await db
883
+ .select({
884
+ yearMonth: sql `to_char(${bookings.createdAt} at time zone 'UTC', 'YYYY-MM')`,
885
+ currency: bookings.sellCurrency,
886
+ sellAmountCents: sql `coalesce(sum(${bookings.sellAmountCents}), 0)::bigint`,
887
+ })
888
+ .from(bookings)
889
+ .where(and(...(rangeConditions.length ? rangeConditions : []), sql `${bookings.sellAmountCents} IS NOT NULL`, inArray(bookings.status, [...AGGREGATE_ACTIVE_STATUSES])))
890
+ .groupBy(sql `to_char(${bookings.createdAt} at time zone 'UTC', 'YYYY-MM')`, bookings.sellCurrency)
891
+ .orderBy(sql `to_char(${bookings.createdAt} at time zone 'UTC', 'YYYY-MM')`, bookings.sellCurrency);
892
+ const todayUtc = new Date();
893
+ todayUtc.setUTCHours(0, 0, 0, 0);
894
+ const todayDateString = todayUtc.toISOString().slice(0, 10);
895
+ const [upcomingRow] = await db
896
+ .select({ count: sql `count(*)::int` })
897
+ .from(bookings)
898
+ .where(and(inArray(bookings.status, [...AGGREGATE_ACTIVE_STATUSES]), sql `${bookings.startDate} >= ${todayDateString}`));
899
+ return {
900
+ total: totalRow?.count ?? 0,
901
+ countsByStatus: AGGREGATE_ACTIVE_STATUSES.concat(["expired", "cancelled"]).map((status) => ({
902
+ status,
903
+ count: countsByStatusMap.get(status) ?? 0,
904
+ })),
905
+ monthlyCounts: monthlyCountsRows.map((row) => ({
906
+ yearMonth: row.yearMonth,
907
+ count: row.count,
908
+ })),
909
+ monthlyRevenue: monthlyRevenueRows.map((row) => ({
910
+ yearMonth: row.yearMonth,
911
+ currency: row.currency,
912
+ sellAmountCents: Number(row.sellAmountCents),
913
+ })),
914
+ upcomingDepartures: upcomingRow?.count ?? 0,
915
+ };
916
+ },
803
917
  async listBookings(db, query) {
804
918
  const conditions = [];
805
919
  if (query.status) {
@@ -809,6 +923,25 @@ export const bookingsService = {
809
923
  const term = `%${query.search}%`;
810
924
  conditions.push(or(ilike(bookings.bookingNumber, term), ilike(bookings.internalNotes, term)));
811
925
  }
926
+ if (query.personId) {
927
+ conditions.push(eq(bookings.personId, query.personId));
928
+ }
929
+ if (query.organizationId) {
930
+ conditions.push(eq(bookings.organizationId, query.organizationId));
931
+ }
932
+ if (query.productId || query.optionId) {
933
+ const itemConditions = [eq(bookingItems.bookingId, bookings.id)];
934
+ if (query.productId) {
935
+ itemConditions.push(eq(bookingItems.productId, query.productId));
936
+ }
937
+ if (query.optionId) {
938
+ itemConditions.push(eq(bookingItems.optionId, query.optionId));
939
+ }
940
+ conditions.push(exists(db
941
+ .select({ one: sql `1` })
942
+ .from(bookingItems)
943
+ .where(and(...itemConditions))));
944
+ }
812
945
  const where = conditions.length > 0 ? and(...conditions) : undefined;
813
946
  const [rows, countResult] = await Promise.all([
814
947
  db
@@ -828,7 +961,16 @@ export const bookingsService = {
828
961
  };
829
962
  },
830
963
  async convertProductToBooking(db, data, productData, userId) {
831
- const { product, option, dayServices, units } = productData;
964
+ const { product, option, slot, dayServices, units } = productData;
965
+ // Slot dates win over product dates so scheduled/recurring products don't
966
+ // land with null dates. endsAt is a timestamp; fall back to the slot's
967
+ // dateLocal when the slot has no explicit end timestamp.
968
+ const startDate = slot?.dateLocal ?? product.startDate;
969
+ const endDate = slot
970
+ ? slot.endsAt
971
+ ? slot.endsAt.toISOString().slice(0, 10)
972
+ : slot.dateLocal
973
+ : product.endDate;
832
974
  const [booking] = await db
833
975
  .insert(bookings)
834
976
  .values({
@@ -840,8 +982,8 @@ export const bookingsService = {
840
982
  sellAmountCents: product.sellAmountCents,
841
983
  costAmountCents: product.costAmountCents,
842
984
  marginPercent: product.marginPercent,
843
- startDate: product.startDate,
844
- endDate: product.endDate,
985
+ startDate,
986
+ endDate,
845
987
  pax: product.pax,
846
988
  internalNotes: data.internalNotes ?? null,
847
989
  })
@@ -865,6 +1007,14 @@ export const bookingsService = {
865
1007
  : selectedUnits.length === 1
866
1008
  ? selectedUnits
867
1009
  : [];
1010
+ const slotFields = slot
1011
+ ? {
1012
+ serviceDate: slot.dateLocal,
1013
+ startsAt: slot.startsAt,
1014
+ endsAt: slot.endsAt,
1015
+ metadata: { availabilitySlotId: slot.id },
1016
+ }
1017
+ : { metadata: null };
868
1018
  const itemRows = unitsToSeed.length > 0
869
1019
  ? unitsToSeed.map((unit, index) => {
870
1020
  const quantity = unit.unitType === "person" && product.pax
@@ -897,6 +1047,7 @@ export const bookingsService = {
897
1047
  productId: product.id,
898
1048
  optionId: option?.id ?? null,
899
1049
  optionUnitId: unit.id,
1050
+ ...slotFields,
900
1051
  };
901
1052
  })
902
1053
  : [
@@ -916,6 +1067,7 @@ export const bookingsService = {
916
1067
  productId: product.id,
917
1068
  optionId: option?.id ?? null,
918
1069
  optionUnitId: null,
1070
+ ...slotFields,
919
1071
  },
920
1072
  ];
921
1073
  const insertedItems = await db.insert(bookingItems).values(itemRows).returning();
@@ -948,7 +1100,12 @@ export const bookingsService = {
948
1100
  actorId: userId ?? "system",
949
1101
  activityType: "booking_converted",
950
1102
  description: `Booking converted from product "${product.name}"`,
951
- metadata: { productId: product.id, productName: product.name, optionId: option?.id ?? null },
1103
+ metadata: {
1104
+ productId: product.id,
1105
+ productName: product.name,
1106
+ optionId: option?.id ?? null,
1107
+ slotId: slot?.id ?? null,
1108
+ },
952
1109
  });
953
1110
  return booking;
954
1111
  },
@@ -1324,7 +1481,7 @@ export const bookingsService = {
1324
1481
  .returning({ id: bookings.id });
1325
1482
  return row ?? null;
1326
1483
  },
1327
- async updateBookingStatus(db, id, data, userId) {
1484
+ async updateBookingStatus(db, id, data, userId, runtime = {}) {
1328
1485
  const [current] = await db
1329
1486
  .select({ id: bookings.id, status: bookings.status })
1330
1487
  .from(bookings)
@@ -1334,13 +1491,13 @@ export const bookingsService = {
1334
1491
  return { status: "not_found" };
1335
1492
  }
1336
1493
  if (current.status === "on_hold" && data.status === "confirmed") {
1337
- return bookingsService.confirmBooking(db, id, { note: data.note }, userId);
1494
+ return bookingsService.confirmBooking(db, id, { note: data.note }, userId, runtime);
1338
1495
  }
1339
1496
  if (current.status === "on_hold" && data.status === "expired") {
1340
- return bookingsService.expireBooking(db, id, { note: data.note }, userId);
1497
+ return bookingsService.expireBooking(db, id, { note: data.note }, userId, runtime);
1341
1498
  }
1342
1499
  if (data.status === "cancelled") {
1343
- return bookingsService.cancelBooking(db, id, { note: data.note }, userId);
1500
+ return bookingsService.cancelBooking(db, id, { note: data.note }, userId, runtime);
1344
1501
  }
1345
1502
  if (data.status === "on_hold") {
1346
1503
  return { status: "invalid_transition" };
@@ -1376,9 +1533,9 @@ export const bookingsService = {
1376
1533
  }
1377
1534
  return { status: "ok", booking: row ?? null };
1378
1535
  },
1379
- async confirmBooking(db, id, data, userId) {
1536
+ async confirmBooking(db, id, data, userId, runtime = {}) {
1380
1537
  try {
1381
- return await db.transaction(async (tx) => {
1538
+ const result = await db.transaction(async (tx) => {
1382
1539
  const rows = await tx.execute(sql `SELECT id, booking_number, status, hold_expires_at
1383
1540
  FROM ${bookings}
1384
1541
  WHERE ${bookings.id} = ${id}
@@ -1432,6 +1589,17 @@ export const bookingsService = {
1432
1589
  }
1433
1590
  return { status: "ok", booking: row ?? null };
1434
1591
  });
1592
+ // Emit AFTER the transaction commits so subscribers can't observe a
1593
+ // confirmed state that might still roll back. `emit` is fire-and-forget
1594
+ // per the EventBus contract — subscriber errors are logged, not rethrown.
1595
+ if (result.status === "ok" && result.booking) {
1596
+ await runtime.eventBus?.emit("booking.confirmed", {
1597
+ bookingId: result.booking.id,
1598
+ bookingNumber: result.booking.bookingNumber,
1599
+ actorId: userId ?? null,
1600
+ }, { category: "domain", source: "service" });
1601
+ }
1602
+ return result;
1435
1603
  }
1436
1604
  catch (error) {
1437
1605
  if (error instanceof BookingServiceError) {
@@ -1490,9 +1658,9 @@ export const bookingsService = {
1490
1658
  throw error;
1491
1659
  }
1492
1660
  },
1493
- async expireBooking(db, id, data, userId) {
1661
+ async expireBooking(db, id, data, userId, runtime = {}) {
1494
1662
  try {
1495
- return await db.transaction(async (tx) => {
1663
+ const result = await db.transaction(async (tx) => {
1496
1664
  const rows = await tx.execute(sql `SELECT id, status, hold_expires_at
1497
1665
  FROM ${bookings}
1498
1666
  WHERE ${bookings.id} = ${id}
@@ -1549,6 +1717,15 @@ export const bookingsService = {
1549
1717
  }
1550
1718
  return { status: "ok", booking: row ?? null };
1551
1719
  });
1720
+ if (result.status === "ok" && result.booking) {
1721
+ await runtime.eventBus?.emit("booking.expired", {
1722
+ bookingId: result.booking.id,
1723
+ bookingNumber: result.booking.bookingNumber,
1724
+ cause: runtime.cause ?? "route",
1725
+ actorId: userId ?? null,
1726
+ }, { category: "domain", source: "service" });
1727
+ }
1728
+ return result;
1552
1729
  }
1553
1730
  catch (error) {
1554
1731
  if (error instanceof BookingServiceError) {
@@ -1557,7 +1734,7 @@ export const bookingsService = {
1557
1734
  throw error;
1558
1735
  }
1559
1736
  },
1560
- async expireStaleBookings(db, data, userId) {
1737
+ async expireStaleBookings(db, data, userId, runtime = {}) {
1561
1738
  const cutoff = data.before ? new Date(data.before) : new Date();
1562
1739
  const staleBookings = await db
1563
1740
  .select({ id: bookings.id })
@@ -1566,7 +1743,7 @@ export const bookingsService = {
1566
1743
  .orderBy(asc(bookings.holdExpiresAt), asc(bookings.createdAt));
1567
1744
  const expiredIds = [];
1568
1745
  for (const booking of staleBookings) {
1569
- const result = await this.expireBooking(db, booking.id, { note: data.note ?? "Hold expired by sweep" }, userId);
1746
+ const result = await this.expireBooking(db, booking.id, { note: data.note ?? "Hold expired by sweep" }, userId, { ...runtime, cause: "sweep" });
1570
1747
  if ("booking" in result && result.booking) {
1571
1748
  expiredIds.push(result.booking.id);
1572
1749
  }
@@ -1577,9 +1754,9 @@ export const bookingsService = {
1577
1754
  cutoff,
1578
1755
  };
1579
1756
  },
1580
- async cancelBooking(db, id, data, userId) {
1757
+ async cancelBooking(db, id, data, userId, runtime = {}) {
1581
1758
  try {
1582
- return await db.transaction(async (tx) => {
1759
+ const result = await db.transaction(async (tx) => {
1583
1760
  const rows = await tx.execute(sql `SELECT id, status
1584
1761
  FROM ${bookings}
1585
1762
  WHERE ${bookings.id} = ${id}
@@ -1591,6 +1768,7 @@ export const bookingsService = {
1591
1768
  if (!["draft", "on_hold", "confirmed", "in_progress"].includes(booking.status)) {
1592
1769
  throw new BookingServiceError("invalid_transition");
1593
1770
  }
1771
+ const previousStatus = booking.status;
1594
1772
  const allocations = await tx
1595
1773
  .select()
1596
1774
  .from(bookingAllocations)
@@ -1640,8 +1818,17 @@ export const bookingsService = {
1640
1818
  }
1641
1819
  // Clean up any booking-group membership (dissolve if ≤1 active members remain).
1642
1820
  await cleanupGroupOnBookingCancelled(tx, id);
1643
- return { status: "ok", booking: row ?? null };
1821
+ return { status: "ok", booking: row ?? null, previousStatus };
1644
1822
  });
1823
+ if (result.status === "ok" && result.booking) {
1824
+ await runtime.eventBus?.emit("booking.cancelled", {
1825
+ bookingId: result.booking.id,
1826
+ bookingNumber: result.booking.bookingNumber,
1827
+ previousStatus: result.previousStatus,
1828
+ actorId: userId ?? null,
1829
+ }, { category: "domain", source: "service" });
1830
+ }
1831
+ return { status: result.status, booking: result.booking };
1645
1832
  }
1646
1833
  catch (error) {
1647
1834
  if (error instanceof BookingServiceError) {
@@ -161,17 +161,36 @@ export declare const bookingListQuerySchema: z.ZodObject<{
161
161
  expired: "expired";
162
162
  }>>;
163
163
  search: z.ZodOptional<z.ZodString>;
164
+ productId: z.ZodOptional<z.ZodString>;
165
+ optionId: z.ZodOptional<z.ZodString>;
166
+ personId: z.ZodOptional<z.ZodString>;
167
+ organizationId: z.ZodOptional<z.ZodString>;
164
168
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
165
169
  offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
166
170
  }, z.core.$strip>;
171
+ export declare const bookingAggregatesQuerySchema: z.ZodObject<{
172
+ from: z.ZodOptional<z.ZodString>;
173
+ to: z.ZodOptional<z.ZodString>;
174
+ }, z.core.$strip>;
167
175
  export declare const convertProductSchema: z.ZodObject<{
168
176
  productId: z.ZodString;
169
177
  optionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
178
+ slotId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
170
179
  bookingNumber: z.ZodString;
171
180
  personId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
172
181
  organizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
173
182
  internalNotes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
174
183
  }, z.core.$strip>;
184
+ /**
185
+ * Admin pricing-preview request. Mirrors the storefront pricing session
186
+ * resolver input so the operator dialog sees the same numbers the customer
187
+ * would see for the same product + option + catalog.
188
+ */
189
+ export declare const pricingPreviewSchema: z.ZodObject<{
190
+ productId: z.ZodString;
191
+ optionId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
192
+ catalogId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
193
+ }, z.core.$strip>;
175
194
  export declare const updateBookingStatusSchema: z.ZodObject<{
176
195
  status: z.ZodEnum<{
177
196
  cancelled: "cancelled";
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA2DvB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAoB,CAAA;AACpD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA8B,CAAA;AAE9D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAW5B,CAAA;AAEJ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;iBAKjC,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;iBAO/B,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;iBAGpC,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqBnC,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmB7B,CAAA;AAEJ,eAAO,MAAM,uBAAuB;;;iBAYhC,CAAA;AAEJ,eAAO,MAAM,oBAAoB;;iBAE/B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;iBAE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;;;;;;;;;;;;;;;;;;;;;;GAK1C,CAAA;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAKtC,CAAA;AAIL,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAarC,CAAA;AAIL,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;GAavC,CAAA;AAEL,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;GAAkC,CAAA;AAcjF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;iBAA2B,CAAA;AAClE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;iBAErC,CAAA;AAIF,eAAO,MAAM,uBAAuB;;iBAElC,CAAA;AAIF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;GAYnC,CAAA;AAEL,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA8B,CAAA;AAI9E,eAAO,MAAM,sBAAsB;;;EAAmC,CAAA;AACtE,eAAO,MAAM,4BAA4B;;;EAAgC,CAAA;AAWzE,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAAyB,CAAA;AAC9D,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAAmC,CAAA;AAExE,eAAO,MAAM,2BAA2B;;;;;;iBAGtC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;iBAMtC,CAAA;AAEF,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA"}
@@ -54,17 +54,36 @@ export const createBookingSchema = bookingCoreSchema
54
54
  export const bookingListQuerySchema = z.object({
55
55
  status: bookingStatusSchema.optional(),
56
56
  search: z.string().optional(),
57
+ productId: z.string().optional(),
58
+ optionId: z.string().optional(),
59
+ personId: z.string().optional(),
60
+ organizationId: z.string().optional(),
57
61
  limit: z.coerce.number().int().min(1).max(100).default(50),
58
62
  offset: z.coerce.number().int().min(0).default(0),
59
63
  });
64
+ export const bookingAggregatesQuerySchema = z.object({
65
+ from: z.string().datetime().optional(),
66
+ to: z.string().datetime().optional(),
67
+ });
60
68
  export const convertProductSchema = z.object({
61
69
  productId: z.string().min(1),
62
70
  optionId: z.string().optional().nullable(),
71
+ slotId: z.string().optional().nullable(),
63
72
  bookingNumber: z.string().min(1).max(50),
64
73
  personId: z.string().optional().nullable(),
65
74
  organizationId: z.string().optional().nullable(),
66
75
  internalNotes: z.string().optional().nullable(),
67
76
  });
77
+ /**
78
+ * Admin pricing-preview request. Mirrors the storefront pricing session
79
+ * resolver input so the operator dialog sees the same numbers the customer
80
+ * would see for the same product + option + catalog.
81
+ */
82
+ export const pricingPreviewSchema = z.object({
83
+ productId: z.string().min(1),
84
+ optionId: z.string().optional().nullable(),
85
+ catalogId: z.string().optional().nullable(),
86
+ });
68
87
  export const updateBookingStatusSchema = z.object({
69
88
  status: bookingStatusSchema,
70
89
  note: z.string().optional().nullable(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/bookings",
3
- "version": "0.6.9",
3
+ "version": "0.7.0",
4
4
  "license": "FSL-1.1-Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -49,14 +49,14 @@
49
49
  "drizzle-orm": "^0.45.2",
50
50
  "hono": "^4.12.10",
51
51
  "zod": "^4.3.6",
52
- "@voyantjs/core": "0.6.9",
53
- "@voyantjs/db": "0.6.9",
54
- "@voyantjs/hono": "0.6.9",
55
- "@voyantjs/utils": "0.6.9"
52
+ "@voyantjs/core": "0.7.0",
53
+ "@voyantjs/db": "0.7.0",
54
+ "@voyantjs/hono": "0.7.0",
55
+ "@voyantjs/utils": "0.7.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "typescript": "^6.0.2",
59
- "@voyantjs/products": "0.6.9",
59
+ "@voyantjs/products": "0.7.0",
60
60
  "@voyantjs/voyant-typescript-config": "0.1.0"
61
61
  },
62
62
  "files": [