@voyant-travel/accommodations 0.105.24 → 0.105.25

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.
@@ -0,0 +1,210 @@
1
+ DO $$ BEGIN
2
+ CREATE TYPE "public"."accommodation_guarantee_mode" AS ENUM('none', 'card_hold', 'deposit', 'full_prepay', 'on_request');
3
+ EXCEPTION WHEN duplicate_object THEN null;
4
+ END $$;--> statement-breakpoint
5
+ DO $$ BEGIN
6
+ CREATE TYPE "public"."accommodation_inventory_mode" AS ENUM('pooled', 'serialized', 'virtual');
7
+ EXCEPTION WHEN duplicate_object THEN null;
8
+ END $$;--> statement-breakpoint
9
+ DO $$ BEGIN
10
+ CREATE TYPE "public"."rate_plan_charge_frequency" AS ENUM('per_night', 'per_stay', 'per_person_per_night', 'per_person_per_stay');
11
+ EXCEPTION WHEN duplicate_object THEN null;
12
+ END $$;--> statement-breakpoint
13
+ DO $$ BEGIN
14
+ CREATE TYPE "public"."stay_booking_item_status" AS ENUM('reserved', 'cancelled', 'no_show');
15
+ EXCEPTION WHEN duplicate_object THEN null;
16
+ END $$;--> statement-breakpoint
17
+ CREATE TABLE "stay_booking_items" (
18
+ "id" text PRIMARY KEY NOT NULL,
19
+ "booking_item_id" text NOT NULL,
20
+ "property_id" text NOT NULL,
21
+ "room_type_id" text NOT NULL,
22
+ "supplier_room_ref" text,
23
+ "rate_plan_id" text NOT NULL,
24
+ "check_in_date" date NOT NULL,
25
+ "check_out_date" date NOT NULL,
26
+ "night_count" integer DEFAULT 1 NOT NULL,
27
+ "room_count" integer DEFAULT 1 NOT NULL,
28
+ "adults" integer DEFAULT 1 NOT NULL,
29
+ "children" integer DEFAULT 0 NOT NULL,
30
+ "infants" integer DEFAULT 0 NOT NULL,
31
+ "meal_plan_id" text,
32
+ "confirmation_code" text,
33
+ "voucher_code" text,
34
+ "status" "stay_booking_item_status" DEFAULT 'reserved' NOT NULL,
35
+ "notes" text,
36
+ "metadata" jsonb,
37
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
38
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
39
+ );
40
+ --> statement-breakpoint
41
+ CREATE TABLE "stay_daily_rates" (
42
+ "id" text PRIMARY KEY NOT NULL,
43
+ "stay_booking_item_id" text NOT NULL,
44
+ "date" date NOT NULL,
45
+ "sell_currency" text NOT NULL,
46
+ "sell_amount_cents" integer,
47
+ "cost_currency" text,
48
+ "cost_amount_cents" integer,
49
+ "tax_amount_cents" integer,
50
+ "fee_amount_cents" integer,
51
+ "commission_amount_cents" integer,
52
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
53
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
54
+ );
55
+ --> statement-breakpoint
56
+ CREATE TABLE "meal_plans" (
57
+ "id" text PRIMARY KEY NOT NULL,
58
+ "property_id" text NOT NULL,
59
+ "code" text NOT NULL,
60
+ "name" text NOT NULL,
61
+ "description" text,
62
+ "includes_breakfast" boolean DEFAULT false NOT NULL,
63
+ "includes_lunch" boolean DEFAULT false NOT NULL,
64
+ "includes_dinner" boolean DEFAULT false NOT NULL,
65
+ "includes_drinks" boolean DEFAULT false NOT NULL,
66
+ "active" boolean DEFAULT true NOT NULL,
67
+ "sort_order" integer DEFAULT 0 NOT NULL,
68
+ "metadata" jsonb,
69
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
70
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
71
+ );
72
+ --> statement-breakpoint
73
+ CREATE TABLE "rate_plan_room_types" (
74
+ "id" text PRIMARY KEY NOT NULL,
75
+ "rate_plan_id" text NOT NULL,
76
+ "room_type_id" text NOT NULL,
77
+ "product_id" text,
78
+ "option_id" text,
79
+ "unit_id" text,
80
+ "active" boolean DEFAULT true NOT NULL,
81
+ "sort_order" integer DEFAULT 0 NOT NULL,
82
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
83
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
84
+ );
85
+ --> statement-breakpoint
86
+ CREATE TABLE "rate_plans" (
87
+ "id" text PRIMARY KEY NOT NULL,
88
+ "property_id" text NOT NULL,
89
+ "code" text NOT NULL,
90
+ "name" text NOT NULL,
91
+ "description" text,
92
+ "meal_plan_id" text,
93
+ "price_catalog_id" text,
94
+ "cancellation_policy_id" text,
95
+ "market_id" text,
96
+ "currency_code" text NOT NULL,
97
+ "charge_frequency" "rate_plan_charge_frequency" DEFAULT 'per_night' NOT NULL,
98
+ "guarantee_mode" "accommodation_guarantee_mode" DEFAULT 'none' NOT NULL,
99
+ "commissionable" boolean DEFAULT true NOT NULL,
100
+ "refundable" boolean DEFAULT true NOT NULL,
101
+ "active" boolean DEFAULT true NOT NULL,
102
+ "sort_order" integer DEFAULT 0 NOT NULL,
103
+ "customer_payment_policy" jsonb,
104
+ "metadata" jsonb,
105
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
106
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
107
+ );
108
+ --> statement-breakpoint
109
+ CREATE TABLE "room_type_bed_configs" (
110
+ "id" text PRIMARY KEY NOT NULL,
111
+ "room_type_id" text NOT NULL,
112
+ "bed_type" text NOT NULL,
113
+ "quantity" integer DEFAULT 1 NOT NULL,
114
+ "is_primary" boolean DEFAULT false NOT NULL,
115
+ "notes" text,
116
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
117
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
118
+ );
119
+ --> statement-breakpoint
120
+ CREATE TABLE "room_types" (
121
+ "id" text PRIMARY KEY NOT NULL,
122
+ "property_id" text NOT NULL,
123
+ "supplier_id" text,
124
+ "code" text,
125
+ "name" text NOT NULL,
126
+ "description" text,
127
+ "inventory_mode" "accommodation_inventory_mode" DEFAULT 'pooled' NOT NULL,
128
+ "room_class" text,
129
+ "max_adults" integer,
130
+ "max_children" integer,
131
+ "max_infants" integer,
132
+ "standard_occupancy" integer,
133
+ "max_occupancy" integer,
134
+ "min_occupancy" integer,
135
+ "bedroom_count" integer,
136
+ "bathroom_count" integer,
137
+ "area_value" integer,
138
+ "area_unit" text,
139
+ "accessibility_notes" text,
140
+ "smoking_allowed" boolean DEFAULT false NOT NULL,
141
+ "active" boolean DEFAULT true NOT NULL,
142
+ "sort_order" integer DEFAULT 0 NOT NULL,
143
+ "metadata" jsonb,
144
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
145
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
146
+ );
147
+ --> statement-breakpoint
148
+ CREATE TABLE "accommodations_sourced_content" (
149
+ "entity_id" text NOT NULL,
150
+ "locale" text NOT NULL,
151
+ "market" text DEFAULT '*' NOT NULL,
152
+ "payload" jsonb NOT NULL,
153
+ "content_schema_version" text NOT NULL,
154
+ "returned_locale" text NOT NULL,
155
+ "machine_translated" boolean DEFAULT false NOT NULL,
156
+ "source_updated_at" timestamp with time zone,
157
+ "fetched_at" timestamp with time zone DEFAULT now() NOT NULL,
158
+ "fresh_until" timestamp with time zone,
159
+ "etag" text,
160
+ "fetch_status" text DEFAULT 'ok' NOT NULL,
161
+ "fetch_error" text,
162
+ CONSTRAINT "accommodations_sourced_content_entity_id_locale_market_pk" PRIMARY KEY("entity_id","locale","market")
163
+ );
164
+ --> statement-breakpoint
165
+ ALTER TABLE "stay_booking_items" ADD CONSTRAINT "stay_booking_items_booking_item_id_booking_items_id_fk" FOREIGN KEY ("booking_item_id") REFERENCES "public"."booking_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
166
+ ALTER TABLE "stay_booking_items" ADD CONSTRAINT "stay_booking_items_room_type_id_room_types_id_fk" FOREIGN KEY ("room_type_id") REFERENCES "public"."room_types"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
167
+ ALTER TABLE "stay_booking_items" ADD CONSTRAINT "stay_booking_items_rate_plan_id_rate_plans_id_fk" FOREIGN KEY ("rate_plan_id") REFERENCES "public"."rate_plans"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
168
+ ALTER TABLE "stay_booking_items" ADD CONSTRAINT "stay_booking_items_meal_plan_id_meal_plans_id_fk" FOREIGN KEY ("meal_plan_id") REFERENCES "public"."meal_plans"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
169
+ ALTER TABLE "stay_daily_rates" ADD CONSTRAINT "stay_daily_rates_stay_booking_item_id_stay_booking_items_id_fk" FOREIGN KEY ("stay_booking_item_id") REFERENCES "public"."stay_booking_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
170
+ ALTER TABLE "rate_plan_room_types" ADD CONSTRAINT "rate_plan_room_types_rate_plan_id_rate_plans_id_fk" FOREIGN KEY ("rate_plan_id") REFERENCES "public"."rate_plans"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
171
+ ALTER TABLE "rate_plan_room_types" ADD CONSTRAINT "rate_plan_room_types_room_type_id_room_types_id_fk" FOREIGN KEY ("room_type_id") REFERENCES "public"."room_types"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
172
+ ALTER TABLE "rate_plans" ADD CONSTRAINT "rate_plans_meal_plan_id_meal_plans_id_fk" FOREIGN KEY ("meal_plan_id") REFERENCES "public"."meal_plans"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
173
+ ALTER TABLE "room_type_bed_configs" ADD CONSTRAINT "room_type_bed_configs_room_type_id_room_types_id_fk" FOREIGN KEY ("room_type_id") REFERENCES "public"."room_types"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
174
+ CREATE INDEX "idx_stay_booking_items_booking_item" ON "stay_booking_items" USING btree ("booking_item_id");--> statement-breakpoint
175
+ CREATE INDEX "idx_stay_booking_items_check_in" ON "stay_booking_items" USING btree ("check_in_date");--> statement-breakpoint
176
+ CREATE INDEX "idx_stay_booking_items_property_check_in" ON "stay_booking_items" USING btree ("property_id","check_in_date");--> statement-breakpoint
177
+ CREATE INDEX "idx_stay_booking_items_room_type_check_in" ON "stay_booking_items" USING btree ("room_type_id","check_in_date");--> statement-breakpoint
178
+ CREATE INDEX "idx_stay_booking_items_rate_plan_check_in" ON "stay_booking_items" USING btree ("rate_plan_id","check_in_date");--> statement-breakpoint
179
+ CREATE INDEX "idx_stay_booking_items_status_check_in" ON "stay_booking_items" USING btree ("status","check_in_date");--> statement-breakpoint
180
+ CREATE UNIQUE INDEX "uidx_stay_booking_items_booking_item" ON "stay_booking_items" USING btree ("booking_item_id");--> statement-breakpoint
181
+ CREATE INDEX "idx_stay_daily_rates_stay_booking_item" ON "stay_daily_rates" USING btree ("stay_booking_item_id");--> statement-breakpoint
182
+ CREATE INDEX "idx_stay_daily_rates_date" ON "stay_daily_rates" USING btree ("date");--> statement-breakpoint
183
+ CREATE UNIQUE INDEX "uidx_stay_daily_rates_item_date" ON "stay_daily_rates" USING btree ("stay_booking_item_id","date");--> statement-breakpoint
184
+ CREATE INDEX "idx_meal_plans_property_sort_name" ON "meal_plans" USING btree ("property_id","sort_order","name");--> statement-breakpoint
185
+ CREATE INDEX "idx_meal_plans_active_sort_name" ON "meal_plans" USING btree ("active","sort_order","name");--> statement-breakpoint
186
+ CREATE UNIQUE INDEX "uidx_meal_plans_property_code" ON "meal_plans" USING btree ("property_id","code");--> statement-breakpoint
187
+ CREATE INDEX "idx_rate_plan_room_types_rate_plan_sort_created" ON "rate_plan_room_types" USING btree ("rate_plan_id","sort_order","created_at");--> statement-breakpoint
188
+ CREATE INDEX "idx_rate_plan_room_types_room_type_sort_created" ON "rate_plan_room_types" USING btree ("room_type_id","sort_order","created_at");--> statement-breakpoint
189
+ CREATE INDEX "idx_rate_plan_room_types_product_sort_created" ON "rate_plan_room_types" USING btree ("product_id","sort_order","created_at");--> statement-breakpoint
190
+ CREATE INDEX "idx_rate_plan_room_types_option" ON "rate_plan_room_types" USING btree ("option_id");--> statement-breakpoint
191
+ CREATE INDEX "idx_rate_plan_room_types_unit" ON "rate_plan_room_types" USING btree ("unit_id");--> statement-breakpoint
192
+ CREATE INDEX "idx_rate_plan_room_types_active_sort_created" ON "rate_plan_room_types" USING btree ("active","sort_order","created_at");--> statement-breakpoint
193
+ CREATE UNIQUE INDEX "uidx_rate_plan_room_types_pair" ON "rate_plan_room_types" USING btree ("rate_plan_id","room_type_id");--> statement-breakpoint
194
+ CREATE INDEX "idx_rate_plans_property_sort_name" ON "rate_plans" USING btree ("property_id","sort_order","name");--> statement-breakpoint
195
+ CREATE INDEX "idx_rate_plans_meal_plan_sort_name" ON "rate_plans" USING btree ("meal_plan_id","sort_order","name");--> statement-breakpoint
196
+ CREATE INDEX "idx_rate_plans_catalog" ON "rate_plans" USING btree ("price_catalog_id");--> statement-breakpoint
197
+ CREATE INDEX "idx_rate_plans_policy" ON "rate_plans" USING btree ("cancellation_policy_id");--> statement-breakpoint
198
+ CREATE INDEX "idx_rate_plans_market_sort_name" ON "rate_plans" USING btree ("market_id","sort_order","name");--> statement-breakpoint
199
+ CREATE INDEX "idx_rate_plans_active_sort_name" ON "rate_plans" USING btree ("active","sort_order","name");--> statement-breakpoint
200
+ CREATE UNIQUE INDEX "uidx_rate_plans_property_code" ON "rate_plans" USING btree ("property_id","code");--> statement-breakpoint
201
+ CREATE INDEX "idx_room_type_bed_configs_room_type_primary_created" ON "room_type_bed_configs" USING btree ("room_type_id","is_primary","created_at");--> statement-breakpoint
202
+ CREATE INDEX "idx_room_type_bed_configs_bed_type_primary_created" ON "room_type_bed_configs" USING btree ("bed_type","is_primary","created_at");--> statement-breakpoint
203
+ CREATE INDEX "idx_room_types_property_sort_name" ON "room_types" USING btree ("property_id","sort_order","name");--> statement-breakpoint
204
+ CREATE INDEX "idx_room_types_supplier_sort_name" ON "room_types" USING btree ("supplier_id","sort_order","name");--> statement-breakpoint
205
+ CREATE INDEX "idx_room_types_active_sort_name" ON "room_types" USING btree ("active","sort_order","name");--> statement-breakpoint
206
+ CREATE INDEX "idx_room_types_inventory_mode_sort_name" ON "room_types" USING btree ("inventory_mode","sort_order","name");--> statement-breakpoint
207
+ CREATE UNIQUE INDEX "uidx_room_types_property_code" ON "room_types" USING btree ("property_id","code");--> statement-breakpoint
208
+ CREATE INDEX "accommodations_sourced_content_locale_fresh_idx" ON "accommodations_sourced_content" USING btree ("locale","fresh_until");--> statement-breakpoint
209
+ CREATE INDEX "accommodations_sourced_content_returned_locale_idx" ON "accommodations_sourced_content" USING btree ("entity_id","returned_locale");--> statement-breakpoint
210
+ CREATE INDEX "accommodations_sourced_content_schema_version_idx" ON "accommodations_sourced_content" USING btree ("content_schema_version");
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1781955201171,
9
+ "tag": "0000_accommodations_baseline",
10
+ "breakpoints": true
11
+ }
12
+ ]
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyant-travel/accommodations",
3
- "version": "0.105.24",
3
+ "version": "0.105.25",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -60,18 +60,21 @@
60
60
  "hono": "^4.12.10",
61
61
  "zod": "^4.3.6",
62
62
  "@voyant-travel/accommodations-contracts": "^0.105.2",
63
- "@voyant-travel/bookings": "^0.126.0",
64
- "@voyant-travel/catalog": "^0.124.0",
65
- "@voyant-travel/db": "^0.108.3",
66
- "@voyant-travel/operations": "^0.1.6"
63
+ "@voyant-travel/bookings": "^0.127.0",
64
+ "@voyant-travel/catalog": "^0.125.0",
65
+ "@voyant-travel/db": "^0.108.4",
66
+ "@voyant-travel/operations": "^0.2.0"
67
67
  },
68
68
  "devDependencies": {
69
+ "drizzle-kit": "^0.31.10",
69
70
  "typescript": "^6.0.2",
70
71
  "vitest": "^4.1.2",
71
72
  "@voyant-travel/voyant-typescript-config": "^0.1.0"
72
73
  },
73
74
  "files": [
74
- "dist"
75
+ "dist",
76
+ "migrations/*.sql",
77
+ "migrations/meta/_journal.json"
75
78
  ],
76
79
  "publishConfig": {
77
80
  "access": "public"
@@ -94,7 +97,8 @@
94
97
  "lint": "biome check src/",
95
98
  "test": "vitest run",
96
99
  "build": "tsc -p tsconfig.json",
97
- "clean": "rm -rf dist tsconfig.tsbuildinfo"
100
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
101
+ "db:generate": "drizzle-kit generate --config=drizzle.migrations.config.ts --name=accommodations_baseline && node ../../scripts/d2/guard-create-type.mjs ./migrations && node ../../scripts/d2/ensure-extensions.mjs ./migrations"
98
102
  },
99
103
  "main": "./dist/index.js",
100
104
  "types": "./dist/index.d.ts"