@voyantjs/accommodations 0.55.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.
Files changed (47) hide show
  1. package/README.md +11 -0
  2. package/dist/booking-engine/handler.d.ts +103 -0
  3. package/dist/booking-engine/handler.d.ts.map +1 -0
  4. package/dist/booking-engine/handler.js +254 -0
  5. package/dist/booking-engine/index.d.ts +8 -0
  6. package/dist/booking-engine/index.d.ts.map +1 -0
  7. package/dist/booking-engine/index.js +7 -0
  8. package/dist/catalog-policy.d.ts +23 -0
  9. package/dist/catalog-policy.d.ts.map +1 -0
  10. package/dist/catalog-policy.js +422 -0
  11. package/dist/content-shape.d.ts +185 -0
  12. package/dist/content-shape.d.ts.map +1 -0
  13. package/dist/content-shape.js +122 -0
  14. package/dist/draft-shape.d.ts +35 -0
  15. package/dist/draft-shape.d.ts.map +1 -0
  16. package/dist/draft-shape.js +84 -0
  17. package/dist/index.d.ts +8 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +7 -0
  20. package/dist/routes-content.d.ts +31 -0
  21. package/dist/routes-content.d.ts.map +1 -0
  22. package/dist/routes-content.js +87 -0
  23. package/dist/schema-bookings.d.ts +582 -0
  24. package/dist/schema-bookings.d.ts.map +1 -0
  25. package/dist/schema-bookings.js +65 -0
  26. package/dist/schema-inventory.d.ts +1361 -0
  27. package/dist/schema-inventory.d.ts.map +1 -0
  28. package/dist/schema-inventory.js +132 -0
  29. package/dist/schema-shared.d.ts +5 -0
  30. package/dist/schema-shared.d.ts.map +1 -0
  31. package/dist/schema-shared.js +24 -0
  32. package/dist/schema-sourced-content.d.ts +254 -0
  33. package/dist/schema-sourced-content.d.ts.map +1 -0
  34. package/dist/schema-sourced-content.js +48 -0
  35. package/dist/schema.d.ts +5 -0
  36. package/dist/schema.d.ts.map +1 -0
  37. package/dist/schema.js +4 -0
  38. package/dist/service-catalog-plane.d.ts +55 -0
  39. package/dist/service-catalog-plane.d.ts.map +1 -0
  40. package/dist/service-catalog-plane.js +202 -0
  41. package/dist/service-content-synthesizer.d.ts +43 -0
  42. package/dist/service-content-synthesizer.d.ts.map +1 -0
  43. package/dist/service-content-synthesizer.js +149 -0
  44. package/dist/service-content.d.ts +54 -0
  45. package/dist/service-content.d.ts.map +1 -0
  46. package/dist/service-content.js +480 -0
  47. package/package.json +113 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-inventory.d.ts","sourceRoot":"","sources":["../src/schema-inventory.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CrB,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B9B,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAG,OAAO,SAAS,CAAC,YAAY,CAAA;AACvD,MAAM,MAAM,QAAQ,GAAG,OAAO,SAAS,CAAC,YAAY,CAAA;AACpD,MAAM,MAAM,WAAW,GAAG,OAAO,SAAS,CAAC,YAAY,CAAA;AACvD,MAAM,MAAM,gBAAgB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAA;AACpE,MAAM,MAAM,mBAAmB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAA"}
@@ -0,0 +1,132 @@
1
+ import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
2
+ import { properties } from "@voyantjs/facilities/schema";
3
+ import { boolean, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
4
+ import { accommodationGuaranteeModeEnum, accommodationInventoryModeEnum, ratePlanChargeFrequencyEnum, } from "./schema-shared.js";
5
+ export const roomTypes = pgTable("room_types", {
6
+ id: typeId("room_types"),
7
+ propertyId: typeIdRef("property_id")
8
+ .notNull()
9
+ .references(() => properties.id, { onDelete: "cascade" }),
10
+ supplierId: text("supplier_id"),
11
+ code: text("code"),
12
+ name: text("name").notNull(),
13
+ description: text("description"),
14
+ inventoryMode: accommodationInventoryModeEnum("inventory_mode").notNull().default("pooled"),
15
+ roomClass: text("room_class"),
16
+ maxAdults: integer("max_adults"),
17
+ maxChildren: integer("max_children"),
18
+ maxInfants: integer("max_infants"),
19
+ standardOccupancy: integer("standard_occupancy"),
20
+ maxOccupancy: integer("max_occupancy"),
21
+ minOccupancy: integer("min_occupancy"),
22
+ bedroomCount: integer("bedroom_count"),
23
+ bathroomCount: integer("bathroom_count"),
24
+ areaValue: integer("area_value"),
25
+ areaUnit: text("area_unit"),
26
+ accessibilityNotes: text("accessibility_notes"),
27
+ smokingAllowed: boolean("smoking_allowed").notNull().default(false),
28
+ active: boolean("active").notNull().default(true),
29
+ sortOrder: integer("sort_order").notNull().default(0),
30
+ metadata: jsonb("metadata").$type(),
31
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
32
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
33
+ }, (table) => [
34
+ index("idx_room_types_property_sort_name").on(table.propertyId, table.sortOrder, table.name),
35
+ index("idx_room_types_supplier_sort_name").on(table.supplierId, table.sortOrder, table.name),
36
+ index("idx_room_types_active_sort_name").on(table.active, table.sortOrder, table.name),
37
+ index("idx_room_types_inventory_mode_sort_name").on(table.inventoryMode, table.sortOrder, table.name),
38
+ uniqueIndex("uidx_room_types_property_code").on(table.propertyId, table.code),
39
+ ]);
40
+ export const roomTypeBedConfigs = pgTable("room_type_bed_configs", {
41
+ id: typeId("room_type_bed_configs"),
42
+ roomTypeId: typeIdRef("room_type_id")
43
+ .notNull()
44
+ .references(() => roomTypes.id, { onDelete: "cascade" }),
45
+ bedType: text("bed_type").notNull(),
46
+ quantity: integer("quantity").notNull().default(1),
47
+ isPrimary: boolean("is_primary").notNull().default(false),
48
+ notes: text("notes"),
49
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
50
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
51
+ }, (table) => [
52
+ index("idx_room_type_bed_configs_room_type_primary_created").on(table.roomTypeId, table.isPrimary, table.createdAt),
53
+ index("idx_room_type_bed_configs_bed_type_primary_created").on(table.bedType, table.isPrimary, table.createdAt),
54
+ ]);
55
+ export const mealPlans = pgTable("meal_plans", {
56
+ id: typeId("meal_plans"),
57
+ propertyId: typeIdRef("property_id")
58
+ .notNull()
59
+ .references(() => properties.id, { onDelete: "cascade" }),
60
+ code: text("code").notNull(),
61
+ name: text("name").notNull(),
62
+ description: text("description"),
63
+ includesBreakfast: boolean("includes_breakfast").notNull().default(false),
64
+ includesLunch: boolean("includes_lunch").notNull().default(false),
65
+ includesDinner: boolean("includes_dinner").notNull().default(false),
66
+ includesDrinks: boolean("includes_drinks").notNull().default(false),
67
+ active: boolean("active").notNull().default(true),
68
+ sortOrder: integer("sort_order").notNull().default(0),
69
+ metadata: jsonb("metadata").$type(),
70
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
71
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
72
+ }, (table) => [
73
+ index("idx_meal_plans_property_sort_name").on(table.propertyId, table.sortOrder, table.name),
74
+ index("idx_meal_plans_active_sort_name").on(table.active, table.sortOrder, table.name),
75
+ uniqueIndex("uidx_meal_plans_property_code").on(table.propertyId, table.code),
76
+ ]);
77
+ export const ratePlans = pgTable("rate_plans", {
78
+ id: typeId("rate_plans"),
79
+ propertyId: typeIdRef("property_id")
80
+ .notNull()
81
+ .references(() => properties.id, { onDelete: "cascade" }),
82
+ code: text("code").notNull(),
83
+ name: text("name").notNull(),
84
+ description: text("description"),
85
+ mealPlanId: typeIdRef("meal_plan_id").references(() => mealPlans.id, { onDelete: "set null" }),
86
+ priceCatalogId: text("price_catalog_id"),
87
+ cancellationPolicyId: text("cancellation_policy_id"),
88
+ marketId: text("market_id"),
89
+ currencyCode: text("currency_code").notNull(),
90
+ chargeFrequency: ratePlanChargeFrequencyEnum("charge_frequency").notNull().default("per_night"),
91
+ guaranteeMode: accommodationGuaranteeModeEnum("guarantee_mode").notNull().default("none"),
92
+ commissionable: boolean("commissionable").notNull().default(true),
93
+ refundable: boolean("refundable").notNull().default(true),
94
+ active: boolean("active").notNull().default(true),
95
+ sortOrder: integer("sort_order").notNull().default(0),
96
+ customerPaymentPolicy: jsonb("customer_payment_policy"),
97
+ metadata: jsonb("metadata").$type(),
98
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
99
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
100
+ }, (table) => [
101
+ index("idx_rate_plans_property_sort_name").on(table.propertyId, table.sortOrder, table.name),
102
+ index("idx_rate_plans_meal_plan_sort_name").on(table.mealPlanId, table.sortOrder, table.name),
103
+ index("idx_rate_plans_catalog").on(table.priceCatalogId),
104
+ index("idx_rate_plans_policy").on(table.cancellationPolicyId),
105
+ index("idx_rate_plans_market_sort_name").on(table.marketId, table.sortOrder, table.name),
106
+ index("idx_rate_plans_active_sort_name").on(table.active, table.sortOrder, table.name),
107
+ uniqueIndex("uidx_rate_plans_property_code").on(table.propertyId, table.code),
108
+ ]);
109
+ export const ratePlanRoomTypes = pgTable("rate_plan_room_types", {
110
+ id: typeId("rate_plan_room_types"),
111
+ ratePlanId: typeIdRef("rate_plan_id")
112
+ .notNull()
113
+ .references(() => ratePlans.id, { onDelete: "cascade" }),
114
+ roomTypeId: typeIdRef("room_type_id")
115
+ .notNull()
116
+ .references(() => roomTypes.id, { onDelete: "cascade" }),
117
+ productId: text("product_id"),
118
+ optionId: text("option_id"),
119
+ unitId: text("unit_id"),
120
+ active: boolean("active").notNull().default(true),
121
+ sortOrder: integer("sort_order").notNull().default(0),
122
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
123
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
124
+ }, (table) => [
125
+ index("idx_rate_plan_room_types_rate_plan_sort_created").on(table.ratePlanId, table.sortOrder, table.createdAt),
126
+ index("idx_rate_plan_room_types_room_type_sort_created").on(table.roomTypeId, table.sortOrder, table.createdAt),
127
+ index("idx_rate_plan_room_types_product_sort_created").on(table.productId, table.sortOrder, table.createdAt),
128
+ index("idx_rate_plan_room_types_option").on(table.optionId),
129
+ index("idx_rate_plan_room_types_unit").on(table.unitId),
130
+ index("idx_rate_plan_room_types_active_sort_created").on(table.active, table.sortOrder, table.createdAt),
131
+ uniqueIndex("uidx_rate_plan_room_types_pair").on(table.ratePlanId, table.roomTypeId),
132
+ ]);
@@ -0,0 +1,5 @@
1
+ export declare const accommodationInventoryModeEnum: import("drizzle-orm/pg-core").PgEnum<["pooled", "serialized", "virtual"]>;
2
+ export declare const ratePlanChargeFrequencyEnum: import("drizzle-orm/pg-core").PgEnum<["per_night", "per_stay", "per_person_per_night", "per_person_per_stay"]>;
3
+ export declare const accommodationGuaranteeModeEnum: import("drizzle-orm/pg-core").PgEnum<["none", "card_hold", "deposit", "full_prepay", "on_request"]>;
4
+ export declare const stayBookingItemStatusEnum: import("drizzle-orm/pg-core").PgEnum<["reserved", "cancelled", "no_show"]>;
5
+ //# sourceMappingURL=schema-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-shared.d.ts","sourceRoot":"","sources":["../src/schema-shared.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,2EAIzC,CAAA;AAEF,eAAO,MAAM,2BAA2B,gHAKtC,CAAA;AAEF,eAAO,MAAM,8BAA8B,qGAMzC,CAAA;AAEF,eAAO,MAAM,yBAAyB,4EAIpC,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { pgEnum } from "drizzle-orm/pg-core";
2
+ export const accommodationInventoryModeEnum = pgEnum("accommodation_inventory_mode", [
3
+ "pooled",
4
+ "serialized",
5
+ "virtual",
6
+ ]);
7
+ export const ratePlanChargeFrequencyEnum = pgEnum("rate_plan_charge_frequency", [
8
+ "per_night",
9
+ "per_stay",
10
+ "per_person_per_night",
11
+ "per_person_per_stay",
12
+ ]);
13
+ export const accommodationGuaranteeModeEnum = pgEnum("accommodation_guarantee_mode", [
14
+ "none",
15
+ "card_hold",
16
+ "deposit",
17
+ "full_prepay",
18
+ "on_request",
19
+ ]);
20
+ export const stayBookingItemStatusEnum = pgEnum("stay_booking_item_status", [
21
+ "reserved",
22
+ "cancelled",
23
+ "no_show",
24
+ ]);
@@ -0,0 +1,254 @@
1
+ /**
2
+ * Accommodation sourced-content cache. Sibling to
3
+ * `products_sourced_content` and `cruises_sourced_content` — same
4
+ * shape, different vertical.
5
+ *
6
+ * One row per sourced room-type × locale × market. Stores the rich
7
+ * detail-page content the upstream adapter served via `getContent`,
8
+ * plus the SWR metadata the read service needs.
9
+ *
10
+ * The accommodation vertical's catalog entry is the **room type** (the
11
+ * sellable variant within a property). Sourced room types — bedbank
12
+ * inventory like Hotelbeds / Expedia — store the property summary,
13
+ * room types, rate plans, meal plans, and amenities all in one
14
+ * payload via `getContent`.
15
+ *
16
+ * See `docs/architecture/catalog-sourced-content.md` §3.2.
17
+ */
18
+ export type AccommodationSourcedContentFetchStatus = "ok" | "stale" | "error" | "unsupported";
19
+ export declare const ACCOMMODATION_CONTENT_MARKET_ANY = "*";
20
+ export declare const accommodationSourcedContentTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
21
+ name: "accommodations_sourced_content";
22
+ schema: undefined;
23
+ columns: {
24
+ entity_id: import("drizzle-orm/pg-core").PgColumn<{
25
+ name: "entity_id";
26
+ tableName: "accommodations_sourced_content";
27
+ dataType: "string";
28
+ columnType: "PgText";
29
+ data: string;
30
+ driverParam: string;
31
+ notNull: true;
32
+ hasDefault: false;
33
+ isPrimaryKey: false;
34
+ isAutoincrement: false;
35
+ hasRuntimeDefault: false;
36
+ enumValues: [string, ...string[]];
37
+ baseColumn: never;
38
+ identity: undefined;
39
+ generated: undefined;
40
+ }, {}, {}>;
41
+ locale: import("drizzle-orm/pg-core").PgColumn<{
42
+ name: "locale";
43
+ tableName: "accommodations_sourced_content";
44
+ dataType: "string";
45
+ columnType: "PgText";
46
+ data: string;
47
+ driverParam: string;
48
+ notNull: true;
49
+ hasDefault: false;
50
+ isPrimaryKey: false;
51
+ isAutoincrement: false;
52
+ hasRuntimeDefault: false;
53
+ enumValues: [string, ...string[]];
54
+ baseColumn: never;
55
+ identity: undefined;
56
+ generated: undefined;
57
+ }, {}, {}>;
58
+ market: import("drizzle-orm/pg-core").PgColumn<{
59
+ name: "market";
60
+ tableName: "accommodations_sourced_content";
61
+ dataType: "string";
62
+ columnType: "PgText";
63
+ data: string;
64
+ driverParam: string;
65
+ notNull: true;
66
+ hasDefault: true;
67
+ isPrimaryKey: false;
68
+ isAutoincrement: false;
69
+ hasRuntimeDefault: false;
70
+ enumValues: [string, ...string[]];
71
+ baseColumn: never;
72
+ identity: undefined;
73
+ generated: undefined;
74
+ }, {}, {}>;
75
+ payload: import("drizzle-orm/pg-core").PgColumn<{
76
+ name: "payload";
77
+ tableName: "accommodations_sourced_content";
78
+ dataType: "json";
79
+ columnType: "PgJsonb";
80
+ data: Record<string, unknown>;
81
+ driverParam: unknown;
82
+ notNull: true;
83
+ hasDefault: false;
84
+ isPrimaryKey: false;
85
+ isAutoincrement: false;
86
+ hasRuntimeDefault: false;
87
+ enumValues: undefined;
88
+ baseColumn: never;
89
+ identity: undefined;
90
+ generated: undefined;
91
+ }, {}, {
92
+ $type: Record<string, unknown>;
93
+ }>;
94
+ content_schema_version: import("drizzle-orm/pg-core").PgColumn<{
95
+ name: "content_schema_version";
96
+ tableName: "accommodations_sourced_content";
97
+ dataType: "string";
98
+ columnType: "PgText";
99
+ data: string;
100
+ driverParam: string;
101
+ notNull: true;
102
+ hasDefault: false;
103
+ isPrimaryKey: false;
104
+ isAutoincrement: false;
105
+ hasRuntimeDefault: false;
106
+ enumValues: [string, ...string[]];
107
+ baseColumn: never;
108
+ identity: undefined;
109
+ generated: undefined;
110
+ }, {}, {}>;
111
+ returned_locale: import("drizzle-orm/pg-core").PgColumn<{
112
+ name: "returned_locale";
113
+ tableName: "accommodations_sourced_content";
114
+ dataType: "string";
115
+ columnType: "PgText";
116
+ data: string;
117
+ driverParam: string;
118
+ notNull: true;
119
+ hasDefault: false;
120
+ isPrimaryKey: false;
121
+ isAutoincrement: false;
122
+ hasRuntimeDefault: false;
123
+ enumValues: [string, ...string[]];
124
+ baseColumn: never;
125
+ identity: undefined;
126
+ generated: undefined;
127
+ }, {}, {}>;
128
+ machine_translated: import("drizzle-orm/pg-core").PgColumn<{
129
+ name: "machine_translated";
130
+ tableName: "accommodations_sourced_content";
131
+ dataType: "boolean";
132
+ columnType: "PgBoolean";
133
+ data: boolean;
134
+ driverParam: boolean;
135
+ notNull: true;
136
+ hasDefault: true;
137
+ isPrimaryKey: false;
138
+ isAutoincrement: false;
139
+ hasRuntimeDefault: false;
140
+ enumValues: undefined;
141
+ baseColumn: never;
142
+ identity: undefined;
143
+ generated: undefined;
144
+ }, {}, {}>;
145
+ source_updated_at: import("drizzle-orm/pg-core").PgColumn<{
146
+ name: "source_updated_at";
147
+ tableName: "accommodations_sourced_content";
148
+ dataType: "date";
149
+ columnType: "PgTimestamp";
150
+ data: Date;
151
+ driverParam: string;
152
+ notNull: false;
153
+ hasDefault: false;
154
+ isPrimaryKey: false;
155
+ isAutoincrement: false;
156
+ hasRuntimeDefault: false;
157
+ enumValues: undefined;
158
+ baseColumn: never;
159
+ identity: undefined;
160
+ generated: undefined;
161
+ }, {}, {}>;
162
+ fetched_at: import("drizzle-orm/pg-core").PgColumn<{
163
+ name: "fetched_at";
164
+ tableName: "accommodations_sourced_content";
165
+ dataType: "date";
166
+ columnType: "PgTimestamp";
167
+ data: Date;
168
+ driverParam: string;
169
+ notNull: true;
170
+ hasDefault: true;
171
+ isPrimaryKey: false;
172
+ isAutoincrement: false;
173
+ hasRuntimeDefault: false;
174
+ enumValues: undefined;
175
+ baseColumn: never;
176
+ identity: undefined;
177
+ generated: undefined;
178
+ }, {}, {}>;
179
+ fresh_until: import("drizzle-orm/pg-core").PgColumn<{
180
+ name: "fresh_until";
181
+ tableName: "accommodations_sourced_content";
182
+ dataType: "date";
183
+ columnType: "PgTimestamp";
184
+ data: Date;
185
+ driverParam: string;
186
+ notNull: false;
187
+ hasDefault: false;
188
+ isPrimaryKey: false;
189
+ isAutoincrement: false;
190
+ hasRuntimeDefault: false;
191
+ enumValues: undefined;
192
+ baseColumn: never;
193
+ identity: undefined;
194
+ generated: undefined;
195
+ }, {}, {}>;
196
+ etag: import("drizzle-orm/pg-core").PgColumn<{
197
+ name: "etag";
198
+ tableName: "accommodations_sourced_content";
199
+ dataType: "string";
200
+ columnType: "PgText";
201
+ data: string;
202
+ driverParam: string;
203
+ notNull: false;
204
+ hasDefault: false;
205
+ isPrimaryKey: false;
206
+ isAutoincrement: false;
207
+ hasRuntimeDefault: false;
208
+ enumValues: [string, ...string[]];
209
+ baseColumn: never;
210
+ identity: undefined;
211
+ generated: undefined;
212
+ }, {}, {}>;
213
+ fetch_status: import("drizzle-orm/pg-core").PgColumn<{
214
+ name: "fetch_status";
215
+ tableName: "accommodations_sourced_content";
216
+ dataType: "string";
217
+ columnType: "PgText";
218
+ data: AccommodationSourcedContentFetchStatus;
219
+ driverParam: string;
220
+ notNull: true;
221
+ hasDefault: true;
222
+ isPrimaryKey: false;
223
+ isAutoincrement: false;
224
+ hasRuntimeDefault: false;
225
+ enumValues: [string, ...string[]];
226
+ baseColumn: never;
227
+ identity: undefined;
228
+ generated: undefined;
229
+ }, {}, {
230
+ $type: AccommodationSourcedContentFetchStatus;
231
+ }>;
232
+ fetch_error: import("drizzle-orm/pg-core").PgColumn<{
233
+ name: "fetch_error";
234
+ tableName: "accommodations_sourced_content";
235
+ dataType: "string";
236
+ columnType: "PgText";
237
+ data: string;
238
+ driverParam: string;
239
+ notNull: false;
240
+ hasDefault: false;
241
+ isPrimaryKey: false;
242
+ isAutoincrement: false;
243
+ hasRuntimeDefault: false;
244
+ enumValues: [string, ...string[]];
245
+ baseColumn: never;
246
+ identity: undefined;
247
+ generated: undefined;
248
+ }, {}, {}>;
249
+ };
250
+ dialect: "pg";
251
+ }>;
252
+ export type InsertAccommodationSourcedContent = typeof accommodationSourcedContentTable.$inferInsert;
253
+ export type SelectAccommodationSourcedContent = typeof accommodationSourcedContentTable.$inferSelect;
254
+ //# sourceMappingURL=schema-sourced-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-sourced-content.d.ts","sourceRoot":"","sources":["../src/schema-sourced-content.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,MAAM,sCAAsC,GAAG,IAAI,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,CAAA;AAE7F,eAAO,MAAM,gCAAgC,MAAM,CAAA;AAEnD,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuC5C,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG,OAAO,gCAAgC,CAAC,YAAY,CAAA;AACpG,MAAM,MAAM,iCAAiC,GAAG,OAAO,gCAAgC,CAAC,YAAY,CAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Accommodation sourced-content cache. Sibling to
3
+ * `products_sourced_content` and `cruises_sourced_content` — same
4
+ * shape, different vertical.
5
+ *
6
+ * One row per sourced room-type × locale × market. Stores the rich
7
+ * detail-page content the upstream adapter served via `getContent`,
8
+ * plus the SWR metadata the read service needs.
9
+ *
10
+ * The accommodation vertical's catalog entry is the **room type** (the
11
+ * sellable variant within a property). Sourced room types — bedbank
12
+ * inventory like Hotelbeds / Expedia — store the property summary,
13
+ * room types, rate plans, meal plans, and amenities all in one
14
+ * payload via `getContent`.
15
+ *
16
+ * See `docs/architecture/catalog-sourced-content.md` §3.2.
17
+ */
18
+ import { boolean, index, jsonb, pgTable, primaryKey, text, timestamp } from "drizzle-orm/pg-core";
19
+ export const ACCOMMODATION_CONTENT_MARKET_ANY = "*";
20
+ export const accommodationSourcedContentTable = pgTable("accommodations_sourced_content", {
21
+ /**
22
+ * TypeID for the sourced room option/catalog entry. Existing room option
23
+ * rows use the room_types TypeID family.
24
+ */
25
+ entity_id: text("entity_id").notNull(),
26
+ /** BCP 47 language tag. */
27
+ locale: text("locale").notNull(),
28
+ /** Market id, or `'*'` for all-markets. */
29
+ market: text("market").notNull().default(ACCOMMODATION_CONTENT_MARKET_ANY),
30
+ payload: jsonb("payload").$type().notNull(),
31
+ content_schema_version: text("content_schema_version").notNull(),
32
+ returned_locale: text("returned_locale").notNull(),
33
+ machine_translated: boolean("machine_translated").notNull().default(false),
34
+ source_updated_at: timestamp("source_updated_at", { withTimezone: true }),
35
+ fetched_at: timestamp("fetched_at", { withTimezone: true }).notNull().defaultNow(),
36
+ fresh_until: timestamp("fresh_until", { withTimezone: true }),
37
+ etag: text("etag"),
38
+ fetch_status: text("fetch_status")
39
+ .$type()
40
+ .notNull()
41
+ .default("ok"),
42
+ fetch_error: text("fetch_error"),
43
+ }, (table) => [
44
+ primaryKey({ columns: [table.entity_id, table.locale, table.market] }),
45
+ index("accommodations_sourced_content_locale_fresh_idx").on(table.locale, table.fresh_until),
46
+ index("accommodations_sourced_content_returned_locale_idx").on(table.entity_id, table.returned_locale),
47
+ index("accommodations_sourced_content_schema_version_idx").on(table.content_schema_version),
48
+ ]);
@@ -0,0 +1,5 @@
1
+ export * from "./schema-bookings.js";
2
+ export * from "./schema-inventory.js";
3
+ export * from "./schema-shared.js";
4
+ export * from "./schema-sourced-content.js";
5
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA"}
package/dist/schema.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./schema-bookings.js";
2
+ export * from "./schema-inventory.js";
3
+ export * from "./schema-shared.js";
4
+ export * from "./schema-sourced-content.js";
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Catalog-plane integration for the accommodation service.
3
+ *
4
+ * The accommodation vertical's catalog entry is the **room type** — the
5
+ * sellable variant within a property. Properties live in
6
+ * `packages/facilities` and are referenced via `propertyId`.
7
+ *
8
+ * Mirrors the pattern in `packages/products/src/service-catalog-plane.ts`.
9
+ *
10
+ * See `docs/architecture/catalog-architecture.md` §9.1.
11
+ */
12
+ import { type CaptureSnapshotInput, type DocumentBuilder, type DocumentEmitter, type IndexerDocument, type IndexerSlice, type PricingBasis, type Provenance, type ResolvedView, type ResolverScope } from "@voyantjs/catalog";
13
+ import type { AnyDrizzleDb } from "@voyantjs/db";
14
+ import { roomTypes } from "./schema-inventory.js";
15
+ /**
16
+ * Maps a room-type row to a field-keyed projection. Provenance covers sourced
17
+ * and direct-supplier lodging inventory; the caller declares the source kind.
18
+ */
19
+ export declare function roomTypeRowToProjection(row: typeof roomTypes.$inferSelect, context: {
20
+ sellerOperatorId: string;
21
+ sourceKind?: string;
22
+ sourceRef?: string;
23
+ }): ReadonlyMap<string, unknown>;
24
+ export declare function roomTypeProvenance(_row: typeof roomTypes.$inferSelect, context: {
25
+ sellerOperatorId: string;
26
+ sourceKind?: string;
27
+ sourceRef?: string;
28
+ }): Provenance;
29
+ export interface RoomTypeCatalogContext {
30
+ sellerOperatorId: string;
31
+ scope: ResolverScope;
32
+ sourceKind?: string;
33
+ sourceRef?: string;
34
+ }
35
+ export declare function getResolvedRoomTypeById(db: AnyDrizzleDb, id: string, context: RoomTypeCatalogContext): Promise<ResolvedView | null>;
36
+ export declare function listResolvedRoomTypes(db: AnyDrizzleDb, rows: ReadonlyArray<typeof roomTypes.$inferSelect>, context: RoomTypeCatalogContext): Promise<ResolvedView[]>;
37
+ /**
38
+ * Build a `CaptureSnapshotInput` for a accommodation room type. Used by
39
+ * booking commit flows to capture the room-type view at booking time.
40
+ */
41
+ export declare function buildRoomTypeSnapshotInput(db: AnyDrizzleDb, roomTypeId: string, context: RoomTypeCatalogContext & {
42
+ pricingBasis?: PricingBasis;
43
+ }): Promise<Omit<CaptureSnapshotInput, "bookingId"> | null>;
44
+ export declare function createRoomTypeDocumentEmitter(context: {
45
+ sellerOperatorId: string;
46
+ sourceKind?: string;
47
+ sourceRef?: string;
48
+ }): DocumentEmitter<typeof roomTypes.$inferSelect>;
49
+ export declare function createRoomTypeDocumentBuilder(db: AnyDrizzleDb, context: {
50
+ sellerOperatorId: string;
51
+ sourceKind?: string;
52
+ sourceRef?: string;
53
+ }): DocumentBuilder;
54
+ export type { CaptureSnapshotInput, DocumentBuilder, DocumentEmitter, IndexerDocument, IndexerSlice, PricingBasis, Provenance, ResolvedView, ResolverScope, };
55
+ //# sourceMappingURL=service-catalog-plane.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-catalog-plane.d.ts","sourceRoot":"","sources":["../src/service-catalog-plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAGL,KAAK,oBAAoB,EAEzB,KAAK,eAAe,EACpB,KAAK,eAAe,EAEpB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAIhD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAcjD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,SAAS,CAAC,YAAY,EAClC,OAAO,EAAE;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7E,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CA4C9B;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,SAAS,CAAC,YAAY,EACnC,OAAO,EAAE;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7E,UAAU,CAMZ;AAED,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,MAAM,CAAA;IACxB,KAAK,EAAE,aAAa,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SA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