@voyant-travel/charters 0.124.0 → 0.124.1

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,227 @@
1
+ DO $$ BEGIN
2
+ CREATE TYPE "public"."charter_booking_mode" AS ENUM('per_suite', 'whole_yacht');
3
+ EXCEPTION WHEN duplicate_object THEN null;
4
+ END $$;--> statement-breakpoint
5
+ DO $$ BEGIN
6
+ CREATE TYPE "public"."charter_source" AS ENUM('local', 'external');
7
+ EXCEPTION WHEN duplicate_object THEN null;
8
+ END $$;--> statement-breakpoint
9
+ DO $$ BEGIN
10
+ CREATE TYPE "public"."charter_status" AS ENUM('draft', 'awaiting_review', 'live', 'archived');
11
+ EXCEPTION WHEN duplicate_object THEN null;
12
+ END $$;--> statement-breakpoint
13
+ DO $$ BEGIN
14
+ CREATE TYPE "public"."charter_suite_availability" AS ENUM('available', 'limited', 'on_request', 'wait_list', 'sold_out');
15
+ EXCEPTION WHEN duplicate_object THEN null;
16
+ END $$;--> statement-breakpoint
17
+ DO $$ BEGIN
18
+ CREATE TYPE "public"."charter_suite_category" AS ENUM('standard', 'deluxe', 'suite', 'penthouse', 'owners', 'signature');
19
+ EXCEPTION WHEN duplicate_object THEN null;
20
+ END $$;--> statement-breakpoint
21
+ DO $$ BEGIN
22
+ CREATE TYPE "public"."charter_voyage_sales_status" AS ENUM('open', 'on_request', 'wait_list', 'sold_out', 'closed');
23
+ EXCEPTION WHEN duplicate_object THEN null;
24
+ END $$;--> statement-breakpoint
25
+ DO $$ BEGIN
26
+ CREATE TYPE "public"."charter_yacht_class" AS ENUM('luxury_motor', 'luxury_sailing', 'expedition', 'small_cruise');
27
+ EXCEPTION WHEN duplicate_object THEN null;
28
+ END $$;--> statement-breakpoint
29
+ CREATE TABLE "booking_charter_details" (
30
+ "booking_id" text PRIMARY KEY NOT NULL,
31
+ "booking_mode" charter_booking_mode NOT NULL,
32
+ "source" charter_source DEFAULT 'local' NOT NULL,
33
+ "source_provider" text,
34
+ "source_ref" jsonb,
35
+ "voyage_id" text,
36
+ "suite_id" text,
37
+ "yacht_id" text,
38
+ "voyage_display_name" text,
39
+ "suite_display_name" text,
40
+ "yacht_name" text,
41
+ "charter_area_snapshot" text,
42
+ "guest_count" smallint NOT NULL,
43
+ "quoted_currency" char(3) NOT NULL,
44
+ "quoted_suite_price" numeric(12, 2),
45
+ "quoted_port_fee" numeric(12, 2),
46
+ "quoted_charter_fee" numeric(15, 2),
47
+ "apa_percent" numeric(5, 2),
48
+ "apa_amount" numeric(15, 2),
49
+ "quoted_total" numeric(15, 2) NOT NULL,
50
+ "myba_template_id_snapshot" text,
51
+ "myba_contract_id" text,
52
+ "apa_paid_amount" numeric(15, 2) DEFAULT '0.00',
53
+ "apa_spent_amount" numeric(15, 2) DEFAULT '0.00',
54
+ "apa_refund_amount" numeric(15, 2) DEFAULT '0.00',
55
+ "apa_settled_at" timestamp with time zone,
56
+ "connector_booking_ref" text,
57
+ "connector_status" text,
58
+ "notes" text,
59
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
60
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
61
+ );
62
+ --> statement-breakpoint
63
+ CREATE TABLE "charters_sourced_content" (
64
+ "entity_id" text NOT NULL,
65
+ "locale" text NOT NULL,
66
+ "market" text DEFAULT '*' NOT NULL,
67
+ "payload" jsonb NOT NULL,
68
+ "content_schema_version" text NOT NULL,
69
+ "returned_locale" text NOT NULL,
70
+ "machine_translated" boolean DEFAULT false NOT NULL,
71
+ "source_updated_at" timestamp with time zone,
72
+ "fetched_at" timestamp with time zone DEFAULT now() NOT NULL,
73
+ "fresh_until" timestamp with time zone,
74
+ "etag" text,
75
+ "fetch_status" text DEFAULT 'ok' NOT NULL,
76
+ "fetch_error" text,
77
+ CONSTRAINT "charters_sourced_content_entity_id_locale_market_pk" PRIMARY KEY("entity_id","locale","market")
78
+ );
79
+ --> statement-breakpoint
80
+ CREATE TABLE "charter_products" (
81
+ "id" text PRIMARY KEY NOT NULL,
82
+ "slug" text NOT NULL,
83
+ "name" text NOT NULL,
84
+ "line_supplier_id" text,
85
+ "default_yacht_id" text,
86
+ "description" text,
87
+ "short_description" text,
88
+ "hero_image_url" text,
89
+ "map_image_url" text,
90
+ "regions" jsonb DEFAULT '[]'::jsonb,
91
+ "themes" jsonb DEFAULT '[]'::jsonb,
92
+ "status" charter_status DEFAULT 'draft' NOT NULL,
93
+ "default_booking_modes" jsonb DEFAULT '["per_suite"]'::jsonb,
94
+ "default_myba_template_id" text,
95
+ "default_apa_percent" numeric(5, 2),
96
+ "lowest_price_cached_amount" numeric(12, 2),
97
+ "lowest_price_cached_currency" text,
98
+ "earliest_voyage_cached" date,
99
+ "latest_voyage_cached" date,
100
+ "external_refs" jsonb DEFAULT '{}'::jsonb,
101
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
102
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
103
+ );
104
+ --> statement-breakpoint
105
+ CREATE TABLE "charter_voyages" (
106
+ "id" text PRIMARY KEY NOT NULL,
107
+ "product_id" text NOT NULL,
108
+ "yacht_id" text NOT NULL,
109
+ "voyage_code" text NOT NULL,
110
+ "name" text,
111
+ "embark_port_facility_id" text,
112
+ "embark_port_name" text,
113
+ "disembark_port_facility_id" text,
114
+ "disembark_port_name" text,
115
+ "departure_date" date NOT NULL,
116
+ "return_date" date NOT NULL,
117
+ "nights" smallint NOT NULL,
118
+ "booking_modes" jsonb DEFAULT '["per_suite"]'::jsonb NOT NULL,
119
+ "appointment_only" boolean DEFAULT false NOT NULL,
120
+ "whole_yacht_prices_by_currency" jsonb DEFAULT '{}'::jsonb NOT NULL,
121
+ "apa_percent_override" numeric(5, 2),
122
+ "myba_template_id_override" text,
123
+ "charter_area_override" text,
124
+ "sales_status" charter_voyage_sales_status DEFAULT 'open' NOT NULL,
125
+ "availability_note" text,
126
+ "external_refs" jsonb DEFAULT '{}'::jsonb,
127
+ "last_synced_at" timestamp with time zone,
128
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
129
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
130
+ );
131
+ --> statement-breakpoint
132
+ CREATE TABLE "charter_schedule_days" (
133
+ "id" text PRIMARY KEY NOT NULL,
134
+ "voyage_id" text NOT NULL,
135
+ "day_number" smallint NOT NULL,
136
+ "port_facility_id" text,
137
+ "port_name" text,
138
+ "schedule_date" date,
139
+ "arrival_time" time,
140
+ "departure_time" time,
141
+ "is_sea_day" boolean DEFAULT false NOT NULL,
142
+ "description" text,
143
+ "activities" jsonb DEFAULT '[]'::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 "charter_suites" (
149
+ "id" text PRIMARY KEY NOT NULL,
150
+ "voyage_id" text NOT NULL,
151
+ "suite_code" text NOT NULL,
152
+ "suite_name" text NOT NULL,
153
+ "suite_category" charter_suite_category,
154
+ "description" text,
155
+ "square_feet" numeric(8, 2),
156
+ "images" jsonb DEFAULT '[]'::jsonb,
157
+ "floorplan_images" jsonb DEFAULT '[]'::jsonb,
158
+ "max_guests" smallint,
159
+ "prices_by_currency" jsonb DEFAULT '{}'::jsonb NOT NULL,
160
+ "port_fees_by_currency" jsonb DEFAULT '{}'::jsonb NOT NULL,
161
+ "availability" charter_suite_availability DEFAULT 'available' NOT NULL,
162
+ "units_available" smallint,
163
+ "appointment_only" boolean DEFAULT false NOT NULL,
164
+ "notes" text,
165
+ "extra" jsonb DEFAULT '{}'::jsonb,
166
+ "external_refs" jsonb DEFAULT '{}'::jsonb,
167
+ "last_synced_at" timestamp with time zone,
168
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
169
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
170
+ );
171
+ --> statement-breakpoint
172
+ CREATE TABLE "charter_yachts" (
173
+ "id" text PRIMARY KEY NOT NULL,
174
+ "line_supplier_id" text,
175
+ "name" text NOT NULL,
176
+ "slug" text NOT NULL,
177
+ "yacht_class" charter_yacht_class NOT NULL,
178
+ "capacity_guests" integer,
179
+ "capacity_crew" integer,
180
+ "length_meters" numeric(8, 2),
181
+ "year_built" integer,
182
+ "year_refurbished" integer,
183
+ "imo" text,
184
+ "description" text,
185
+ "gallery" jsonb DEFAULT '[]'::jsonb,
186
+ "amenities" jsonb DEFAULT '{}'::jsonb,
187
+ "crew_bios" jsonb DEFAULT '[]'::jsonb,
188
+ "default_charter_areas" jsonb DEFAULT '[]'::jsonb,
189
+ "external_refs" jsonb DEFAULT '{}'::jsonb,
190
+ "is_active" boolean DEFAULT true NOT NULL,
191
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
192
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
193
+ );
194
+ --> statement-breakpoint
195
+ ALTER TABLE "charter_products" ADD CONSTRAINT "charter_products_default_yacht_id_charter_yachts_id_fk" FOREIGN KEY ("default_yacht_id") REFERENCES "public"."charter_yachts"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
196
+ ALTER TABLE "charter_voyages" ADD CONSTRAINT "charter_voyages_product_id_charter_products_id_fk" FOREIGN KEY ("product_id") REFERENCES "public"."charter_products"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
197
+ ALTER TABLE "charter_voyages" ADD CONSTRAINT "charter_voyages_yacht_id_charter_yachts_id_fk" FOREIGN KEY ("yacht_id") REFERENCES "public"."charter_yachts"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
198
+ ALTER TABLE "charter_schedule_days" ADD CONSTRAINT "charter_schedule_days_voyage_id_charter_voyages_id_fk" FOREIGN KEY ("voyage_id") REFERENCES "public"."charter_voyages"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
199
+ ALTER TABLE "charter_suites" ADD CONSTRAINT "charter_suites_voyage_id_charter_voyages_id_fk" FOREIGN KEY ("voyage_id") REFERENCES "public"."charter_voyages"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
200
+ CREATE INDEX "idx_bchd_mode" ON "booking_charter_details" USING btree ("booking_mode");--> statement-breakpoint
201
+ CREATE INDEX "idx_bchd_source" ON "booking_charter_details" USING btree ("source");--> statement-breakpoint
202
+ CREATE INDEX "idx_bchd_voyage" ON "booking_charter_details" USING btree ("voyage_id");--> statement-breakpoint
203
+ CREATE INDEX "idx_bchd_suite" ON "booking_charter_details" USING btree ("suite_id");--> statement-breakpoint
204
+ CREATE INDEX "idx_bchd_yacht" ON "booking_charter_details" USING btree ("yacht_id");--> statement-breakpoint
205
+ CREATE INDEX "idx_bchd_myba_contract" ON "booking_charter_details" USING btree ("myba_contract_id");--> statement-breakpoint
206
+ CREATE INDEX "idx_bchd_connector_ref" ON "booking_charter_details" USING btree ("connector_booking_ref");--> statement-breakpoint
207
+ CREATE INDEX "idx_bchd_provider" ON "booking_charter_details" USING btree ("source_provider");--> statement-breakpoint
208
+ CREATE INDEX "charters_sourced_content_locale_fresh_idx" ON "charters_sourced_content" USING btree ("locale","fresh_until");--> statement-breakpoint
209
+ CREATE INDEX "charters_sourced_content_returned_locale_idx" ON "charters_sourced_content" USING btree ("entity_id","returned_locale");--> statement-breakpoint
210
+ CREATE INDEX "charters_sourced_content_schema_version_idx" ON "charters_sourced_content" USING btree ("content_schema_version");--> statement-breakpoint
211
+ CREATE UNIQUE INDEX "uidx_charter_products_slug" ON "charter_products" USING btree ("slug");--> statement-breakpoint
212
+ CREATE INDEX "idx_charter_products_status_created" ON "charter_products" USING btree ("status","created_at");--> statement-breakpoint
213
+ CREATE INDEX "idx_charter_products_supplier_status" ON "charter_products" USING btree ("line_supplier_id","status");--> statement-breakpoint
214
+ CREATE INDEX "idx_charter_products_earliest" ON "charter_products" USING btree ("earliest_voyage_cached","status");--> statement-breakpoint
215
+ CREATE INDEX "idx_charter_voyages_product_departure" ON "charter_voyages" USING btree ("product_id","departure_date");--> statement-breakpoint
216
+ CREATE INDEX "idx_charter_voyages_yacht_departure" ON "charter_voyages" USING btree ("yacht_id","departure_date");--> statement-breakpoint
217
+ CREATE INDEX "idx_charter_voyages_status_departure" ON "charter_voyages" USING btree ("sales_status","departure_date");--> statement-breakpoint
218
+ CREATE UNIQUE INDEX "uidx_charter_voyages_product_date_yacht" ON "charter_voyages" USING btree ("product_id","departure_date","yacht_id");--> statement-breakpoint
219
+ CREATE UNIQUE INDEX "uidx_charter_schedule_voyage_day" ON "charter_schedule_days" USING btree ("voyage_id","day_number");--> statement-breakpoint
220
+ CREATE INDEX "idx_charter_schedule_voyage" ON "charter_schedule_days" USING btree ("voyage_id");--> statement-breakpoint
221
+ CREATE UNIQUE INDEX "uidx_charter_suites_voyage_code" ON "charter_suites" USING btree ("voyage_id","suite_code");--> statement-breakpoint
222
+ CREATE INDEX "idx_charter_suites_voyage_availability" ON "charter_suites" USING btree ("voyage_id","availability");--> statement-breakpoint
223
+ CREATE INDEX "idx_charter_suites_voyage_category" ON "charter_suites" USING btree ("voyage_id","suite_category");--> statement-breakpoint
224
+ CREATE UNIQUE INDEX "uidx_charter_yachts_slug" ON "charter_yachts" USING btree ("slug");--> statement-breakpoint
225
+ CREATE UNIQUE INDEX "uidx_charter_yachts_imo" ON "charter_yachts" USING btree ("imo");--> statement-breakpoint
226
+ CREATE INDEX "idx_charter_yachts_supplier_active" ON "charter_yachts" USING btree ("line_supplier_id","is_active");--> statement-breakpoint
227
+ CREATE INDEX "idx_charter_yachts_class_active" ON "charter_yachts" USING btree ("yacht_class","is_active");
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1781947495978,
9
+ "tag": "0000_charters_baseline",
10
+ "breakpoints": true
11
+ }
12
+ ]
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyant-travel/charters",
3
- "version": "0.124.0",
3
+ "version": "0.124.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -77,18 +77,21 @@
77
77
  "@voyant-travel/bookings": "^0.126.0",
78
78
  "@voyant-travel/charters-contracts": "^0.104.1",
79
79
  "@voyant-travel/core": "^0.110.0",
80
- "@voyant-travel/db": "^0.108.3",
80
+ "@voyant-travel/db": "^0.108.4",
81
81
  "@voyant-travel/hono": "^0.112.2",
82
- "@voyant-travel/catalog": "^0.124.0"
82
+ "@voyant-travel/catalog": "^0.124.1"
83
83
  },
84
84
  "devDependencies": {
85
+ "drizzle-kit": "^0.31.10",
85
86
  "typescript": "^6.0.2",
86
87
  "vitest": "^4.0.0",
87
88
  "@voyant-travel/voyant-test-utils": "^0.1.0",
88
89
  "@voyant-travel/voyant-typescript-config": "^0.1.0"
89
90
  },
90
91
  "files": [
91
- "dist"
92
+ "dist",
93
+ "migrations/*.sql",
94
+ "migrations/meta/_journal.json"
92
95
  ],
93
96
  "publishConfig": {
94
97
  "access": "public"
@@ -109,7 +112,8 @@
109
112
  "lint": "biome check src/",
110
113
  "test": "vitest run",
111
114
  "build": "tsc -p tsconfig.json",
112
- "clean": "rm -rf dist tsconfig.tsbuildinfo"
115
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
116
+ "db:generate": "drizzle-kit generate --config=drizzle.migrations.config.ts --name=charters_baseline && node ../../scripts/d2/guard-create-type.mjs ./migrations && node ../../scripts/d2/ensure-extensions.mjs ./migrations"
113
117
  },
114
118
  "main": "./dist/index.js",
115
119
  "types": "./dist/index.d.ts"