@voyant-travel/charters 0.117.2
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/LICENSE +201 -0
- package/README.md +16 -0
- package/dist/adapters/index.d.ts +254 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +16 -0
- package/dist/adapters/memoize.d.ts +28 -0
- package/dist/adapters/memoize.d.ts.map +1 -0
- package/dist/adapters/memoize.js +121 -0
- package/dist/adapters/mock.d.ts +50 -0
- package/dist/adapters/mock.d.ts.map +1 -0
- package/dist/adapters/mock.js +194 -0
- package/dist/adapters/registry.d.ts +24 -0
- package/dist/adapters/registry.d.ts.map +1 -0
- package/dist/adapters/registry.js +40 -0
- package/dist/booking-extension.d.ts +895 -0
- package/dist/booking-extension.d.ts.map +1 -0
- package/dist/booking-extension.js +339 -0
- package/dist/catalog-policy.d.ts +23 -0
- package/dist/catalog-policy.d.ts.map +1 -0
- package/dist/catalog-policy.js +400 -0
- package/dist/content-shape.d.ts +5 -0
- package/dist/content-shape.d.ts.map +1 -0
- package/dist/content-shape.js +13 -0
- package/dist/draft-shape.d.ts +29 -0
- package/dist/draft-shape.d.ts.map +1 -0
- package/dist/draft-shape.js +63 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/lib/key.d.ts +22 -0
- package/dist/lib/key.d.ts.map +1 -0
- package/dist/lib/key.js +24 -0
- package/dist/routes-public.d.ts +785 -0
- package/dist/routes-public.d.ts.map +1 -0
- package/dist/routes-public.js +234 -0
- package/dist/routes.d.ts +1744 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +543 -0
- package/dist/schema-core.d.ts +815 -0
- package/dist/schema-core.d.ts.map +1 -0
- package/dist/schema-core.js +98 -0
- package/dist/schema-itinerary.d.ts +239 -0
- package/dist/schema-itinerary.d.ts.map +1 -0
- package/dist/schema-itinerary.js +30 -0
- package/dist/schema-pricing.d.ts +385 -0
- package/dist/schema-pricing.d.ts.map +1 -0
- package/dist/schema-pricing.js +62 -0
- package/dist/schema-shared.d.ts +8 -0
- package/dist/schema-shared.d.ts.map +1 -0
- package/dist/schema-shared.js +37 -0
- package/dist/schema-sourced-content.d.ts +253 -0
- package/dist/schema-sourced-content.d.ts.map +1 -0
- package/dist/schema-sourced-content.js +44 -0
- package/dist/schema-yachts.d.ts +367 -0
- package/dist/schema-yachts.d.ts.map +1 -0
- package/dist/schema-yachts.js +30 -0
- package/dist/schema.d.ts +8 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +7 -0
- package/dist/service-bookings-helpers.d.ts +20 -0
- package/dist/service-bookings-helpers.d.ts.map +1 -0
- package/dist/service-bookings-helpers.js +67 -0
- package/dist/service-bookings-local.d.ts +5 -0
- package/dist/service-bookings-local.d.ts.map +1 -0
- package/dist/service-bookings-local.js +177 -0
- package/dist/service-bookings-types.d.ts +88 -0
- package/dist/service-bookings-types.d.ts.map +1 -0
- package/dist/service-bookings-types.js +1 -0
- package/dist/service-bookings.d.ts +36 -0
- package/dist/service-bookings.d.ts.map +1 -0
- package/dist/service-bookings.js +267 -0
- package/dist/service-catalog-plane.d.ts +58 -0
- package/dist/service-catalog-plane.d.ts.map +1 -0
- package/dist/service-catalog-plane.js +145 -0
- package/dist/service-content-synthesizer.d.ts +42 -0
- package/dist/service-content-synthesizer.d.ts.map +1 -0
- package/dist/service-content-synthesizer.js +122 -0
- package/dist/service-content.d.ts +43 -0
- package/dist/service-content.d.ts.map +1 -0
- package/dist/service-content.js +248 -0
- package/dist/service-myba.d.ts +85 -0
- package/dist/service-myba.d.ts.map +1 -0
- package/dist/service-myba.js +88 -0
- package/dist/service-pricing.d.ts +64 -0
- package/dist/service-pricing.d.ts.map +1 -0
- package/dist/service-pricing.js +167 -0
- package/dist/service.d.ts +131 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +279 -0
- package/dist/validation-core.d.ts +152 -0
- package/dist/validation-core.d.ts.map +1 -0
- package/dist/validation-core.js +66 -0
- package/dist/validation-itinerary.d.ts +43 -0
- package/dist/validation-itinerary.d.ts.map +1 -0
- package/dist/validation-itinerary.js +19 -0
- package/dist/validation-pricing.d.ts +103 -0
- package/dist/validation-pricing.d.ts.map +1 -0
- package/dist/validation-pricing.js +28 -0
- package/dist/validation-shared.d.ts +61 -0
- package/dist/validation-shared.d.ts.map +1 -0
- package/dist/validation-shared.js +60 -0
- package/dist/validation-yachts.d.ts +76 -0
- package/dist/validation-yachts.d.ts.map +1 -0
- package/dist/validation-yachts.js +36 -0
- package/dist/validation.d.ts +6 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +5 -0
- package/package.json +116 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalog plane field policy for `packages/charters`.
|
|
3
|
+
*
|
|
4
|
+
* The charters vertical models luxury yacht-style products: per-suite or
|
|
5
|
+
* whole-yacht booking, MYBA contracts, APA (Advance Provisioning Allowance)
|
|
6
|
+
* as a first-class concern. See `docs/architecture/charters-module.md` for
|
|
7
|
+
* the vertical's design.
|
|
8
|
+
*
|
|
9
|
+
* Scope of this file:
|
|
10
|
+
* - The root `charter_products` table (from `schema-core.ts`).
|
|
11
|
+
* - Provenance + identity fields the catalog plane needs to track.
|
|
12
|
+
*
|
|
13
|
+
* Out of scope (deferred to follow-up adoption passes):
|
|
14
|
+
* - `charter_voyages` — own lifecycle (sales status), own query surface.
|
|
15
|
+
* - `charter_yachts` — vessel reference data; cross-module link target.
|
|
16
|
+
* - `charter_suites` — selectable variant axis with own micro-registry.
|
|
17
|
+
* - `charter_schedule_days` — composite list (mixed-class leaves).
|
|
18
|
+
*/
|
|
19
|
+
import { defineFieldPolicy } from "@voyant-travel/catalog/contract";
|
|
20
|
+
const CHARTER_FIELD_POLICY = [
|
|
21
|
+
// ── Source pointer / provenance ─────────────────────────────────────────
|
|
22
|
+
{
|
|
23
|
+
path: "source.kind",
|
|
24
|
+
class: "managed",
|
|
25
|
+
merge: "source-only",
|
|
26
|
+
drift: "critical",
|
|
27
|
+
reindex: "facet-affecting",
|
|
28
|
+
snapshot: "on-book",
|
|
29
|
+
query: "indexed-column",
|
|
30
|
+
localized: false,
|
|
31
|
+
visibility: ["staff"],
|
|
32
|
+
editRole: "none",
|
|
33
|
+
overrideFriction: "none",
|
|
34
|
+
sourceFreshness: "sync",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
path: "source.ref",
|
|
38
|
+
class: "managed",
|
|
39
|
+
merge: "source-only",
|
|
40
|
+
drift: "critical",
|
|
41
|
+
reindex: "none",
|
|
42
|
+
snapshot: "on-book",
|
|
43
|
+
query: "indexed-column",
|
|
44
|
+
localized: false,
|
|
45
|
+
visibility: ["staff"],
|
|
46
|
+
editRole: "none",
|
|
47
|
+
overrideFriction: "none",
|
|
48
|
+
sourceFreshness: "sync",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
path: "seller.operator_id",
|
|
52
|
+
class: "managed",
|
|
53
|
+
merge: "source-only",
|
|
54
|
+
drift: "critical",
|
|
55
|
+
reindex: "none",
|
|
56
|
+
snapshot: "on-book",
|
|
57
|
+
query: "indexed-column",
|
|
58
|
+
localized: false,
|
|
59
|
+
visibility: ["staff"],
|
|
60
|
+
editRole: "none",
|
|
61
|
+
overrideFriction: "none",
|
|
62
|
+
sourceFreshness: "static",
|
|
63
|
+
},
|
|
64
|
+
// ── Identity / lifecycle ────────────────────────────────────────────────
|
|
65
|
+
{
|
|
66
|
+
path: "id",
|
|
67
|
+
class: "managed",
|
|
68
|
+
merge: "source-only",
|
|
69
|
+
drift: "critical",
|
|
70
|
+
reindex: "none",
|
|
71
|
+
snapshot: "on-book",
|
|
72
|
+
query: "first-class-table",
|
|
73
|
+
localized: false,
|
|
74
|
+
visibility: ["staff", "customer", "partner"],
|
|
75
|
+
editRole: "none",
|
|
76
|
+
overrideFriction: "none",
|
|
77
|
+
sourceFreshness: "static",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
path: "slug",
|
|
81
|
+
class: "managed",
|
|
82
|
+
merge: "source-only",
|
|
83
|
+
drift: "high",
|
|
84
|
+
reindex: "entry",
|
|
85
|
+
snapshot: "on-book",
|
|
86
|
+
query: "indexed-column",
|
|
87
|
+
localized: false,
|
|
88
|
+
visibility: ["staff", "customer", "partner"],
|
|
89
|
+
editRole: "none",
|
|
90
|
+
overrideFriction: "none",
|
|
91
|
+
sourceFreshness: "sync",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
path: "createdAt",
|
|
95
|
+
class: "managed",
|
|
96
|
+
merge: "source-only",
|
|
97
|
+
drift: "none",
|
|
98
|
+
reindex: "none",
|
|
99
|
+
snapshot: "on-book",
|
|
100
|
+
query: "indexed-column",
|
|
101
|
+
localized: false,
|
|
102
|
+
visibility: ["staff"],
|
|
103
|
+
editRole: "none",
|
|
104
|
+
overrideFriction: "none",
|
|
105
|
+
sourceFreshness: "static",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
path: "updatedAt",
|
|
109
|
+
class: "managed",
|
|
110
|
+
merge: "source-only",
|
|
111
|
+
drift: "none",
|
|
112
|
+
reindex: "none",
|
|
113
|
+
snapshot: "never",
|
|
114
|
+
query: "indexed-column",
|
|
115
|
+
localized: false,
|
|
116
|
+
visibility: ["staff"],
|
|
117
|
+
editRole: "none",
|
|
118
|
+
overrideFriction: "none",
|
|
119
|
+
sourceFreshness: "sync",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
path: "externalRefs",
|
|
123
|
+
class: "managed",
|
|
124
|
+
merge: "source-only",
|
|
125
|
+
drift: "medium",
|
|
126
|
+
reindex: "none",
|
|
127
|
+
snapshot: "on-book",
|
|
128
|
+
query: "blob-only",
|
|
129
|
+
localized: false,
|
|
130
|
+
visibility: ["staff"],
|
|
131
|
+
editRole: "none",
|
|
132
|
+
overrideFriction: "none",
|
|
133
|
+
sourceFreshness: "sync",
|
|
134
|
+
},
|
|
135
|
+
// ── Merchandisable / marketing ──────────────────────────────────────────
|
|
136
|
+
{
|
|
137
|
+
path: "name",
|
|
138
|
+
class: "merchandisable",
|
|
139
|
+
merge: "replace",
|
|
140
|
+
drift: "medium",
|
|
141
|
+
reindex: "entry-locale",
|
|
142
|
+
snapshot: "on-book",
|
|
143
|
+
query: "indexed-column",
|
|
144
|
+
localized: true,
|
|
145
|
+
visibility: ["staff", "customer", "partner"],
|
|
146
|
+
editRole: "marketing",
|
|
147
|
+
overrideFriction: "none",
|
|
148
|
+
sourceFreshness: "sync",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
path: "description",
|
|
152
|
+
class: "merchandisable",
|
|
153
|
+
merge: "replace",
|
|
154
|
+
drift: "low",
|
|
155
|
+
reindex: "entry-locale",
|
|
156
|
+
snapshot: "on-book",
|
|
157
|
+
query: "blob-only",
|
|
158
|
+
localized: true,
|
|
159
|
+
visibility: ["staff", "customer", "partner"],
|
|
160
|
+
editRole: "marketing",
|
|
161
|
+
overrideFriction: "none",
|
|
162
|
+
sourceFreshness: "sync",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
path: "shortDescription",
|
|
166
|
+
class: "merchandisable",
|
|
167
|
+
merge: "replace",
|
|
168
|
+
drift: "low",
|
|
169
|
+
reindex: "entry-locale",
|
|
170
|
+
snapshot: "on-book",
|
|
171
|
+
query: "indexed-column",
|
|
172
|
+
localized: true,
|
|
173
|
+
visibility: ["staff", "customer", "partner"],
|
|
174
|
+
editRole: "marketing",
|
|
175
|
+
overrideFriction: "none",
|
|
176
|
+
sourceFreshness: "sync",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
path: "heroImageUrl",
|
|
180
|
+
class: "merchandisable",
|
|
181
|
+
merge: "replace",
|
|
182
|
+
drift: "low",
|
|
183
|
+
reindex: "entry",
|
|
184
|
+
snapshot: "on-book",
|
|
185
|
+
query: "blob-only",
|
|
186
|
+
localized: false,
|
|
187
|
+
visibility: ["staff", "customer", "partner"],
|
|
188
|
+
editRole: "marketing",
|
|
189
|
+
overrideFriction: "none",
|
|
190
|
+
sourceFreshness: "sync",
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
path: "thumbnailUrl",
|
|
194
|
+
class: "merchandisable",
|
|
195
|
+
merge: "source-only",
|
|
196
|
+
drift: "low",
|
|
197
|
+
reindex: "entry",
|
|
198
|
+
snapshot: "on-book",
|
|
199
|
+
query: "indexed-column",
|
|
200
|
+
localized: false,
|
|
201
|
+
visibility: ["staff", "customer", "partner"],
|
|
202
|
+
editRole: "none",
|
|
203
|
+
overrideFriction: "none",
|
|
204
|
+
sourceFreshness: "sync",
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
path: "mapImageUrl",
|
|
208
|
+
class: "merchandisable",
|
|
209
|
+
merge: "replace",
|
|
210
|
+
drift: "low",
|
|
211
|
+
reindex: "entry",
|
|
212
|
+
snapshot: "on-book",
|
|
213
|
+
query: "blob-only",
|
|
214
|
+
localized: false,
|
|
215
|
+
visibility: ["staff", "customer", "partner"],
|
|
216
|
+
editRole: "marketing",
|
|
217
|
+
overrideFriction: "none",
|
|
218
|
+
sourceFreshness: "sync",
|
|
219
|
+
},
|
|
220
|
+
// ── Structural / facet-affecting ───────────────────────────────────────
|
|
221
|
+
{
|
|
222
|
+
path: "status",
|
|
223
|
+
class: "structural",
|
|
224
|
+
merge: "source-only",
|
|
225
|
+
drift: "high",
|
|
226
|
+
reindex: "facet-affecting",
|
|
227
|
+
snapshot: "on-book",
|
|
228
|
+
query: "indexed-column",
|
|
229
|
+
localized: false,
|
|
230
|
+
visibility: ["staff"],
|
|
231
|
+
editRole: "none",
|
|
232
|
+
overrideFriction: "none",
|
|
233
|
+
sourceFreshness: "sync",
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
path: "lineSupplierId",
|
|
237
|
+
class: "structural",
|
|
238
|
+
merge: "source-only",
|
|
239
|
+
drift: "high",
|
|
240
|
+
reindex: "facet-affecting",
|
|
241
|
+
snapshot: "on-book",
|
|
242
|
+
query: "indexed-column",
|
|
243
|
+
localized: false,
|
|
244
|
+
visibility: ["staff", "customer", "partner"],
|
|
245
|
+
editRole: "none",
|
|
246
|
+
overrideFriction: "none",
|
|
247
|
+
sourceFreshness: "sync",
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
path: "defaultYachtId",
|
|
251
|
+
class: "structural",
|
|
252
|
+
merge: "source-only",
|
|
253
|
+
drift: "medium",
|
|
254
|
+
reindex: "entry",
|
|
255
|
+
snapshot: "on-book",
|
|
256
|
+
query: "indexed-column",
|
|
257
|
+
localized: false,
|
|
258
|
+
visibility: ["staff", "customer", "partner"],
|
|
259
|
+
editRole: "none",
|
|
260
|
+
overrideFriction: "none",
|
|
261
|
+
sourceFreshness: "sync",
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
// Same TODO as products / cruises — split into marketing_regions +
|
|
265
|
+
// facet_regions per architecture §7.1.
|
|
266
|
+
path: "regions[]",
|
|
267
|
+
class: "structural",
|
|
268
|
+
merge: "additive-set",
|
|
269
|
+
drift: "medium",
|
|
270
|
+
reindex: "facet-affecting",
|
|
271
|
+
snapshot: "on-book",
|
|
272
|
+
query: "indexed-column",
|
|
273
|
+
localized: false,
|
|
274
|
+
visibility: ["staff", "customer", "partner"],
|
|
275
|
+
editRole: "ops",
|
|
276
|
+
overrideFriction: "confirm",
|
|
277
|
+
sourceFreshness: "sync",
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
path: "themes[]",
|
|
281
|
+
class: "structural",
|
|
282
|
+
merge: "additive-set",
|
|
283
|
+
drift: "medium",
|
|
284
|
+
reindex: "facet-affecting",
|
|
285
|
+
snapshot: "on-book",
|
|
286
|
+
query: "indexed-column",
|
|
287
|
+
localized: false,
|
|
288
|
+
visibility: ["staff", "customer", "partner"],
|
|
289
|
+
editRole: "ops",
|
|
290
|
+
overrideFriction: "confirm",
|
|
291
|
+
sourceFreshness: "sync",
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
path: "defaultBookingModes[]",
|
|
295
|
+
class: "structural",
|
|
296
|
+
merge: "source-only",
|
|
297
|
+
drift: "high",
|
|
298
|
+
reindex: "facet-affecting",
|
|
299
|
+
snapshot: "on-book",
|
|
300
|
+
query: "indexed-column",
|
|
301
|
+
localized: false,
|
|
302
|
+
visibility: ["staff", "customer", "partner"],
|
|
303
|
+
editRole: "none",
|
|
304
|
+
overrideFriction: "none",
|
|
305
|
+
sourceFreshness: "sync",
|
|
306
|
+
},
|
|
307
|
+
// ── Charter-specific managed fields ────────────────────────────────────
|
|
308
|
+
{
|
|
309
|
+
// Soft FK to legal.contractTemplates — managed reference, captured at
|
|
310
|
+
// booking time so refunds / disputes can read the contract template
|
|
311
|
+
// that was in force.
|
|
312
|
+
path: "defaultMybaTemplateId",
|
|
313
|
+
class: "managed",
|
|
314
|
+
merge: "source-only",
|
|
315
|
+
drift: "high",
|
|
316
|
+
reindex: "none",
|
|
317
|
+
snapshot: "on-book",
|
|
318
|
+
query: "indexed-column",
|
|
319
|
+
localized: false,
|
|
320
|
+
visibility: ["staff"],
|
|
321
|
+
editRole: "none",
|
|
322
|
+
overrideFriction: "none",
|
|
323
|
+
sourceFreshness: "sync",
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
// APA % — operationally-tunable but legally-sensitive. Override allowed
|
|
327
|
+
// (per-product) but with confirm-friction and audit trail.
|
|
328
|
+
path: "defaultApaPercent",
|
|
329
|
+
class: "managed",
|
|
330
|
+
merge: "source-only",
|
|
331
|
+
drift: "high",
|
|
332
|
+
reindex: "none",
|
|
333
|
+
snapshot: "on-quote-and-book",
|
|
334
|
+
query: "indexed-column",
|
|
335
|
+
localized: false,
|
|
336
|
+
visibility: ["staff", "customer", "partner"],
|
|
337
|
+
editRole: "none",
|
|
338
|
+
overrideFriction: "none",
|
|
339
|
+
sourceFreshness: "sync",
|
|
340
|
+
},
|
|
341
|
+
// ── Volatile-indexed (browse-time approximations) ──────────────────────
|
|
342
|
+
{
|
|
343
|
+
path: "lowestPriceCachedAmount",
|
|
344
|
+
class: "volatile-indexed",
|
|
345
|
+
merge: "source-only",
|
|
346
|
+
drift: "low",
|
|
347
|
+
reindex: "entry",
|
|
348
|
+
snapshot: "on-quote-and-book",
|
|
349
|
+
query: "indexed-column",
|
|
350
|
+
localized: false,
|
|
351
|
+
visibility: ["staff", "customer", "partner"],
|
|
352
|
+
editRole: "none",
|
|
353
|
+
overrideFriction: "none",
|
|
354
|
+
sourceFreshness: "sync",
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
path: "lowestPriceCachedCurrency",
|
|
358
|
+
class: "volatile-indexed",
|
|
359
|
+
merge: "source-only",
|
|
360
|
+
drift: "low",
|
|
361
|
+
reindex: "entry",
|
|
362
|
+
snapshot: "on-quote-and-book",
|
|
363
|
+
query: "indexed-column",
|
|
364
|
+
localized: false,
|
|
365
|
+
visibility: ["staff", "customer", "partner"],
|
|
366
|
+
editRole: "none",
|
|
367
|
+
overrideFriction: "none",
|
|
368
|
+
sourceFreshness: "sync",
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
path: "earliestVoyageCached",
|
|
372
|
+
class: "volatile-indexed",
|
|
373
|
+
merge: "source-only",
|
|
374
|
+
drift: "low",
|
|
375
|
+
reindex: "facet-affecting",
|
|
376
|
+
snapshot: "never",
|
|
377
|
+
query: "indexed-column",
|
|
378
|
+
localized: false,
|
|
379
|
+
visibility: ["staff", "customer", "partner"],
|
|
380
|
+
editRole: "none",
|
|
381
|
+
overrideFriction: "none",
|
|
382
|
+
sourceFreshness: "sync",
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
path: "latestVoyageCached",
|
|
386
|
+
class: "volatile-indexed",
|
|
387
|
+
merge: "source-only",
|
|
388
|
+
drift: "low",
|
|
389
|
+
reindex: "facet-affecting",
|
|
390
|
+
snapshot: "never",
|
|
391
|
+
query: "indexed-column",
|
|
392
|
+
localized: false,
|
|
393
|
+
visibility: ["staff", "customer", "partner"],
|
|
394
|
+
editRole: "none",
|
|
395
|
+
overrideFriction: "none",
|
|
396
|
+
sourceFreshness: "sync",
|
|
397
|
+
},
|
|
398
|
+
];
|
|
399
|
+
export const charterCatalogPolicy = defineFieldPolicy(CHARTER_FIELD_POLICY);
|
|
400
|
+
export { CHARTER_FIELD_POLICY };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ContentOverlay, type MergeOverlaysOptions } from "@voyant-travel/catalog";
|
|
2
|
+
import { type CharterContent } from "@voyant-travel/charters-contracts/content-shape";
|
|
3
|
+
export { CHARTERS_CONTENT_SCHEMA_VERSION, type CharterContent, type CharterPolicy, type CharterScheduleDay, type CharterSuiteContent, type CharterSummary, type CharterVoyageContent, type CharterYachtContent, charterContentSchema, charterPolicySchema, charterScheduleDaySchema, charterSuiteSchema, charterSummarySchema, charterVoyageSchema, charterYachtSchema, validateCharterContent, } from "@voyant-travel/charters-contracts/content-shape";
|
|
4
|
+
export declare function mergeOverlaysIntoCharterContent(payload: CharterContent, overlays: ReadonlyArray<ContentOverlay>, options?: Pick<MergeOverlaysOptions, "onOverlayError">): CharterContent;
|
|
5
|
+
//# sourceMappingURL=content-shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-shape.d.ts","sourceRoot":"","sources":["../src/content-shape.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAE1B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,iDAAiD,CAAA;AAExD,OAAO,EACL,+BAA+B,EAC/B,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,iDAAiD,CAAA;AAExD,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,EACvC,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,gBAAgB,CAAM,GACzD,cAAc,CAShB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { mergeOverlaysIntoContent, } from "@voyant-travel/catalog";
|
|
2
|
+
import { charterContentSchema, validateCharterContent, } from "@voyant-travel/charters-contracts/content-shape";
|
|
3
|
+
export { CHARTERS_CONTENT_SCHEMA_VERSION, charterContentSchema, charterPolicySchema, charterScheduleDaySchema, charterSuiteSchema, charterSummarySchema, charterVoyageSchema, charterYachtSchema, validateCharterContent, } from "@voyant-travel/charters-contracts/content-shape";
|
|
4
|
+
export function mergeOverlaysIntoCharterContent(payload, overlays, options = {}) {
|
|
5
|
+
const merged = mergeOverlaysIntoContent(payload, overlays, {
|
|
6
|
+
validate(p) {
|
|
7
|
+
const r = validateCharterContent(p);
|
|
8
|
+
return r.valid ? { valid: true } : { valid: false, reason: r.reason };
|
|
9
|
+
},
|
|
10
|
+
onOverlayError: options.onOverlayError,
|
|
11
|
+
});
|
|
12
|
+
return charterContentSchema.parse(merged);
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project a `CharterContent` payload into a `BookingDraftShape`.
|
|
3
|
+
*
|
|
4
|
+
* Charter products fall into two booking modes that require
|
|
5
|
+
* different sub-steps:
|
|
6
|
+
* - **Whole-yacht** (`charter_type: "whole_yacht"`): party books the
|
|
7
|
+
* entire yacht. Configure step picks a voyage (departure date)
|
|
8
|
+
* and total guest count; per-suite selection is implicit (all
|
|
9
|
+
* suites belong to the booking).
|
|
10
|
+
* - **Per-suite** (`charter_type: "per_suite"`): individual suites
|
|
11
|
+
* are bookable. Configure step adds a suite-selection sub-step
|
|
12
|
+
* and pax bands track per-suite occupancy.
|
|
13
|
+
*
|
|
14
|
+
* The builder reads `content.charter.charter_type` to pick the mode.
|
|
15
|
+
* Pricing always flows through liveResolve.
|
|
16
|
+
*/
|
|
17
|
+
import { type BookingDraftShape, type PaxBandSpec } from "@voyant-travel/catalog/booking-engine";
|
|
18
|
+
import type { CharterContent } from "./content-shape.js";
|
|
19
|
+
export declare const DEFAULT_CHARTER_PAX_BANDS: ReadonlyArray<PaxBandSpec>;
|
|
20
|
+
export interface BuildCharterDraftShapeOptions {
|
|
21
|
+
locale?: string;
|
|
22
|
+
paxBands?: ReadonlyArray<PaxBandSpec>;
|
|
23
|
+
paxBandsAllowedTotal?: {
|
|
24
|
+
min: number;
|
|
25
|
+
max: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare function buildCharterDraftShape(content: CharterContent, options?: BuildCharterDraftShapeOptions): BookingDraftShape;
|
|
29
|
+
//# sourceMappingURL=draft-shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-shape.d.ts","sourceRoot":"","sources":["../src/draft-shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,KAAK,iBAAiB,EAMtB,KAAK,WAAW,EAEjB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,eAAO,MAAM,yBAAyB,EAAE,aAAa,CAAC,WAAW,CAEhE,CAAA;AAED,MAAM,WAAW,6BAA6B;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAA;IACrC,oBAAoB,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CACpD;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,cAAc,EACvB,OAAO,GAAE,6BAAkC,GAC1C,iBAAiB,CAmCnB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project a `CharterContent` payload into a `BookingDraftShape`.
|
|
3
|
+
*
|
|
4
|
+
* Charter products fall into two booking modes that require
|
|
5
|
+
* different sub-steps:
|
|
6
|
+
* - **Whole-yacht** (`charter_type: "whole_yacht"`): party books the
|
|
7
|
+
* entire yacht. Configure step picks a voyage (departure date)
|
|
8
|
+
* and total guest count; per-suite selection is implicit (all
|
|
9
|
+
* suites belong to the booking).
|
|
10
|
+
* - **Per-suite** (`charter_type: "per_suite"`): individual suites
|
|
11
|
+
* are bookable. Configure step adds a suite-selection sub-step
|
|
12
|
+
* and pax bands track per-suite occupancy.
|
|
13
|
+
*
|
|
14
|
+
* The builder reads `content.charter.charter_type` to pick the mode.
|
|
15
|
+
* Pricing always flows through liveResolve.
|
|
16
|
+
*/
|
|
17
|
+
import { defaultBookingFields, defaultDraftShapeFlags, defaultTravelerFields, paxBandsAllowedTotalFrom, } from "@voyant-travel/catalog/booking-engine";
|
|
18
|
+
export const DEFAULT_CHARTER_PAX_BANDS = [
|
|
19
|
+
{ code: "adult", label: "Adult", minCount: 1, maxCount: 12 },
|
|
20
|
+
];
|
|
21
|
+
export function buildCharterDraftShape(content, options = {}) {
|
|
22
|
+
const paxBands = options.paxBands ??
|
|
23
|
+
(content.yacht?.capacity_guests
|
|
24
|
+
? [{ code: "adult", label: "Adult", minCount: 1, maxCount: content.yacht.capacity_guests }]
|
|
25
|
+
: DEFAULT_CHARTER_PAX_BANDS);
|
|
26
|
+
const total = options.paxBandsAllowedTotal ?? paxBandsAllowedTotalFrom(paxBands);
|
|
27
|
+
const isPerSuite = content.charter.charter_type === "per_suite";
|
|
28
|
+
const configureSubSteps = [];
|
|
29
|
+
if (content.voyages.length > 0) {
|
|
30
|
+
configureSubSteps.push({ kind: "departure", required: true });
|
|
31
|
+
}
|
|
32
|
+
if (isPerSuite && content.suites.length > 0) {
|
|
33
|
+
// Per-suite charters reuse the cabin-category sub-step shape —
|
|
34
|
+
// suites map cleanly to "category" for descriptor purposes; the
|
|
35
|
+
// wizard component is the same. (When per-suite booking gets its
|
|
36
|
+
// own shape kind in a future revision, swap here.)
|
|
37
|
+
configureSubSteps.push({
|
|
38
|
+
kind: "cabin-category",
|
|
39
|
+
categories: content.suites.map(toSuiteOption),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
configureSubSteps.push({ kind: "occupancy", bands: paxBands });
|
|
43
|
+
return {
|
|
44
|
+
...defaultDraftShapeFlags(),
|
|
45
|
+
paxBands,
|
|
46
|
+
paxBandsAllowedTotal: total,
|
|
47
|
+
travelerFields: defaultTravelerFields(),
|
|
48
|
+
bookingFields: defaultBookingFields(),
|
|
49
|
+
configureSubSteps,
|
|
50
|
+
paymentIntents: ["hold", "card"],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function toSuiteOption(s) {
|
|
54
|
+
return {
|
|
55
|
+
id: s.id,
|
|
56
|
+
code: s.code ?? undefined,
|
|
57
|
+
name: s.name,
|
|
58
|
+
type: s.category ?? undefined,
|
|
59
|
+
capacityMin: s.capacity ?? undefined,
|
|
60
|
+
capacityMax: s.capacity ?? undefined,
|
|
61
|
+
description: s.description ?? undefined,
|
|
62
|
+
};
|
|
63
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LinkableDefinition, Module } from "@voyant-travel/core";
|
|
2
|
+
import type { HonoModule } from "@voyant-travel/hono/module";
|
|
3
|
+
export type { AdapterCallContext, CharterAdapter, CreateExternalPerSuiteBookingInput as AdapterCreatePerSuiteBookingInput, CreateExternalWholeYachtBookingInput as AdapterCreateWholeYachtBookingInput, ExternalBookingResult, ExternalCharterProduct, ExternalCharterProductSummary, ExternalCharterScheduleDay, ExternalCharterSuite, ExternalCharterVoyage, ExternalCharterYacht, ExternalContactInput, ExternalGuestInput, ListEntriesOptions, ListEntriesResult, SourceRef, } from "./adapters/index.js";
|
|
4
|
+
export { type MemoizeOptions, memoizeCharterAdapter } from "./adapters/memoize.js";
|
|
5
|
+
export { MockCharterAdapter, type MockCharterAdapterOptions } from "./adapters/mock.js";
|
|
6
|
+
export { clearCharterAdapters, hasCharterAdapter, listCharterAdapters, registerCharterAdapter, resolveCharterAdapter, unregisterCharterAdapter, } from "./adapters/registry.js";
|
|
7
|
+
export { type BookingCharterDetail, bookingCharterDetails, bookingCharterDetailsService, type CharterDetailUpsert, type CharterSourceRef, charterDetailUpsertSchema, chartersBookingExtension, chartersBookingExtensionRoutes, type NewBookingCharterDetail, } from "./booking-extension.js";
|
|
8
|
+
export type { ChartersAdminRoutes } from "./routes.js";
|
|
9
|
+
export { chartersAdminRoutes } from "./routes.js";
|
|
10
|
+
export type { ChartersPublicRoutes } from "./routes-public.js";
|
|
11
|
+
export { chartersPublicRoutes } from "./routes-public.js";
|
|
12
|
+
export { chartersService } from "./service.js";
|
|
13
|
+
export { type CharterContact, type CharterGuest, type CreateExternalPerSuiteBookingInput, type CreateExternalPerSuiteBookingResult, type CreateExternalWholeYachtBookingInput, type CreateExternalWholeYachtBookingResult, type CreatePerSuiteBookingInput, type CreatePerSuiteBookingResult, type CreateWholeYachtBookingInput, type CreateWholeYachtBookingResult, chartersBookingService, } from "./service-bookings.js";
|
|
14
|
+
export { type CharterContractsService, type GenerateMybaContractInput, type GenerateMybaContractResult, mybaService, } from "./service-myba.js";
|
|
15
|
+
export { composePerSuiteQuote, composeWholeYachtQuote, computeApaAmount, type PerSuiteQuote, pricingService, type WholeYachtQuote, } from "./service-pricing.js";
|
|
16
|
+
export declare const charterProductLinkable: LinkableDefinition;
|
|
17
|
+
export declare const charterVoyageLinkable: LinkableDefinition;
|
|
18
|
+
export declare const charterYachtLinkable: LinkableDefinition;
|
|
19
|
+
export declare const chartersModule: Module;
|
|
20
|
+
export declare const chartersHonoModule: HonoModule;
|
|
21
|
+
export { type ParsedKey, parseUnifiedKey } from "./lib/key.js";
|
|
22
|
+
export type { CharterProduct, CharterVoyage, NewCharterProduct, NewCharterVoyage, } from "./schema-core.js";
|
|
23
|
+
export { charterProducts, charterVoyages } from "./schema-core.js";
|
|
24
|
+
export type { CharterScheduleDay, NewCharterScheduleDay } from "./schema-itinerary.js";
|
|
25
|
+
export { charterScheduleDays } from "./schema-itinerary.js";
|
|
26
|
+
export type { CharterSuite, NewCharterSuite } from "./schema-pricing.js";
|
|
27
|
+
export { charterSuites } from "./schema-pricing.js";
|
|
28
|
+
export { charterBookingModeEnum, charterSourceEnum, charterStatusEnum, suiteAvailabilityEnum, suiteCategoryEnum, voyageSalesStatusEnum, yachtClassEnum, } from "./schema-shared.js";
|
|
29
|
+
export type { CharterYacht, NewCharterYacht } from "./schema-yachts.js";
|
|
30
|
+
export { charterYachts } from "./schema-yachts.js";
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { chartersAdminRoutes } from "./routes.js";
|
|
2
|
+
import { chartersPublicRoutes } from "./routes-public.js";
|
|
3
|
+
export { memoizeCharterAdapter } from "./adapters/memoize.js";
|
|
4
|
+
export { MockCharterAdapter } from "./adapters/mock.js";
|
|
5
|
+
export { clearCharterAdapters, hasCharterAdapter, listCharterAdapters, registerCharterAdapter, resolveCharterAdapter, unregisterCharterAdapter, } from "./adapters/registry.js";
|
|
6
|
+
// Booking extension (1:1 with bookings — populated when a booking is for a charter).
|
|
7
|
+
export { bookingCharterDetails, bookingCharterDetailsService, charterDetailUpsertSchema, chartersBookingExtension, chartersBookingExtensionRoutes, } from "./booking-extension.js";
|
|
8
|
+
export { chartersAdminRoutes } from "./routes.js";
|
|
9
|
+
export { chartersPublicRoutes } from "./routes-public.js";
|
|
10
|
+
export { chartersService } from "./service.js";
|
|
11
|
+
// Booking creation entry points + supporting types.
|
|
12
|
+
export { chartersBookingService, } from "./service-bookings.js";
|
|
13
|
+
// MYBA contract wrapper (DI-shaped, no hard dep on @voyant-travel/legal).
|
|
14
|
+
export { mybaService, } from "./service-myba.js";
|
|
15
|
+
export { composePerSuiteQuote, composeWholeYachtQuote, computeApaAmount, pricingService, } from "./service-pricing.js";
|
|
16
|
+
// Linkables for cross-module links from a template's links/ directory.
|
|
17
|
+
export const charterProductLinkable = {
|
|
18
|
+
module: "charters",
|
|
19
|
+
entity: "charter_product",
|
|
20
|
+
table: "charter_products",
|
|
21
|
+
idPrefix: "chrt",
|
|
22
|
+
};
|
|
23
|
+
export const charterVoyageLinkable = {
|
|
24
|
+
module: "charters",
|
|
25
|
+
entity: "charter_voyage",
|
|
26
|
+
table: "charter_voyages",
|
|
27
|
+
idPrefix: "chrv",
|
|
28
|
+
};
|
|
29
|
+
export const charterYachtLinkable = {
|
|
30
|
+
module: "charters",
|
|
31
|
+
entity: "charter_yacht",
|
|
32
|
+
table: "charter_yachts",
|
|
33
|
+
idPrefix: "chry",
|
|
34
|
+
};
|
|
35
|
+
export const chartersModule = {
|
|
36
|
+
name: "charters",
|
|
37
|
+
linkable: {
|
|
38
|
+
charter_product: charterProductLinkable,
|
|
39
|
+
charter_voyage: charterVoyageLinkable,
|
|
40
|
+
charter_yacht: charterYachtLinkable,
|
|
41
|
+
},
|
|
42
|
+
requiresTransactionalDb: true,
|
|
43
|
+
};
|
|
44
|
+
export const chartersHonoModule = {
|
|
45
|
+
module: chartersModule,
|
|
46
|
+
adminRoutes: chartersAdminRoutes,
|
|
47
|
+
publicRoutes: chartersPublicRoutes,
|
|
48
|
+
};
|
|
49
|
+
// Unified key parser (admin routes accept TypeIDs or `<provider>:<ref>`).
|
|
50
|
+
export { parseUnifiedKey } from "./lib/key.js";
|
|
51
|
+
export { charterProducts, charterVoyages } from "./schema-core.js";
|
|
52
|
+
export { charterScheduleDays } from "./schema-itinerary.js";
|
|
53
|
+
export { charterSuites } from "./schema-pricing.js";
|
|
54
|
+
export { charterBookingModeEnum, charterSourceEnum, charterStatusEnum, suiteAvailabilityEnum, suiteCategoryEnum, voyageSalesStatusEnum, yachtClassEnum, } from "./schema-shared.js";
|
|
55
|
+
export { charterYachts } from "./schema-yachts.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified key parser for charter admin routes.
|
|
3
|
+
*
|
|
4
|
+
* The same admin endpoint (e.g. `GET /v1/admin/charters/products/:key`)
|
|
5
|
+
* accepts both local TypeIDs (`chrt_…`) and external adapter-scoped keys
|
|
6
|
+
* (`<provider>:<ref>`, e.g. `voyant-connect:cnx_xx/extId`). Phase 2 only
|
|
7
|
+
* exercises `kind: 'local'`; external keys return 501 until phase 3 ships
|
|
8
|
+
* the adapter contract. Mirrors the cruises lib/key.ts implementation.
|
|
9
|
+
*/
|
|
10
|
+
export type ParsedKey = {
|
|
11
|
+
kind: "local";
|
|
12
|
+
id: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "external";
|
|
15
|
+
provider: string;
|
|
16
|
+
ref: string;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "invalid";
|
|
19
|
+
raw: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function parseUnifiedKey(raw: string): ParsedKey;
|
|
22
|
+
//# sourceMappingURL=key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../src/lib/key.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAIpC,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAWtD"}
|
package/dist/lib/key.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified key parser for charter admin routes.
|
|
3
|
+
*
|
|
4
|
+
* The same admin endpoint (e.g. `GET /v1/admin/charters/products/:key`)
|
|
5
|
+
* accepts both local TypeIDs (`chrt_…`) and external adapter-scoped keys
|
|
6
|
+
* (`<provider>:<ref>`, e.g. `voyant-connect:cnx_xx/extId`). Phase 2 only
|
|
7
|
+
* exercises `kind: 'local'`; external keys return 501 until phase 3 ships
|
|
8
|
+
* the adapter contract. Mirrors the cruises lib/key.ts implementation.
|
|
9
|
+
*/
|
|
10
|
+
const TYPEID_RE = /^[a-z]+_[0-9a-zA-Z]+$/;
|
|
11
|
+
export function parseUnifiedKey(raw) {
|
|
12
|
+
const decoded = decodeURIComponent(raw);
|
|
13
|
+
const colon = decoded.indexOf(":");
|
|
14
|
+
if (colon > 0) {
|
|
15
|
+
const provider = decoded.slice(0, colon);
|
|
16
|
+
const ref = decoded.slice(colon + 1);
|
|
17
|
+
if (provider && ref)
|
|
18
|
+
return { kind: "external", provider, ref };
|
|
19
|
+
return { kind: "invalid", raw: decoded };
|
|
20
|
+
}
|
|
21
|
+
if (TYPEID_RE.test(decoded))
|
|
22
|
+
return { kind: "local", id: decoded };
|
|
23
|
+
return { kind: "invalid", raw: decoded };
|
|
24
|
+
}
|